Skip to content
LearnPY

ML API atlas / 211 entries / 16 categories

The machine-learning map.

Search the APIs that carry a project from first split to saved pipeline. Filter by workflow stage or library, then read the signature before you reach for autocomplete.

211 APIs

211 APIs

Foundations

10 APIs

Splitting, validation, and the small helpers every workflow touches.

train_test_split

function
train_test_split(*arrays, test_size=None, train_size=None, random_state=None, stratify=None, shuffle=True)

Split arrays into reproducible training and test subsets.

scikit-learnsplitvalidationbaseline

cross_val_score

function
cross_val_score(estimator, X, y=None, *, groups=None, cv=None, scoring=None, n_jobs=None)

Return one score per cross-validation fold for an estimator.

scikit-learnvalidationcvscore

cross_validate

function
cross_validate(estimator, X, y=None, *, groups=None, scoring=None, cv=None, return_train_score=False, n_jobs=None)

Run cross-validation and return fit, score, and timing details.

scikit-learnvalidationcvtiming

KFold

utility
KFold(n_splits=5, *, shuffle=False, random_state=None)

Yield train and test indices for k contiguous folds.

scikit-learncvindices

StratifiedKFold

utility
StratifiedKFold(n_splits=5, *, shuffle=False, random_state=None)

Keep class proportions in every fold of a classification split.

scikit-learncvclassificationimbalance

GroupKFold

utility
GroupKFold(n_splits=5)

Keep rows from the same group inside a single fold.

scikit-learncvgroupsleakage

ShuffleSplit

utility
ShuffleSplit(n_splits=10, *, test_size=None, train_size=None, random_state=None)

Draw repeated random train and test index sets.

scikit-learncvrandomindices

learning_curve

function
learning_curve(estimator, X, y, *, train_sizes=..., cv=None, scoring=None, n_jobs=None)

Measure training and validation scores as the training set grows.

scikit-learndiagnosticsbiasvariance

validation_curve

function
validation_curve(estimator, X, y, *, param_name, param_range, cv=None, scoring=None)

Sweep one hyperparameter and report training versus validation score.

scikit-learndiagnosticshyperparameter

check_cv

function
check_cv(cv=5, y=None, *, classifier=False)

Normalize an integer, splitter, or iterable into a CV splitter.

scikit-learncvutilities

Preprocessing

24 APIs

Scaling, encoding, imputing, and turning raw columns into model input.

StandardScaler

estimator
StandardScaler(*, with_mean=True, with_std=True)

Center features and scale them to unit variance.

scikit-learnscalingz-score

MinMaxScaler

estimator
MinMaxScaler(feature_range=(0, 1), *, copy=True, clip=False)

Scale each feature into a fixed range such as zero to one.

scikit-learnscalingbounded

RobustScaler

estimator
RobustScaler(*, with_centering=True, with_scaling=True, quantile_range=(25.0, 75.0))

Scale with median and interquartile range so outliers matter less.

scikit-learnscalingoutliers

MaxAbsScaler

estimator
MaxAbsScaler(*, copy=True)

Scale by the largest absolute value, preserving sparse zeros.

scikit-learnscalingsparse

Normalizer

estimator
Normalizer(norm='l2', *, copy=True)

Scale each row to unit norm for distance-based models.

scikit-learnscalingrowstext

OneHotEncoder

estimator
OneHotEncoder(*, categories='auto', drop=None, sparse_output=True, handle_unknown='error')

Turn categorical values into indicator columns.

scikit-learnencodingcategorical

OrdinalEncoder

estimator
OrdinalEncoder(*, categories='auto', handle_unknown='error', unknown_value=None)

Map categories to integer codes, optionally in a chosen order.

scikit-learnencodingcategoricaltrees

LabelEncoder

estimator
LabelEncoder()

Encode target labels as integers from zero to n_classes minus one.

scikit-learnencodingtarget

TargetEncoder

estimator
TargetEncoder(categories='auto', target_type='auto', smooth='auto', cv=5, random_state=None)

Replace categories with smoothed, cross-fitted target averages.

scikit-learnencodingcategoricalleakage

KBinsDiscretizer

estimator
KBinsDiscretizer(n_bins=5, *, encode='onehot', strategy='quantile', subsample=None)

Bucket continuous features into ordered bins.

scikit-learnbinningdiscretization

SimpleImputer

estimator
SimpleImputer(*, missing_values=nan, strategy='mean', fill_value=None, add_indicator=False)

Fill missing values with a mean, median, mode, or constant.

scikit-learnmissingimputation

KNNImputer

estimator
KNNImputer(*, missing_values=nan, n_neighbors=5, weights='uniform', metric='nan_euclidean')

Fill missing values from the nearest complete rows.

scikit-learnmissingimputationneighbors

IterativeImputer

estimator
IterativeImputer(*, estimator=None, max_iter=10, random_state=None, add_indicator=False)

Model each feature with missing values as a function of the others.

scikit-learnmissingimputationexperimental

MissingIndicator

estimator
MissingIndicator(*, missing_values=nan, features='missing-only', sparse='auto', error_on_new=True)

Add boolean columns that record where values were missing.

scikit-learnmissingfeatures

PolynomialFeatures

estimator
PolynomialFeatures(degree=2, *, interaction_only=False, include_bias=True)

Create interaction and power terms from numeric columns.

scikit-learnfeaturesinteractionsnonlinear

SplineTransformer

estimator
SplineTransformer(n_knots=5, degree=3, *, knots='uniform', extrapolation='constant')

Expand each feature into a smooth spline basis.

scikit-learnfeaturesnonlinearsplines

