Contents

6.2.15.1. scikits.learn.linear_model.sparse.Lasso

class scikits.learn.linear_model.sparse.Lasso(alpha=1.0, fit_intercept=False)

Linear Model trained with L1 prior as regularizer

This implementation works on scipy.sparse X and dense coef_. Technically this is the same as Elastic Net with the L2 penalty set to zero.

Parameters :

alpha : float

Constant that multiplies the L1 term. Defaults to 1.0

coef_ : ndarray of shape n_features

The initial coeffients to warm-start the optimization

fit_intercept: bool :

Whether the intercept should be estimated or not. If False, the data is assumed to be already centered.

Methods

fit(X, y[, max_iter, tol]) Fit current model with coordinate descent
predict(X) Predict using the linear model
score(X, y) Returns the coefficient of determination of the prediction
__init__(alpha=1.0, fit_intercept=False)
fit(X, y, max_iter=1000, tol=0.0001, **params)

Fit current model with coordinate descent

X is expected to be a sparse matrix. For maximum efficiency, use a sparse matrix in CSC format (scipy.sparse.csc_matrix)

predict(X)

Predict using the linear model

Parameters :X : scipy.sparse matrix of shape [n_samples, n_features]
Returns :array, shape = [n_samples] with the predicted real values :
score(X, y)

Returns the coefficient of determination of the prediction

Parameters :

X : array-like, shape = [n_samples, n_features]

Training set.

y : array-like, shape = [n_samples]

Returns :

z : float