Skip to content

Commit 34eff85

Browse files
amuellerjnothman
authored andcommitted
DOC better explain bootstrap option in forests and bagging (scikit-learn#12875)
1 parent 098a5c6 commit 34eff85

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

sklearn/ensemble/bagging.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,8 @@ class BaggingClassifier(BaseBagging, ClassifierMixin):
471471
- If float, then draw `max_features * X.shape[1]` features.
472472
473473
bootstrap : boolean, optional (default=True)
474-
Whether samples are drawn with replacement.
474+
Whether samples are drawn with replacement. If False, sampling
475+
without replacement is performed.
475476
476477
bootstrap_features : boolean, optional (default=False)
477478
Whether features are drawn with replacement.
@@ -851,7 +852,8 @@ class BaggingRegressor(BaseBagging, RegressorMixin):
851852
- If float, then draw `max_features * X.shape[1]` features.
852853
853854
bootstrap : boolean, optional (default=True)
854-
Whether samples are drawn with replacement.
855+
Whether samples are drawn with replacement. If False, sampling
856+
without replacement is performed.
855857
856858
bootstrap_features : boolean, optional (default=False)
857859
Whether features are drawn with replacement.

sklearn/ensemble/forest.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,8 @@ class RandomForestClassifier(ForestClassifier):
863863
864864
865865
bootstrap : boolean, optional (default=True)
866-
Whether bootstrap samples are used when building trees.
866+
Whether bootstrap samples are used when building trees. If False, the
867+
whole datset is used to build each tree.
867868
868869
oob_score : bool (default=False)
869870
Whether to use out-of-bag samples to estimate
@@ -1153,7 +1154,8 @@ class RandomForestRegressor(ForestRegressor):
11531154
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
11541155
11551156
bootstrap : boolean, optional (default=True)
1156-
Whether bootstrap samples are used when building trees.
1157+
Whether bootstrap samples are used when building trees. If False, the
1158+
whole datset is used to build each tree.
11571159
11581160
oob_score : bool, optional (default=False)
11591161
whether to use out-of-bag samples to estimate
@@ -1403,7 +1405,8 @@ class ExtraTreesClassifier(ForestClassifier):
14031405
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
14041406
14051407
bootstrap : boolean, optional (default=False)
1406-
Whether bootstrap samples are used when building trees.
1408+
Whether bootstrap samples are used when building trees. If False, the
1409+
whole datset is used to build each tree.
14071410
14081411
oob_score : bool, optional (default=False)
14091412
Whether to use out-of-bag samples to estimate
@@ -1664,7 +1667,8 @@ class ExtraTreesRegressor(ForestRegressor):
16641667
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
16651668
16661669
bootstrap : boolean, optional (default=False)
1667-
Whether bootstrap samples are used when building trees.
1670+
Whether bootstrap samples are used when building trees. If False, the
1671+
whole datset is used to build each tree.
16681672
16691673
oob_score : bool, optional (default=False)
16701674
Whether to use out-of-bag samples to estimate the R^2 on unseen data.

0 commit comments

Comments
 (0)