sklearn.linear model.Lasso System
(Redirected from sklearn.linear model.Lasso)
Jump to navigation
Jump to search
A sklearn.linear_model.Lasso System is a linear least-squares L1-regularized regression system within sklearn.linear_model (that implements a LASSO algorithm to solve a LASSO task).
- Context:
- Usage:
- 1) Import Lasso Regression model from scikit-learn :
from sklearn.linear_model import Lasso
- 2) Create design matrix
X
and response vectorY
- 3) Create Lasso Regression object:
lasso=Lasso(alpha=alpha[,fit_intercept=True, normalize=False,...])
- 4) Choose method(s):
- Fit model with coordinate descent:
lasso.fit(X, Y[, check_input]))
- Predict Y using the linear model with estimated coefficients:
Y_pred = lasso.predict(X)
- Return coefficient of determination (R^2) of the prediction:
lasso.score(X,Y[, sample_weight=w])
- Compute elastic net path with coordinate descent:
lasso.path(X, y[, l1_ratio, eps, n_alphas,...])
- Get estimator parameters:
lasso.get_params([deep])
- Set estimator parameters:
lasso.set_params(**params)
- Fit model with coordinate descent:
- 1) Import Lasso Regression model from scikit-learn :
- Example(s):
- Counter-Example(s)
- See: LASSO Task, sklearn.decomposition.sparse_encode.sklearn.decomposition.sparse_encode, sklearn.linear_model.lars_path System, sklearn.
References
2017a
- (Scikit Learn, 2017) ⇒ http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html#sklearn.linear_model.Lasso
- QUOTE:
class sklearn.linear_model.Lasso(alpha=1.0, fit_intercept=True, normalize=False, precompute=False, copy_X=True, max_iter=1000, tol=0.0001, warm_start=False, positive=False, random_state=None, selection=’cyclic’)
- QUOTE:
- Linear Model trained with L1 prior as regularizer (aka the Lasso)
- The optimization objective for Lasso is:
(1 / (2 * n_samples)) * ||y - Xw||^2_2 + alpha * ||w||_1
- Technically the Lasso model is optimizing the same objective function as the Elastic Net with l1_ratio=1.0 (no L2 penalty).
- Read more in the User Guide.