Skip to content

BUG Fix zero division error in GBDTs #14024

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
merged 7 commits into from
Jun 13, 2019

Conversation

NicolasHug
Copy link
Member

Fixes #14018

Probably also #14014

Non-regression test fails on master.

@@ -2352,8 +2352,8 @@ def check_decision_proba_consistency(name, estimator_orig):
hasattr(estimator, "predict_proba")):

estimator.fit(X, y)
a = estimator.predict_proba(X_test)[:, 1]
b = estimator.decision_function(X_test)
a = estimator.predict_proba(X_test)[:, 1].round(decimals=10)
Copy link
Member

Choose a reason for hiding this comment

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

That's not great :-/ Can we avoid that? Basically you're saying after the "fix" the estimator is not consistent any more because of floating point issues?

Copy link
Member Author

Choose a reason for hiding this comment

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

because scipy's expit isn't precise enough. But I feel like 1e-10 is a decent precision. I had issues with this test before and IMO it's too strict.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed it's fine.

Copy link
Member

Choose a reason for hiding this comment

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

Should we be rounding as a non-copying operation? Is this copying?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's copying.

I can't tell from the docs (nor the code) whether it copies if we pass out=.

I don't think that's important though?

Copy link
Member

Choose a reason for hiding this comment

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

Using out= will not copy if it's into the same array.
I forgot this was in estimator checks. Yes, not important.

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

LGTM

@jnothman jnothman added this to the 0.21.3 milestone Jun 7, 2019
@@ -2352,8 +2352,8 @@ def check_decision_proba_consistency(name, estimator_orig):
hasattr(estimator, "predict_proba")):

estimator.fit(X, y)
a = estimator.predict_proba(X_test)[:, 1]
b = estimator.decision_function(X_test)
a = estimator.predict_proba(X_test)[:, 1].round(decimals=10)
Copy link
Member

Choose a reason for hiding this comment

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

Should we be rounding as a non-copying operation? Is this copying?

thomasjpfan
thomasjpfan previously approved these changes Jun 12, 2019
@thomasjpfan thomasjpfan dismissed their stale review June 12, 2019 23:26

Forgot to comment about test

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 once #14024 (comment) is addressed.

@NicolasHug
Copy link
Member Author

Comment was addressed

@thomasjpfan thomasjpfan changed the title [MRG] Fix zero division error in GBDTs BUG Fix zero division error in GBDTs Jun 13, 2019
@thomasjpfan thomasjpfan merged commit b580ad5 into scikit-learn:master Jun 13, 2019
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Jun 24, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
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.

Zero division error in HistGradientBoosting
6 participants