FunctionTransformer

estimator
FunctionTransformer(func=None, inverse_func=None, *, validate=False, accept_sparse=False)

Wrap a plain function so it can live inside a pipeline.

scikit-learnfeaturespipelinecustom

Binarizer

estimator
Binarizer(*, threshold=0.0, copy=True)

Threshold features into zero or one.

scikit-learnbinningfeatures

MultiLabelBinarizer

estimator
MultiLabelBinarizer(*, classes=None, sparse_output=False)

Encode lists of labels as a binary indicator matrix.

scikit-learnencodingmultilabel

ColumnTransformer

estimator
ColumnTransformer(transformers, *, remainder='drop', sparse_threshold=0.3, verbose_feature_names_out=True)

Apply different preprocessing steps to selected column groups.

scikit-learnpipelinecolumnsmixed-types

FeatureUnion

estimator
FeatureUnion(transformer_list, *, n_jobs=None, transformer_weights=None, verbose=False)

Concatenate the outputs of several feature transformers.

scikit-learnpipelinefeatures

make_column_transformer

function
make_column_transformer(*transformers, remainder='drop', sparse_threshold=0.3, verbose_feature_names_out=True)

Build a ColumnTransformer with terser positional syntax.

scikit-learnpipelinecolumns

make_column_selector

function
make_column_selector(pattern=None, *, dtype_include=None, dtype_exclude=None)

Select DataFrame columns by name pattern or dtype.

scikit-learncolumnspandaspipeline

add_dummy_feature

function
add_dummy_feature(X, value=1.0)

Prepend a constant column for an explicit intercept term.

scikit-learnfeaturesintercept

Feature selection

16 APIs

Keep the signal and drop the noise before a model learns from it.

VarianceThreshold

estimator
VarianceThreshold(threshold=0.0)

Drop features whose variance is below a threshold.

scikit-learnfeature-selectionunsupervised

SelectKBest

estimator
SelectKBest(score_func=f_classif, *, k=10)

Keep the k highest-scoring features from a univariate test.

scikit-learnfeature-selectionfilter

SelectPercentile

estimator
SelectPercentile(score_func=f_classif, *, percentile=10)

Keep a percentile of features ranked by a univariate score.

scikit-learnfeature-selectionfilter

SelectFpr

estimator
SelectFpr(score_func=f_classif, *, alpha=0.05)

Keep features whose false positive rate is below alpha.

scikit-learnfeature-selectionstatistical

SelectFdr

estimator
SelectFdr(score_func=f_classif, *, alpha=0.05)

Control the expected false discovery rate among selected features.

scikit-learnfeature-selectionstatistical

SelectFwe

estimator
SelectFwe(score_func=f_classif, *, alpha=0.05)

Control the family-wise error rate of feature tests.

scikit-learnfeature-selectionstatistical

GenericUnivariateSelect

estimator
GenericUnivariateSelect(score_func=f_classif, *, mode='percentile', param=1e-5)

Configure a univariate selector by mode and parameter.

scikit-learnfeature-selectionfilter

RFE

estimator
RFE(estimator, n_features_to_select=None, *, step=1, importance_getter='auto')

Recursively remove the least important features.

scikit-learnfeature-selectionwrapper

RFECV

estimator
RFECV(estimator, *, step=1, min_features_to_select=1, cv=None, scoring=None)

Choose the number of features by cross-validated recursive elimination.

scikit-learnfeature-selectionwrappercv

SelectFromModel

estimator
SelectFromModel(estimator, *, threshold=None, prefit=False, max_features=None)

Keep features whose importance exceeds a threshold.

scikit-learnfeature-selectionembedded

SequentialFeatureSelector

estimator
SequentialFeatureSelector(estimator, *, n_features_to_select='auto', direction='forward', cv=5)

Greedily add or remove features while scoring the model.

scikit-learnfeature-selectionwrapper

chi2

function
chi2(X, y)

Score nonnegative features with a chi-squared test.

scikit-learnfeature-selectiontextcounts

f_classif

function
f_classif(X, y)

ANOVA F-score for features against class labels.

scikit-learnfeature-selectionclassification

f_regression

function
f_regression(X, y, *, center=True, force_finite=True)

Univariate linear F-score between features and a numeric target.

scikit-learnfeature-selectionregression

mutual_info_classif

function
mutual_info_classif(X, y, *, discrete_features='auto', n_neighbors=3)

Estimate nonlinear dependency between features and classes.

scikit-learnfeature-selectionnonlinearinformation

mutual_info_regression

function
mutual_info_regression(X, y, *, discrete_features='auto', n_neighbors=3)

Estimate nonlinear dependency between features and a target.

scikit-learnfeature-selectionnonlinearinformation

Linear models

29 APIs

Regression and classification where predictions are linear in the inputs.

LinearRegression

estimator
LinearRegression(*, fit_intercept=True, copy_X=True, n_jobs=None, positive=False)

Fit ordinary least squares regression with optional nonnegative coefficients.

scikit-learnregressionbaseline

Ridge

estimator
Ridge(alpha=1.0, *, fit_intercept=True, solver='auto', positive=False)

Least squares regression with an L2 penalty on coefficients.

scikit-learnregressionregularizationl2

RidgeCV

estimator
RidgeCV(alphas=(0.1, 1.0, 10.0), *, cv=None, scoring=None)

Choose the Ridge alpha by cross-validation in one fit.

scikit-learnregressionregularizationcv

Lasso

estimator
Lasso(alpha=1.0, *, fit_intercept=True, max_iter=1000, positive=False)

Linear regression with an L1 penalty that can zero coefficients.

