Skip to content

Avoid deprecation warning for cluster module#15276

Merged
NicolasHug merged 1 commit intoscikit-learn:masterfrom
TomAugspurger:cluster-warning
Oct 16, 2019
Merged

Avoid deprecation warning for cluster module#15276
NicolasHug merged 1 commit intoscikit-learn:masterfrom
TomAugspurger:cluster-warning

Conversation

@TomAugspurger
Copy link
Copy Markdown
Contributor

What does this implement/fix? Explain your changes.

After #14948, there's an unavoidable warning on import, because the birch module is using the deprecated path (added the assert to make the culprit clearer).

In [2]: import sklearn.cluster
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-2-c8a0f0fed13e> in <module>
----> 1 import sklearn.cluster

~/sandbox/scikit-learn/sklearn/cluster/__init__.py in <module>
     15                       cluster_optics_xi)
     16 from ._bicluster import SpectralBiclustering, SpectralCoclustering
---> 17 from ._birch import Birch
     18
     19 __all__ = ['AffinityPropagation',

~/sandbox/scikit-learn/sklearn/cluster/_birch.py in <module>
     15 from ..utils.validation import check_is_fitted
     16 from ..exceptions import ConvergenceWarning
---> 17 from .hierarchical import AgglomerativeClustering
     18
     19

~/sandbox/scikit-learn/sklearn/cluster/hierarchical.py in <module>
      2 # THIS FILE WAS AUTOMATICALLY GENERATED BY deprecated_modules.py
      3
----> 4 assert 0
      5 from ._hierarchical import *  # noqa
      6 from ..utils.deprecation import _raise_dep_warning_if_not_pytest

@TomAugspurger TomAugspurger changed the title avoid cluster warning Avoid import warning for cluster module Oct 16, 2019
@TomAugspurger TomAugspurger changed the title Avoid import warning for cluster module Avoid deprecation warning for cluster module Oct 16, 2019
@NicolasHug
Copy link
Copy Markdown
Member

Thanks @TomAugspurger .

There are some other imports that are wrong in the tests e.g. sklearn.cluster.spectral import discretize . I wonder why tests don't fail here on these.

I'll merge this one and try to figure out the rest later.

@NicolasHug NicolasHug merged commit 1fd0c34 into scikit-learn:master Oct 16, 2019
@thomasjpfan
Copy link
Copy Markdown
Member

Looks like tests could have deprecation warnings and we would not catch them. I will look over the other modules to see if there was anything we missed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants