Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Make EvalML compatible with Woodwork changes #4066
Make EvalML compatible with Woodwork changes #4066
Changes from 21 commits
4e76e5d
4ed1c64
0889ad3
080a4cc
dc20f23
0141795
5996b78
06b87dd
e2d9401
02f5f7f
a7f8ef2
a9c365c
818c838
7ecf770
d0803e2
9a0977c
92b979d
c17717e
6c8e2b5
032e1dd
f0b820c
623c4d2
632b124
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
do you want to add a comment here and below explaining why we're setting it as
category
instead of leaving it asobject
? Might be good to remember.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.
What change caused this? It's a surprising distinction to make
Also, a nitpicky clarity change - we can replace the separate order messages here with
order_msg = f"Columns '{order[0]}', '{order[1]}', '{order[2]}' are 95% or more..."
just to make it clearer what the difference is!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.
In this case,
col_3_id
is a random series of string-represented numbers, which under the new inference will become theInteger
ltype
. Following this logic in validate, since they're all unique values and since the column ends inid
, it gets identified as a possible ID column.Previously however, since this column wasn't a numeric logical type, the logic here didn't catch it, but this did.
This just ends up resulting in a different ordering by which these columns are caught as possible ID columns by the data check
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 you explain why we need this now? do we need to add support directly into prediction explanations?
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'm concerned by this change as well. I think
json.loads(json.dumps(best_worst)) == best_worst
is an axiom we should maintain, rather than patching it over for the sake of the upgrade. What change predicated this, and how can we account for it in prediction explanations instead?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.
This is because the output of
explain_predictions_best_worst
results in the keys ofpredicted_values
being integers, since they're numeric values being represented as strings. Woodwork's new inference will infer strings as their appropriate numeric logical type if their incoming dtype isobject
and no other logical type is specified.but JSON doesn't allow non-string keys, so it replaces them with
What I added here was an
object_hook
to be called instead of the standarddict
which converts thestring
key back to anint
just so they can be compared for the test.I think what's happening is that this is creating keys and assigning them to the
probabilities
key even if they're integers. I can modify this to stringify all keys since JSON will end up converting them anyways. I just thought it would be better for the output ofexplain_predictions_best_worst
to represent the actual values even if JSON would end up stringifying them. @eccabay @jeremyliweishih does that make sense?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.
wait @ParthivNaresh why does woodwork inference matter when we're testing if dumping and loading the same json will result in the same dictionary?
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.
@jeremyliweishih Because JSON only allows key names to be strings, so if the values themselves aren't strings, then they get dumped as integers and read as strings. I think somewhere in the prediction explanation process, the original dtype of
y
is lost and reinferred, which means if the original dtype was a string, it would be reinferred as an integer.I tried replacing
with
or explicitly setting it as string dtype (
string
instead ofstr
), but it still writes out the dictionary inbest_worst
as an integerThere 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.
Doesn't your second comment contradict this, so
explain_predictions_best_worst
is still modifying the actual values, but in the wrong direction?My preference remains that we keep the assertion that
json.loads(json.dumps(best_worst)) == best_worst
, and we update the code to maintain this rather than the test.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.
explain_predictions_best_worst
is modifying this somewhere but that's not the expectation. If I pass in a string dtype (which Woodwork won't infer as numeric, but Categorical in this case) then that would be the expected output.I'm taking a look into
explain_predictions_best_worst
to see where this unexpected reinference is happeningThere 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.
@eccabay I think the issue was that
ww.init_series
was being used to determine the unique classes that existed in a classification pipeline. If the column names were strings then they got inferred as integers because of this.