ml-best-practices
Skill8 starsChanged 2 months agoMITView on GitHub
Statistical machine learning best practices, exploratory data analysis, feature engineering, and rigorous model evaluation. Use when analyzing tabular datasets, engineering features, training classifiers or regressors, forecasting time series, or computing 95% bootstrap confidence intervals — even if they don't explicitly say \"ml best practices\". Do NOT use for standard database queries without ML, basic spreadsheet formatting, or general application backend logic.
We split this skill into the rules it gives an agent
4 rules. 0 are common, 4 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Strict Train-Test Isolation: Always partition datasets into training, validation, and test splits before fitting any scalers, encoders, or …
- Distinctive: line 20
Dual-Model Benchmark: Never rely on a single model architecture in isolation.
- Distinctive: line 22
Story-First Notebook Structure: Every code execution cell must be paired with an analytical markdown cell explaining the observed patterns, …
- Distinctive: line 62
Key Point: Check for target column anomalies, extreme outliers, and non-sensical values before modeling.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Machine Learning Best Practices
Apply rigorous machine learning engineering standards across exploratory analysis, feature engineering, model training, and statistical performance validation.
Core Principle
Every model finding must be grounded in leakage-free splits, dual-model baselines, and statistical confidence intervals.
Core Invariants
- Strict Train-Test Isolation: Always partition datasets into training, validation, and test splits before fitting any scalers, encoders, or transformers.
- Mandatory Missing Value Strategy: Explicitly quantify missing value frequencies and document domain rationale for keeping, dropping, or imputing them.
- Dual-Model Benchmark: Never rely on a single model architecture in isolation. Train at least two distinct candidate families against a naive baseline.
- Statistical Significance Over Raw Averages: Report 95% bootstrap confidence intervals for key evaluation metrics (F1, AUC, RMSE) to verify statistical separation.
- Story-First Notebook Structure: Every code execution cell must be paired with an analytical markdown cell explaining the observed patterns, trade-offs, and conclusions.
Architecture & Map of Content (MOC)
Raw Dataset & Objective
│
▼
┌────────────────────────────────────────┐
│ 1. Data Hygiene & Anomaly Screening │ (Missingness, Cardinality, Invariants)
└──────────────────┬─────────────────────┘
│
┌───────────┴───────────┐
▼ ▼
┌──────────────┐ ┌──────────────┐
│ Clustering │ │ Forecasting │ (Silhouette Optimization, Stationarity)
└──────────────┘ └──────────────┘
│ │
└───────────┬───────────┘
│
┌───────────┴───────────┐
▼ ▼
┌──────────────┐ ┌──────────────┐
│Classification│ │ Regression │ (Pipeline Encoders, Regularization)
└──────────────┘ └──────────────┘
│
▼
┌────────────────────────────────────────┐
│ 2. Statistical Model Comparison │ (95% Bootstrap CIs, Slice Analysis)
└────────────────────────────────────────┘Step-by-Step Procedure (TWI)
Step 1: Exploratory Analysis & Anomaly Detection
- Action: Inspect schema, compute summary statistics, and visualize target distributions with scatter plots and histograms.
- Key Point: Check for target column anomalies, extreme outliers, and non-sensical values before modeling.
- Why: Training models on corrupt or undetected anomalous targets invalidates the experimental setup.
Step 2: Supervised Modeling (Classification / Regression)
- Action: Apply transformers inside scikit-learn pipelines fit exclusively on training data; evaluate regularization to control overfitting.
- Key Point: For high-cardinality nominal features, restrict cardinality or use target encoding with out-of-fold regularization.
- Why: Fitting transformers on the combined dataset causes subtle target and variance leakage.
- Inline Checklist:
- Data split chronologically (if temporal) or via StratifiedKFold (if classification)
- Encoders and scalers wrapped inside Pipeline, fitted only on X_train
- Confusion matrices, ROC curves, or residual diagnostic plots generated
- Missing values handled with documented justification
Step 3: Unsupervised Clustering & Time-Series Forecasting
- Action: For clustering, standardize features and optimize the Silhouette Score; for forecasting, test stationarity and seasonality.
- Key Point: For time series, verify that no future information leaks into historical lag features.
- Why: Silhouette optimization prevents arbitrary cluster count selection; stationarity testing determines appropriate model family.
Step 4: Model Comparison & 95% Bootstrap Confidence Intervals
- Action: Benchmark multiple model candidates on identical cross-validation folds and calculate bootstrap confidence intervals.
- Key Point: Conduct slice-based error analysis across critical subpopulations and compile an operational trade-off table.
- Why: Point estimates of accuracy often conceal performance drops on key customer cohorts.
Anti-Rationalization Guardrails
| Tempting Rationalization | Binding Rule | Engineering Rationale |
| "Standard scaling before splitting is harmless." | Fit scalers strictly on training folds. | Scalers compute dataset-wide statistics that cause subtle distribution leakage. |
| "Accuracy is 94%, so the classifier is ready." | Always inspect PR-AUC, F1, and confusion matrix. | On imbalanced classes, 94% accuracy may be worse than a naive majority-class guess. |
| "We don't need a baseline because XGBoost is superior." | Always establish naive and linear baselines first. | Naive baselines justify model complexity and reveal genuine signal gains. |
| "Shuffling temporal data is fine if well-mixed." | Split temporal data chronologically. | Shuffling time series causes future lookahead leakage into historical folds. |
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- GoogleCloudPlatform/data-agent-kit-plugin★ 240same name
- sid-lakhani/agents-config★ 2same name
- matt-rabah/sf-rag★ 0same name
- MortuisVMain/ai-agent-superpowers★ 0same 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 repository42 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ai-data-remediationSkill
- ai-engineeringSkill
- codebase-designSkill
- code-reviewSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- engineering-workflow-guideSkill
- git-safety-guardrailsSkill
- goalSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- j-spaceSkill
- migrate-to-shoehornSkill
- prototypeSkill
- researchSkill
- resolving-merge-conflictsSkill
- retroSkill
- scaffold-exercisesSkill
- setup-engineering-workflowsSkill
- setup-pre-commitSkill
- setup-ts-deep-modulesSkill
- skill-conductorSkill
- tddSkill
- teachSkill
- to-questionnaireSkill
- to-specSkill
- to-ticketsSkill
- triageSkill
- wait-whatSkill
- wayfinderSkill
- wizardSkill
- workflow-designerSkill
- writing-beatsSkill
- writing-for-agentsSkill
- writing-fragmentsSkill
- writing-shapeSkill
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.

