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

Skip to content

[MRG] DOC Homogeneous deprecation in docstring #8907

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
merged 7 commits into from
May 23, 2017
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
8 changes: 8 additions & 0 deletions doc/developers/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,14 @@ the removal will be in 0.(x+2). For example, if the deprecation happened
in version 0.18-dev, the message should say it happened in version 0.18
and the old behavior will be removed in version 0.20.

In addition, a deprecation note should be added in the docstring, recalling the
same information as the deprecation warning as explained above. Use the
``.. deprecated::`` directive::

.. deprecated:: 0.13
``k`` was renamed to ``n_clusters`` in version 0.13 and will be removed
in 0.15.


.. currentmodule:: sklearn

Expand Down
45 changes: 45 additions & 0 deletions sklearn/ensemble/forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,15 @@ class RandomForestClassifier(ForestClassifier):
Best nodes are defined as relative reduction in impurity.
If None then unlimited number of leaf nodes.

min_impurity_split : float,
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 : float, optional (default=0.)
A node will be split if this split induces a decrease of the impurity
greater than or equal to this value.
Expand Down Expand Up @@ -1061,6 +1070,15 @@ class RandomForestRegressor(ForestRegressor):
Best nodes are defined as relative reduction in impurity.
If None then unlimited number of leaf nodes.

min_impurity_split : float,
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 : float, optional (default=0.)
A node will be split if this split induces a decrease of the impurity
greater than or equal to this value.
Expand Down Expand Up @@ -1263,6 +1281,15 @@ class ExtraTreesClassifier(ForestClassifier):
Best nodes are defined as relative reduction in impurity.
If None then unlimited number of leaf nodes.

min_impurity_split : float,
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 : float, optional (default=0.)
A node will be split if this split induces a decrease of the impurity
greater than or equal to this value.
Expand Down Expand Up @@ -1503,6 +1530,15 @@ class ExtraTreesRegressor(ForestRegressor):
Best nodes are defined as relative reduction in impurity.
If None then unlimited number of leaf nodes.

min_impurity_split : float,
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 : float, optional (default=0.)
A node will be split if this split induces a decrease of the impurity
greater than or equal to this value.
Expand Down Expand Up @@ -1684,6 +1720,15 @@ class RandomTreesEmbedding(BaseForest):
Best nodes are defined as relative reduction in impurity.
If None then unlimited number of leaf nodes.

min_impurity_split : float,
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 : float, optional (default=0.)
A node will be split if this split induces a decrease of the impurity
greater than or equal to this value.
Expand Down
18 changes: 18 additions & 0 deletions sklearn/ensemble/gradient_boosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,15 @@ class GradientBoostingClassifier(BaseGradientBoosting, ClassifierMixin):
Best nodes are defined as relative reduction in impurity.
If None then unlimited number of leaf nodes.

min_impurity_split : float,
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 : float, optional (default=0.)
A node will be split if this split induces a decrease of the impurity
greater than or equal to this value.
Expand Down Expand Up @@ -1732,6 +1741,15 @@ class GradientBoostingRegressor(BaseGradientBoosting, RegressorMixin):
Best nodes are defined as relative reduction in impurity.
If None then unlimited number of leaf nodes.

min_impurity_split : float,
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 : float, optional (default=0.)
A node will be split if this split induces a decrease of the impurity
greater than or equal to this value.
Expand Down
5 changes: 3 additions & 2 deletions sklearn/linear_model/ransac.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ class RANSACRegressor(BaseEstimator, MetaEstimatorMixin, RegressorMixin):

lambda dy: np.sum(np.abs(dy), axis=1)

NOTE: residual_metric is deprecated from 0.18 and will be removed in 0.20
Use ``loss`` instead.
.. deprecated:: 0.18
``residual_metric`` is deprecated from 0.18 and will be removed in
0.20. Use ``loss`` instead.

