8000 MNT Put back and properly deprecate MaskedArray by NicolasHug · Pull Request #17199 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

MNT Put back and properly deprecate MaskedArray #17199

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 2 commits into from
May 13, 2020
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
11 changes: 11 additions & 0 deletions sklearn/utils/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
import scipy
import scipy.stats
from scipy.sparse.linalg import lsqr as sparse_lsqr # noqa
from numpy.ma import MaskedArray as _MaskedArray # TODO: remove in 0.25

from .deprecation import deprecated


def _parse_version(version_string):
Expand Down Expand Up @@ -154,3 +157,11 @@ class loguniform(scipy.stats.reciprocal):
>>> rvs.max() # doctest: +SKIP
9.97403052786026
"""


@deprecated(
'MaskedArray is deprecated in version 0.23 and will be removed in version '
'0.25. Use numpy.ma.MaskedArray instead.'
)
class MaskedArray(_MaskedArray):
pass # TODO: remove in 0.25
6 changes: 6 additions & 0 deletions sklearn/utils/tests/test_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from sklearn.utils.fixes import _joblib_parallel_args
from sklearn.utils.fixes import _object_dtype_isnan
from sklearn.utils.fixes import loguniform
from sklearn.utils.fixes import MaskedArray


@pytest.mark.parametrize('joblib_version', ('0.11', '0.12.0'))
Expand Down Expand Up @@ -83,3 +84,8 @@ def test_loguniform(low, high, base):
loguniform(base ** low, base ** high).rvs(random_state=0)
== loguniform(base ** low, base ** high).rvs(random_state=0)
)


def test_masked_array_deprecated(): # TODO: remove in 0.25
with pytest.warns(FutureWarning, match='is deprecated'):
MaskedArray()
0