Skip to content
Automation
Skill

/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.

From plugin
auto-empirical-research-skills
4.9k200 skills

Claude Code

$ npx -y skills add brycewang-stanford/Auto-Empirical-Research-Skills --skill scikit-learn --agent claude-code

SKILL.md

scikit-learn.SKILL.md
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

Read more
@brycewang-stanford
Ships withauto-empirical-research-skills

## 🔥 力荐 · StatsPAI — Stata 与 R 的 Python 平替,为 AI Agent 而生 🔁 Stata / R 平替:reghdfe、csdid、rdrobust、synth、fixest、did 等常用命令在 Python 中一站式替代,一个 import statspai as sp 搞定 DID / RD / IV / SCM / DML / matching 🤖 面向 Agent 设计:结构化结果对象 + 内置 MCP Server,Claude / Codex

4.9k200 skills
Get the whole plugin

Stars on GitHub

Momentum

stars in total
4.9k
Star history of brycewang-stanford/Auto-Empirical-Research-Skills on GitHub, a chart by star-history.com

More skills from other plugins.

agent-builder

agent-builder

Load immediately after an Agent intent, before the first agent_builder_* call. Governs how you create, configure, test, and…

n8n11d209k
@n8n-io@n8n-ioInstall Skill
browser-use

browser-use

Direct browser control via CDP for web interaction: automation, scraping, testing, screenshots, and site/app work. Also covers…

@browser-use@browser-useInstall Skill
agent-browser

agent-browser

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…

@vercel-labs-2@vercel-labs-2Install Skill
add-anydoc

add-anydoc

Add local office-document-to-Markdown conversion to NanoClaw agent containers with the pinned Firecrawl AnyDoc CLI. Use when…

@nanocoai@nanocoaiInstall Skill

Questions about scikit-learn.

Which coding agents can use scikit-learn?
scikit-learn installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.