Skip to content

TST avoid FutureWarning due to n_features_in_ deprecation in Dummy* #20963

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

Conversation

glemaitre
Copy link
Member

follow-up #20960

Removing the warning issued due to the deprecation of n_features_in_ in Dummy*.

Copy link
Member

@NicolasHug NicolasHug left a comment

Choose a reason for hiding this comment

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

Thanks! I will let you merge this time lol

@@ -615,6 +615,7 @@ def fit(self, X, y, sample_weight=None, **fit_params):
return super().fit(X, y, sample_weight)


@pytest.mark.filterwarnings("ignore:`n_features_in_` is deprecated")
Copy link
Member Author

@glemaitre glemaitre Sep 7, 2021

Choose a reason for hiding this comment

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

This one is worrying me. Here, it shows that a user will see the warning for some meta-estimators using the dummy estimator. Indeed, for the meta-estimators setting n_features_in_ depending on the inner estimator, we will check n_features_in_ and it will raise the warning with the dummy estimators.

It might be less of a big deal because it is only a dummy estimator and maybe not that many people are using it in a meta-estimator.

Copy link
Member

@thomasjpfan thomasjpfan Sep 7, 2021

Choose a reason for hiding this comment

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

If it gets annoying for users, we can define our own hasattr that ignores future warnings emitted by sklearn.

Edit: Most likely better to use a @property and @available_if. (If @available_if works with properties)

@glemaitre
Copy link
Member Author

Thanks! I will let you merge this time lol

Let see if the CIs are passing first :)

Copy link
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!

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

Successfully merging this pull request may close these issues.

4 participants