scikit-learnregressionregularizationl1

LassoCV

estimator
LassoCV(*, eps=1e-3, n_alphas=100, alphas=None, cv=None, random_state=None)

Search the Lasso regularization path with cross-validation.

scikit-learnregressionregularizationcv

ElasticNet

estimator
ElasticNet(alpha=1.0, *, l1_ratio=0.5, fit_intercept=True, positive=False)

Combine L1 and L2 penalties with a tunable mixing ratio.

scikit-learnregressionregularizationl1

ElasticNetCV

estimator
ElasticNetCV(*, l1_ratio=0.5, alphas=None, cv=None, random_state=None)

Tune ElasticNet alpha and mixing ratio by cross-validation.

scikit-learnregressionregularizationcv

Lars

estimator
Lars(*, fit_intercept=True, n_nonzero_coefs=500, precompute='auto')

Follow the least-angle regression path for sparse coefficients.

scikit-learnregressionpath

LassoLars

estimator
LassoLars(alpha=1.0, *, fit_intercept=True, precompute='auto')

Solve Lasso with the least-angle regression algorithm.

scikit-learnregressionl1path

BayesianRidge

estimator
BayesianRidge(*, n_iter=300, alpha_1=1e-6, lambda_1=1e-6)

Fit a Bayesian linear model and expose predictive uncertainty.

scikit-learnregressionbayesianuncertainty

ARDRegression

estimator
ARDRegression(*, n_iter=300, alpha_1=1e-6, lambda_1=1e-6)

Sparse Bayesian regression with automatic relevance determination.

scikit-learnregressionbayesiansparse

HuberRegressor

estimator
HuberRegressor(*, epsilon=1.35, alpha=0.0001, max_iter=100)

Robust linear regression that limits the influence of outliers.

scikit-learnregressionrobustoutliers

RANSACRegressor

estimator
RANSACRegressor(estimator=None, *, min_samples=None, residual_threshold=None)

Fit a model repeatedly on random inlier samples.

scikit-learnregressionrobustoutliers

TheilSenRegressor

estimator
TheilSenRegressor(*, fit_intercept=True, max_subpopulation=10000)

Median-of-slopes regression with high breakdown against outliers.

scikit-learnregressionrobust

SGDRegressor

estimator
SGDRegressor(loss='squared_error', *, penalty='l2', alpha=0.0001, learning_rate='invscaling')

Train a linear regressor with stochastic gradient descent.

scikit-learnregressiononlinesgd

PoissonRegressor

estimator
PoissonRegressor(*, alpha=1.0, fit_intercept=True, max_iter=100)

Generalized linear model for nonnegative count targets.

scikit-learnregressioncountsglm

GammaRegressor

estimator
GammaRegressor(*, alpha=1.0, fit_intercept=True, max_iter=100)

Generalized linear model for positive continuous targets.

scikit-learnregressionglm

TweedieRegressor

estimator
TweedieRegressor(*, power=0, alpha=1.0, link='auto', max_iter=100)

Fit a GLM across normal, Poisson, gamma, and Tweedie targets.

scikit-learnregressionglm

QuantileRegressor

estimator
QuantileRegressor(*, quantile=0.5, alpha=1.0, solver='highs')

Predict a conditional quantile instead of the mean.

scikit-learnregressionquantilerobust

LogisticRegression

estimator
LogisticRegression(penalty='l2', *, C=1.0, solver='lbfgs', max_iter=100, class_weight=None)

Fit a linear classifier with a logistic loss.

scikit-learnclassificationlinearprobability

LogisticRegressionCV

estimator
LogisticRegressionCV(*, Cs=10, cv=None, penalty='l2', scoring=None, max_iter=100)

Choose the inverse regularization strength by cross-validation.

scikit-learnclassificationlinearcv

RidgeClassifier

estimator
RidgeClassifier(alpha=1.0, *, fit_intercept=True, class_weight=None)

Classify with a ridge regression objective on class labels.

scikit-learnclassificationlinearfast

SGDClassifier

estimator
SGDClassifier(loss='hinge', *, penalty='l2', alpha=0.0001, max_iter=1000)

Train a linear classifier with stochastic gradient descent.

scikit-learnclassificationonlinesgd

Perceptron

estimator
Perceptron(*, penalty=None, alpha=0.0001, max_iter=1000, eta0=1.0)

Fit the classic mistake-driven linear threshold classifier.

scikit-learnclassificationlinearbaseline

PassiveAggressiveClassifier

estimator
PassiveAggressiveClassifier(*, C=1.0, max_iter=1000, average=False)

Update linear weights only when a margin mistake occurs.

scikit-learnclassificationonline

LinearSVC

estimator
LinearSVC(penalty='l2', *, C=1.0, loss='squared_hinge', multi_class='ovr')

Fast linear support vector classifier for large sparse data.

scikit-learnclassificationlinearsvm

LinearSVR

estimator
LinearSVR(*, epsilon=0.0, C=1.0, loss='epsilon_insensitive', max_iter=1000)

Linear support vector regression with an epsilon-insensitive loss.

scikit-learnregressionlinearsvm

LinearDiscriminantAnalysis

estimator
LinearDiscriminantAnalysis(*, solver='svd', shrinkage=None, priors=None)

Gaussian classifier that assumes a shared covariance per class.

scikit-learnclassificationgenerativeprojection

QuadraticDiscriminantAnalysis

estimator
QuadraticDiscriminantAnalysis(*, priors=None, reg_param=0.0)

Gaussian classifier with a separate covariance for each class.

scikit-learnclassificationgenerativequadratic

Tree models

10 APIs

