From 1c7e3df8bedd1d145118979568911dac846c7ec2 Mon Sep 17 00:00:00 2001 From: adrinjalali Date: Wed, 1 Jul 2020 16:24:37 +0200 Subject: [PATCH 1/2] deprecate ChangedBehaviorWarning and NonBLASDotWarning --- doc/modules/classes.rst | 4 +--- sklearn/exceptions.py | 6 ++++++ sklearn/utils/validation.py | 6 +----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/modules/classes.rst b/doc/modules/classes.rst index 35fa24ac9a846..9aaa1a13b9fe4 100644 --- a/doc/modules/classes.rst +++ b/doc/modules/classes.rst @@ -433,14 +433,12 @@ Samples generator :toctree: generated/ :template: class.rst - exceptions.ChangedBehaviorWarning exceptions.ConvergenceWarning exceptions.DataConversionWarning exceptions.DataDimensionalityWarning exceptions.EfficiencyWarning exceptions.FitFailedWarning exceptions.NotFittedError - exceptions.NonBLASDotWarning exceptions.UndefinedMetricWarning @@ -900,7 +898,7 @@ Miscellaneous manifold.smacof manifold.spectral_embedding manifold.trustworthiness - + .. _metrics_ref: diff --git a/sklearn/exceptions.py b/sklearn/exceptions.py index 7140b98e53027..3a3188be35468 100644 --- a/sklearn/exceptions.py +++ b/sklearn/exceptions.py @@ -3,6 +3,8 @@ classes used across scikit-learn. """ +from .utils.deprecation import deprecated + __all__ = ['NotFittedError', 'ChangedBehaviorWarning', 'ConvergenceWarning', @@ -38,6 +40,8 @@ class NotFittedError(ValueError, AttributeError): """ +@deprecated("ChangedBehaviorWarning is deprecated in 0.24 and will be removed " + "in 0.26") class ChangedBehaviorWarning(UserWarning): """Warning class used to notify the user of any change in the behavior. @@ -109,6 +113,8 @@ class FitFailedWarning(RuntimeWarning): """ +@deprecated("NonBLASDotWarning is deprecated in 0.24 and will be removed in " + "0.26") class NonBLASDotWarning(EfficiencyWarning): """Warning used when the dot operation does not use BLAS. diff --git a/sklearn/utils/validation.py b/sklearn/utils/validation.py index 8dc2cdee67c7e..ea911af1d23a2 100644 --- a/sklearn/utils/validation.py +++ b/sklearn/utils/validation.py @@ -25,16 +25,12 @@ from .fixes import _object_dtype_isnan, parse_version from .. import get_config as _get_config -from ..exceptions import NonBLASDotWarning, PositiveSpectrumWarning +from ..exceptions import PositiveSpectrumWarning from ..exceptions import NotFittedError from ..exceptions import DataConversionWarning FLOAT_DTYPES = (np.float64, np.float32, np.float16) -# Silenced by default to reduce verbosity. Turn on at runtime for -# performance profiling. -warnings.simplefilter('ignore', NonBLASDotWarning) - def _deprecate_positional_args(f): """Decorator for methods that issues warnings for positional arguments From c7adc57cc783e00b99ec499e4fc8396a3bef00bc Mon Sep 17 00:00:00 2001 From: adrinjalali Date: Wed, 1 Jul 2020 16:31:09 +0200 Subject: [PATCH 2/2] add whats_new entry --- doc/whats_new/v0.24.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/whats_new/v0.24.rst b/doc/whats_new/v0.24.rst index 096d05b91db1d..49777d8b457e4 100644 --- a/doc/whats_new/v0.24.rst +++ b/doc/whats_new/v0.24.rst @@ -97,6 +97,13 @@ Changelog :pr:`17694` by :user:`Markus Rempfler ` and :user:`Tsutomu Kusanagi `. +:mod:`sklearn.exceptions` +......................... + +- |API| :class:`exceptions.ChangedBehaviorWarning` and + :class:`exceptions.NonBLASDotWarning` are deprecated and will be removed in + v0.26, :pr:`17804` by `Adrin Jalali`_. + :mod:`sklearn.feature_selection` ................................ @@ -164,8 +171,8 @@ Changelog class to be used when computing the precision and recall statistics. :pr:`17569` by :user:`Guillaume Lemaitre `. -- |Feature| :func:`metrics.plot_confusion_matrix` now supports making colorbar - optional in the matplotlib plot by setting colorbar=False. :pr:`17192` by +- |Feature| :func:`metrics.plot_confusion_matrix` now supports making colorbar + optional in the matplotlib plot by setting colorbar=False. :pr:`17192` by :user:`Avi Gupta ` :mod:`sklearn.model_selection` @@ -219,7 +226,7 @@ Changelog - |Enhancement| Avoid converting float32 input to float64 in :class:`neural_network.BernoulliRBM`. - :pr:`16352` by :user:`Arthur Imbert `. + :pr:`16352` by :user:`Arthur Imbert `. :mod:`sklearn.preprocessing` ............................