Esempio n. 1
0
 def test__data_at_node(self):
     tree = dt._create_decision_node(self.x, self.labels_train)
     assert np.all(
         self.x[self.x[:,2] < 0] == dt._data_at_node(tree, tree.children[0],
                                                    self.x)
     )
     assert np.all(
         self.x[self.x[:,2] > 0] == dt._data_at_node(tree, tree.children[1],
                                                    self.x)
     )
Esempio n. 2
0
 def test_min_obs_split(self):
     min_obs = 5
     tree = dt._create_decision_node(X_TRAIN, self.labels_train,
                                     min_obs_split=min_obs)
     for desc in tree.descendents():
         if len(dt._data_at_node(tree, desc, X_TRAIN)) < min_obs:
             assert desc.split is None
Esempio n. 3
0
 def test_min_obs_split(self):
     min_obs = 5
     tree = dt._create_decision_node(X_TRAIN,
                                     self.labels_train,
                                     min_obs_split=min_obs)
     for desc in tree.descendents():
         if len(dt._data_at_node(tree, desc, X_TRAIN)) < min_obs:
             assert desc.split is None
Esempio n. 4
0
 def test__data_at_node(self):
     tree = dt._create_decision_node(self.x, self.labels_train)
     assert np.all(self.x[self.x[:, 2] < 0] == dt._data_at_node(
         tree, tree.children[0], self.x))
     assert np.all(self.x[self.x[:, 2] > 0] == dt._data_at_node(
         tree, tree.children[1], self.x))