Class: LarsCV

Cross-validated Least Angle Regression model.

See glossary entry for cross-validation estimator.

Read more in the User Guide.

Python Reference

Constructors

new LarsCV()

new LarsCV(opts?): LarsCV

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.precompute?boolean | ArrayLike | "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 LarsCV

Defined in generated/linear_model/LarsCV.ts:25

Properties

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

Accessors

active_

Get Signature

get active_(): Promise<any>

Indices of active variables at the end of the path. If this is a list of lists, the outer list length is n_targets.

Returns Promise<any>

Defined in generated/linear_model/LarsCV.ts:378


alpha_

Get Signature

get alpha_(): Promise<number>

the estimated regularization parameter alpha

Returns Promise<number>

Defined in generated/linear_model/LarsCV.ts:468


alphas_

Get Signature

get alphas_(): Promise<ArrayLike>

the different values of alpha along the path

Returns Promise<ArrayLike>

Defined in generated/linear_model/LarsCV.ts:490


coef_

Get Signature

get coef_(): Promise<ArrayLike>

parameter vector (w in the formulation formula)

Returns Promise<ArrayLike>

Defined in generated/linear_model/LarsCV.ts:400


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/LarsCV.ts:445


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/LarsCV.ts:512


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/LarsCV.ts:603


intercept_

Get Signature

get intercept_(): Promise<number>

independent term in decision function

Returns Promise<number>

Defined in generated/linear_model/LarsCV.ts:422


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/LarsCV.ts:535


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/LarsCV.ts:580


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/LarsCV.ts:558


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/linear_model/LarsCV.ts:87

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/LarsCV.ts:138


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/LarsCV.ts:155


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/LarsCV.ts:199


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/LarsCV.ts:100


predict()

predict(opts): Promise<any>

Predict using the linear model.

Parameters

ParameterTypeDescription
optsobject-
opts.X?anySamples.

Returns Promise<any>

Defined in generated/linear_model/LarsCV.ts:231


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/LarsCV.ts:264


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/LarsCV.ts:310


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/LarsCV.ts:346