LarsCV
Cross-validated Least Angle Regression model.
See glossary entry for cross-validation estimator.
Read more in the User Guide.
Python Reference (opens in a new tab)
Constructors
constructor()
Signature
new LarsCV(opts?: object): LarsCV;
Parameters
Name | Type | Description |
---|---|---|
opts? | object | - |
opts.copy_X? | boolean | If true , X will be copied; else, it may be overwritten. Default Value true |
opts.cv? | number | Determines the cross-validation splitting strategy. Possible inputs for cv are: |
opts.eps? | number | The 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? | boolean | Whether 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). Default Value true |
opts.max_iter? | number | Maximum number of iterations to perform. Default Value 500 |
opts.max_n_alphas? | number | The maximum number of points on the path used to compute the residuals in the cross-validation. Default Value 1000 |
opts.n_jobs? | number | Number of CPUs to use during the cross validation. undefined means 1 unless in a joblib.parallel\_backend (opens in a new tab) context. \-1 means using all processors. See Glossary for more details. |
opts.normalize? | boolean | This parameter is ignored when fit\_intercept is set to false . If true , the regressors X will be normalized before regression by subtracting the mean and dividing by the l2-norm. If you wish to standardize, please use StandardScaler before calling fit on an estimator with normalize=False . Default Value false |
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. Default Value 'auto' |
opts.verbose? | number | boolean | Sets the verbosity amount. Default Value false |
Returns
Defined in: generated/linear_model/LarsCV.ts:25 (opens in a new tab)
Properties
_isDisposed
boolean
=false
Defined in: generated/linear_model/LarsCV.ts:23 (opens in a new tab)
_isInitialized
boolean
=false
Defined in: generated/linear_model/LarsCV.ts:22 (opens in a new tab)
_py
PythonBridge
Defined in: generated/linear_model/LarsCV.ts:21 (opens in a new tab)
id
string
Defined in: generated/linear_model/LarsCV.ts:18 (opens in a new tab)
opts
any
Defined in: generated/linear_model/LarsCV.ts:19 (opens in a new tab)
Accessors
active_
Indices of active variables at the end of the path. If this is a list of lists, the outer list length is n\_targets
.
Signature
active_(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/linear_model/LarsCV.ts:291 (opens in a new tab)
alpha_
the estimated regularization parameter alpha
Signature
alpha_(): Promise<number>;
Returns
Promise
<number
>
Defined in: generated/linear_model/LarsCV.ts:381 (opens in a new tab)
alphas_
the different values of alpha along the path
Signature
alphas_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/linear_model/LarsCV.ts:403 (opens in a new tab)
coef_
parameter vector (w in the formulation formula)
Signature
coef_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/linear_model/LarsCV.ts:313 (opens in a new tab)
coef_path_
the varying values of the coefficients along the path
Signature
coef_path_(): Promise<ArrayLike[]>;
Returns
Promise
<ArrayLike
[]>
Defined in: generated/linear_model/LarsCV.ts:358 (opens in a new tab)
cv_alphas_
all the values of alpha along the path for the different folds
Signature
cv_alphas_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/linear_model/LarsCV.ts:425 (opens in a new tab)
feature_names_in_
Names of features seen during fit. Defined only when X
has feature names that are all strings.
Signature
feature_names_in_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/linear_model/LarsCV.ts:516 (opens in a new tab)
intercept_
independent term in decision function
Signature
intercept_(): Promise<number>;
Returns
Promise
<number
>
Defined in: generated/linear_model/LarsCV.ts:335 (opens in a new tab)
mse_path_
the mean square error on left-out for each fold along the path (alpha values given by cv\_alphas
)
Signature
mse_path_(): Promise<ArrayLike[]>;
Returns
Promise
<ArrayLike
[]>
Defined in: generated/linear_model/LarsCV.ts:448 (opens in a new tab)
n_features_in_
Number of features seen during fit.
Signature
n_features_in_(): Promise<number>;
Returns
Promise
<number
>
Defined in: generated/linear_model/LarsCV.ts:493 (opens in a new tab)
n_iter_
the number of iterations run by Lars with the optimal alpha.
Signature
n_iter_(): Promise<number | ArrayLike>;
Returns
Promise
<number
| ArrayLike
>
Defined in: generated/linear_model/LarsCV.ts:471 (opens in a new tab)
py
Signature
py(): PythonBridge;
Returns
PythonBridge
Defined in: generated/linear_model/LarsCV.ts:94 (opens in a new tab)
Signature
py(pythonBridge: PythonBridge): void;
Parameters
Name | Type |
---|---|
pythonBridge | PythonBridge |
Returns
void
Defined in: generated/linear_model/LarsCV.ts:98 (opens in a new tab)
Methods
dispose()
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Signature
dispose(): Promise<void>;
Returns
Promise
<void
>
Defined in: generated/linear_model/LarsCV.ts:154 (opens in a new tab)
fit()
Fit the model using X, y as training data.
Signature
fit(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike [] | Training data. |
opts.y? | ArrayLike | Target values. |
Returns
Promise
<any
>
Defined in: generated/linear_model/LarsCV.ts:171 (opens in a new tab)
init()
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Signature
init(py: PythonBridge): Promise<void>;
Parameters
Name | Type |
---|---|
py | PythonBridge |
Returns
Promise
<void
>
Defined in: generated/linear_model/LarsCV.ts:107 (opens in a new tab)
predict()
Predict using the linear model.
Signature
predict(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | any | Samples. |
Returns
Promise
<any
>
Defined in: generated/linear_model/LarsCV.ts:211 (opens in a new tab)
score()
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.
Signature
score(opts: object): Promise<number>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
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.sample_weight? | ArrayLike | Sample weights. |
opts.y? | ArrayLike | True values for X . |
Returns
Promise
<number
>
Defined in: generated/linear_model/LarsCV.ts:244 (opens in a new tab)