Single decision trees for rules, splits, and feature insight.

DecisionTreeClassifier

estimator
DecisionTreeClassifier(*, criterion='gini', max_depth=None, min_samples_leaf=1, random_state=None)

Learn a tree of axis-aligned splits for classification.

scikit-learnclassificationtreeinterpretable

DecisionTreeRegressor

estimator
DecisionTreeRegressor(*, criterion='squared_error', max_depth=None, min_samples_leaf=1, random_state=None)

Learn a tree of splits that predicts a numeric target.

scikit-learnregressiontreeinterpretable

ExtraTreeClassifier

estimator
ExtraTreeClassifier(*, criterion='gini', max_depth=None, splitter='random')

A single extremely randomized tree, mostly used inside ensembles.

scikit-learnclassificationtreerandom

ExtraTreeRegressor

estimator
ExtraTreeRegressor(*, criterion='squared_error', max_depth=None, splitter='random')

A single extremely randomized regression tree.

scikit-learnregressiontreerandom

export_text

function
export_text(decision_tree, *, feature_names=None, max_depth=10, decimals=2)

Render a fitted tree as a readable text rule list.

scikit-learntreevisualizationrules

export_graphviz

function
export_graphviz(decision_tree, out_file=None, *, feature_names=None, class_names=None)

Export a tree in Graphviz DOT format.

scikit-learntreevisualization

plot_tree

function
plot_tree(decision_tree, *, max_depth=None, feature_names=None, class_names=None)

Draw a fitted tree with Matplotlib.

scikit-learntreevisualizationmatplotlib

apply

function
apply(X, check_input=True)

Return the index of the leaf each sample lands in.

scikit-learntreeleavesfeatures

decision_path

function
decision_path(X, check_input=True)

Return the sparse indicator matrix of nodes each sample visits.

scikit-learntreeexplainability

cost_complexity_pruning_path

function
cost_complexity_pruning_path(X, y, sample_weight=None)

List alphas and impurities for pruning a fitted tree.

scikit-learntreepruningregularization

Ensembles

17 APIs

Random forests, gradient boosting, and voting across many estimators.

RandomForestClassifier

estimator
RandomForestClassifier(n_estimators=100, *, max_depth=None, max_features='sqrt', class_weight=None, n_jobs=None)

Average many decorrelated decision trees for classification.

scikit-learnclassificationbaggingstrong-baseline

RandomForestRegressor

estimator
RandomForestRegressor(n_estimators=100, *, max_depth=None, max_features=1.0, n_jobs=None)

Average many decorrelated decision trees for regression.

scikit-learnregressionbaggingstrong-baseline

ExtraTreesClassifier

estimator
ExtraTreesClassifier(n_estimators=100, *, max_depth=None, max_features='sqrt')

Random forest variant that randomizes split thresholds too.

scikit-learnclassificationbaggingfast

ExtraTreesRegressor

estimator
ExtraTreesRegressor(n_estimators=100, *, max_depth=None, max_features=1.0)

Extremely randomized trees for regression.

scikit-learnregressionbaggingfast

GradientBoostingClassifier

estimator
GradientBoostingClassifier(*, loss='log_loss', learning_rate=0.1, n_estimators=100, max_depth=3)

Fit shallow trees sequentially to reduce the loss.

scikit-learnclassificationboosting

GradientBoostingRegressor

estimator
GradientBoostingRegressor(*, loss='squared_error', learning_rate=0.1, n_estimators=100, max_depth=3)

Fit sequential trees to the negative gradient of a regression loss.

scikit-learnregressionboosting

HistGradientBoostingClassifier

estimator
HistGradientBoostingClassifier(*, learning_rate=0.1, max_iter=100, max_leaf_nodes=31, early_stopping='auto')

Fast histogram-based gradient boosting for larger datasets.

scikit-learnclassificationboostinghistogram

HistGradientBoostingRegressor

estimator
HistGradientBoostingRegressor(*, loss='squared_error', learning_rate=0.1, max_iter=100, early_stopping='auto')

Histogram-based gradient boosting for regression.

scikit-learnregressionboostinghistogram

AdaBoostClassifier

estimator
AdaBoostClassifier(estimator=None, *, n_estimators=50, learning_rate=1.0)

Reweight misclassified rows to build a boosted classifier.

scikit-learnclassificationboosting

AdaBoostRegressor

estimator
AdaBoostRegressor(estimator=None, *, n_estimators=50, learning_rate=1.0, loss='linear')

Boost weak regressors by focusing on large residuals.

scikit-learnregressionboosting

BaggingClassifier

estimator
BaggingClassifier(estimator=None, n_estimators=10, *, max_samples=1.0, max_features=1.0)

Train one base estimator per bootstrap sample and vote.

scikit-learnclassificationbagging

BaggingRegressor

estimator
BaggingRegressor(estimator=None, n_estimators=10, *, max_samples=1.0, max_features=1.0)

Train one base regressor per bootstrap sample and average.

scikit-learnregressionbagging

VotingClassifier

estimator
VotingClassifier(estimators, *, voting='hard', weights=None, n_jobs=None)

Combine different classifiers with hard or soft voting.

scikit-learnclassificationstacking

VotingRegressor

estimator
VotingRegressor(estimators, *, weights=None, n_jobs=None)

Average predictions from several heterogeneous regressors.

scikit-learnregressionstacking

StackingClassifier

estimator
StackingClassifier(estimators, *, final_estimator=None, cv=None, stack_method='auto')

Feed out-of-fold base predictions into a final classifier.

scikit-learnclassificationstackingmeta-model

StackingRegressor

