@@ -660,6 +660,12 @@ class RandomForestClassifier(ForestClassifier):
660
660
``min_samples_leaf`` samples.
661
661
Note: this parameter is tree-specific.
662
662
663
+ max_leaf_nodes : int or None, optional (default=None)
664
+ Grow trees with ``max_leaf_nodes`` in best-first fashion.
665
+ Best nodes are defined as relative reduction in impurity.
666
+ If None then unlimited number of leaf nodes.
667
+ Note: this parameter is tree-specific.
668
+
663
669
bootstrap : boolean, optional (default=True)
664
670
Whether bootstrap samples are used when building trees.
665
671
@@ -721,6 +727,7 @@ def __init__(self,
721
727
min_samples_split = 2 ,
722
728
min_samples_leaf = 1 ,
723
729
max_features = "auto" ,
730
+ max_leaf_nodes = None ,
724
731
bootstrap = True ,
725
732
oob_score = False ,
726
733
n_jobs = 1 ,
@@ -733,7 +740,7 @@ def __init__(self,
733
740
n_estimators = n_estimators ,
734
741
estimator_params = ("criterion" , "max_depth" , "min_samples_split" ,
735
742
"min_samples_leaf" , "max_features" ,
736
- "random_state" ),
743
+ "max_leaf_nodes" , " random_state" ),
737
744
bootstrap = bootstrap ,
738
745
oob_score = oob_score ,
739
746
n_jobs = n_jobs ,
@@ -745,6 +752,7 @@ def __init__(self,
745
752
self .min_samples_split = min_samples_split
746
753
self .min_samples_leaf = min_samples_leaf
747
754
self .max_features = max_features
755
+ self .max_leaf_nodes = max_leaf_nodes
748
756
749
757
if min_density is not None :
750
758
warn ("The min_density parameter is deprecated as of version 0.14 "
@@ -804,6 +812,12 @@ class RandomForestRegressor(ForestRegressor):
804
812
``min_samples_leaf`` samples.
805
813
Note: this parameter is tree-specific.
806
814
815
+ max_leaf_nodes : int or None, optional (default=None)
816
+ Grow trees with ``max_leaf_nodes`` in best-first fashion.
817
+ Best nodes are defined as relative reduction in impurity.
818
+ If None then unlimited number of leaf nodes.
819
+ Note: this parameter is tree-specific.
820
+
807
821
bootstrap : boolean, optional (default=True)
808
822
Whether bootstrap samples are used when building trees.
809
823
@@ -854,6 +868,7 @@ def __init__(self,
854
868
min_samples_split = 2 ,
855
869
min_samples_leaf = 1 ,
856
870
max_features = "auto" ,
871
+ max_leaf_nodes = None ,
857
872
bootstrap = True ,
858
873
oob_score = False ,
859
874
n_jobs = 1 ,
@@ -866,7 +881,7 @@ def __init__(self,
866
881
n_estimators = n_estimators ,
867
882
estimator_params = ("criterion" , "max_depth" , "min_samples_split" ,
868
883
"min_samples_leaf" , "max_features" ,
869
- "random_state" ),
884
+ "max_leaf_nodes" , " random_state" ),
870
885
bootstrap = bootstrap ,
871
886
oob_score = oob_score ,
872
887
n_jobs = n_jobs ,
@@ -878,6 +893,7 @@ def __init__(self,
878
893
self .min_samples_split = min_samples_split
879
894
self .min_samples_leaf = min_samples_leaf
880
895
self .max_features = max_features
896
+ self .max_leaf_nodes = max_leaf_nodes
881
897
882
898
if min_density is not None :
883
899
warn ("The min_density parameter is deprecated as of version 0.14 "
@@ -938,6 +954,12 @@ class ExtraTreesClassifier(ForestClassifier):
938
954
``min_samples_leaf`` samples.
939
955
Note: this parameter is tree-specific.
940
956
957
+ max_leaf_nodes : int or None, optional (default=None)
958
+ Grow trees with ``max_leaf_nodes`` in best-first fashion.
959
+ Best nodes are defined as relative reduction in impurity.
960
+ If None then unlimited number of leaf nodes.
961
+ Note: this parameter is tree-specific.
962
+
941
963
bootstrap : boolean, optional (default=False)
942
964
Whether bootstrap samples are used when building trees.
943
965
@@ -1002,6 +1024,7 @@ def __init__(self,
1002
1024
min_samples_split = 2 ,
1003
1025
min_samples_leaf = 1 ,
1004
1026
max_features = "auto" ,
1027
+ max_leaf_nodes = None ,
1005
1028
bootstrap = False ,
1006
1029
oob_score = False ,
1007
1030
n_jobs = 1 ,
@@ -1014,7 +1037,7 @@ def __init__(self,
1014
1037
n_estimators = n_estimators ,
1015
1038
estimator_params = ("criterion" , "max_depth" , "min_samples_split" ,
1016
1039
"min_samples_leaf" , "max_features" ,
1017
- "random_state" ),
1040
+ "max_leaf_nodes" , " random_state" ),
1018
1041
bootstrap = bootstrap ,
1019
1042
oob_score = oob_score ,
1020
1043
n_jobs = n_jobs ,
@@ -1026,6 +1049,7 @@ def __init__(self,
1026
1049
self .min_samples_split = min_samples_split
1027
1050
self .min_samples_leaf = min_samples_leaf
1028
1051
self .max_features = max_features
1052
+ self .max_leaf_nodes = max_leaf_nodes
1029
1053
1030
1054
if min_density is not None :
1031
1055
warn ("The min_density parameter is deprecated as of version 0.14 "
@@ -1086,6 +1110,12 @@ class ExtraTreesRegressor(ForestRegressor):
1086
1110
``min_samples_leaf`` samples.
1087
1111
Note: this parameter is tree-specific.
1088
1112
1113
+ max_leaf_nodes : int or None, optional (default=None)
1114
+ Grow trees with ``max_leaf_nodes`` in best-first fashion.
1115
+ Best nodes are defined as relative reduction in impurity.
1116
+ If None then unlimited number of leaf nodes.
1117
+ Note: this parameter is tree-specific.
1118
+
1089
1119
bootstrap : boolean, optional (default=False)
1090
1120
Whether bootstrap samples are used when building trees.
1091
1121
Note: this parameter is tree-specific.
@@ -1139,6 +1169,7 @@ def __init__(self,
1139
1169
min_samples_split = 2 ,
1140
1170
min_samples_leaf = 1 ,
1141
1171
max_features = "auto" ,
1172
+ max_leaf_nodes = None ,
1142
1173
bootstrap = False ,
1143
1174
oob_score = False ,
1144
1175
n_jobs = 1 ,
@@ -1151,7 +1182,7 @@ def __init__(self,
1151
1182
n_estimators = n_estimators ,
1152
1183
estimator_params = ("criterion" , "max_depth" , "min_samples_split" ,
1153
1184
"min_samples_leaf" , "max_features" ,
1154
- "random_state" ),
1185
+ "max_leaf_nodes" , " random_state" ),
1155
1186
bootstrap = bootstrap ,
1156
1187
oob_score = oob_score ,
1157
1188
n_jobs = n_jobs ,
@@ -1163,6 +1194,7 @@ def __init__(self,
1163
1194
self .min_samples_split = min_samples_split
1164
1195
self .min_samples_leaf = min_samples_leaf
1165
1196
self .max_features = max_features
1197
+ self .max_leaf_nodes = max_leaf_nodes
1166
1198
1167
1199
if min_density is not None :
1168
1200
warn ("The min_density parameter is deprecated as of version 0.14 "
@@ -1205,6 +1237,12 @@ class RandomTreesEmbedding(BaseForest):
1205
1237
``min_samples_leaf`` samples.
1206
1238
Note: this parameter is tree-specific.
1207
1239
1240
+ max_leaf_nodes : int or None, optional (default=None)
1241
+ Grow trees with ``max_leaf_nodes`` in best-first fashion.
1242
+ Best nodes are defined as relative reduction in impurity.
1243
+ If None then unlimited number of leaf nodes.
1244
+ Note: this parameter is tree-specific.
1245
+
1208
1246
n_jobs : integer, optional (default=1)
1209
1247
The number of jobs to run in parallel for both `fit` and `predict`.
1210
1248
If -1, then the number of jobs is set to the number of cores.
@@ -1238,6 +1276,7 @@ def __init__(self,
1238
1276
max_depth = 5 ,
1239
1277
min_samples_split = 2 ,
1240
1278
min_samples_leaf = 1 ,
1279
+ max_leaf_nodes = None ,
1241
1280
n_jobs = 1 ,
1242
1281
random_state = None ,
1243
1282
verbose = 0 ,
@@ -1247,7 +1286,7 @@ def __init__(self,
1247
1286
n_estimators = n_estimators ,
1248
1287
estimator_params = ("criterion" , "max_depth" , "min_samples_split" ,
1249
1288
"min_samples_leaf" , "max_features" ,
1250
- "random_state" ),
1289
+ "max_leaf_nodes" , " random_state" ),
1251
1290
bootstrap = False ,
1252
1291
oob_score = False ,
1253
1292
n_jobs = n_jobs ,
@@ -1259,6 +1298,7 @@ def __init__(self,
1259
1298
self .min_samples_split = min_samples_split
1260
1299
self .min_samples_leaf = min_samples_leaf
1261
1300
self .max_features = 1
1301
+ self .max_leaf_nodes = max_leaf_nodes
1262
1302
1263
1303
if min_density is not None :
1264
1304
warn ("The min_density parameter is deprecated as of version 0.14 "
0 commit comments