scikit-learn
Python machine learning library with classification, regression and clustering algorithms.
3. Used by agents' projects
Dependency in 135 public GitHub projects set up for AI coding agents that we scanned (2.2%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What scikit-learn does
scikit-learn keeps a deliberately narrow scope: one unified API for the basic machine learning tasks, tied together with pipelines and grid search, while deep learning, reinforcement learning and structured prediction are kept out by design.
scikit-learn popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How scikit-learn is used
- scikit-learn is a dependency in 135 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (8.3% of the 1,623 Python ones), #3 of 293 in ml and data science.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,348; those are left out of every share on this page.
- Projects that use it most often also use NumPy (86.7%), pandas (76.3%), Matplotlib (51.1%).
- It is more common in projects set up for OpenClaw (4.8%) than for Gemini CLI (1.1%).
By coding agent
Often used with
scikit-learn in practice
Strengths
The FAQ describes <code>ColumnTransformer</code> as a way to send column subsets, chosen by name or dtype, to their own transformers. It says this is often the first step of a pipeline when the input is a heterogeneous dataframe.
Estimators accept both <code>pandas.DataFrame</code> and <code>polars.DataFrame</code> as input. Transformers can return dataframes through the <code>set_output</code> API.
<code>HistGradientBoostingClassifier</code> and <code>HistGradientBoostingRegressor</code> can infer categorical columns from pandas or polars categorical dtypes. You turn this on with <code>categorical_features="from_dtype"</code>.
Since 2023, some estimators can run on GPUs through the experimental Array API support. This requires two things: the input is a PyTorch or CuPy array, and scikit-learn is configured to accept such inputs. The docs call the list "limited but growing".
Watch out for
The FAQ says these do not fit the library's design constraints. The simple multilayer perceptron in <code>sklearn.neural_network</code> only receives bug fixes. For more complex models, the docs point to tensorflow, keras and pytorch.
Most of the library works on single-dtype numeric arrays, which have no explicit representation for categorical variables. You must convert categorical columns to numbers before most estimators can use them.
Dataframe support is described as "limited". Most estimators convert dataframe input into NumPy arrays or SciPy sparse matrices for computation. Dataframe output is generated back from those structures.
Install with pip
pip install -U scikit-learnMore about scikit-learn
Funding
- Own page: https://numfocus.org/donate-to-scikit-learn
Agent Skills for it
- scikit-learn: Supports machine learning in Python with scikit-learn. Applies when working with supervised learning (classification, regression), unsupervi
- scikit-learn: Machine learning in Python with scikit-learn. Use when working with supervised learning (classification, regression), unsupervised learning
- scikit-learn: Machine learning in Python with scikit-learn. Use when working with supervised learning (classification, regression), unsupervised learning
- scikit-learn: Machine learning: clustering, PCA/t-SNE/UMAP, classification, prediction regression (Ridge/Lasso/ensemble), cross-validation, Pipelines. For
Packages around it
- numpy: Required array dependency
- pandas: DataFrame input and output
- python-dotenv: Environment config
- pydantic: Data validation
- scipy: Required dependency, sparse matrices
- fastapi: API serving
More in ML and data science
Alternatives
scikit-learn This page
Get started
Install it.
pip install scikit-learnRules for your agent
## scikit-learn
- Target Python 3.12 or newer, NumPy 1.26.0 or newer and SciPy 1.11.4 or newer. Add Matplotlib only if you call `plot_*` functions or `*Display` classes.
- Encode categorical features to numeric values before fitting most estimators. The exception is `HistGradientBoostingClassifier`/`HistGradientBoostingRegressor`, which accept `categorical_features="from_dtype"`.
- For heterogeneous dataframes, put a `ColumnTransformer` first in the pipeline and map columns by name or dtype to dedicated transformers.
- Use the `set_output` API to get dataframes back from transformers. Do not assume estimators compute on the dataframe directly.
- Do not put y transformations in a `Pipeline`. Use `TransformedTargetRegressor` for invertible target transforms.
- Do not build deep models on `sklearn.neural_network`, which only receives bug fixes. The docs point to tensorflow, keras or pytorch for those.
- Set the `SKLEARN_SEED` environment variable to control random number generation when running the test suite.