-
Notifications
You must be signed in to change notification settings - Fork 87
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
Raise a custom exception for partial dependence errors #2604
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2604 +/- ##
=======================================
+ Coverage 99.9% 99.9% +0.1%
=======================================
Files 295 295
Lines 26848 26894 +46
=======================================
+ Hits 26802 26848 +46
Misses 46 46
Continue to review full report at Codecov.
|
raise ValueError( | ||
"Too many features given to graph_partial_dependence. Only one or two-way partial " | ||
"dependence is supported." | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this try
unfortunately makes the diff seem bigger than it is. I think it's important to catch all possible errors that this can raise so that users don't have to resort to except Exception
or except PartialDependenceError, ValueError
and hope that'll catch everything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an outstanding issue to clean up partial dependence (#2502) so maybe this will be cleaner once we redesign this with this requirement in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very awesome, great work. Thanks for consolidating all these exceptions and making it super tidy. I think this will also help downstream consumers of EvalML a LOT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code=PartialDependenceErrorCode.COMPUTED_PERCENTILES_TOO_CLOSE, | ||
) | ||
else: | ||
raise e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so this error isn't necessarily due to Partial Dependence, so it doesn't necessarily fall into the PartialDependenceError
category? Got it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea it's caused by something else in sklearn. Raising here makes sure the final except
catches it and then we can wrap as PartialDependenceError
with the "all other errors code"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, about the docs page. Yea you have to click on the drop down on the left hand side and then click on exceptions.
The "API Reference" is a manually curated list of functions/classes but it's not exhaustive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid work, love the Enum implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love this change. LGTM!
if any(is_datetime): | ||
raise ValueError( | ||
"Two-way partial dependence is not supported for datetime columns." | ||
X_unknown = X_features.ww.select("unknown") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we combine this with the following check for "URL", "EmailAddress", "NaturalLanguage"? They all have the INVALID_FEATURE_TYPE
code :)
8650c12
to
2148a52
Compare
2148a52
to
53b932b
Compare
Pull Request Description
Fixes #2539
Design document here .
After creating the pull request: in order to pass the release_notes_updated check you will need to update the "Future Release" section of
docs/source/release_notes.rst
to include this pull request by adding :pr:123
.