estimator
StackingRegressor(estimators, *, final_estimator=None, cv=None)

Feed out-of-fold base predictions into a final regressor.

scikit-learnregressionstackingmeta-model

RandomTreesEmbedding

estimator
RandomTreesEmbedding(n_estimators=10, *, max_depth=5, sparse_output=True)

Encode rows by the leaves they reach in a random forest.

scikit-learnfeaturesembeddingunsupervised

Neighbors and SVMs

10 APIs

Instance-based learning and margin-based classifiers for small datasets.

KNeighborsClassifier

estimator
KNeighborsClassifier(n_neighbors=5, *, weights='uniform', metric='minkowski', p=2)

Classify a row by the votes of its nearest training neighbors.

scikit-learnclassificationneighborsinstance-based

KNeighborsRegressor

estimator
KNeighborsRegressor(n_neighbors=5, *, weights='uniform', metric='minkowski', p=2)

Predict the average target of the nearest training rows.

scikit-learnregressionneighborsinstance-based

RadiusNeighborsClassifier

estimator
RadiusNeighborsClassifier(*, radius=1.0, weights='uniform', outlier_label=None)

Classify using neighbors inside a fixed radius.

scikit-learnclassificationneighborssparse

RadiusNeighborsRegressor

estimator
RadiusNeighborsRegressor(*, radius=1.0, weights='uniform', metric='minkowski')

Average targets inside a fixed-radius neighborhood.

scikit-learnregressionneighborssparse

NearestNeighbors

estimator
NearestNeighbors(*, n_neighbors=5, radius=1.0, algorithm='auto', metric='minkowski')

Find nearest rows without attaching a prediction target.

scikit-learnneighborsretrievalunsupervised

kneighbors_graph

function
kneighbors_graph(X, n_neighbors, *, mode='connectivity', metric='minkowski', include_self=False)

Build a sparse graph connecting each row to its neighbors.

scikit-learnneighborsgraphmanifold

SVC

estimator
SVC(*, C=1.0, kernel='rbf', degree=3, gamma='scale', class_weight=None, probability=False)

Support vector classifier with nonlinear kernels and margins.

scikit-learnclassificationsvmkernel

SVR

estimator
SVR(*, kernel='rbf', degree=3, gamma='scale', C=1.0, epsilon=0.1)

Support vector regression that ignores small residuals.

scikit-learnregressionsvmkernel

NuSVC

estimator
NuSVC(*, nu=0.5, kernel='rbf', degree=3, gamma='scale')

SVC variant parameterized by an upper bound on margin errors.

scikit-learnclassificationsvmnu

NuSVR

estimator
NuSVR(*, nu=0.5, C=1.0, kernel='rbf', gamma='scale')

SVR variant that controls the fraction of support vectors.

scikit-learnregressionsvmnu

Naive Bayes

5 APIs

Fast probabilistic baselines for text and tabular counts.

GaussianNB

estimator
GaussianNB(*, priors=None, var_smoothing=1e-9)

Naive Bayes for continuous features that look roughly Gaussian.

scikit-learnclassificationbayesbaseline

MultinomialNB

estimator
MultinomialNB(*, alpha=1.0, force_alpha=True, fit_prior=True)

Naive Bayes for nonnegative counts such as word frequencies.

scikit-learnclassificationbayestext

BernoulliNB

estimator
BernoulliNB(*, alpha=1.0, binarize=0.0, fit_prior=True)

Naive Bayes over boolean or binarized features.

scikit-learnclassificationbayestext

ComplementNB

estimator
ComplementNB(*, alpha=1.0, norm=False, fit_prior=True)

Naive Bayes variant designed for imbalanced text classes.

scikit-learnclassificationbayesimbalance

CategoricalNB

estimator
CategoricalNB(*, alpha=1.0, min_categories=None, fit_prior=True)

Naive Bayes for features that are already category codes.

scikit-learnclassificationbayescategorical

Clustering

17 APIs

Group unlabeled rows, find density, and score the result.

KMeans

estimator
KMeans(n_clusters=8, *, init='k-means++', n_init='auto', max_iter=300, random_state=None)

Partition rows into k clusters by minimizing within-cluster distance.

scikit-learnclusteringcentroids

MiniBatchKMeans

estimator
MiniBatchKMeans(n_clusters=8, *, batch_size=1024, n_init='auto', max_iter=100)

Faster approximate k-means using batches of rows.

scikit-learnclusteringlarge-data

DBSCAN

estimator
DBSCAN(eps=0.5, *, min_samples=5, metric='euclidean')

Find dense regions and label low-density rows as noise.

scikit-learnclusteringdensitynoise

OPTICS

estimator
OPTICS(*, min_samples=5, max_eps=inf, metric='minkowski', cluster_method='xi')

Order points by reachability distance to find variable-density clusters.

scikit-learnclusteringdensity

HDBSCAN

estimator
HDBSCAN(*, min_cluster_size=5, min_samples=None, cluster_selection_epsilon=0.0)

Hierarchical density clustering with automatic cluster counts.

scikit-learnclusteringdensitynoise

AgglomerativeClustering

estimator
AgglomerativeClustering(n_clusters=2, *, linkage='ward', metric='euclidean')

Merge rows bottom-up into a hierarchy of clusters.

scikit-learnclusteringhierarchical

Birch

estimator
Birch(*, threshold=0.5, branching_factor=50, n_clusters=3)

Build a compact clustering feature tree for large datasets.

scikit-learnclusteringlarge-data

SpectralClustering

estimator
SpectralClustering(n_clusters=8, *, affinity='rbf', assign_labels='kmeans')

Cluster with eigenvectors of a similarity graph.

