Skip to content

Conversation

@sepro
Copy link
Member

@sepro sepro commented Jan 8, 2026

If column names were in the training data, coldsnap will now check if they are included in new data when predicting and ensure the order is correct.

claude and others added 2 commits January 7, 2026 10:09
Implemented automatic column order validation and reordering for
DataFrame inputs in the Model.predict() method:

- Validates that all required features are present in input DataFrame
- Automatically reorders columns to match expected feature order
- Issues warning when columns are reordered or when using arrays
- Raises ValueError if required features are missing
- Handles extra columns by selecting only needed features
- Works for both classifiers and regressors

Added comprehensive tests covering:
- Correct column order (no warning)
- Incorrect column order (auto-reorder with warning)
- Missing columns (raises error)
- Extra columns (handled gracefully)
- NumPy arrays (warns about assumed order)
- Regressor support

All 56 tests pass including 7 new tests for column order validation.
@sepro sepro merged commit 03d5d14 into main Jan 8, 2026
2 of 4 checks passed
@sepro sepro deleted the claude/validate-column-order-TeQTx branch January 8, 2026 08:08
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