@@ -844,28 +844,27 @@ def test_min_impurity_split():
844
844
def test_min_impurity_decrease ():
845
845
# test if min_impurity_decrease ensure that a split is made only if
846
846
# if the impurity decrease is atleast that value
847
- X = np .asfortranarray (iris .data .astype (tree ._tree .DTYPE ))
848
- y = iris .target
847
+ X , y = datasets .make_classification (n_samples = 10000 , random_state = 42 )
849
848
850
849
# test both DepthFirstTreeBuilder and BestFirstTreeBuilder
851
850
# by setting max_leaf_nodes
852
851
for max_leaf_nodes , name in product ((None , 1000 ), ALL_TREES .keys ()):
853
852
TreeEstimator = ALL_TREES [name ]
854
853
855
854
# Check default value of min_impurity_decrease, 1e-7
856
- est1 = TreeEstimator (max_leaf_nodes = max_leaf_nodes ,
857
- random_state = 0 )
855
+ est1 = TreeEstimator (max_leaf_nodes = max_leaf_nodes , random_state = 0 )
858
856
# Check with explicit value of 0.05
859
857
est2 = TreeEstimator (max_leaf_nodes = max_leaf_nodes ,
860
- min_impurity_decrease = 0.05 ,
861
- random_state = 0 )
862
- # Check with a much lower value of 0.00001
858
+ min_impurity_decrease = 0.05 , random_state = 0 )
859
+ # Check with a much lower value of 0.0001
863
860
est3 = TreeEstimator (max_leaf_nodes = max_leaf_nodes ,
864
- min_impurity_decrease = 0.00001 ,
865
- random_state = 0 )
861
+ min_impurity_decrease = 0.0001 , random_state = 0 )
862
+ # Check with a much lower value of 0.1
863
+ est4 = TreeEstimator (max_leaf_nodes = max_leaf_nodes ,
864
+ min_impurity_decrease = 0.1 , random_state = 0 )
866
865
867
866
for est , expected_decrease in ((est1 , 1e-7 ), (est2 , 0.05 ),
868
- (est3 , 0.00001 )):
867
+ (est3 , 0.0001 ), ( est4 , 0.1 )):
869
868
assert_less_equal (est .min_impurity_decrease , expected_decrease ,
870
869
"Failed, min_impurity_decrease = {0} > {1}"
871
870
.format (est .min_impurity_decrease ,
0 commit comments