镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Merged
Li Jiang (thinkall) merged 5 commits into
microsoft:mainfrom
dannycg1996:flaml-fix-groups-issue-for-regression-tasks
Dec 18, 2024
Merged

Li Jiang (thinkall) merged 5 commits into
microsoft:mainfrom
dannycg1996:flaml-fix-groups-issue-for-regression-tasks

Conversation

@dannycg1996

@dannycg1996 Daniel Grindrod (dannycg1996) commented Dec 6, 2024 •

Copy link
Copy Markdown
Collaborator

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

@thinkall Li Jiang (thinkall) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you Daniel Grindrod (@dannycg1996) for the PR. Please see my comments in #1384 .

@thinkall Li Jiang (thinkall) left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator Author

Thanks Li Jiang (@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
Copy Markdown
Collaborator

Thanks Li Jiang (@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
Copy Markdown
Collaborator Author

That's great - thanks!

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