Updated error message to remove deprecated n_values#13454
Updated error message to remove deprecated n_values#13454jnothman merged 5 commits intoscikit-learn:masterfrom
Conversation
| if self._categories != 'auto': | ||
| if len(self._categories) != n_features: | ||
| raise ValueError("Shape mismatch: if n_values is an array," | ||
| raise ValueError("Shape mismatch: if categories is an array," |
There was a problem hiding this comment.
seems like there's no test for this one, could you please add a test for it?
There was a problem hiding this comment.
could you please clarify? are you referring to the same point as made by jnothman or anything specific like naming conventions on the test..
sklearn/preprocessing/_encoders.py
Outdated
| % type(self._n_values)) | ||
| if n_values.ndim < 1 or n_values.shape[0] != X.shape[1]: | ||
| raise ValueError("Shape mismatch: if n_values is an array," | ||
| raise ValueError("Shape mismatch: if categories is an array," |
There was a problem hiding this comment.
I don't think the change is applicable here. This condition applies only when the user is working with the deprecated parameter.
There was a problem hiding this comment.
will revert the change for the _legacy_fit_transform.
|
See log at https://circleci.com/gh/scikit-learn/scikit-learn/51959 for pep8
errors
|
Thanks. Will make the changes and resubmit tonight. |
|
Fixed pep8 issues. |
| cats = ['Low', 'Medium', 'High'] | ||
| enc = OrdinalEncoder(categories=cats) | ||
| msg = ("Shape mismatch: if categories is an array,") | ||
| # "Call 'fit' with appropriate arguments before using this method.") |
There was a problem hiding this comment.
What is the reason for this comment? (I don't really understand it)
There was a problem hiding this comment.
My bad.. that was unrelated. Have removed it now.
|
@maftabali you still have one remaining linting error: sklearn/preprocessing/tests/test_encoders.py:702:1: W293 blank line contains whitespace For the rest looks good to me! |
All done @jorisvandenbossche |
|
Thanks @maftabali |
Pleasure @jnothman |
…it-learn#13454)" This reverts commit c783d04.
…it-learn#13454)" This reverts commit c783d04.
Reference Issues/PRs
Fixes #13446
What does this implement/fix? Explain your changes.
Updated error message to use categories in place of the deprecated n_values
Any other comments?