Skip to content
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

fix: KeyError no longer occurs when using groupfolds for regression tasks. #1385

Conversation

dannycg1996
Copy link
Collaborator

@dannycg1996 dannycg1996 commented Dec 6, 2024

Why are these changes needed?

Currently KeyErrors are raised (under certain conditions outlined in the linked issue) when using AutoML for regression tasks, with GroupKFold splits.
This was caused by the index not being reset for group folds.

As part of this PR, I've modified the if statement in prepare_data to ensure that we now also reset the index, regardless of the split type. This will ensure that this error doesn't occur when group folds are used, or when custom splitters are passed in. I've also added a test, which checks that my example code from the linked issue can now run without errors.

Hopefully that's merge-able - please let me know if you have any suggestions/comments.
Thanks!

Related issue number

Close #1384
Closes #1254

Checks

@dannycg1996 dannycg1996 requested a review from thinkall December 6, 2024 11:31
@dannycg1996 dannycg1996 added the bug Something isn't working label Dec 6, 2024
Copy link
Collaborator

@thinkall thinkall left a comment

Choose a reason for hiding this comment

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

Thank you @dannycg1996 for the PR. Please see my comments in #1384 .

Copy link
Collaborator

@thinkall thinkall left a comment

Choose a reason for hiding this comment

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

Since we're allowing group for regression task. Do you mind update the related docstring as well? Thanks.

@dannycg1996
Copy link
Collaborator Author

Thanks @thinkall - I have updated the docs. Please let me know if I've missed anything!
Can I please ask what the plans are for future releases? We are building a project that depends on the latest FLAML changes.
Thanks again!

@thinkall
Copy link
Collaborator

Thanks @thinkall - I have updated the docs. Please let me know if I've missed anything! Can I please ask what the plans are for future releases? We are building a project that depends on the latest FLAML changes. Thanks again!

I can make a release once your PR is merged.

@dannycg1996
Copy link
Collaborator Author

That's great - thanks!

@thinkall thinkall merged commit c038fbc into microsoft:main Dec 18, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: KeyError raised when Using GroupKFold for Regression Tasks Regression with Grouped kFold CV
2 participants