Skip to content

fix: apply ExperimentConfig before resolving x_column (#67)#68

Merged
finitearth merged 3 commits into
automl:mainfrom
SAY-5:fix/x-column-config-override-67
May 13, 2026
Merged

fix: apply ExperimentConfig before resolving x_column (#67)#68
finitearth merged 3 commits into
automl:mainfrom
SAY-5:fix/x-column-config-override-67

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented May 11, 2026

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.

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
@SAY-5 SAY-5 requested a review from mo374z as a code owner May 11, 2026 20:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 ExperimentConfig to BaseTask before performing any x_column-dependent dataframe operations (deduplication and xs/ys extraction).
  • Ensure RewardTask builds its kwargs_map using the resolved self.x_column rather than the constructor parameter.
  • Add a regression test covering x_column override via ExperimentConfig (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.

Copy link
Copy Markdown
Collaborator

@finitearth finitearth 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 for contributing and improving promptolution! Great catch on the initialization order bug, and thanks for including a regression test as well. LGTM!

@finitearth finitearth merged commit 0523fb3 into automl:main May 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x_column bug in task creation via ExperimentConfig

5 participants