-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
FIX Extract estimator objects before aggregating dict of scores #17745
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
Conversation
You are super-efficient. You open a PR before that I found that the CI was broken :) |
We should probably have a test to trigger this usage. I am thinking that this is maybe the job of the |
I was looking to the failures in the CRON jobs and I realize that the documentation build was failing. Since I love keep things properly working, I propose the PR :) |
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.
LGTM. Maybe @thomasjpfan wants to have a look
So maybe your solution is better then :) |
if key.endswith(("time", "score")) | ||
else [score[key] for score in scores] |
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 would prefer to dispatch based on the type:
return {
key: np.asarray([score[key] for score in scores])
if isinstance(scores[0][key], numbers.Number)
else [score[key] for score in scores]
for key in scores[0]
}
and then update the docstring:
Aggregate a list of dicts to a dict of ndarray or list.
WTYD @glemaitre ?
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 made the change and merged so that PRs are not failing. We can have a followup PR if we want to go back to checking the key.
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.
Hmm... the only recent PR that was blocked was #17743
Thank you @alfaro96 for being so quick with the fix! |
Thanks @thomasjpfan and @glemaitre for taking care and finalizing this PR! |
…it-learn#17745) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
…it-learn#17745) Co-authored-by: Thomas J. Fan <thomasjpfan@gmail.com>
Reference Issues/PRs
Coming from #17332.
What does this implement/fix? Explain your changes.
This PR extracts the estimator objects for each cross-validation split before executing the
_aggregate_score_dicts
incross_validation
function to avoid that nested estimators are converted to arrays.Any other comments?
WDYT @thomasjpfan about this solution?
Another idea to solve this issue?