scikit-learnclusteringgraphnonlinear

AffinityPropagation

estimator
AffinityPropagation(*, damping=0.5, max_iter=200, random_state=None)

Choose exemplars by passing messages between rows.

scikit-learnclusteringexemplars

MeanShift

estimator
MeanShift(*, bandwidth=None, bin_seeding=False, cluster_all=True)

Find modes of a density estimate without a cluster count.

scikit-learnclusteringdensity

silhouette_score

function
silhouette_score(X, labels, *, metric='euclidean', sample_size=None, random_state=None)

Measure how much closer rows are to their own cluster than the next.

scikit-learnclusteringscore

silhouette_samples

function
silhouette_samples(X, labels, *, metric='euclidean')

Return one silhouette value per row.

scikit-learnclusteringdiagnostics

calinski_harabasz_score

function
calinski_harabasz_score(X, labels)

Ratio of between-cluster to within-cluster dispersion.

scikit-learnclusteringscore

davies_bouldin_score

function
davies_bouldin_score(X, labels)

Average similarity between each cluster and its most similar cluster.

scikit-learnclusteringscore

adjusted_rand_score

function
adjusted_rand_score(labels_true, labels_pred)

Chance-adjusted agreement between two labelings.

scikit-learnclusteringexternal-score

normalized_mutual_info_score

function
normalized_mutual_info_score(labels_true, labels_pred, *, average_method='arithmetic')

Shared information between two labelings, normalized to one.

scikit-learnclusteringexternal-score

homogeneity_completeness_v_measure

function
homogeneity_completeness_v_measure(labels_true, labels_pred, *, beta=1.0)

Return homogeneity, completeness, and their harmonic mean together.

scikit-learnclusteringexternal-score

Decomposition

11 APIs

Compress features, denoise, and inspect structure with matrix methods.

PCA

estimator
PCA(n_components=None, *, whiten=False, svd_solver='auto', random_state=None)

Project features onto the directions of greatest variance.

scikit-learndecompositionlineardimensionality-reduction

IncrementalPCA

estimator
IncrementalPCA(n_components=None, *, batch_size=None, whiten=False)

Fit PCA in batches for data that does not fit in memory.

scikit-learndecompositionlarge-data

KernelPCA

estimator
KernelPCA(n_components=None, *, kernel='linear', gamma=None, eigen_solver='auto')

Nonlinear dimensionality reduction with a kernel.

scikit-learndecompositionkernelnonlinear

TruncatedSVD

estimator
TruncatedSVD(n_components=2, *, algorithm='randomized', n_iter=5, random_state=None)

Reduce sparse matrices without centering them.

scikit-learndecompositionsparsetext

NMF

estimator
NMF(n_components=None, *, init='nndsvda', solver='cd', max_iter=200)

Factor a nonnegative matrix into nonnegative parts.

scikit-learndecompositionnonnegativetopics

LatentDirichletAllocation

estimator
LatentDirichletAllocation(n_components=10, *, learning_method='batch', max_iter=10)

Model documents as mixtures of latent topics.

scikit-learndecompositiontopicstext

FactorAnalysis

estimator
FactorAnalysis(n_components=None, *, tol=0.01, max_iter=1000, rotation=None)

Explain correlated features with a smaller set of latent factors.

scikit-learndecompositionlatent

FastICA

estimator
FastICA(n_components=None, *, algorithm='parallel', whiten='unit-variance', random_state=None)

Separate independent signals from mixed observations.

scikit-learndecompositionicablind-source

DictionaryLearning

estimator
DictionaryLearning(n_components=None, *, alpha=1.0, max_iter=1000, random_state=None)

Learn a sparse dictionary that reconstructs the rows.

scikit-learndecompositionsparse

SparsePCA

estimator
SparsePCA(n_components=None, *, alpha=1.0, max_iter=1000, random_state=None)

Find sparse components that are easier to interpret.

scikit-learndecompositionsparseinterpretable

randomized_svd

function
randomized_svd(M, n_components, *, n_oversamples=10, n_iter='auto', random_state=None)

Compute a fast approximate truncated SVD.

scikit-learndecompositionsvdlarge-data

Neural networks

3 APIs

Small multilayer perceptrons and the knobs that keep them stable.

MLPClassifier

estimator
MLPClassifier(hidden_layer_sizes=(100,), *, activation='relu', solver='adam', alpha=0.0001, max_iter=200)

Train a feed-forward neural network for classification.

scikit-learnclassificationneural-network

MLPRegressor

estimator
MLPRegressor(hidden_layer_sizes=(100,), *, activation='relu', solver='adam', alpha=0.0001, max_iter=200)

Train a feed-forward neural network for regression.

scikit-learnregressionneural-network

BernoulliRBM

estimator
BernoulliRBM(*, n_components=256, learning_rate=0.1, n_iter=10, random_state=None)

Learn a restricted Boltzmann machine as a feature transformer.

scikit-learnneural-networkunsupervisedfeatures

Model selection

11 APIs

Search parameters and compare candidates without leaking test data.

GridSearchCV

estimator
GridSearchCV(estimator, param_grid, *, scoring=None, n_jobs=None, cv=None, refit=True)

Exhaustively evaluate every parameter combination by cross-validation.

scikit-learnhyperparametercvsearch

RandomizedSearchCV

estimator
RandomizedSearchCV(estimator, param_distributions, *, n_iter=10, scoring=None, cv=None)

Sample a fixed number of parameter combinations.

scikit-learnhyperparametercvsearch

HalvingGridSearchCV

estimator
HalvingGridSearchCV(estimator, param_grid, *, factor=3, resource='n_samples', cv=5)

