Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[MRG] Change deprecation for min_impurity_split from removal to changing the default #12400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions sklearn/ensemble/forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,14 +850,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 @@ -1139,14 +1141,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 @@ -1388,14 +1391,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 @@ -1648,14 +1652,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 @@ -1848,14 +1853,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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