8000 MNT change 0.25 to 1.0 and 0.26 to 1.1 in deprecation messages by glemaitre · Pull Request #19005 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

MNT change 0.25 to 1.0 and 0.26 to 1.1 in deprecation messages #19005

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
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
4 changes: 2 additions & 2 deletions doc/developers/develop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ to slice rows and columns.

.. deprecated:: 0.24

The _pairwise attribute is deprecated in 0.24. From 0.26 onward,
the `pairwise` estimator tag should be used instead.
The _pairwise attribute is deprecated in 0.24. From 1.1 (renaming of 0.26)
onward, the `pairwise` estimator tag should be used instead.

Universal attributes
^^^^^^^^^^^^^^^^^^^^
Expand Down
6 changes: 3 additions & 3 deletions doc/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,9 @@ General Concepts

.. deprecated:: 0.24

The _pairwise attribute is deprecated in 0.24. From 0.26
onward, the `pairwise` estimator tag should be used
instead.
The _pairwise attribute is deprecated in 0.24. From 1.1
(renaming of 0.26) onward, the `pairwise` estimator tag
should be used instead.

For more detailed info, see :ref:`estimator_tags`.

Expand Down
4 changes: 2 additions & 2 deletions doc/modules/classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1637,5 +1637,5 @@ Utilities from joblib:
Recently deprecated
===================

To be removed in 0.25
---------------------
To be removed in 1.0 (renaming of 0.25)
---------------------------------------
4 changes: 2 additions & 2 deletions doc/whats_new/v0.23.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ In an effort to promote clear and non-ambiguous use of the library, most
constructor and function parameters are now expected to be passed as keyword
arguments (i.e. using the `param=value` syntax) instead of positional. To
ease the transition, a `FutureWarning` is raised if a keyword-only parameter
is used as positional. In version 0.25, these parameters will be strictly
keyword-only, and a `TypeError` will be raised.
is used as positional. In version 1.0 (renaming of 0.25), these parameters
will be strictly keyword-only, and a `TypeError` will be raised.
:issue:`15005` by `Joel Nothman`_, `Adrin Jalali`_, `Thomas Fan`_, and
`Nicolas Hug`_. See `SLEP009
<https://scikit-learn-enhancement-proposals.readthedocs.io/en/latest/slep009/proposal.html>`_
Expand Down
41 changes: 24 additions & 17 deletions doc/whats_new/v0.24.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ Changelog
initial cluster centroids. :pr:`17937` by :user:`g-walsh`

- |API| :class:`cluster.MiniBatchKMeans` attributes, `counts_` and
`init_size_`, are deprecated and will be removed in 0.26. :pr:`17864` by
:user:`Jérémie du Boisberranger <jeremiedbb>`.
`init_size_`, are deprecated and will be removed in 1.1 (renaming of 0.26).
:pr:`17864` by :user:`Jérémie du Boisberranger <jeremiedbb>`.

:mod:`sklearn.compose`
......................
Expand All @@ -128,7 +128,8 @@ Changelog
- |API| Deprecates `cv_alphas_` in favor of `cv_results_['alphas']` and
`grid_scores_` in favor of split scores in `cv_results_` in
:class:`covariance.GraphicalLassoCV`. `cv_alphas_` and `grid_scores_` will be
removed in version 0.26. :pr:`16392` by `Thomas Fan`_.
removed in version 1.1 (renaming of 0.26).
:pr:`16392` by `Thomas Fan`_.

:mod:`sklearn.cross_decomposition`
..................................
Expand All @@ -149,7 +150,7 @@ Changelog
- |API| For :class:`cross_decomposition.NMF`,
the `init` value, when 'init=None' and
n_components <= min(n_samples, n_features) will be changed from
`'nndsvd'` to `'nndsvda'` in 0.26.
`'nndsvd'` to `'nndsvda'` in 1.1 (renaming of 0.26).
:pr:`18525` by :user:`Chiara Marmo <cmarmo>`.

- |API| The bounds of the `n_components` parameter is now restricted:
Expand All @@ -159,20 +160,23 @@ Changelog
and :class:`cross_decomposition.PLSCanonical`.
- into `[1, n_features]` or :class:`cross_decomposition.PLSRegression`.

An error will be raised in 0.26. :pr:`17095` by `Nicolas Hug`_.
An error will be raised in 1.1 (renaming of 0.26).
:pr:`17095` by `Nicolas Hug`_.