Search a grid while eliminating weak candidates early.

scikit-learnhyperparametersuccessive-halving

HalvingRandomSearchCV

estimator
HalvingRandomSearchCV(estimator, param_distributions, *, n_candidates='exhaust', factor=3, cv=5)

Sample candidates and eliminate weak ones across rounds.

scikit-learnhyperparametersuccessive-halving

ParameterGrid

utility
ParameterGrid(param_grid)

Iterate over every dictionary in a parameter grid.

scikit-learnhyperparameterutilities

ParameterSampler

utility
ParameterSampler(param_distributions, n_iter, *, random_state=None)

Sample parameter dictionaries from distributions.

scikit-learnhyperparameterutilities

PredefinedSplit

utility
PredefinedSplit(test_fold)

Use caller-supplied fold assignments.

scikit-learncvcustom

LeaveOneOut

utility
LeaveOneOut()

Hold out one row per fold for very small datasets.

scikit-learncvsmall-data

RepeatedKFold

utility
RepeatedKFold(*, n_splits=5, n_repeats=10, random_state=None)

Repeat shuffled k-fold splits for a more stable estimate.

scikit-learncvstability

RepeatedStratifiedKFold

utility
RepeatedStratifiedKFold(*, n_splits=5, n_repeats=10, random_state=None)

Repeat stratified folds for classification.

scikit-learncvclassificationstability

GroupShuffleSplit

utility
GroupShuffleSplit(n_splits=5, *, test_size=None, train_size=None, random_state=None)

Randomly split whole groups into train and test.

scikit-learncvgroupsleakage

Metrics

30 APIs

Score regression, classification, ranking, and clustering honestly.

accuracy_score

function
accuracy_score(y_true, y_pred, *, normalize=True, sample_weight=None)

Fraction of labels predicted correctly.

scikit-learnclassificationbaseline

balanced_accuracy_score

function
balanced_accuracy_score(y_true, y_pred, *, sample_weight=None, adjusted=False)

Average recall across classes, so majority labels do not dominate.

scikit-learnclassificationimbalance

top_k_accuracy_score

function
top_k_accuracy_score(y_true, y_score, *, k=2, normalize=True, labels=None)

Fraction of rows whose true label is among the k highest scores.

scikit-learnclassificationranking

precision_score

function
precision_score(y_true, y_pred, *, labels=None, average='binary', zero_division='warn')

Of the rows predicted positive, how many really were positive.

scikit-learnclassificationprecision

recall_score

function
recall_score(y_true, y_pred, *, labels=None, average='binary', zero_division='warn')

Of the truly positive rows, how many were found.

scikit-learnclassificationrecall

f1_score

function
f1_score(y_true, y_pred, *, labels=None, average='binary', zero_division='warn')

Harmonic mean of precision and recall.

scikit-learnclassificationf1

fbeta_score

function
fbeta_score(y_true, y_pred, *, beta, average='binary', zero_division='warn')

Weight precision and recall differently with a beta value.

scikit-learnclassificationf1

precision_recall_fscore_support

function
precision_recall_fscore_support(y_true, y_pred, *, beta=1.0, labels=None, average=None, zero_division='warn')

Return precision, recall, F-score, and support in one pass.

scikit-learnclassificationper-class

classification_report

function
classification_report(y_true, y_pred, *, labels=None, target_names=None, digits=2)

Format per-class precision, recall, F1, and support as text.

scikit-learnclassificationreport

confusion_matrix

function
confusion_matrix(y_true, y_pred, *, labels=None, sample_weight=None, normalize=None)

Count true versus predicted labels in a matrix.

scikit-learnclassificationerrors

multilabel_confusion_matrix

function
multilabel_confusion_matrix(y_true, y_pred, *, sample_weight=None, labels=None)

Build one binary confusion matrix per label.

scikit-learnmultilabelerrors

roc_auc_score

function
roc_auc_score(y_true, y_score, *, average='macro', multi_class='raise', max_fpr=None)

Area under the receiver operating characteristic curve.

scikit-learnclassificationrankingthreshold-free

roc_curve

function
roc_curve(y_true, y_score, *, pos_label=None, sample_weight=None, drop_intermediate=True)

Compute false positive and true positive rates across thresholds.

scikit-learnclassificationthresholds

auc

function
auc(x, y)

Integrate a curve with the trapezoidal rule.

scikit-learncurvearea

precision_recall_curve

function
precision_recall_curve(y_true, probas_pred, *, pos_label=None, sample_weight=None)

Track precision and recall as the decision threshold moves.

scikit-learnclassificationthresholdsimbalance

average_precision_score

function
average_precision_score(y_true, y_score, *, average='macro', pos_label=1)

Summarize a precision-recall curve with a weighted mean precision.

scikit-learnclassificationrankingimbalance

log_loss

function
log_loss(y_true, y_pred, *, eps='auto', normalize=True, labels=None)

Penalize confident wrong probabilities with cross-entropy.

scikit-learnclassificationprobabilitycalibration

brier_score_loss

function
brier_score_loss(y_true, y_proba, *, sample_weight=None, pos_label=None)

Mean squared error between predicted probabilities and outcomes.

scikit-learnclassificationprobabilitycalibration

matthews_corrcoef

function
matthews_corrcoef(y_true, y_pred, *, sample_weight=None)

Balanced correlation score for binary and multiclass labels.

scikit-learnclassificationimbalance

cohen_kappa_score

function
cohen_kappa_score(y1, y2, *, labels=None, weights=None, sample_weight=None)

Agreement between two labelings after chance correction.

