fix: apply ExperimentConfig before resolving x_column (#67)#68
Merged
Conversation
BaseTask.__init__ called df.drop_duplicates(subset=[x_column]) before config.apply_to(self), so the default x_column='x' was used even when ExperimentConfig overrode it, raising KeyError on dataframes using other column names. Apply config first, then index the dataframe. Fixes automl#67
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a task-construction bug where ExperimentConfig overrides (notably x_column) were applied too late, causing BaseTask (and downstream tasks like RewardTask) to operate on the default x_column='x' and crash when that column didn’t exist.
Changes:
- Apply
ExperimentConfigtoBaseTaskbefore performing anyx_column-dependent dataframe operations (deduplication andxs/ysextraction). - Ensure
RewardTaskbuilds itskwargs_mapusing the resolvedself.x_columnrather than the constructor parameter. - Add a regression test covering
x_columnoverride viaExperimentConfig(issue #67).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
promptolution/tasks/base_task.py |
Moves drop_duplicates and xs/ys extraction to occur after config application so overridden columns are respected. |
promptolution/tasks/reward_tasks.py |
Uses self.x_column when indexing the dataframe to build kwargs_map, aligning with config overrides. |
tests/tasks/test_reward_tasks.py |
Adds a regression test verifying x_column is correctly sourced from ExperimentConfig. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
finitearth
approved these changes
May 12, 2026
Collaborator
finitearth
left a comment
There was a problem hiding this comment.
Thank you for contributing and improving promptolution! Great catch on the initialization order bug, and thanks for including a regression test as well. LGTM!
mo374z
approved these changes
May 12, 2026
timo282
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
BaseTask.init called df.drop_duplicates(subset=[x_column]) before config.apply_to(self), so the default x_column='x' was used even when ExperimentConfig overrode it. Fixes #67. Added regression test.