Skip to content

FIX Do not reset for non-fit in multiclass#20205

Merged
glemaitre merged 5 commits intoscikit-learn:mainfrom
thomasjpfan:multiclass_n_features_in_small_fix
Jun 9, 2021
Merged

FIX Do not reset for non-fit in multiclass#20205
glemaitre merged 5 commits intoscikit-learn:mainfrom
thomasjpfan:multiclass_n_features_in_small_fix

Conversation

@thomasjpfan
Copy link
Copy Markdown
Member

Copy link
Copy Markdown
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I changed the validation scheme twice and copy pasted too quickly for the last version :/

@jeremiedbb
Copy link
Copy Markdown
Member

jeremiedbb commented Jun 3, 2021

Actually it seems to break something. Let's validate properly:
self._validate_data(X, force_all_finite=False, dtype=None, ensure_2d=False, reset=True|False)
I tested locally and it seems enough

@thomasjpfan
Copy link
Copy Markdown
Member Author

Actually it seems to break something. Let's validate properly: self._validate_data(X, force_all_finite=False, dtype=None, ensure_2d=False, reset=True|False) I tested locally and it seems enough

This can create a new numpy array when X is a list and _ConstantPredictor does not actually use the values of X.

Thinking through the test such as check_fit2d_predict1d with meta-estimators: we are not validating in the meta-estimator and delegating to the inner estimator. This means we can not expect check_fit2d_predict1d to pass for meta-estimators where the inner estimator does not validate.

@thomasjpfan
Copy link
Copy Markdown
Member Author

On a related note, I have been seeing the CI failing which is related related to the issue when the inner estimator is not validating. In that case test_estimators[OutputCodeClassifier(estimator=LogisticRegression(C=1))-check_complex_data] is failing.

Copy link
Copy Markdown
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but don't we need a dedicated non-regression test for this?

Copy link
Copy Markdown
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approved this PR without realizing that there were newly introduced broken tests :(

@glemaitre glemaitre merged commit 007da8d into scikit-learn:main Jun 9, 2021
@glemaitre
Copy link
Copy Markdown
Member

Thanks @thomasjpfan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants