scikits.learn.linear_model.LARS¶
- class scikits.learn.linear_model.LARS(fit_intercept=True, verbose=False)¶
- Least Angle Regression model a.k.a. LAR - Parameters : - n_features : int, optional - Number of selected active features - fit_intercept : boolean - whether to calculate the intercept for this model. If set to false, no intercept will be used in calculations (e.g. data is expected to be already centered). - References - http://en.wikipedia.org/wiki/Least_angle_regression - Examples - >>> from scikits.learn import linear_model >>> clf = linear_model.LARS() >>> clf.fit([[-1,1], [0, 0], [1, 1]], [-1, 0, -1], max_features=1) LARS(verbose=False, fit_intercept=True) >>> print clf.coef_ [ 0. -0.81649658] - Attributes - coef_ - array, shape = [n_features] - parameter vector (w in the fomulation formula) - intercept_ - float - independent term in decision function. - Methods - __init__(fit_intercept=True, verbose=False)¶
 - fit(X, y, normalize=True, max_features=None, precompute='auto', overwrite_X=False, **params)¶
- Fit the model using X, y as training data. - Parameters : - X : array-like, shape = [n_samples, n_features] - Training data. - y : array-like, shape = [n_samples] - Target values. - precompute : True | False | ‘auto’ | array-like - Whether to use a precomputed Gram matrix to speed up calculations. If set to ‘auto’ let us decide. The Gram matrix can also be passed as argument. - Returns : - self : object - returns an instance of self. 
 - predict(X)¶
- Predict using the linear model - Parameters : - X : numpy array of shape [n_samples, n_features] - Returns : - C : array, shape = [n_samples] - Returns predicted 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 
 
