sklearn.linear model.Lars
Jump to navigation
Jump to search
A sklearn.linear model.Lars is an Least Angle Regression System within sklearn.linear_model
class.
- AKA: Lars, linear_model.Lars.
- Context
- Usage:
- 1) Import Lars Regression model from scikit-learn :
from sklearn.linear_model import Lars
- 2) Create design matrix
X
and response vectorY
- 3) Create Lars Regression object:
Larsreg=Lars([fit_intercept=True, verbose=False, normalize=True, precompute=’auto’, n_nonzero_coefs=500, eps=2.2204460492503131e-16, copy_X=True, fit_path=True, positive=False])
- 4) Choose method(s):
- Fit the Lars Regression model with coordinate descent to the dataset:
Larsreg.fit(X, Y[, check_input]))
- Predict Y using the linear model with estimated coefficients:
Y_pred = HEreg.predict(X)
- Return coefficient of determination (R^2) of the prediction:
Larsreg.score(X,Y[, sample_weight=w])
- Get estimator parameters:
Larsreg.get_params([deep])
- Set estimator parameters:
Larsreg.set_params(**params)
- Fit the Lars Regression model with coordinate descent to the dataset:
- 1) Import Lars Regression model from scikit-learn :
- Example(s):
Input: | Output: |
#Importing modules
#Calculaton of RMSE and Explained Variances
# Printing Results
#plotting real vs predicted data
|
![]()
|
- Counter-Example(s):
- See: Regression System, Regressor, Cross-Validation Task, Ridge Regression Task, Bayesian Analysis.
References
2017
- http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lars.html
- QUOTE:
class sklearn.linear_model.Lars(fit_intercept=True, verbose=False, normalize=True, precompute=’auto’, n_nonzero_coefs=500, eps=2.2204460492503131e-16, copy_X=True, fit_path=True, positive=False)
- QUOTE:
- Least Angle Regression model a.k.a. LAR.