Class: LassoLarsCV

Cross-validated Lasso, using the LARS algorithm.

See glossary entry for cross-validation estimator.

The optimization objective for Lasso is:

Python Reference

Constructors

new LassoLarsCV()

new LassoLarsCV(opts?): LassoLarsCV

Parameters

ParameterTypeDescription
opts?object-
opts.copy_X?booleanIf true, X will be copied; else, it may be overwritten.
opts.cv?numberDetermines the cross-validation splitting strategy. Possible inputs for cv are:
opts.eps?numberThe machine-precision regularization in the computation of the Cholesky diagonal factors. Increase this for very ill-conditioned systems. Unlike the tol parameter in some iterative optimization-based algorithms, this parameter does not control the tolerance of the optimization.
opts.fit_intercept?booleanWhether to calculate the intercept for this model. If set to false, no intercept will be used in calculations (i.e. data is expected to be centered).
opts.max_iter?numberMaximum number of iterations to perform.
opts.max_n_alphas?numberThe maximum number of points on the path used to compute the residuals in the cross-validation.
opts.n_jobs?numberNumber of CPUs to use during the cross validation. undefined means 1 unless in a joblib.parallel_backend context. \-1 means using all processors. See Glossary for more details.
opts.positive?booleanRestrict coefficients to be >= 0. Be aware that you might want to remove fit_intercept which is set true by default. Under the positive restriction the model coefficients do not converge to the ordinary-least-squares solution for small values of alpha. Only coefficients up to the smallest alpha value (alphas_\[alphas_ > 0.\].min() when fit_path=true) reached by the stepwise Lars-Lasso algorithm are typically in congruence with the solution of the coordinate descent Lasso estimator. As a consequence using LassoLarsCV only makes sense for problems where a sparse solution is expected and/or reached.
opts.precompute?boolean | "auto"Whether to use a precomputed Gram matrix to speed up calculations. If set to 'auto' let us decide. The Gram matrix cannot be passed as argument since we will use only subsets of X.
opts.verbose?number | booleanSets the verbosity amount.

Returns LassoLarsCV

Defined in generated/linear_model/LassoLarsCV.ts:25

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/linear_model/LassoLarsCV.ts:23
_isInitializedbooleanfalsegenerated/linear_model/LassoLarsCV.ts:22
_pyPythonBridgeundefinedgenerated/linear_model/LassoLarsCV.ts:21
idstringundefinedgenerated/linear_model/LassoLarsCV.ts:18
optsanyundefinedgenerated/linear_model/LassoLarsCV.ts:19

Accessors

active_

Get Signature

get active_(): Promise<any>

Indices of active variables at the end of the path.

Returns Promise<any>

Defined in generated/linear_model/LassoLarsCV.ts:578


alpha_

Get Signature

get alpha_(): Promise<number>

the estimated regularization parameter alpha

Returns Promise<number>

Defined in generated/linear_model/LassoLarsCV.ts:461


alphas_

Get Signature

get alphas_(): Promise<ArrayLike>

the different values of alpha along the path

Returns Promise<ArrayLike>

Defined in generated/linear_model/LassoLarsCV.ts:484


coef_

Get Signature

get coef_(): Promise<ArrayLike>

parameter vector (w in the formulation formula)

Returns Promise<ArrayLike>

Defined in generated/linear_model/LassoLarsCV.ts:388


coef_path_

Get Signature

get coef_path_(): Promise<ArrayLike[]>

the varying values of the coefficients along the path

Returns Promise<ArrayLike[]>

Defined in generated/linear_model/LassoLarsCV.ts:436


cv_alphas_

Get Signature

get cv_alphas_(): Promise<ArrayLike>

all the values of alpha along the path for the different folds

Returns Promise<ArrayLike>

Defined in generated/linear_model/LassoLarsCV.ts:507


feature_names_in_

Get Signature

get feature_names_in_(): Promise<ArrayLike>

Names of features seen during fit. Defined only when X has feature names that are all strings.

Returns Promise<ArrayLike>

Defined in generated/linear_model/LassoLarsCV.ts:626


intercept_

Get Signature

get intercept_(): Promise<number>

independent term in decision function.

Returns Promise<number>

Defined in generated/linear_model/LassoLarsCV.ts:411


mse_path_

Get Signature

get mse_path_(): Promise<ArrayLike[]>

the mean square error on left-out for each fold along the path (alpha values given by cv_alphas)

Returns Promise<ArrayLike[]>

Defined in generated/linear_model/LassoLarsCV.ts:532


n_features_in_

Get Signature

get n_features_in_(): Promise<number>

Number of features seen during fit.

Returns Promise<number>

Defined in generated/linear_model/LassoLarsCV.ts:601


n_iter_

Get Signature

get n_iter_(): Promise<number | ArrayLike>

the number of iterations run by Lars with the optimal alpha.

Returns Promise<number | ArrayLike>

Defined in generated/linear_model/LassoLarsCV.ts:555


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/linear_model/LassoLarsCV.ts:94

Methods

dispose()

dispose(): Promise<void>

Disposes of the underlying Python resources.

Once dispose() is called, the instance is no longer usable.

Returns Promise<void>

Defined in generated/linear_model/LassoLarsCV.ts:146


fit()

fit(opts): Promise<any>

Fit the model using X, y as training data.

Parameters

ParameterTypeDescription
optsobject-
opts.params?anyParameters to be passed to the CV splitter.
opts.X?ArrayLike[]Training data.
opts.y?ArrayLikeTarget values.

Returns Promise<any>

Defined in generated/linear_model/LassoLarsCV.ts:163


get_metadata_routing()

get_metadata_routing(opts): Promise<any>

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Parameters

ParameterTypeDescription
optsobject-
opts.routing?anyA MetadataRouter encapsulating routing information.

Returns Promise<any>

Defined in generated/linear_model/LassoLarsCV.ts:207


init()

init(py): Promise<void>

Initializes the underlying Python resources.

This instance is not usable until the Promise returned by init() resolves.

Parameters

ParameterType
pyPythonBridge

Returns Promise<void>

Defined in generated/linear_model/LassoLarsCV.ts:107


predict()

predict(opts): Promise<any>

Predict using the linear model.

Parameters

ParameterTypeDescription
optsobject-
opts.X?anySamples.

Returns Promise<any>

Defined in generated/linear_model/LassoLarsCV.ts:241


score()

score(opts): Promise<number>

Return the coefficient of determination of the prediction.

The coefficient of determination \(R^2\) is defined as \((1 - \frac{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

ParameterTypeDescription
optsobject-
opts.sample_weight?ArrayLikeSample weights.
opts.X?ArrayLike[]Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n_samples, n_samples_fitted), where n_samples_fitted is the number of samples used in the fitting for the estimator.
opts.y?ArrayLikeTrue values for X.

Returns Promise<number>

Defined in generated/linear_model/LassoLarsCV.ts:274


set_fit_request()

set_fit_request(opts): Promise<any>

Request metadata passed to the fit method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

Parameters

ParameterTypeDescription
optsobject-
opts.Xy?string | booleanMetadata routing for Xy parameter in fit.

Returns Promise<any>

Defined in generated/linear_model/LassoLarsCV.ts:320


set_score_request()

set_score_request(opts): Promise<any>

Request metadata passed to the score method.

Note that this method is only relevant if enable_metadata_routing=True (see sklearn.set_config). Please see User Guide on how the routing mechanism works.

The options for each parameter are:

Parameters

ParameterTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample_weight parameter in score.

Returns Promise<any>

Defined in generated/linear_model/LassoLarsCV.ts:356