Skip to content

check last contextual variable value for nans and raise error - #448

Merged
roussel-ryan merged 2 commits into
mainfrom
contextual_bo_generator
Jul 17, 2026
Merged

check last contextual variable value for nans and raise error#448
roussel-ryan merged 2 commits into
mainfrom
contextual_bo_generator

Conversation

@roussel-ryan

Copy link
Copy Markdown
Collaborator

This pull request improves the handling and validation of contextual variables in the Bayesian generator by ensuring that no NaN values are present in the latest row of training data for contextual variables. It also introduces a corresponding test to verify this behavior.

Validation improvements for contextual variables:

  • Added a new method _validate_contextual_variables_no_nan to the BayesianGenerator class, which checks that the most recent row of training data does not contain NaN values in any contextual variable columns and raises a ValueError if this condition is violated.
  • Integrated the validation step into the candidate generation process by calling _validate_contextual_variables_no_nan before model training in the generate method.

Testing enhancements:

  • Added a test test_contextual_variable_nan_in_last_row_raises to ensure that a ValueError is raised if the latest row contains NaN in a contextual variable column during candidate generation.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@roussel-ryan
roussel-ryan merged commit 0812fd6 into main Jul 17, 2026
13 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.

2 participants