-
-
Notifications
You must be signed in to change notification settings - Fork 260
Open
Description
This is currently failing
tests/test_kmeans.py::test_check_estimator FAILED
=================================================================================================================== FAILURES ====================================================================================================================
_____________________________________________________________________________________________________________ test_check_estimator ______________________________________________________________________________________________________________
def test_check_estimator():
with warnings.catch_warnings(record=True):
warnings.simplefilter("ignore", RuntimeWarning)
> check_estimator(DKKMeans())
tests/test_kmeans.py:28:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../.venv/lib/python3.12/site-packages/sklearn/utils/_param_validation.py:216: in wrapper
return func(*args, **kwargs)
../.venv/lib/python3.12/site-packages/sklearn/utils/estimator_checks.py:858: in check_estimator
check(estimator)
../.venv/lib/python3.12/site-packages/sklearn/utils/_testing.py:147: in wrapper
return fn(*args, **kwargs)
../.venv/lib/python3.12/site-packages/sklearn/utils/estimator_checks.py:4498: in check_n_features_in_after_fitting
with raises(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sklearn.utils._testing._Raises object at 0x1484e2ea0>, exc_type = None, exc_value = None, _ = None
def __exit__(self, exc_type, exc_value, _):
# see
# https://docs.python.org/2.5/whatsnew/pep-343.html#SECTION000910000000000000000
if exc_type is None: # No exception was raised in the block
if self.may_pass:
return True # CM is happy
else:
err_msg = self.err_msg or f"Did not raise: {self.expected_exc_types}"
> raise AssertionError(err_msg)
E AssertionError: `KMeans.predict()` does not check for consistency between input number
E of features with KMeans.fit(), via the `n_features_in_` attribute.
E You might want to use `sklearn.utils.validation.validate_data` instead
E of `check_array` in `KMeans.fit()` and KMeans.predict()`. This can be done
E like the following:
E from sklearn.utils.validation import validate_data
E ...
E class MyEstimator(BaseEstimator):
E ...
E def fit(self, X, y):
E X, y = validate_data(self, X, y, ...)
E ...
E return self
E ...
E def predict(self, X):
E X = validate_data(self, X, ..., reset=False)
E ...
E return X
../.venv/lib/python3.12/site-packages/sklearn/utils/_testing.py:1097: AssertionError
#1008 is adding a skip for that particular check.
Metadata
Metadata
Assignees
Labels
No labels