Dev/v0.2.3. Add experimental stacking classifier workflow#15
Merged
Conversation
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.
Summary
This PR adds the MELITE v0.2.3 experimental stacking workflow.
Main changes:
stackmodel key based on sklearnStackingClassifier.StandardScaler -> SVC.stack_method="predict_proba"for stacking.StandardScaler -> SVC(probability=True).LogisticRegressionas the initial final estimator..pklexport throughjoblib..tmp_stack_smoke/to.gitignorefor local smoke-test outputs.Notes
The stacking-internal CV uses the configured split count and random state without repeated splits because sklearn stacking builds out-of-fold meta-features with
cross_val_predict. This ensures each training sample contributes exactly one out-of-fold prediction for training the final estimator.The outer MELITE grid search and reporting workflow still uses the existing repeated CV/F1 evaluation.
Optuna, MLflow, model registry behavior, and
.pklreplacement are intentionally out of scope.Validation
Unit and integration validation:
python -m pytest -p no:cacheprovider tests\test_model_training.py tests\test_export.py tests\test_predict.py tests\test_version.py47 passedFull test suite:
python -m pytest -p no:cacheprovider125 passed, 1 warningVersion checks:
melite --versionMELITE 0.2.3python -m melite.cli --versionMELITE 0.2.3python -c "import melite; print(melite.__version__)"0.2.3Real stack smoke test:
Temporary TOML copied from
examples/example_config.toml.Changed
[models].activeto["stack"].Changed output path to
.tmp_stack_smoke/output/.Ran
python -m melite.cli run --smoke --config .tmp_stack_smoke\stack_smoke.toml.Generated
results.csvwithmodel_name = StackingClassifier.Exported with:
python -m melite.cli export --config .tmp_stack_smoke\stack_smoke.toml --csv .tmp_stack_smoke\output\results.csv --outdir .tmp_stack_smoke\output --row 0 --forceExported model:
.tmp_stack_smoke/output/Model_StackingClassifier_sample_pca70.pklLoaded exported
.pklsuccessfully as:sklearn.ensemble._stacking.StackingClassifierConfirmed:
predict: Truepredict_proba: True[1 1 1 1 1](5, 2)Other checks:
git diff --check