loss : string, callable, optional, default "absolute_loss"
String inputs, "absolute_loss" and "squared_loss" are supported which
Expand Down
7 changes: 5 additions & 2 deletions sklearn/metrics/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,8 +1479,11 @@ def hamming_loss(y_true, y_pred, labels=None, sample_weight=None,
.. versionadded:: 0.18

classes : array, shape = [n_labels], optional
(deprecated) Integer array of labels. This parameter has been
renamed to ``labels`` in version 0.18 and will be removed in 0.20.
Integer array of labels.

.. deprecated:: 0.18
This parameter has been deprecated in favor of ``labels`` in
version 0.18 and will be removed in 0.20. Use ``labels`` instead.

Returns
-------
Expand Down
16 changes: 16 additions & 0 deletions sklearn/model_selection/_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,14 @@ class GridSearchCV(BaseSearchCV):
``scorer(estimator, X, y)``.
If ``None``, the ``score`` method of the estimator is used.

fit_params : dict, optional
Parameters to pass to the fit method.

.. deprecated:: 0.19
``fit_params`` as a constructor argument was deprecated in version
0.19 and will be removed in version 0.21. Pass fit parameters to
the ``fit`` method instead.

n_jobs : int, default=1
Number of jobs to run in parallel.

Expand Down Expand Up @@ -1010,6 +1018,14 @@ class RandomizedSearchCV(BaseSearchCV):
``scorer(estimator, X, y)``.
If ``None``, the ``score`` method of the estimator is used.

fit_params : dict, optional
Parameters to pass to the fit method.

.. deprecated:: 0.19
``fit_params`` as a constructor argument was deprecated in version
0.19 and will be removed in version 0.21. Pass fit parameters to
the ``fit`` method instead.

n_jobs : int, default=1
Number of jobs to run in parallel.

Expand Down
18 changes: 18 additions & 0 deletions sklearn/tree/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,15 @@ class DecisionTreeClassifier(BaseDecisionTree, ClassifierMixin):
If None, the random number generator is the RandomState instance used
by `np.random`.

min_impurity_split : float,
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 : float, optional (default=0.)
A node will be split if this split induces a decrease of the impurity
greater than or equal to this value.
Expand Down Expand Up @@ -938,6 +947,15 @@ class DecisionTreeRegressor(BaseDecisionTree, RegressorMixin):
If None, the random number generator is the RandomState instance used
by `np.random`.

min_impurity_split : float,
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 : float, optional (default=0.)
A node will be split if this split induces a decrease of the impurity
greater than or equal to this value.
Expand Down
11 changes: 11 additions & 0 deletions sklearn/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ def check_array(array, accept_sparse=False, dtype="numeric", order=None,
to be any format. False means that a sparse matrix input will
raise an error.

.. deprecated:: 0.19
Passing 'None' to parameter ``accept_sparse`` in methods is
deprecated in version 0.19 "and will be removed in 0.21. Use
``accept_sparse=False`` instead.

dtype : string, type, list of types or None (default="numeric")
Data type of result. If None, the dtype of the input is preserved.
If "numeric", dtype is preserved unless array.dtype is object.
Expand Down Expand Up @@ -340,6 +345,7 @@ def check_array(array, accept_sparse=False, dtype="numeric", order=None,
-------
X_converted : object
The converted and validated X.

"""
# accept_sparse 'None' deprecation check
if accept_sparse is None:
Expand Down Expand Up @@ -460,6 +466,11 @@ def check_X_y(X, y, accept_sparse=False, dtype="numeric", order=None,
to be any format. False means that a sparse matrix input will
raise an error.

.. deprecated:: 0.19
Passing 'None' to parameter ``accept_sparse`` in methods is
deprecated in version 0.19 "and will be removed in 0.21. Use
``accept_sparse=False`` instead.

dtype : string, type, list of types or None (default="numeric")
Data type of result. If None, the dtype of the input is preserved.
If "numeric", dtype is preserved unless array.dtype is object.
Expand Down