scikit-learn

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

scikit-learn is the standard library for classic machine learning in Python. Within the ML (Machine Learning) section it is the tool for tabular data and small to medium problems, where a well-tuned linear model, tree ensemble or kernel method often beats a neural network and is much cheaper to train. The full tour of the library, from installation and the estimator API to pipelines, validation and model persistence, lives in the Data Science scikit-learn sub-section. This sub-section does not repeat it: it adds the models and practices that are specific to machine learning and shows where scikit-learn hands over to deep-learning frameworks.

The names

The library is called scikit-learn, written with a hyphen and no capital letters apart from the start of a sentence. It is imported as sklearn and installed with pip as scikit-learn. People often write "Sci-kit learn" or "SciKit-Learn"; those spellings are not the project name. The "scikit" part comes from SciKits, add-on toolkits for SciPy, a family that also includes scikit-image. Search for scikit-learn, but write sklearn in import statements, and note that the old pip package name sklearn is not the library.

Version baseline

Item Value checked on 2026-10-30

scikit-learn

1.9.1. The development series is 1.10 and is labelled upcoming wherever it is mentioned.

Python

Examples on these pages were run on 2026-10-31 with Python 3.13, scikit-learn 1.9.1, NumPy 2.5.4, SciPy 1.18.1 (1.17.1 on the Gaussian processes page) and pandas 3.1.0, on CPU. Each page states the libraries it used and names any example that needs hardware or a service that was not available (such as a CUDA GPU) and was therefore not executed.

Related libraries

PyTorch 2.15.0 (CPU), Keras 3.15.1, skorch 1.4.0, skl2onnx 1.20.0, ONNX 1.23.2, ONNX Runtime 1.31.1, imbalanced-learn 0.14.2, XGBoost 3.4.1, LightGBM 4.7.0, CatBoost 1.2.10, Optuna 5.0.0 and optuna-integration 5.0.0, used on the pages that bridge to them.

Foundations from Data Science

The pages below belong to the Data Science section. They are the foundation for everything here, and the pages of this sub-section link to them instead of re-explaining them. Read the ones you do not know before the new pages.

New pages in this sub-section

Models beyond the data science pages

Page What it covers

Neural Networks: MLPClassifier & MLPRegressor

MLPClassifier and MLPRegressor, and their limits.

Kernel Ridge, Kernel Approximation & Nyström

Kernel ridge regression, kernel approximation and the Nystroem method.

Gaussian Processes

Gaussian process regression and classification, kernels and uncertainty.

Linear & Quadratic Discriminant Analysis

Linear and quadratic discriminant analysis.

Isotonic Regression

Isotonic regression and monotonic fits.

Semi-Supervised Learning

Self-training and label propagation with unlabelled data.

Multiclass, Multilabel & Multioutput Strategies

Multiclass, multilabel and multioutput strategies.

Covariance & Density Estimation

Covariance estimators and kernel density estimation.

PLS, CCA & Random Projection

PLS, CCA and random projection.

Practice at scale

Page What it covers

Imbalanced Data: class_weight, Thresholds & imbalanced-learn

class_weight, decision thresholds and imbalanced-learn.

HistGradientBoosting vs XGBoost, LightGBM & CatBoost

HistGradientBoosting compared with XGBoost, LightGBM and CatBoost.

Hyperparameter Tuning at Scale: Halving, Optuna & Parallelism

Successive halving, Optuna and parallelism.

Scaling Strategies & Out-of-Core Learning

Scaling strategies and out-of-core learning with partial_fit.

Building Custom Estimators & Transformers

Building custom estimators and transformers that follow the API.

Callbacks: Progress & Scoring Monitoring (experimental)

The experimental callbacks API for progress and scoring monitoring.

End-to-End ML Project

A complete project from data to a saved pipeline.

Bridges to other tools

Page What it covers

Exporting Pipelines to ONNX

Exporting fitted pipelines to ONNX with sklearn-onnx.

Using scikit-learn with PyTorch & Keras

Using scikit-learn with PyTorch and Keras through skorch and the Keras wrappers.

From scikit-learn to Deep Learning

When scikit-learn stops being enough and what to move to.

The general tour of the library (installation, the estimator API, pipelines, validation and model persistence) is the Data Science scikit-learn sub-section; this one covers only the machine-learning-specific models and practices. See Classic ML Algorithms at a Glance for the map of algorithm families, Tabular Data: Gradient Boosting vs Deep Learning and Choosing a Framework. Return to the ML (Machine Learning) landing page for the whole section.

Bibliography

All official links below were opened on 2026-10-30. The sources of the reused pages are in the Data Science scikit-learn bibliography, and books and general sources for the whole section are in the ML bibliography.

scikit-learn sources

Sources cited by individual pages

The official sources below are cited in the References section of one page each; a source shared by several pages is listed once, under the first page that cites it.

Where older books are outdated

Books and tutorials written for scikit-learn 0.x or early 1.x still circulate, and much of their code no longer runs. The table maps the usual old idioms to what scikit-learn 1.9.1 provides; every name in the right-hand column was checked on 1.9.1.

Old code Status Current replacement

sklearn.cross_validation (train_test_split, cross_val_score, KFold)

Deprecated in 0.18, removed in 0.20

sklearn.model_selection, same function and class names. See Cross-Validation.

sklearn.grid_search (GridSearchCV, RandomizedSearchCV)

Deprecated in 0.18, removed in 0.20

sklearn.model_selection.GridSearchCV and RandomizedSearchCV. See Hyperparameter Search.

sklearn.lda.LDA

Removed in 0.19

sklearn.discriminant_analysis.LinearDiscriminantAnalysis. See Discriminant Analysis.

sklearn.preprocessing.Imputer

Deprecated in 0.20, removed in 0.22

sklearn.impute.SimpleImputer (no axis argument; it always imputes per column). See Imputation.

OneHotEncoder(categorical_features=[...])

Deprecated in 0.20, removed in 0.22

OneHotEncoder on the categorical columns only, selected with sklearn.compose.ColumnTransformer; sparse= is now sparse_output=. See Categorical Encoding.

sklearn.datasets.fetch_mldata

Removed in 0.22 (mldata.org is gone)

sklearn.datasets.fetch_openml. See Datasets.

sklearn.datasets.load_boston

Removed in 1.2 for an ethical problem in the data; importing it raises ImportError with an explanation

fetch_california_housing, or the Ames housing data through fetch_openml(name="house_prices", as_frame=True).

LogisticRegression(multi_class="ovr") or multi_class="multinomial"

Deprecated in 1.5, removed in 1.8

Plain LogisticRegression(), which is multinomial for more than two classes; wrap it in sklearn.multiclass.OneVsRestClassifier for one-vs-rest. See Multiclass & Multioutput.

np.infty (also np.Inf, np.NaN) in parameter grids and thresholds

Removed in NumPy 2.0

np.inf and np.nan.

pickle.dump / pickle.load of a model, often shown with no warning

Still works, but loading a pickle (or a joblib file) can execute arbitrary code, and a model only loads reliably with the same scikit-learn version

joblib.dump / joblib.load for files you created yourself; skops.io (which lists untrusted types with get_untrusted_types before loading) for files from elsewhere; ONNX through skl2onnx for serving without scikit-learn. Only load pickle or joblib files from a source you trust. See Model Persistence and Exporting to ONNX.

SVC(probability=True)

Deprecated in 1.9, removal planned for 1.11; 1.9.1 emits a FutureWarning

CalibratedClassifierCV(SVC(), ensemble=False) from sklearn.calibration, or a model with native probabilities such as LogisticRegression. See Calibration.