class sklearn.linear_model.LassoLarsIC(criterion=’aic’, fit_intercept=True, verbose=False, normalize=True, precompute=’auto’, max_iter=500, eps=2.220446049250313e-16, copy_X=True, positive=False)
[source]
Lasso model fit with Lars using BIC or AIC for model selection
The optimization objective for Lasso is:
(1 / (2 * n_samples)) * ||y - Xw||^2_2 + alpha * ||w||_1
AIC is the Akaike information criterion and BIC is the Bayes Information criterion. Such criteria are useful to select the value of the regularization parameter by making a trade-off between the goodness of fit and the complexity of the model. A good model should explain well the data while being simple.
Read more in the User Guide.
Parameters: |
|
---|---|
Attributes: |
|
See also
The estimation of the number of degrees of freedom is given by:
“On the degrees of freedom of the lasso” Hui Zou, Trevor Hastie, and Robert Tibshirani Ann. Statist. Volume 35, Number 5 (2007), 2173-2192.
https://en.wikipedia.org/wiki/Akaike_information_criterion https://en.wikipedia.org/wiki/Bayesian_information_criterion
>>> from sklearn import linear_model >>> reg = linear_model.LassoLarsIC(criterion='bic') >>> reg.fit([[-1, 1], [0, 0], [1, 1]], [-1.1111, 0, -1.1111]) ... LassoLarsIC(copy_X=True, criterion='bic', eps=..., fit_intercept=True, max_iter=500, normalize=True, positive=False, precompute='auto', verbose=False) >>> print(reg.coef_) [ 0. -1.11...]
fit (X, y[, copy_X]) | Fit the model using X, y as training data. |
get_params ([deep]) | Get parameters for this estimator. |
predict (X) | Predict using the linear model |
score (X, y[, sample_weight]) | Returns the coefficient of determination R^2 of the prediction. |
set_params (**params) | Set the parameters of this estimator. |
__init__(criterion=’aic’, fit_intercept=True, verbose=False, normalize=True, precompute=’auto’, max_iter=500, eps=2.220446049250313e-16, copy_X=True, positive=False)
[source]
fit(X, y, copy_X=True)
[source]
Fit the model using X, y as training data.
Parameters: |
|
---|---|
Returns: |
|
get_params(deep=True)
[source]
Get parameters for this estimator.
Parameters: |
|
---|---|
Returns: |
|
predict(X)
[source]
Predict using the linear model
Parameters: |
|
---|---|
Returns: |
|
score(X, y, sample_weight=None)
[source]
Returns the coefficient of determination R^2 of the prediction.
The coefficient R^2 is defined as (1 - u/v), where u is the residual sum of squares ((y_true - y_pred) ** 2).sum() and v is the total sum of squares ((y_true - y_true.mean()) ** 2).sum(). The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.
Parameters: |
|
---|---|
Returns: |
|
set_params(**params)
[source]
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Returns: |
|
---|
sklearn.linear_model.LassoLarsIC
© 2007–2018 The scikit-learn developers
Licensed under the 3-clause BSD License.
http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LassoLarsIC.html