Skip to content

Commit 7dc7f8a

Browse files
FIX Fixes common test for requires_positive_X (#24667)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
1 parent 27d3899 commit 7dc7f8a

File tree

5 files changed

+69
-102
lines changed

5 files changed

+69
-102
lines changed

doc/whats_new/v1.2.rst

+3
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,9 @@ Changelog
581581
in version 1.4.
582582
:pr:`23834` by :user:`Meekail Zain <micky774>`
583583

584+
- |FIX| :func:`utils.estimator_checks.check_estimator` now takes into account
585+
the `requires_positive_X` tag correctly. :pr:`24667` by `Thomas Fan`_.
586+
584587
Code and Documentation Contributors
585588
-----------------------------------
586589

sklearn/tests/test_docstring_parameters.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from sklearn.utils._testing import ignore_warnings
1919
from sklearn.utils import all_estimators
2020
from sklearn.utils.estimator_checks import _enforce_estimator_tags_y
21-
from sklearn.utils.estimator_checks import _enforce_estimator_tags_x
21+
from sklearn.utils.estimator_checks import _enforce_estimator_tags_X
2222
from sklearn.utils.estimator_checks import _construct_instance
2323
from sklearn.utils.fixes import sp_version, parse_version
2424
from sklearn.utils.deprecation import _is_deprecated
@@ -300,7 +300,7 @@ def test_fit_docstring_attributes(name, Estimator):
300300
)
301301

302302
y = _enforce_estimator_tags_y(est, y)
303-
X = _enforce_estimator_tags_x(est, X)
303+
X = _enforce_estimator_tags_X(est, X)
304304

305305
if "1dlabels" in est._get_tags()["X_types"]:
306306
est.fit(y)

sklearn/tests/test_metaestimators.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from sklearn.base import is_regressor
1010
from sklearn.datasets import make_classification
1111
from sklearn.utils import all_estimators
12-
from sklearn.utils.estimator_checks import _enforce_estimator_tags_x
12+
from sklearn.utils.estimator_checks import _enforce_estimator_tags_X
1313
from sklearn.utils.estimator_checks import _enforce_estimator_tags_y
1414
from sklearn.utils.validation import check_is_fitted
1515
from sklearn.utils._testing import set_random_state
@@ -289,7 +289,7 @@ def test_meta_estimators_delegate_data_validation(estimator):
289289
y = rng.randint(3, size=n_samples)
290290

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

295295
# Calling fit should not raise any data validation exception since X is a

0 commit comments

Comments
 (0)