Skip to content

Commit

Permalink
MNT Change deprecation for min_impurity_split from removal to changin…
Browse files Browse the repository at this point in the history
…g the default (#12400)
  • Loading branch information
NicolasHug authored and jnothman committed Nov 19, 2018
1 parent 9ecada8 commit 4ab6055
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 35 deletions.
36 changes: 21 additions & 15 deletions sklearn/ensemble/forest.py
Expand Up @@ -851,14 +851,16 @@ class RandomForestClassifier(ForestClassifier):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
bootstrap : boolean, optional (default=True)
Whether bootstrap samples are used when building trees.
Expand Down Expand Up @@ -1140,14 +1142,15 @@ class RandomForestRegressor(ForestRegressor):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
bootstrap : boolean, optional (default=True)
Whether bootstrap samples are used when building trees.
Expand Down Expand Up @@ -1389,14 +1392,15 @@ class ExtraTreesClassifier(ForestClassifier):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
bootstrap : boolean, optional (default=False)
Whether bootstrap samples are used when building trees.
Expand Down Expand Up @@ -1649,14 +1653,15 @@ class ExtraTreesRegressor(ForestRegressor):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
bootstrap : boolean, optional (default=False)
Whether bootstrap samples are used when building trees.
Expand Down Expand Up @@ -1849,14 +1854,15 @@ class RandomTreesEmbedding(BaseForest):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
sparse_output : bool, optional (default=True)
Whether or not to return a sparse CSR matrix, as default behavior,
Expand Down
14 changes: 8 additions & 6 deletions sklearn/ensemble/gradient_boosting.py
Expand Up @@ -1782,14 +1782,15 @@ class GradientBoostingClassifier(BaseGradientBoosting, ClassifierMixin):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
init : estimator, optional
An estimator object that is used to compute the initial
Expand Down Expand Up @@ -2241,14 +2242,15 @@ class GradientBoostingRegressor(BaseGradientBoosting, RegressorMixin):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
init : estimator, optional (default=None)
An estimator object that is used to compute the initial
Expand Down
33 changes: 19 additions & 14 deletions sklearn/tree/tree.py
Expand Up @@ -291,8 +291,9 @@ def fit(self, X, y, sample_weight=None, check_input=True,
np.sum(sample_weight))

if self.min_impurity_split is not None:
warnings.warn("The min_impurity_split parameter is deprecated and"
" will be removed in version 0.21. "
warnings.warn("The min_impurity_split parameter is deprecated. "
"Its default value will change from 1e-7 to 0 in "
"version 0.23, and it will be removed in 0.25. "
"Use the min_impurity_decrease parameter instead.",
DeprecationWarning)
min_impurity_split = self.min_impurity_split
Expand Down Expand Up @@ -627,14 +628,15 @@ class DecisionTreeClassifier(BaseDecisionTree, ClassifierMixin):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
class_weight : dict, list of dicts, "balanced" or None, default=None
Weights associated with classes in the form ``{class_label: weight}``.
Expand Down Expand Up @@ -999,14 +1001,15 @@ class DecisionTreeRegressor(BaseDecisionTree, RegressorMixin):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
presort : bool, optional (default=False)
Whether to presort the data to speed up the finding of best splits in
Expand Down Expand Up @@ -1261,14 +1264,15 @@ class ExtraTreeClassifier(DecisionTreeClassifier):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
class_weight : dict, list of dicts, "balanced" or None, default=None
Weights associated with classes in the form ``{class_label: weight}``.
Expand Down Expand Up @@ -1444,14 +1448,15 @@ class ExtraTreeRegressor(DecisionTreeRegressor):
.. versionadded:: 0.19
min_impurity_split : float,
min_impurity_split : float, (default=1e-7)
Threshold for early stopping in tree growth. A node will split
if its impurity is above the threshold, otherwise it is a leaf.
.. deprecated:: 0.19
``min_impurity_split`` has been deprecated in favor of
``min_impurity_decrease`` in 0.19 and will be removed in 0.21.
Use ``min_impurity_decrease`` instead.
``min_impurity_decrease`` in 0.19. The default value of
``min_impurity_split`` will change from 1e-7 to 0 in 0.23 and it
will be removed in 0.25. Use ``min_impurity_decrease`` instead.
max_leaf_nodes : int or None, optional (default=None)
Grow a tree with ``max_leaf_nodes`` in best-first fashion.
Expand Down

0 comments on commit 4ab6055

Please sign in to comment.