scikit-learnclassificationagreement

hinge_loss

function
hinge_loss(y_true, pred_decision, *, labels=None, sample_weight=None)

Margin loss used by support vector machines.

scikit-learnclassificationsvmloss

mean_absolute_error

function
mean_absolute_error(y_true, y_pred, *, sample_weight=None, multioutput='uniform_average')

Average absolute difference between predictions and targets.

scikit-learnregressionerror

mean_squared_error

function
mean_squared_error(y_true, y_pred, *, sample_weight=None, multioutput='uniform_average')

Average squared difference, sensitive to large errors.

scikit-learnregressionerror

root_mean_squared_error

function
root_mean_squared_error(y_true, y_pred, *, sample_weight=None, multioutput='uniform_average')

Square root of mean squared error in the target's units.

scikit-learnregressionerror

mean_absolute_percentage_error

function
mean_absolute_percentage_error(y_true, y_pred, *, sample_weight=None)

Average absolute percentage error, undefined near zero targets.

scikit-learnregressionrelative-error

r2_score

function
r2_score(y_true, y_pred, *, sample_weight=None, multioutput='uniform_average', force_finite=True)

Fraction of target variance explained by the predictions.

scikit-learnregressiongoodness-of-fit

explained_variance_score

function
explained_variance_score(y_true, y_pred, *, sample_weight=None, multioutput='uniform_average')

Variance of the target explained after removing prediction bias.

scikit-learnregressiongoodness-of-fit

median_absolute_error

function
median_absolute_error(y_true, y_pred, *, multioutput='uniform_average')

Median absolute error, robust to a few extreme residuals.

scikit-learnregressionrobust

max_error

function
max_error(y_true, y_pred)

Largest absolute residual in the dataset.

scikit-learnregressionworst-case

mean_pinball_loss

function
mean_pinball_loss(y_true, y_pred, *, sample_weight=None, alpha=0.5)

Quantile loss for evaluating interval and quantile predictions.

scikit-learnregressionquantile

Calibration

4 APIs

Turn scores into probabilities and choose a decision threshold.

CalibratedClassifierCV

estimator
CalibratedClassifierCV(estimator=None, *, method='sigmoid', cv=None, ensemble=True)

Wrap a classifier so its scores behave like probabilities.

scikit-learncalibrationprobability

calibration_curve

function
calibration_curve(y_true, y_prob, *, pos_label=None, n_bins=5, strategy='uniform')

Compare predicted confidence with observed positive rate.

scikit-learncalibrationdiagnostics

FrozenEstimator

utility
FrozenEstimator(estimator, *, fit_parameters=None)

Wrap a fitted estimator so meta-estimators reuse it unchanged.

scikit-learncalibrationutilitiesfitted

IsotonicRegression

estimator
IsotonicRegression(*, y_min=None, y_max=None, increasing=True, out_of_bounds='nan')

Fit a monotonic piecewise-linear calibration curve.

scikit-learncalibrationmonotonic

Outliers and time series

5 APIs

Detect unusual rows and validate models without looking into the future.

IsolationForest

estimator
IsolationForest(*, n_estimators=100, max_samples='auto', contamination='auto', random_state=None)

Score outliers by how quickly random splits isolate them.

scikit-learnoutliersanomalyensemble

LocalOutlierFactor

estimator
LocalOutlierFactor(n_neighbors=20, *, contamination='auto', novelty=False)

Flag rows whose local density is much lower than their neighbors.

scikit-learnoutliersanomalyneighbors

OneClassSVM

estimator
OneClassSVM(*, kernel='rbf', gamma='scale', nu=0.5)

Learn a boundary around normal rows for novelty detection.

scikit-learnoutliersanomalysvm

EllipticEnvelope

estimator
EllipticEnvelope(*, store_precision=True, assume_centered=False, support_fraction=None)

Fit a robust Gaussian ellipse and flag far-away rows.

scikit-learnoutliersanomalyrobust

TimeSeriesSplit

utility
TimeSeriesSplit(n_splits=5, *, max_train_size=None, test_size=None, gap=0)

Validate time-ordered data with strictly future test folds.

scikit-learntime-seriescvleakage

Pipelines and persistence

9 APIs

Bundle preprocessing with a model and save the fitted result safely.

Pipeline

estimator
Pipeline(steps, *, memory=None, verbose=False)

Chain preprocessing and a final estimator into one object.

scikit-learnpipelinepreprocessingproduction

make_pipeline

function
make_pipeline(*steps, memory=None, verbose=False)

Build a Pipeline without naming each step.

scikit-learnpipelineutilities

TransformedTargetRegressor

estimator
TransformedTargetRegressor(*, regressor=None, transformer=None, func=None, inverse_func=None)

Transform the target for fitting and invert predictions.

scikit-learnregressionpipelinetarget

make_scorer

function
make_scorer(score_func, *, response_method=None, greater_is_better=True, **kwargs)

Wrap a custom metric as a scoring callable.

scikit-learnscoringutilities

get_scorer

function
get_scorer(scoring)

Look up a scoring callable by its registered name.

scikit-learnscoringutilities

clone

function
clone(estimator, *, safe=True)

Copy an estimator with identical unfitted parameters.

scikit-learnutilitiesestimator

config_context

function
config_context(**new_config)

Temporarily change global scikit-learn display and validation settings.

scikit-learnutilitiesconfiguration

dump

function
dump(value, filename, *, compress=0, protocol=None)

Persist a fitted pipeline or array to disk.

joblibpersistencejoblib

load

function
load(filename, *, mmap_mode=None)

Load an object written by joblib.dump.

joblibpersistencejoblib