diff --git a/doc/modules/classes.rst b/doc/modules/classes.rst index d3fb1615effc6ae12f98e91dd62a93db592ec574..a4d893bafb340410197d0d264b9c47e1d54d864e 100644 --- a/doc/modules/classes.rst +++ b/doc/modules/classes.rst @@ -186,6 +186,7 @@ Splitter Functions :template: function.rst model_selection.train_test_split + model_selection.check_cv Hyper-parameter optimizers -------------------------- @@ -201,6 +202,13 @@ Hyper-parameter optimizers model_selection.ParameterGrid model_selection.ParameterSampler + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + model_selection.fit_grid_point + Model validation ---------------- @@ -315,7 +323,6 @@ Samples generator decomposition.PCA decomposition.IncrementalPCA decomposition.ProjectedGradientNMF - decomposition.RandomizedPCA decomposition.KernelPCA decomposition.FactorAnalysis decomposition.FastICA @@ -560,7 +567,6 @@ From text gaussian_process.GaussianProcessRegressor gaussian_process.GaussianProcessClassifier - gaussian_process.GaussianProcess Kernels: @@ -1349,3 +1355,67 @@ Low-level methods utils.estimator_checks.check_estimator utils.resample utils.shuffle + + +Recently deprecated +=================== + +To be removed in 0.19 +--------------------- + +.. autosummary:: + :toctree: generated/ + :template: deprecated_class.rst + + lda.LDA + qda.QDA + +.. autosummary:: + :toctree: generated/ + :template: deprecated_function.rst + + datasets.load_lfw_pairs + datasets.load_lfw_people + + +To be removed in 0.20 +--------------------- + +.. autosummary:: + :toctree: generated/ + :template: deprecated_class.rst + + grid_search.ParameterGrid + grid_search.ParameterSampler + grid_search.GridSearchCV + grid_search.RandomizedSearchCV + cross_validation.LeaveOneOut + cross_validation.LeavePOut + cross_validation.KFold + cross_validation.LabelKFold + cross_validation.LeaveOneLabelOut + cross_validation.LeavePLabelOut + cross_validation.LabelShuffleSplit + cross_validation.StratifiedKFold + cross_validation.ShuffleSplit + cross_validation.StratifiedShuffleSplit + cross_validation.PredefinedSplit + decomposition.RandomizedPCA + gaussian_process.GaussianProcess + mixture.GMM + mixture.DPGMM + mixture.VBGMM + + +.. autosummary:: + :toctree: generated/ + :template: deprecated_function.rst + + grid_search.fit_grid_point + learning_curve.learning_curve + learning_curve.validation_curve + cross_validation.cross_val_predict + cross_validation.cross_val_score + cross_validation.check_cv + cross_validation.permutation_test_score + cross_validation.train_test_split \ No newline at end of file diff --git a/doc/templates/deprecated_class.rst b/doc/templates/deprecated_class.rst new file mode 100644 index 0000000000000000000000000000000000000000..857e2c28ce1da306b4ea9288fc5e4ad29848dc5b --- /dev/null +++ b/doc/templates/deprecated_class.rst @@ -0,0 +1,23 @@ +:mod:`{{module}}`.{{objname}} +{{ underline }}============== + +.. meta:: + :robots: noindex + +.. warning:: + **DEPRECATED** + + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + + {% block methods %} + .. automethod:: __init__ + {% endblock %} + +.. include:: {{module}}.{{objname}}.examples + +.. raw:: html + + <div class="clearer"></div> diff --git a/doc/templates/deprecated_class_with_call.rst b/doc/templates/deprecated_class_with_call.rst new file mode 100644 index 0000000000000000000000000000000000000000..a04efcb80be07ed3cdd399cef1f05688c524a0f4 --- /dev/null +++ b/doc/templates/deprecated_class_with_call.rst @@ -0,0 +1,24 @@ +:mod:`{{module}}`.{{objname}} +{{ underline }}=============== + +.. meta:: + :robots: noindex + +.. warning:: + **DEPRECATED** + + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + + {% block methods %} + .. automethod:: __init__ + .. automethod:: __call__ + {% endblock %} + +.. include:: {{module}}.{{objname}}.examples + +.. raw:: html + + <div class="clearer"></div> diff --git a/doc/templates/deprecated_class_without_init.rst b/doc/templates/deprecated_class_without_init.rst new file mode 100644 index 0000000000000000000000000000000000000000..c0199924936107f831f6ce8675c421b92aadbf77 --- /dev/null +++ b/doc/templates/deprecated_class_without_init.rst @@ -0,0 +1,19 @@ +:mod:`{{module}}`.{{objname}} +{{ underline }}============== + +.. meta:: + :robots: noindex + +.. warning:: + **DEPRECATED** + + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + +.. include:: {{module}}.{{objname}}.examples + +.. raw:: html + + <div class="clearer"></div> diff --git a/doc/templates/deprecated_function.rst b/doc/templates/deprecated_function.rst new file mode 100644 index 0000000000000000000000000000000000000000..6d13ac6aca2de306805a8f493c96d92a3c0ae9d9 --- /dev/null +++ b/doc/templates/deprecated_function.rst @@ -0,0 +1,19 @@ +:mod:`{{module}}`.{{objname}} +{{ underline }}==================== + +.. meta:: + :robots: noindex + +.. warning:: + **DEPRECATED** + + +.. currentmodule:: {{ module }} + +.. autofunction:: {{ objname }} + +.. include:: {{module}}.{{objname}}.examples + +.. raw:: html + + <div class="clearer"></div> diff --git a/doc/templates/generate_deprecated.sh b/doc/templates/generate_deprecated.sh new file mode 100755 index 0000000000000000000000000000000000000000..a7301fb5dc419c57f854c545f636bb65c010424e --- /dev/null +++ b/doc/templates/generate_deprecated.sh @@ -0,0 +1,8 @@ +#!/bin/bash +for f in [^d]*; do (head -n2 < $f; echo ' +.. meta:: + :robots: noindex + +.. warning:: + **DEPRECATED** +'; tail -n+3 $f) > deprecated_$f; done diff --git a/doc/themes/scikit-learn/static/nature.css_t b/doc/themes/scikit-learn/static/nature.css_t index 4c318b514a846802656e97b088948ba5023f3bd7..593cb01ce67c6d79c6deafa53a948a63364f940c 100644 --- a/doc/themes/scikit-learn/static/nature.css_t +++ b/doc/themes/scikit-learn/static/nature.css_t @@ -603,7 +603,7 @@ div.admonition { -moz-border-radius: 4px; } -div.warning { +div.warning, div.deprecated { color: #b94a48; background-color: #F3E5E5; border: 1px solid #eed3d7; diff --git a/sklearn/cross_validation.py b/sklearn/cross_validation.py index 010f7106a4870e0c25c9adcfc7a75d67e618eab0..65960aaa9efe016f56cdbcbd38c9b0ffaf58681e 100644 --- a/sklearn/cross_validation.py +++ b/sklearn/cross_validation.py @@ -109,6 +109,10 @@ class _PartitionIterator(with_metaclass(ABCMeta)): class LeaveOneOut(_PartitionIterator): """Leave-One-Out cross validation iterator. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.LeaveOneOut` instead. + Provides train/test indices to split data in train test sets. Each sample is used once as a test set (singleton) while the remaining samples form the training set. @@ -171,6 +175,10 @@ class LeaveOneOut(_PartitionIterator): class LeavePOut(_PartitionIterator): """Leave-P-Out cross validation iterator + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.LeavePOut` instead. + Provides train/test indices to split data in train test sets. This results in testing on all distinct samples of size p, while the remaining n - p samples form the training set in each iteration. @@ -266,6 +274,10 @@ class _BaseKFold(with_metaclass(ABCMeta, _PartitionIterator)): class KFold(_BaseKFold): """K-Folds cross validation iterator. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.KFold` instead. + Provides train/test indices to split data in train test sets. Split dataset into k consecutive folds (without shuffling by default). @@ -357,6 +369,10 @@ class KFold(_BaseKFold): class LabelKFold(_BaseKFold): """K-fold iterator variant with non-overlapping labels. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.GroupKFold` instead. + The same label will not appear in two different folds (the number of distinct labels has to be at least equal to the number of folds). @@ -459,6 +475,10 @@ class LabelKFold(_BaseKFold): class StratifiedKFold(_BaseKFold): """Stratified K-Folds cross validation iterator + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.StratifiedKFold` instead. + Provides train/test indices to split data in train test sets. This cross-validation object is a variation of KFold that @@ -581,6 +601,10 @@ class StratifiedKFold(_BaseKFold): class LeaveOneLabelOut(_PartitionIterator): """Leave-One-Label_Out cross-validation iterator + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.LeaveOneGroupOut` instead. + Provides train/test indices to split data according to a third-party provided label. This label information can be used to encode arbitrary domain specific stratifications of the samples as integers. @@ -651,6 +675,10 @@ class LeaveOneLabelOut(_PartitionIterator): class LeavePLabelOut(_PartitionIterator): """Leave-P-Label_Out cross-validation iterator + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.LeavePGroupsOut` instead. + Provides train/test indices to split data according to a third-party provided label. This label information can be used to encode arbitrary domain specific stratifications of the samples as integers. @@ -762,6 +790,10 @@ class BaseShuffleSplit(with_metaclass(ABCMeta)): class ShuffleSplit(BaseShuffleSplit): """Random permutation cross-validation iterator. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.ShuffleSplit` instead. + Yields indices to split data into training and test sets. Note: contrary to other cross-validation strategies, random splits @@ -963,6 +995,10 @@ def _approximate_mode(class_counts, n_draws, rng): class StratifiedShuffleSplit(BaseShuffleSplit): """Stratified ShuffleSplit cross validation iterator + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.StratifiedShuffleSplit` instead. + Provides train/test indices to split data in train test sets. This cross-validation object is a merge of StratifiedKFold and @@ -1085,6 +1121,10 @@ class StratifiedShuffleSplit(BaseShuffleSplit): class PredefinedSplit(_PartitionIterator): """Predefined split cross validation iterator + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.PredefinedSplit` instead. + Splits the data into training/test set folds according to a predefined scheme. Each sample can be assigned to at most one test set fold, as specified by the user through the ``test_fold`` parameter. @@ -1140,6 +1180,10 @@ class PredefinedSplit(_PartitionIterator): class LabelShuffleSplit(ShuffleSplit): """Shuffle-Labels-Out cross-validation iterator + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.GroupShuffleSplit` instead. + Provides randomized train/test indices to split data according to a third-party provided label. This label information can be used to encode arbitrary domain specific stratifications of the samples as integers. @@ -1241,6 +1285,10 @@ def cross_val_predict(estimator, X, y=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'): """Generate cross-validated estimates for each input data point + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :func:`sklearn.model_selection.cross_val_predict` instead. + Read more in the :ref:`User Guide <cross_validation>`. Parameters @@ -1421,6 +1469,10 @@ def cross_val_score(estimator, X, y=None, scoring=None, cv=None, n_jobs=1, verbose=0, fit_params=None, pre_dispatch='2*n_jobs'): """Evaluate a score by cross-validation + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :func:`sklearn.model_selection.cross_val_score` instead. + Read more in the :ref:`User Guide <cross_validation>`. Parameters @@ -1724,6 +1776,10 @@ def _shuffle(y, labels, random_state): def check_cv(cv, X=None, y=None, classifier=False): """Input checker utility for building a CV in a user friendly way. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :func:`sklearn.model_selection.check_cv` instead. + Parameters ---------- cv : int, cross-validation generator or an iterable, optional @@ -1781,6 +1837,10 @@ def permutation_test_score(estimator, X, y, cv=None, random_state=0, verbose=0, scoring=None): """Evaluate the significance of a cross-validated score with permutations + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :func:`sklearn.model_selection.permutation_test_score` instead. + Read more in the :ref:`User Guide <cross_validation>`. Parameters @@ -1882,6 +1942,10 @@ permutation_test_score.__test__ = False # to avoid a pb with nosetests def train_test_split(*arrays, **options): """Split arrays or matrices into random train and test subsets + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :func:`sklearn.model_selection.train_test_split` instead. + Quick utility that wraps input validation and ``next(iter(ShuffleSplit(n_samples)))`` and application to input data into a single call for splitting (and optionally subsampling) diff --git a/sklearn/datasets/lfw.py b/sklearn/datasets/lfw.py index af6503f14d7d14be90a7b682ef4d6bcccf64b4ce..e944e658675212d9595b6383aca0211bfb0e4c6a 100644 --- a/sklearn/datasets/lfw.py +++ b/sklearn/datasets/lfw.py @@ -380,7 +380,13 @@ def _fetch_lfw_pairs(index_file_path, data_folder_path, slice_=None, "be removed in 0.19." "Use fetch_lfw_people(download_if_missing=False) instead.") def load_lfw_people(download_if_missing=False, **kwargs): - """Alias for fetch_lfw_people(download_if_missing=False) + """ + Alias for fetch_lfw_people(download_if_missing=False) + + .. deprecated:: 0.17 + This function will be removed in 0.19. + Use :func:`sklearn.datasets.fetch_lfw_people` with parameter + ``download_if_missing=False`` instead. Check fetch_lfw_people.__doc__ for the documentation and parameter list. """ @@ -509,7 +515,13 @@ def fetch_lfw_pairs(subset='train', data_home=None, funneled=True, resize=0.5, "be removed in 0.19." "Use fetch_lfw_pairs(download_if_missing=False) instead.") def load_lfw_pairs(download_if_missing=False, **kwargs): - """Alias for fetch_lfw_pairs(download_if_missing=False) + """ + Alias for fetch_lfw_pairs(download_if_missing=False) + + .. deprecated:: 0.17 + This function will be removed in 0.19. + Use :func:`sklearn.datasets.fetch_lfw_pairs` with parameter + ``download_if_missing=False`` instead. Check fetch_lfw_pairs.__doc__ for the documentation and parameter list. """ diff --git a/sklearn/decomposition/pca.py b/sklearn/decomposition/pca.py index 65bce86840e68a814ef5430b936a34491842a9cb..f9a4142ee8c1947a89bf0ef4e9d6232119062140 100644 --- a/sklearn/decomposition/pca.py +++ b/sklearn/decomposition/pca.py @@ -554,6 +554,12 @@ class PCA(_BasePCA): class RandomizedPCA(BaseEstimator, TransformerMixin): """Principal component analysis (PCA) using randomized SVD + .. deprecated:: 0.18 + This class will be removed in 0.20. + Use :class:`PCA` with parameter svd_solver 'randomized' instead. + The new implementation DOES NOT store whiten ``components_``. + Apply transform to get them. + Linear dimensionality reduction using approximated Singular Value Decomposition of the data and keeping only the most significant singular vectors to project the data to a lower dimensional space. diff --git a/sklearn/discriminant_analysis.py b/sklearn/discriminant_analysis.py index d6675f2fe28756a5d573639b61cb3a1dc1afadfa..628314a013494e02a505880a4dc848c383130ad5 100644 --- a/sklearn/discriminant_analysis.py +++ b/sklearn/discriminant_analysis.py @@ -143,9 +143,6 @@ class LinearDiscriminantAnalysis(BaseEstimator, LinearClassifierMixin, .. versionadded:: 0.17 *LinearDiscriminantAnalysis*. - .. versionchanged:: 0.17 - Deprecated :class:`lda.LDA` have been moved to :class:`LinearDiscriminantAnalysis`. - Read more in the :ref:`User Guide <lda_qda>`. Parameters @@ -562,9 +559,6 @@ class QuadraticDiscriminantAnalysis(BaseEstimator, ClassifierMixin): .. versionadded:: 0.17 *QuadraticDiscriminantAnalysis* - .. versionchanged:: 0.17 - Deprecated :class:`qda.QDA` have been moved to :class:`QuadraticDiscriminantAnalysis`. - Read more in the :ref:`User Guide <lda_qda>`. Parameters diff --git a/sklearn/gaussian_process/gaussian_process.py b/sklearn/gaussian_process/gaussian_process.py index 9e78ba2ea710c045eceee64c63b4e5acafce5a8b..c521cb5b52f43afa9a9e12981eeb3ad852f2fd2a 100644 --- a/sklearn/gaussian_process/gaussian_process.py +++ b/sklearn/gaussian_process/gaussian_process.py @@ -64,8 +64,9 @@ def l1_cross_distances(X): class GaussianProcess(BaseEstimator, RegressorMixin): """The legacy Gaussian Process model class. - Note that this class was deprecated in version 0.18 and will be - removed in 0.20. Use the GaussianProcessRegressor instead. + .. deprecated:: 0.18 + This class will be removed in 0.20. + Use the :class:`GaussianProcessRegressor` instead. Read more in the :ref:`User Guide <gaussian_process>`. diff --git a/sklearn/grid_search.py b/sklearn/grid_search.py index f49d7e0485fa5ba8cc0935f351094983884e4442..6c0101a559bccdfb32f5d44c43a9bfbaa5e3a897 100644 --- a/sklearn/grid_search.py +++ b/sklearn/grid_search.py @@ -46,6 +46,10 @@ warnings.warn("This module was deprecated in version 0.18 in favor of the " class ParameterGrid(object): """Grid of parameters with a discrete number of values for each. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.ParameterGrid` instead. + Can be used to iterate over parameter value combinations with the Python built-in function iter. @@ -165,6 +169,10 @@ class ParameterGrid(object): class ParameterSampler(object): """Generator on parameters sampled from given distributions. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.ParameterSampler` instead. + Non-deterministic iterable over random candidate combinations for hyper- parameter search. If all parameters are presented as a list, sampling without replacement is performed. If at least one parameter @@ -265,6 +273,10 @@ def fit_grid_point(X, y, estimator, parameters, train, test, scorer, verbose, error_score='raise', **fit_params): """Run fit on one set of parameters. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :func:`sklearn.model_selection.fit_grid_point` instead. + Parameters ---------- X : array-like, sparse matrix or list @@ -618,6 +630,10 @@ class BaseSearchCV(six.with_metaclass(ABCMeta, BaseEstimator, class GridSearchCV(BaseSearchCV): """Exhaustive search over specified parameter values for an estimator. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.GridSearchCV` instead. + Important members are fit, predict. GridSearchCV implements a "fit" and a "score" method. @@ -820,6 +836,9 @@ class GridSearchCV(BaseSearchCV): class RandomizedSearchCV(BaseSearchCV): """Randomized search on hyper parameters. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :class:`sklearn.model_selection.RandomizedSearchCV` instead. RandomizedSearchCV implements a "fit" and a "score" method. It also implements "predict", "predict_proba", "decision_function", diff --git a/sklearn/lda.py b/sklearn/lda.py index 8a488ecc7e38e7a27b68292c0b4d5e81f87d4ffb..9c3959b6bc102a2821f0c6ca3a9106304e60d323 100644 --- a/sklearn/lda.py +++ b/sklearn/lda.py @@ -1,6 +1,20 @@ import warnings +from .discriminant_analysis import LinearDiscriminantAnalysis as _LDA + warnings.warn("lda.LDA has been moved to " "discriminant_analysis.LinearDiscriminantAnalysis " "in 0.17 and will be removed in 0.19", DeprecationWarning) -from .discriminant_analysis import LinearDiscriminantAnalysis as LDA + +class LDA(_LDA): + """ + Alias for + :class:`sklearn.discriminant_analysis.LinearDiscriminantAnalysis`. + + .. deprecated:: 0.17 + This class will be removed in 0.19. + Use + :class:`sklearn.discriminant_analysis.LinearDiscriminantAnalysis` + instead. + """ + pass diff --git a/sklearn/learning_curve.py b/sklearn/learning_curve.py index 1642b9a7c4dc078ec75d88fef0e82cec9666bd9b..59d55cad3eb7f706f67d2c5838d09953f8a547f0 100644 --- a/sklearn/learning_curve.py +++ b/sklearn/learning_curve.py @@ -32,6 +32,10 @@ def learning_curve(estimator, X, y, train_sizes=np.linspace(0.1, 1.0, 5), error_score='raise'): """Learning curve. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :func:`sklearn.model_selection.learning_curve` instead. + Determines cross-validated training and test scores for different training set sizes. @@ -259,6 +263,10 @@ def validation_curve(estimator, X, y, param_name, param_range, cv=None, scoring=None, n_jobs=1, pre_dispatch="all", verbose=0): """Validation curve. + .. deprecated:: 0.18 + This module will be removed in 0.20. + Use :func:`sklearn.model_selection.validation_curve` instead. + Determine training and test scores for varying parameter values. Compute scores for an estimator with different values of a specified diff --git a/sklearn/mixture/dpgmm.py b/sklearn/mixture/dpgmm.py index 1b119b8b72f8139b454bc21750d58173cdaa1698..bbbf0b9e217f2413c1f796ed0c8e52f3d5d83858 100644 --- a/sklearn/mixture/dpgmm.py +++ b/sklearn/mixture/dpgmm.py @@ -629,6 +629,16 @@ class _DPGMMBase(_GMMBase): "instead. DPGMM is deprecated in 0.18 and will be " "removed in 0.20.") class DPGMM(_DPGMMBase): + """Dirichlet Process Gaussian Mixture Models + + .. deprecated:: 0.18 + This class will be removed in 0.20. + Use :class:`sklearn.mixture.BayesianGaussianMixture` with + parameter ``weight_concentration_prior_type='dirichlet_process'`` + instead. + + """ + def __init__(self, n_components=1, covariance_type='diag', alpha=1.0, random_state=None, tol=1e-3, verbose=0, min_covar=None, n_iter=10, params='wmc', init_params='wmc'): @@ -647,6 +657,11 @@ class DPGMM(_DPGMMBase): class VBGMM(_DPGMMBase): """Variational Inference for the Gaussian Mixture Model + .. deprecated:: 0.18 + This class will be removed in 0.20. + Use :class:`sklearn.mixture.BayesianGaussianMixture` with parameter + ``weight_concentration_prior_type='dirichlet_distribution'`` instead. + Variational inference for a Gaussian mixture model probability distribution. This class allows for easy and efficient inference of an approximate posterior distribution over the parameters of a diff --git a/sklearn/mixture/gmm.py b/sklearn/mixture/gmm.py index 588882cefe9741a94c4634b68cf204545b26edcb..69f182b142590bec90e259ca6897e79687b5c58b 100644 --- a/sklearn/mixture/gmm.py +++ b/sklearn/mixture/gmm.py @@ -670,6 +670,15 @@ class _GMMBase(BaseEstimator): @deprecated("The class GMM is deprecated in 0.18 and will be " " removed in 0.20. Use class GaussianMixture instead.") class GMM(_GMMBase): + """ + Legacy Gaussian Mixture Model + + .. deprecated:: 0.18 + This class will be removed in 0.20. + Use :class:`sklearn.mixture.GaussianMixture` instead. + + """ + def __init__(self, n_components=1, covariance_type='diag', random_state=None, tol=1e-3, min_covar=1e-3, n_iter=100, n_init=1, params='wmc', init_params='wmc', diff --git a/sklearn/qda.py b/sklearn/qda.py index 069afb629c7f42e13899457a5de35896f92ae530..604d6a919d26182b7c82d3f1cc85031b0150439a 100644 --- a/sklearn/qda.py +++ b/sklearn/qda.py @@ -1,6 +1,20 @@ import warnings +from .discriminant_analysis import QuadraticDiscriminantAnalysis as _QDA + warnings.warn("qda.QDA has been moved to " "discriminant_analysis.QuadraticDiscriminantAnalysis " "in 0.17 and will be removed in 0.19.", DeprecationWarning) -from .discriminant_analysis import QuadraticDiscriminantAnalysis as QDA + +class QDA(_QDA): + """ + Alias for + :class:`sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis`. + + .. deprecated:: 0.17 + This class will be removed in 0.19. + Use + :class:`sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis` + instead. + """ + pass diff --git a/sklearn/tests/test_discriminant_analysis.py b/sklearn/tests/test_discriminant_analysis.py index 64e476967060d85e7999985cfc6f4557c0a47f2c..d1049fa6de31ee03afe2c9e5212e2c856cd5c111 100644 --- a/sklearn/tests/test_discriminant_analysis.py +++ b/sklearn/tests/test_discriminant_analysis.py @@ -329,7 +329,7 @@ def test_deprecated_lda_qda_deprecation(): return sklearn.lda lda = assert_warns(DeprecationWarning, import_lda_module) - assert lda.LDA is LinearDiscriminantAnalysis + assert isinstance(lda.LDA(), LinearDiscriminantAnalysis) def import_qda_module(): import sklearn.qda @@ -339,7 +339,7 @@ def test_deprecated_lda_qda_deprecation(): return sklearn.qda qda = assert_warns(DeprecationWarning, import_qda_module) - assert qda.QDA is QuadraticDiscriminantAnalysis + assert isinstance(qda.QDA(), QuadraticDiscriminantAnalysis) def test_covariance():