Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX Fixes common test for requires_positive_X #24667

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 5 commits into from
Oct 26, 2022
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
3 changes: 3 additions & 0 deletions doc/whats_new/v1.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,9 @@ Changelog
in version 1.4.
:pr:`23834` by :user:`Meekail Zain <micky774>`

- |FIX| :func:`utils.estimator_checks.check_estimator` now takes into account
the `requires_positive_X` tag correctly. :pr:`24667` by `Thomas Fan`_.

Code and Documentation Contributors
-----------------------------------

Expand Down
4 changes: 2 additions & 2 deletions sklearn/tests/test_docstring_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from sklearn.utils._testing import ignore_warnings
from sklearn.utils import all_estimators
from sklearn.utils.estimator_checks import _enforce_estimator_tags_y
from sklearn.utils.estimator_checks import _enforce_estimator_tags_x
from sklearn.utils.estimator_checks import _enforce_estimator_tags_X
from sklearn.utils.estimator_checks import _construct_instance
from sklearn.utils.fixes import sp_version, parse_version
from sklearn.utils.deprecation import _is_deprecated
Expand Down Expand Up @@ -300,7 +300,7 @@ def test_fit_docstring_attributes(name, Estimator):
)

y = _enforce_estimator_tags_y(est, y)
X = _enforce_estimator_tags_x(est, X)
X = _enforce_estimator_tags_X(est, X)

if "1dlabels" in est._get_tags()["X_types"]:
est.fit(y)
Expand Down
4 changes: 2 additions & 2 deletions sklearn/tests/test_metaestimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sklearn.base import is_regressor
from sklearn.datasets import make_classification
from sklearn.utils import all_estimators
from sklearn.utils.estimator_checks import _enforce_estimator_tags_x
from sklearn.utils.estimator_checks import _enforce_estimator_tags_X
from sklearn.utils.estimator_checks import _enforce_estimator_tags_y
from sklearn.utils.validation import check_is_fitted
from sklearn.utils._testing import set_random_state
Expand Down Expand Up @@ -289,7 +289,7 @@ def test_meta_estimators_delegate_data_validation(estimator):
y = rng.randint(3, size=n_samples)

# We convert to lists to make sure it works on array-like
X = _enforce_estimator_tags_x(estimator, X).tolist()
X = _enforce_estimator_tags_X(estimator, X).tolist()
y = _enforce_estimator_tags_y(estimator, y).tolist()

# Calling fit should not raise any data validation exception since X is a
Expand Down
Loading