sklearn.linear_model#

A variety of linear models.

User guide. See the Linear Models section for further details.

The following subsections are only rough guidelines: the same estimator can fall into multiple categories, depending on its parameters.

Linear classifiers#

LogisticRegression

Logistic Regression (aka logit, MaxEnt) classifier.

LogisticRegressionCV

Logistic Regression CV (aka logit, MaxEnt) classifier.

PassiveAggressiveClassifier

Passive Aggressive Classifier.

Perceptron

Linear perceptron classifier.

RidgeClassifier

Classifier using Ridge regression.

RidgeClassifierCV

Ridge classifier with built-in cross-validation.

SGDClassifier

Linear classifiers (SVM, logistic regression, etc.) with SGD training.

SGDOneClassSVM

Solves linear One-Class SVM using Stochastic Gradient Descent.

Classical linear regressors#

LinearRegression

Ordinary least squares Linear Regression.

Ridge

Linear least squares with l2 regularization.

RidgeCV

Ridge regression with built-in cross-validation.

SGDRegressor

Linear model fitted by minimizing a regularized empirical loss with SGD.

Regressors with variable selection#

The following estimators have built-in variable selection fitting procedures, but any estimator using a L1 or elastic-net penalty also performs variable selection: typically SGDRegressor or SGDClassifier with an appropriate penalty.

ElasticNet

Linear regression with combined L1 and L2 priors as regularizer.

ElasticNetCV

Elastic Net model with iterative fitting along a regularization path.

Lars

Least Angle Regression model a.k.a.

LarsCV

Cross-validated Least Angle Regression model.

Lasso

Linear Model trained with L1 prior as regularizer (aka the Lasso).

LassoCV

Lasso linear model with iterative fitting along a regularization path.

LassoLars

Lasso model fit with Least Angle Regression a.k.a.

LassoLarsCV

Cross-validated Lasso, using the LARS algorithm.

LassoLarsIC

Lasso model fit with Lars using BIC or AIC for model selection.

OrthogonalMatchingPursuit

Orthogonal Matching Pursuit model (OMP).

OrthogonalMatchingPursuitCV

Cross-validated Orthogonal Matching Pursuit model (OMP).

Bayesian regressors#

ARDRegression

Bayesian ARD regression.

BayesianRidge

Bayesian ridge regression.

Multi-task linear regressors with variable selection#

These estimators fit multiple regression problems (or tasks) jointly, while inducing sparse coefficients. While the inferred coefficients may differ between the tasks, they are constrained to agree on the features that are selected (non-zero coefficients).

MultiTaskElasticNet

Multi-task ElasticNet model trained with L1/L2 mixed-norm as regularizer.

MultiTaskElasticNetCV

Multi-task L1/L2 ElasticNet with built-in cross-validation.

MultiTaskLasso

Multi-task Lasso model trained with L1/L2 mixed-norm as regularizer.

MultiTaskLassoCV

Multi-task Lasso model trained with L1/L2 mixed-norm as regularizer.

Outlier-robust regressors#

Any estimator using the Huber loss would also be robust to outliers, e.g., SGDRegressor with loss='huber'.

HuberRegressor

L2-regularized linear regression model that is robust to outliers.

QuantileRegressor

Linear regression model that predicts conditional quantiles.

RANSACRegressor

RANSAC (RANdom SAmple Consensus) algorithm.

TheilSenRegressor

Theil-Sen Estimator: robust multivariate regression model.

Generalized linear models (GLM) for regression#

These models allow for response variables to have error distributions other than a normal distribution.

GammaRegressor

Generalized Linear Model with a Gamma distribution.

PoissonRegressor

Generalized Linear Model with a Poisson distribution.

TweedieRegressor

Generalized Linear Model with a Tweedie distribution.

Miscellaneous#

PassiveAggressiveRegressor

Passive Aggressive Regressor.

enet_path

Compute elastic net path with coordinate descent.

lars_path

Compute Least Angle Regression or Lasso path using the LARS algorithm.

lars_path_gram

The lars_path in the sufficient stats mode.

lasso_path

Compute Lasso path with coordinate descent.

orthogonal_mp

Orthogonal Matching Pursuit (OMP).

orthogonal_mp_gram

Gram Orthogonal Matching Pursuit (OMP).

ridge_regression

Solve the ridge equation by the method of normal equations.