Skip to content

Commit dcca31c

Browse files
jrfiedleramueller
authored andcommitted
Modify v0.18 DeprecationWarning messages (scikit-learn#7067)
1 parent 46f81f0 commit dcca31c

File tree

9 files changed

+20
-17
lines changed

9 files changed

+20
-17
lines changed

sklearn/cross_validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from .exceptions import FitFailedWarning
3737

3838

39-
warnings.warn("This module has been deprecated in favor of the "
39+
warnings.warn("This module was deprecated in version 0.18 in favor of the "
4040
"model_selection module into which all the refactored classes "
4141
"and functions are moved. Also note that the interface of the "
4242
"new CV iterators are different from that of this module. "

sklearn/decomposition/pca.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def score(self, X, y=None):
512512
return np.mean(self.score_samples(X))
513513

514514

515-
@deprecated("RandomizedPCA will be removed in 0.20. "
515+
@deprecated("RandomizedPCA was deprecated in 0.18 and will be removed in 0.20. "
516516
"Use PCA(svd_solver='randomized') instead. The new implementation "
517517
"DOES NOT store whiten components_. Apply transform to get them.")
518518
class RandomizedPCA(BaseEstimator, TransformerMixin):

sklearn/decomposition/tests/test_pca.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ def test_deprecation_randomized_pca():
494494
rng = np.random.RandomState(0)
495495
X = rng.random_sample((5, 4))
496496

497-
depr_message = ("Class RandomizedPCA is deprecated; RandomizedPCA will be "
497+
depr_message = ("Class RandomizedPCA is deprecated; RandomizedPCA was "
498+
"deprecated in 0.18 and will be "
498499
"removed in 0.20. Use PCA(svd_solver='randomized') "
499500
"instead. The new implementation DOES NOT store "
500501
"whiten components_. Apply transform to get them.")

sklearn/gaussian_process/gaussian_process.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
MACHINE_EPSILON = np.finfo(np.double).eps
2121

2222

23-
@deprecated("l1_cross_distances is deprecated and will be removed in 0.20.")
23+
@deprecated("l1_cross_distances was deprecated in version 0.18 "
24+
"and will be removed in 0.20.")
2425
def l1_cross_distances(X):
2526
"""
2627
Computes the nonzero componentwise L1 cross-distances between the vectors
@@ -58,13 +59,13 @@ def l1_cross_distances(X):
5859
return D, ij
5960

6061

61-
@deprecated("GaussianProcess is deprecated and will be removed in 0.20. "
62-
"Use the GaussianProcessRegressor instead.")
62+
@deprecated("GaussianProcess was deprecated in version 0.18 and will be "
63+
"removed in 0.20. Use the GaussianProcessRegressor instead.")
6364
class GaussianProcess(BaseEstimator, RegressorMixin):
6465
"""The legacy Gaussian Process model class.
6566
66-
Note that this class is deprecated and will be removed in 0.20.
67-
Use the GaussianProcessRegressor instead.
67+
Note that this class was deprecated in version 0.18 and will be
68+
removed in 0.20. Use the GaussianProcessRegressor instead.
6869
6970
Read more in the :ref:`User Guide <gaussian_process>`.
7071

sklearn/grid_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
'ParameterSampler', 'RandomizedSearchCV']
3838

3939

40-
warnings.warn("This module has been deprecated in favor of the "
40+
warnings.warn("This module was deprecated in version 0.18 in favor of the "
4141
"model_selection module into which all the refactored classes "
4242
"and functions are moved. This module will be removed in 0.20.",
4343
DeprecationWarning)

sklearn/learning_curve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .utils.fixes import astype
1818

1919

20-
warnings.warn("This module has been deprecated in favor of the "
20+
warnings.warn("This module was deprecated in version 0.18 in favor of the "
2121
"model_selection module into which all the functions are moved."
2222
" This module will be removed in 0.20",
2323
DeprecationWarning)

sklearn/linear_model/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ def make_dataset(X, y, sample_weight, random_state=None):
6767
return dataset, intercept_decay
6868

6969

70-
@deprecated("sparse_center_data will be removed in "
71-
"0.20. Use utilities in preprocessing.data instead")
70+
@deprecated("sparse_center_data was deprecated in version 0.18 and will be "
71+
"removed in 0.20. Use utilities in preprocessing.data instead")
7272
def sparse_center_data(X, y, fit_intercept, normalize=False):
7373
"""
7474
Compute information needed to center data to have mean zero along
@@ -105,7 +105,7 @@ def sparse_center_data(X, y, fit_intercept, normalize=False):
105105
return X, y, X_offset, y_offset, X_std
106106

107107

108-
@deprecated("center_data will be removed in "
108+
@deprecated("center_data was deprecated in version 0.18 and will be removed in "
109109
"0.20. Use utilities in preprocessing.data instead")
110110
def center_data(X, y, fit_intercept, normalize=False, copy=True,
111111
sample_weight=None):

sklearn/linear_model/ransac.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,9 @@ def fit(self, X, y, sample_weight=None):
256256

257257
if self.residual_metric is not None:
258258
warnings.warn(
259-
"'residual_metric' will be removed in version 0.20. Use "
260-
"'loss' instead.", DeprecationWarning)
259+
"'residual_metric' was deprecated in version 0.18 and "
260+
"will be removed in version 0.20. Use 'loss' instead.",
261+
DeprecationWarning)
261262

262263
if self.loss == "absolute_loss":
263264
if y.ndim == 1:

sklearn/model_selection/_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,8 @@ def best_score_(self):
614614
@property
615615
def grid_scores_(self):
616616
warnings.warn(
617-
"The grid_scores_ attribute is deprecated in favor of the"
618-
" more elaborate results_ attribute."
617+
"The grid_scores_ attribute was deprecated in version 0.18"
618+
" in favor of the more elaborate results_ attribute."
619619
" The grid_scores_ attribute will not be available from 0.20",
620620
DeprecationWarning)
621621

0 commit comments

Comments
 (0)