text_plain_output_1.png
import numpy as np

import seaborn as sns

NUM_FEATURES = 10
NUM_CLASSES = 3
NUM_POINTS = 100
MAX_DEPTH = 5
METRIC = 'gini'

def plotDists(y):
    return
def acc(true, pred):
    assert len(true) == len(pred), 'Truth and Pred Lengths not same'
    true = np.array(true)
    pred = np.array(pred).astype(np.int32)
    return np.sum(true == pred) / len(true)

d = DecisionTree(x, y, MAX_DEPTH, METRIC)
d.fit()

acc(y, d.predict(x))