-
Notifications
You must be signed in to change notification settings - Fork 1
Test for Mtxslv Decision Trees
Mateus de Assis Silva edited this page May 7, 2020
·
3 revisions
Create a dataset running the following lines:
import numpy as np
lista_features_coluna_1 = [[0],[0],[1],[1]]
lista_features_coluna_2 = [[0],[1],[0],[1]]
features_teste = np.concatenate((lista_features_coluna_1,lista_features_coluna_2), axis = 1)
labels_teste = np.array([[1],[1],[0],[1]])
print("features_teste = \n",features_teste)
print("labels_teste = \n",labels_teste)
Notice is the same thing as:
A | B | y |
---|---|---|
0 | 0 | 1 |
0 | 1 | 1 |
1 | 0 | 0 |
1 | 1 | 1 |
We can formulate the rule for y as: y = A and B or not(A)
. The decision tree can be seen as a disjunction of conjunctions, so this boolean rule can, at least, be represented by our hypothesis space.
In order to create the tree, run:
arvore = MtxslvDecisionTrees()
arvore.fit(features_teste, labels_teste, 0.05)