@@ -67,7 +67,7 @@ def test_criterions(self):
67
67
_test_criterion_init (c2 , ys , w , 1.0 , ind , 0 , y .shape [0 ])
68
68
i1 = _test_criterion_node_impurity (c1 )
69
69
i2 = _test_criterion_node_impurity (c2 )
70
- self .assertAlmostEqual (i1 , i2 )
70
+ self .assertAlmostEqual (i1 , i2 , atol = 1e-8 )
71
71
v1 = _test_criterion_node_value (c1 )
72
72
v2 = _test_criterion_node_value (c2 )
73
73
self .assertEqual (v1 , v2 )
@@ -91,7 +91,7 @@ def test_criterions(self):
91
91
_test_criterion_check (c1 )
92
92
_test_criterion_check (c2 )
93
93
assert_criterion_equal (c1 , c2 )
94
- self .assertAlmostEqual (i1 , i2 )
94
+ self .assertAlmostEqual (i1 , i2 , atol = 1e-10 )
95
95
v1 = _test_criterion_node_value (c1 )
96
96
v2 = _test_criterion_node_value (c2 )
97
97
_test_criterion_check (c2 )
@@ -112,7 +112,7 @@ def test_criterions(self):
112
112
left1 , right1 = _test_criterion_node_impurity_children (c1 )
113
113
left2 , right2 = _test_criterion_node_impurity_children (c2 )
114
114
self .assertAlmostEqual (left1 , left2 )
115
- self .assertAlmostEqual (right1 , right2 )
115
+ self .assertAlmostEqual (right1 , right2 , atol = 1e-10 )
116
116
v1 = _test_criterion_node_value (c1 )
117
117
v2 = _test_criterion_node_value (c2 )
118
118
self .assertEqual (v1 , v2 )
@@ -124,7 +124,7 @@ def test_criterions(self):
124
124
# scikit-learn < 0.24
125
125
p1 = _test_criterion_impurity_improvement (c1 , 0.0 )
126
126
p2 = _test_criterion_impurity_improvement (c2 , 0.0 )
127
- self .assertAlmostEqual (p1 , p2 )
127
+ self .assertAlmostEqual (p1 , p2 , atol = 1e-10 )
128
128
129
129
X = numpy .array ([[1.0 , 2.0 , 10.0 , 11.0 ]]).T
130
130
y = numpy .array ([0.9 , 1.1 , 1.9 , 2.1 ])
@@ -137,7 +137,7 @@ def test_criterions(self):
137
137
_test_criterion_init (c2 , ys , w , 1.0 , ind , 1 , y .shape [0 ])
138
138
i1 = _test_criterion_node_impurity (c1 )
139
139
i2 = _test_criterion_node_impurity (c2 )
140
- self .assertAlmostEqual (i1 , i2 )
140
+ self .assertAlmostEqual (i1 , i2 , atol = 1e-10 )
141
141
v1 = _test_criterion_node_value (c1 )
142
142
v2 = _test_criterion_node_value (c2 )
143
143
self .assertEqual (v1 , v2 )
@@ -175,8 +175,11 @@ def test_decision_tree_criterion(self):
175
175
crit = SimpleRegressorCriterion (
176
176
1 if len (y .shape ) <= 1 else y .shape [1 ], X .shape [0 ]
177
177
)
178
+ print ("F0" )
178
179
clr2 = DecisionTreeRegressor (criterion = crit , max_depth = 1 )
180
+ print ("F1" )
179
181
clr2 .fit (X , y )
182
+ print ("F2" )
180
183
p2 = clr2 .predict (X )
181
184
self .assertEqual (p1 , p2 )
182
185
self .assertEqual (clr1 .tree_ .node_count , clr2 .tree_ .node_count )
0 commit comments