/scikit-learn
Machine learning: clustering, PCA/t-SNE/UMAP, classification, prediction regression (Ridge/Lasso/ensemble), cross-validation, Pipelines. For unsupervised analysis, classification, or prediction. For econometric regression use pyfixest/statsmodels.
$ npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill scikit-learn --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/scikit-learn
Context preview
The summary Claude sees to decide when to auto-load this skill.
Machine learning: clustering, PCA/t-SNE/UMAP, classification, prediction regression (Ridge/Lasso/ensemble), cross-validation, Pipelines. For unsupervised analysis, classification, or prediction. For econometric regression use pyfixest/statsmodels.
SKILL.md
scikit-learn.SKILL.mdname: scikit-learn
description: >-
Machine learning: clustering, PCA/t-SNE/UMAP, classification, prediction regression (Ridge/Lasso/ensemble), cross-validation, Pipelines. For unsupervised analysis, classification, or prediction. For econometric regression use pyfixest/statsmodels.
metadata:
audience: research-coders
domain: python-library
library-version: "1.8.0"
skill-last-updated: "2026-03-28"
scikit-learn Skill
General-purpose machine learning with scikit-learn. Covers unsupervised methods (clustering, GMM, PCA, t-SNE, UMAP, manifold learning, evaluation metrics), supervised methods (classification, prediction-focused regression via Ridge/Lasso/ensemble methods, model evaluation, cross-validation), and shared infrastructure (preprocessing, Pipeline construction, feature selection). Use when performing cluster analysis, dimension reduction, classification, prediction-focused regression, or model evaluation in Python. For econometric regression (OLS, FE, IV, DiD), see pyfixest and statsmodels skills instead.
Comprehensive skill for machine learning in Python with scikit-learn. Covers unsupervised methods (clustering, decomposition, manifold learning), supervised methods (classification, regression), and shared infrastructure (preprocessing, pipelines, evaluation). Use decision trees below to find the right guidance, then load detailed references.
What is scikit-learn?
scikit-learn is the standard **general-purpose machine learning library** for Python:
- **Consistent API**: Every estimator follows `fit()` / `predict()` / `transform()` — learn once, apply everywhere
- **Unsupervised methods**: Clustering (KMeans, DBSCAN, HDBSCAN, hierarchical), decomposition (PCA, NMF, SVD), mixture models (GMM), manifold learning (t-SNE)
- **Supervised methods**: Classification (logistic regression, random forest, gradient boosting, SVM) and prediction-focused regression (Ridge, Lasso, ensemble methods)
- **Model evaluation**: Cross-validation, grid search, metrics for both classification and clustering
- **Pipelines**: Chain preprocessing and models into reproducible, leak-free workflows
Version Notes
This skill targets **scikit-learn 1.8.0**. Notable changes in recent versions:
- HDBSCAN added as a first-class estimator (1.3+)
- `set_output(transform="pandas")` for DataFrame output from transformers (1.2+)
- HistGradientBoosting estimators are now stable (1.0+)
- `n_init="auto"` default for KMeans (1.4+) — uses 10 for `init="random"`, 1 for `init="k-means++"`
How to Use This Skill
Reference File Structure
Each topic in `./references/` contains focused documentation:
| File | Purpose | When to Read | |------|---------|--------------| | `quickstart.md` | Import patterns, fit/predict/transform API, Pipeline, train_test_split | First use of scikit-learn | | `clustering.md` | KMeans, AgglomerativeClustering, DBSCAN, HDBSCAN, SpectralClustering, OPTICS | Cluster analysis tasks | | `mixture-models.md` | GaussianMixture, BayesianGaussianMixture, BIC/AIC model selection | Model-based clustering, soft assignments | | `decomposition.md` | PCA, KernelPCA, TruncatedSVD, NMF, IncrementalPCA | Dimension reduction tasks | | `manifold.md` | t-SNE, UMAP (umap-learn), Isomap, LLE, MDS, SpectralEmbedding | Visualizing high-dimensional data | | `evaluation-unsupervised.md` | silhouette_score, Davies-Bouldin, Calinski-Harabasz, ARI, NMI, gap statistic | Validating cluster solutions | | `preprocessing.md` | StandardScaler, encoders, ColumnTransformer, Pipeline construction | Preparing data for ML | | `classification.md` | LogisticRegression, RandomForest, GradientBoosting, SVC, KNeighbors | Classification tasks | | `regression-ml.md` | Ridge, Lasso, ElasticNet, tree/ensemble regressors, SVR | ML regression (prediction-focused) | | `evaluation-supervised.md` | Accuracy, F1, ROC-AUC, confusion matrix, cross_val_score, GridSearchCV | Evaluating supervised models | | `feature-selection.md` | SelectKBest, RFE, permutation_importance, VarianceThreshold | Selecting informative features | | `gotchas.md` | Data leakage, scaling errors, t-SNE misinterpretation, class imbalance | Avoiding common mistakes | | `interpretation.md` | SHAP values (TreeExplainer, KernelExplainer), permutation importance visualization, partial dependence plots, ICE plots | After training a model, when interpretation or explanation is needed | | `fairness.md` | fairlearn MetricFrame, ThresholdOptimizer, ExponentiatedGradient, demographic parity, equalized odds | Assessing or mitigating fairness of supervised models |
Reading Order
1. **New to scikit-learn?** Start with `quickstart.md` then the task-specific reference 2. **Clustering task?** Read `clustering.md`, then `evaluation-unsupervised.md` 3. **Classification task?** Read `classification.md`, then `evaluation-supervised.md` 4. **Need preprocessing?** Read `preprocessing.md` (covers Pipeline construction) 5. **Having issues?** Check `gotchas.md` first 6. **Interpretation task?** Read `interpretation.md`, then check `supervised-ml.md` in data-scientist skill for methodology 7. **Fairness assessment?** Read `fairness.md`, then check `supervised-ml.md` in data-scientist skill for conceptual framework
Related Skills
| Skill | Relationship | |-------|-------------| | `data-scientist` | Methodology guidance — load `exploratory-unsupervised.md` for "when and why" behind unsupervised methods | | `pyfixest` | Econometric regression: OLS with fixed effects, IV, DiD, clustered SEs, hypothesis testing | | `statsmodels` | Statistical modeling: OLS without FE, GLM, time series, diagnostic tests | | `polars` | Data preparation before ML (convert to pandas/numpy before passing to scikit-learn) | | `geopandas` | Spatial analysis — use geopandas for geographic data, not scikit-learn | | `plotnine` | Custom visualization beyond scikit-learn's built-in plotting | | `data-scientist` | Load `supervised-ml.md` for supervised ML methodology — the "when and why" behind pred
Read more
name: scikit-learn description: >- Machine learning: clustering, PCA/t-SNE/UMAP, classification, prediction regression (Ridge/Lasso/ensemble), cross-validation, Pipelines. For unsupervised analysis, classification, or prediction. For econometric regression use pyfixest/statsmodels. metadata: audience: research-coders domain: python-library library-version: "1.8.0" skill-last-updated: "2026-03-28"
scikit-learn Skill
General-purpose machine learning with scikit-learn. Covers unsupervised methods (clustering, GMM, PCA, t-SNE, UMAP, manifold learning, evaluation metrics), supervised methods (classification, prediction-focused regression via Ridge/Lasso/ensemble methods, model evaluation, cross-validation), and shared infrastructure (preprocessing, Pipeline construction, feature selection). Use when performing cluster analysis, dimension reduction, classification, prediction-focused regression, or model evaluation in Python. For econometric regression (OLS, FE, IV, DiD), see pyfixest and statsmodels skills instead.
Comprehensive skill for machine learning in Python with scikit-learn. Covers unsupervised methods (clustering, decomposition, manifold learning), supervised methods (classification, regression), and shared infrastructure (preprocessing, pipelines, evaluation). Use decision trees below to find the right guidance, then load detailed references.
What is scikit-learn?
scikit-learn is the standard **general-purpose machine learning library** for Python:
- **Consistent API**: Every estimator follows `fit()` / `predict()` / `transform()` — learn once, apply everywhere
- **Unsupervised methods**: Clustering (KMeans, DBSCAN, HDBSCAN, hierarchical), decomposition (PCA, NMF, SVD), mixture models (GMM), manifold learning (t-SNE)
- **Supervised methods**: Classification (logistic regression, random forest, gradient boosting, SVM) and prediction-focused regression (Ridge, Lasso, ensemble methods)
- **Model evaluation**: Cross-validation, grid search, metrics for both classification and clustering
- **Pipelines**: Chain preprocessing and models into reproducible, leak-free workflows
Version Notes
This skill targets **scikit-learn 1.8.0**. Notable changes in recent versions:
- HDBSCAN added as a first-class estimator (1.3+)
- `set_output(transform="pandas")` for DataFrame output from transformers (1.2+)
- HistGradientBoosting estimators are now stable (1.0+)
- `n_init="auto"` default for KMeans (1.4+) — uses 10 for `init="random"`, 1 for `init="k-means++"`
How to Use This Skill
Reference File Structure
Each topic in `./references/` contains focused documentation:
| File | Purpose | When to Read | |------|---------|--------------| | `quickstart.md` | Import patterns, fit/predict/transform API, Pipeline, train_test_split | First use of scikit-learn | | `clustering.md` | KMeans, AgglomerativeClustering, DBSCAN, HDBSCAN, SpectralClustering, OPTICS | Cluster analysis tasks | | `mixture-models.md` | GaussianMixture, BayesianGaussianMixture, BIC/AIC model selection | Model-based clustering, soft assignments | | `decomposition.md` | PCA, KernelPCA, TruncatedSVD, NMF, IncrementalPCA | Dimension reduction tasks | | `manifold.md` | t-SNE, UMAP (umap-learn), Isomap, LLE, MDS, SpectralEmbedding | Visualizing high-dimensional data | | `evaluation-unsupervised.md` | silhouette_score, Davies-Bouldin, Calinski-Harabasz, ARI, NMI, gap statistic | Validating cluster solutions | | `preprocessing.md` | StandardScaler, encoders, ColumnTransformer, Pipeline construction | Preparing data for ML | | `classification.md` | LogisticRegression, RandomForest, GradientBoosting, SVC, KNeighbors | Classification tasks | | `regression-ml.md` | Ridge, Lasso, ElasticNet, tree/ensemble regressors, SVR | ML regression (prediction-focused) | | `evaluation-supervised.md` | Accuracy, F1, ROC-AUC, confusion matrix, cross_val_score, GridSearchCV | Evaluating supervised models | | `feature-selection.md` | SelectKBest, RFE, permutation_importance, VarianceThreshold | Selecting informative features | | `gotchas.md` | Data leakage, scaling errors, t-SNE misinterpretation, class imbalance | Avoiding common mistakes | | `interpretation.md` | SHAP values (TreeExplainer, KernelExplainer), permutation importance visualization, partial dependence plots, ICE plots | After training a model, when interpretation or explanation is needed | | `fairness.md` | fairlearn MetricFrame, ThresholdOptimizer, ExponentiatedGradient, demographic parity, equalized odds | Assessing or mitigating fairness of supervised models |
Reading Order
1. **New to scikit-learn?** Start with `quickstart.md` then the task-specific reference 2. **Clustering task?** Read `clustering.md`, then `evaluation-unsupervised.md` 3. **Classification task?** Read `classification.md`, then `evaluation-supervised.md` 4. **Need preprocessing?** Read `preprocessing.md` (covers Pipeline construction) 5. **Having issues?** Check `gotchas.md` first 6. **Interpretation task?** Read `interpretation.md`, then check `supervised-ml.md` in data-scientist skill for methodology 7. **Fairness assessment?** Read `fairness.md`, then check `supervised-ml.md` in data-scientist skill for conceptual framework
Related Skills
| Skill | Relationship | |-------|-------------| | `data-scientist` | Methodology guidance — load `exploratory-unsupervised.md` for "when and why" behind unsupervised methods | | `pyfixest` | Econometric regression: OLS with fixed effects, IV, DiD, clustered SEs, hypothesis testing | | `statsmodels` | Statistical modeling: OLS without FE, GLM, time series, diagnostic tests | | `polars` | Data preparation before ML (convert to pandas/numpy before passing to scikit-learn) | | `geopandas` | Spatial analysis — use geopandas for geographic data, not scikit-learn | | `plotnine` | Custom visualization beyond scikit-learn's built-in plotting | | `data-scientist` | Load `supervised-ml.md` for supervised ML methodology — the "when and why" behind pred
📌 文档结构(2026-07-22 起): 本文件是中文默认入口 —— banner + badges + 信任面 + 9 阶段流水线速览 + 76 行合集总表。 每个合集的完整描述、按用途分组、精确数字、验证方法在 docs/CONTENT_ZH.md(扩展正文,总表行内的 → 直接跳转到对应锚点)。 English version: README-en.md · 中文扩展正文:docs/CONTENT_ZH.md · README-zh-CN.md 已弃用(重定向占位) 🌐 语言: English |
Other skills on auto-empirical-research-skills.
- /pipeline
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy + statsmodels + linearmodels + pyfixest + rdrobust + econml + causalml + matplotlib/seaborn. **Defaults to economics empirical-paper style** (AER / QJE / AEJ) —
Open skill - /pipeline
Classical end-to-end empirical analysis workflow in the modern tidyverse + econometrics R ecosystem — dplyr + tidyr + haven + fixest + sandwich + lmtest + clubSandwich + AER + ivreg + did + bacondecomp + HonestDiD + eventstudyr + rdrobust + rddensity + Synth + gsynth + synthdid
Open skill - /pipeline
Classical end-to-end empirical analysis workflow in the traditional Stata ecosystem — native Stata + reghdfe + ivreg2 + csdid + did_imputation + eventstudyinteract + sdid + rdrobust + rddensity + synth + synth_runner + psmatch2 + teffects + ebalance + coefplot + esttab + asdoc +
Open skill - /00-Full-empirical-analysis-skill_StatsPAI
Use when the user asks to run a full empirical / causal analysis in Python — by default in the style of an applied economics paper (AER / QJE / JPE / ReStud / AEJ) with DID / RD / IV / SCM / DML / matching, written-out estimating equation + identifying assumption, Table 1 /
Open skill - /00.1-Full-empirical-analysis-skill_Python
Classical end-to-end empirical analysis workflow in the traditional Python econometric stack — pandas + numpy + scipy + statsmodels + linearmodels + pyfixest + rdrobust + econml + causalml + matplotlib/seaborn. **Defaults to economics empirical-paper style** (AER / QJE / AEJ) —
Open skill - /00.2-Full-empirical-analysis-skill_Stata
Classical end-to-end empirical analysis workflow in the traditional Stata ecosystem — native Stata + reghdfe + ivreg2 + csdid + did_imputation + eventstudyinteract + sdid + rdrobust + rddensity + synth + synth_runner + psmatch2 + teffects + ebalance + coefplot + esttab + asdoc +
Open skill