- |API| For :class:`cross_decomposition.PLSSVD`,
:class:`cross_decomposition.CCA`, and
:class:`cross_decomposition.PLSCanonical`, the `x_scores_` and `y_scores_`
attributes were deprecated and will be removed in 0.26. They can be
retrieved by calling `transform` on the training data. The `norm_y_weights`
attribute will also be removed. :pr:`17095` by `Nicolas Hug`_.
attributes were deprecated and will be removed in 1.1 (renaming of 0.26).
They can be retrieved by calling `transform` on the training data.
The `norm_y_weights` attribute will also be removed.
:pr:`17095` by `Nicolas Hug`_.

- |API| For :class:`cross_decomposition.PLSRegression`,
:class:`cross_decomposition.PLSCanonical`,
:class:`cross_decomposition.CCA`, and
:class:`cross_decomposition.PLSSVD`, the `x_mean_`, `y_mean_`, `x_std_`, and
`y_std_` attributes were deprecated and will be removed in 0.26.
`y_std_` attributes were deprecated and will be removed in 1.1
(renaming of 0.26).
:pr:`18768` by :user:`Maren Westermann <marenwestermann>`.

- |Fix| :class:`decomposition.TruncatedSVD` becomes deterministic by using the
Expand Down Expand Up @@ -240,8 +244,9 @@ Changelog

- |Fix| Fix :class:`decomposition.SparseCoder` such that it follows
scikit-learn API and support cloning. The attribute `components_` is
deprecated in 0.24 and will be removed in 0.26. This attribute was
redundant with the `dictionary` attribute and constructor parameter.
deprecated in 0.24 and will be removed in 1.1 (renaming of 0.26).
This attribute was redundant with the `dictionary` attribute and constructor
parameter.
:pr:`17679` by :user:`Xavier Dupré <sdpython>`.

- |Fix| :meth:`TruncatedSVD.fit_transform` consistently returns the same
Expand Down Expand Up @@ -302,7 +307,8 @@ Changelog

- |API| :class:`exceptions.ChangedBehaviorWarning` and
:class:`exceptions.NonBLASDotWarning` are deprecated and will be removed in
v0.26, :pr:`17804` by `Adrin Jalali`_.
1.1 (renaming of 0.26).
:pr:`17804` by `Adrin Jalali`_.

:mod:`sklearn.feature_extraction`
.................................
Expand Down Expand Up @@ -390,7 +396,8 @@ Changelog
:user:`Roei Kahny <RoeiKa>`.

- |API| Positional arguments are deprecated in
:meth:`inspection.PartialDependenceDisplay.plot` and will error in 0.26.
:meth:`inspection.PartialDependenceDisplay.plot` and will error in 1.1
(renaming of 0.26).
:pr:`18293` by `Thomas Fan`_.

:mod:`sklearn.isotonic`
Expand Down Expand Up @@ -458,8 +465,8 @@ Changelog

- |Enhancement| Add `square_distances` parameter to :class:`manifold.TSNE`,
which provides backward compatibility during deprecation of legacy squaring
behavior. Distances will be squared by default in 0.26, and this parameter
will be removed in 0.28. :pr:`17662` by
behavior. Distances will be squared by default in 1.1 (renaming of 0.26),
and this parameter will be removed in 1.3. :pr:`17662` by
:user:`Joshua Newton <joshuacwnewton>`.

- |Fix| :class:`manifold.MDS` now correctly sets its `_pairwise` attribute.
Expand Down Expand Up @@ -645,8 +652,8 @@ Changelog
- |API| The attributes ``coef_`` and ``intercept_`` are now deprecated in
:class:`naive_bayes.MultinomialNB`, :class:`naive_bayes.ComplementNB`,
:class:`naive_bayes.BernoulliNB` and :class:`naive_bayes.CategoricalNB`,
and will be removed in v0.26. :pr:`17427` by
:user:`Juan Carlos Alfaro Jiménez <alfaro96>`.
and will be removed in v1.1 (renaming of 0.26).
:pr:`17427` by :user:`Juan Carlos Alfaro Jiménez <alfaro96>`.

:mod:`sklearn.neighbors`
........................
Expand Down
9 changes: 6 additions & 3 deletions sklearn/base.py
F438
Original file line number Diff line number Diff line change
Expand Up @@ -845,9 +845,12 @@ def _is_pairwise(estimator):

if has_pairwise_attribute:
if pairwise_attribute != pairwise_tag:
warnings.warn("_pairwise was deprecated in 0.24 and will be "
"removed in 0.26. Set the estimator tags of your "
"estimator instead", FutureWarning)
warnings.warn(
"_pairwise was deprecated in 0.24 and will be removed in 1.1 "
"(renaming of 0.26). Set the estimator tags of your estimator "
"instead",
FutureWarning
)
return pairwise_attribute

# use pairwise tag when the attribute is not present
Expand Down
8 changes: 4 additions & 4 deletions sklearn/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ class _CalibratedClassifier:

.. deprecated:: 0.24
`calibrators_` is deprecated from 0.24 and will be removed in
0.26. Use `calibrators` instead.
1.1 (renaming of 0.26). Use `calibrators` instead.
"""
def __init__(self, base_estimator, calibrators, *, classes,
method='sigmoid'):
Expand All @@ -608,11 +608,11 @@ def __init__(self, base_estimator, calibrators, *, classes,
self.classes = classes
self.method = method

# TODO: Remove in 0.26
# TODO: Remove in 1.1
# mypy error: Decorated property not supported
@deprecated( # type: ignore
"calibrators_ is deprecated in 0.24 and will be removed in 0.26. "
"Use calibrators instead."
"calibrators_ is deprecated in 0.24 and will be removed in 1.1"
"(renaming of 0.26). Use calibrators instead."
)
@property
def calibrators_(self):
Expand Down
19 changes: 10 additions & 9 deletions sklearn/cluster/_affinity_propagation.py
10000
Original file line numberDiff line number Diff line change
Expand Up @@ -145,13 +145,14 @@ def affinity_propagation(S, *, preference=None, convergence_iter=15,
else (np.array([0]), np.array([0] * n_samples)))

if random_state == 'warn':
warnings.warn(("'random_state' has been introduced in 0.23. "
"It will be set to None starting from 0.25 which "
"means that results will differ at every function "
"call. Set 'random_state' to None to silence this "
"warning, or to 0 to keep the behavior of versions "
"<0.23."),
FutureWarning)
warnings.warn(
"'random_state' has been introduced in 0.23. It will be set to "
"None starting from 1.0 (renaming of 0.25) which means that "
"results will differ at every function call. Set 'random_state' "
"to None to silence this warning, or to 0 to keep the behavior of "
"versions <0.23.",
FutureWarning
)
random_state = 0
random_state = check_random_state(random_state)

Expand Down Expand Up @@ -375,10 +376,10 @@ def __init__(self, *, damping=.5, max_iter=200, convergence_iter=15,
self.affinity = affinity
self.random_state = random_state

# TODO: Remove in 0.26
# TODO: Remove in 1.1
# mypy error: Decorated property not supported
@deprecated("Attribute _pairwise was deprecated in " # type: ignore
"version 0.24 and will be removed in 0.26.")
"version 0.24 and will be removed in 1.1 (renaming of 0.26).")
@property
def _pairwise(self):
return self.affinity == "precomputed"
Expand Down
6 changes: 3 additions & 3 deletions sklearn/cluster/_bicluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def fit(self, X, y=None):
"""
if self.n_jobs != 'deprecated':
warnings.warn("'n_jobs' was deprecated in version 0.23 and will be"
" removed in 0.25.", FutureWarning)
" removed in 1.0 (renaming of 0.25).", FutureWarning)

X = self._validate_data(X, accept_sparse='csr', dtype=np.float64)
self._check_parameters()
Expand Down Expand Up @@ -240,7 +240,7 @@ class SpectralCoclustering(BaseSpectral):

.. deprecated:: 0.23
``n_jobs`` was deprecated in version 0.23 and will be removed in
0.25.
1.0 (renaming of 0.25).

random_state : int, RandomState instance, default=None
Used for randomizing the singular value decomposition and the k-means
Expand Down Expand Up @@ -392,7 +392,7 @@ class SpectralBiclustering(BaseSpectral):

.. deprecated:: 0.23
``n_jobs`` was deprecated in version 0.23 and will be removed in
0.25.
1.0 (renaming of 0.25).

