feat: add cross validation to workflow (#700)

This commit is contained in:
Yuante Li
2025-03-19 17:56:42 +08:00
committed by GitHub
parent 466a851362
commit 8133e4dcde
2 changed files with 18 additions and 1 deletions
@@ -263,8 +263,24 @@ spec:
3. Dataset Splitting
- The dataset returned by `load_data` is not pre-split. After calling `feat_eng`, split the data into training and test sets.
- If feasible, apply cross-validation on the training set (`X_transformed`, `y_transformed`) to ensure a reliable assessment of model performance.
- [Notice] If feasible, apply cross-validation (e.g. KFold) on the training set (`X_transformed`, `y_transformed`) to ensure a reliable assessment of model performance.
- Keep the test set (`X_test_transformed`) unchanged, as it is only used for generating the final predictions.
- Pseudocode logic for reference:
```
Set number of splits and initialize KFold cross-validator.
Create dictionaries for validation and test predictions.
For each model file:
Import the model dynamically.
Initialize arrays for out-of-fold (OOF) and test predictions.
For each fold in KFold:
Split data into training and validation sets.
Run model workflow to get validation and test predictions.
Validate shapes.
Store validation and test predictions.
Compute average test predictions across folds.
Save OOF and averaged test predictions.
Ensemble predictions from all models and print the final shape.
```
4. Submission File:
- Save the final predictions as `submission.csv`, ensuring the format matches the competition requirements (refer to `sample_submission` in the Folder Description for the correct structure).
@@ -113,6 +113,7 @@ workflow_eval:
[Note]
1. The individual components (data loading, feature engineering, model tuning, etc.) have already been evaluated by the user. You should only evaluate and improve the workflow code, unless there are critical issues in the components.
2. Model performance is NOT a concern in this evaluation—only correct execution and formatting matter.
3. As long as the execution does not exceed the time limit, ensure that the code uses cross-validation to split the training data and train the model. If cross-validation is not used, mention it in the execution section and set `final_decision` to `false`.
## Evaluation Criteria
You will be given the workflow execution output (`stdout`) to determine correctness.