model-training
Skill2 starsChanged 12 days agoMITView on GitHub
Model Training and Saving. Train, test and save machine learning models - baselines, algorithm choice, scikit-learn or imbalanced-learn Pipeline, class imbalance handling, cross-validation, threshold on validation, one-time test evaluation, final refit, learning curves, pickle persistence (.pkl or .sav), model bundle with metadata, schema, checksum and background sample, reload parity test, version guard and verify-model. Use for fit a model, train classifier or regressor, build a predictive model, save or export a model, pickle, joblib, or prepare a model for deployment.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- SharpAI/DeepCameratheir own version, first seen Oct 8, 2026
- Ascend/agent-skillstheir own version, first seen Mar 17, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- SharpAI/DeepCamera★ 3.1ksame name
- Ascend/agent-skills★ 43same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- ai-prediction-explainerSkill
- data-mining-machine-learningSkill
- data-miningSkill
- data-preparationSkill
- data-profilingSkill
- data-storytellingSkill
- feature-engineeringSkill
- hyperparameter-tuningSkill
- ml-quality-guardSkill
- ml-web-applicationSkill
- model-deploymentSkill
- model-evaluationSkill
- model-explainabilitySkill
- notebook-auditSkill
- problem-framingSkill
- statistical-analysisSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 42
Verify from the shell: bin/data-mining-ml verify-model models/v1.2.0 (standard library only).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Model Training and Saving
Template: templates/notebooks/train_test_save.ipynb. Atoms: mlkit.workflow, mlkit.persistence.
Protocol
- Split once into train, validation and test with the strategy from data-preparation. Fix and record the seed.
- One Pipeline holds preprocessing, engineered features, in-fold resampling and the estimator. It is the only object saved, so serving cannot drift from training.
- Baseline first (majority, mean, last value, current rule, logistic or linear regression), then candidates (
references/algorithms.md). Compare with cross-validation on train, reporting mean and spread. - Tune with cross-validation only (hyperparameter-tuning). Choose the threshold on validation data (model-evaluation).
- Test once. Metrics with intervals, the baseline comparison, per-slice results, the positive count. No tuning after this; if it happens, say so and get a fresh holdout.
- Final refit policy (default): refit the chosen configuration on train plus validation, keep the test result as the reported estimate, record that the shipped model saw more data.
- Learning curve (train versus validation score by sample size) to judge whether more data or a simpler model helps.
Imbalance
Order: stratified splits, class weights, threshold moving, resampling inside an imbalanced-learn Pipeline, imbalance-aware algorithms (balanced random forest, scale_pos_weight, focal loss), anomaly framing at extreme rates. Recalibrate after reweighting or resampling. Details: model-evaluation/references/imbalance-and-metrics.md.
Persistence
from mlkit.persistence import parity_check, save_bundle, verify_bundle
bundle_dir = save_bundle(final, "models", X_trval, y_trval, version="1.2.0", task="binary_classification",
target="churned", classes=[0, 1], threshold=t, metrics=test_metrics, seed=SEED,
feature_info=FEATURE_INFO, model_card=card, feature_dictionary=fd)
assert parity_check(bundle_dir, X_test.head(200), final)["passed"]Writes models/v1.2.0/: model.pkl (pickle, HIGHEST_PROTOCOL; filename="model.sav" for the other common name; joblib is an alternative for very large NumPy-heavy models), model.sha256, metadata.json (version, UTC time, git commit, seed, task, target, classes, threshold, cost matrix, metrics with intervals, positive count, data hash, row count, library versions used by the pipeline), schema.json (type, unit, range, default, step, label, description, adjustable per predictor), background.csv (no identifiers), optional model_card.md and feature_dictionary.csv, and models/CURRENT.
Rules
- Custom transformers live in
src/<package>/transformers.py, never in a notebook, so the API can unpickle them. - Reload parity in a fresh process: probabilities
numpy.allclose, labels equal. Also in pytest. - Version guard: major or minor mismatch raises in production, warns in development.
- Security: unpickling runs code. Load only bundles you produced, from storage you control, after the checksum check. Never load a path from user input or an upload.
- Verify from the shell:
bin/data-mining-ml verify-model models/v1.2.0(standard library only).
Full protocol and failure modes: references/training-and-persistence.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