random_state : int, RandomState instance, default=None
Used for randomizing the singular value decomposition and the k-means
Expand Down
26 changes: 14 additions & 12 deletions sklearn/cluster/_kmeans.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def k_means(X, n_clusters, *, sample_weight=None, init='k-means++',

.. deprecated:: 0.23
'precompute_distances' was deprecated in version 0.23 and will be
removed in 0.25. It has no effect.
removed in 1.0 (renaming of 0.25). It has no effect.

n_init : int, default=10
Number of time the k-means algorithm will be run with different
Expand Down Expand Up @@ -254,7 +254,7 @@ def k_means(X, n_clusters, *, sample_weight=None, init='k-means++',

.. deprecated:: 0.23
``n_jobs`` was deprecated in version 0.23 and will be removed in
0.25.
1.0 (renaming of 0.25).

algorithm : {"auto", "full", "elkan"}, default="auto"
K-means algorithm to use. The classical EM-style algorithm is "full".
Expand Down Expand Up @@ -657,7 +657,7 @@ class KMeans(TransformerMixin, ClusterMixin, BaseEstimator):

.. deprecated:: 0.23
'precompute_distances' was deprecated in version 0.22 and will be
removed in 0.25. It has no effect.
removed in 1.0 (renaming of 0.25). It has no effect.

verbose : int, default=0
Verbosity mode.
Expand Down Expand Up @@ -686,7 +686,7 @@ class KMeans(TransformerMixin, ClusterMixin, BaseEstimator):

.. deprecated:: 0.23
``n_jobs`` was deprecated in version 0.23 and will be removed in
0.25.
1.0 (renaming of 0.25).

algorithm : {"auto", "full", "elkan"}, default="auto"
K-means algorithm to use. The classical EM-style algorithm is "full".
Expand Down Expand Up @@ -784,13 +784,13 @@ def _check_params(self, X):
# precompute_distances
if self.precompute_distances != 'deprecated':
warnings.warn("'precompute_distances' was deprecated in version "
"0.23 and will be removed in 0.25. It has no "
"effect", FutureWarning)
"0.23 and will be removed in 1.0 (renaming of 0.25)"
". It has no effect", FutureWarning)

# n_jobs
if self.n_jobs != 'deprecated':
warnings.warn("'n_jobs' was deprecated in version 0.23 and will be"
" removed in 0.25.", FutureWarning)
" removed in 1.0 (renaming of 0.25).", FutureWarning)
self._n_threads = self.n_jobs
else:
self._n_threads = None
Expand Down Expand Up @@ -1512,13 +1512,15 @@ class MiniBatchKMeans(KMeans):
Weigth sum of each cluster.

.. deprecated:: 0.24
This attribute is deprecated in 0.24 and will be removed in 0.26.
This attribute is deprecated in 0.24 and will be removed in
1.1 (renaming of 0.26).

init_size_ : int
The effective number of samples used for the initialization.

.. deprecated:: 0.24
This attribute is deprecated in 0.24 and will be removed in 0.26.
This attribute is deprecated in 0.24 and will be removed in
1.1 (renaming of 0.26).

See Also
--------
Expand Down Expand Up @@ -1577,19 +1579,19 @@ def __init__(self, n_clusters=8, *, init='k-means++', max_iter=100,
self.reassignment_ratio = reassignment_ratio

@deprecated("The attribute 'counts_' is deprecated in 0.24" # type: ignore
" and will be removed in 0.26.")
" and will be removed in 1.1 (renaming of 0.26).")
@property
def counts_(self):
return self._counts

@deprecated("The attribute 'init_size_' is deprecated in " # type: ignore
"0.24 and will be removed in 0.26.")
"0.24 and will be removed in 1.1 (renaming of 0.26).")
@property
def init_size_(self):
return self._init_size

@deprecated("The attribute 'random_state_' is deprecated " # type: ignore
"in 0.24 and will be removed in 0.26.")
"in 0.24 and will be removed in 1.1 (renaming of 0.26).")
@property
def random_state_(self):
return getattr(self, "_random_state", None)
Expand Down
4 changes: 2 additions & 2 deletions sklearn/cluster/_spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,10 +571,10 @@ def _more_tags(self):
return {'pairwise': self.affinity in ["precomputed",
"precomputed_nearest_neighbors"]}

# TODO: Remove in 0.26
# TODO: Remove in 1.1
# mypy error: Decorated property not supported
@deprecated("Attribute _pairwise was deprecated in " # type: ignore
"version 0.24 and will be removed in 0.26.")
"version 0.24 and will be removed in 1.1 (renaming of 0.26).")
@property
def _pairwise(self):
return self.affinity in ["precomputed",
Expand Down
11 changes: 3 additions & 8 deletions sklearn/cluster/tests/test_affinity_propagation.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,11 @@ def test_affinity_propagation_random_state():
assert np.mean((centers0 - centers76) ** 2) > 1


# FIXME: to be removed in 0.25
# FIXME: to be removed in 1.0
def test_affinity_propagation_random_state_warning():
# test that a warning is raised when random_state is not defined.
X = np.array([[0, 0], [1, 1], [-2, -2]])
match = ("'random_state' has been introduced in 0.23. "
"It will be set to None starting from 0.25 which "
"means that results will differ at every function "
"call. Set 'random_state' to None to silence this "
"warning, or to 0 to keep the behavior of versions "
"<0.23.")
match = "'random_state' has been introduced in 0.23."
with pytest.warns(FutureWarning, match=match):
AffinityPropagation().fit(X)

Expand Down Expand Up @@ -246,7 +241,7 @@ def test_affinity_propagation_float32():
assert_array_equal(afp.labels_, expected)


# TODO: Remove in 0.26
# TODO: Remove in 1.1
def test_affinity_propagation_pairwise_is_deprecated():
afp = AffinityPropagation(affinity='precomputed')
msg = r"Attribute _pairwise was deprecated in version 0\.24"
Expand Down
Loading
0