Contents

scikits.learn.glm.LARS

class scikits.learn.glm.LARS(n_features, normalize=True)

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).

Notes

See also scikits.learn.glm.LassoLARS that fits a LASSO model using a variant of Least Angle Regression

http://en.wikipedia.org/wiki/Least_angle_regression

See examples/glm/plot_lar.py for an example.

Examples

>>> from scikits.learn import glm
>>> clf = glm.LARS(n_features=1)
>>> clf.fit([[-1,1], [0, 0], [1, 1]], [-1, 0, -1])
LARS(normalize=True, n_features=1)
>>> 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

fit
predict
score
__init__(n_features, normalize=True)
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 explained variance of the prediction

Parameters :

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

Training set.

y : array-like, shape = [n_samples]

Returns :

z : float