Class: LassoLarsIC
Lasso model fit with Lars using BIC or AIC for model selection.
The optimization objective for Lasso is:
Constructors
new LassoLarsIC()
new LassoLarsIC(
opts
?):LassoLarsIC
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.copy_X ? | boolean | If true , X will be copied; else, it may be overwritten. |
opts.criterion ? | "aic" | "bic" | The type of criterion to use. |
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). |
opts.max_iter ? | number | Maximum number of iterations to perform. Can be used for early stopping. |
opts.noise_variance ? | number | The estimated noise variance of the data. If undefined , an unbiased estimate is computed by an OLS model. However, it is only possible in the case where n_samples > n_features + fit_intercept . |
opts.positive ? | boolean | Restrict 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 LassoLarsIC only makes sense for problems where a sparse solution is expected and/or reached. |
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 can also be passed as argument. |
opts.verbose ? | number | boolean | Sets the verbosity amount. |
Returns LassoLarsIC
Defined in generated/linear_model/LassoLarsIC.ts:23
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/linear_model/LassoLarsIC.ts:21 |
_isInitialized | boolean | false | generated/linear_model/LassoLarsIC.ts:20 |
_py | PythonBridge | undefined | generated/linear_model/LassoLarsIC.ts:19 |
id | string | undefined | generated/linear_model/LassoLarsIC.ts:16 |
opts | any | undefined | generated/linear_model/LassoLarsIC.ts:17 |
Accessors
alpha_
Get Signature
get alpha_():
Promise
<number
>
the alpha parameter chosen by the information criterion
Returns Promise
<number
>
Defined in generated/linear_model/LassoLarsIC.ts:429
alphas_
Get Signature
get alphas_():
Promise
<ArrayLike
>
Maximum of covariances (in absolute value) at each iteration. n_alphas
is either max_iter
, n_features
or the number of nodes in the path with alpha >= alpha_min
, whichever is smaller. If a list, it will be of length n_targets
.
Returns Promise
<ArrayLike
>
Defined in generated/linear_model/LassoLarsIC.ts:452
coef_
Get Signature
get coef_():
Promise
<ArrayLike
>
parameter vector (w in the formulation formula)
Returns Promise
<ArrayLike
>
Defined in generated/linear_model/LassoLarsIC.ts:381
criterion_
Get Signature
get criterion_():
Promise
<ArrayLike
>
The value of the information criteria (‘aic’, ‘bic’) across all alphas. The alpha which has the smallest information criterion is chosen, as specified in [1].
Returns Promise
<ArrayLike
>
Defined in generated/linear_model/LassoLarsIC.ts:498
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/LassoLarsIC.ts:573
intercept_
Get Signature
get intercept_():
Promise
<number
>
independent term in decision function.
Returns Promise
<number
>
Defined in generated/linear_model/LassoLarsIC.ts:404
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/LassoLarsIC.ts:548
n_iter_
Get Signature
get n_iter_():
Promise
<number
>
number of iterations run by lars_path to find the grid of alphas.
Returns Promise
<number
>
Defined in generated/linear_model/LassoLarsIC.ts:475
noise_variance_
Get Signature
get noise_variance_():
Promise
<number
>
The estimated noise variance from the data used to compute the criterion.
Returns Promise
<number
>
Defined in generated/linear_model/LassoLarsIC.ts:523
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/linear_model/LassoLarsIC.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/LassoLarsIC.ts:139
fit()
fit(
opts
):Promise
<any
>
Fit the model using X, y as training data.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.copy_X ? | boolean | If provided, this parameter will override the choice of copy_X made at instance creation. If true , X will be copied; else, it may be overwritten. |
opts.X ? | ArrayLike [] | Training data. |
opts.y ? | ArrayLike | Target values. Will be cast to X’s dtype if necessary. |
Returns Promise
<any
>
Defined in generated/linear_model/LassoLarsIC.ts:156
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.routing ? | any | A MetadataRequest encapsulating routing information. |
Returns Promise
<any
>
Defined in generated/linear_model/LassoLarsIC.ts:200
init()
init(
py
):Promise
<void
>
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Parameters
Parameter | Type |
---|---|
py | PythonBridge |
Returns Promise
<void
>
Defined in generated/linear_model/LassoLarsIC.ts:100
predict()
predict(
opts
):Promise
<any
>
Predict using the linear model.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | any | Samples. |
Returns Promise
<any
>
Defined in generated/linear_model/LassoLarsIC.ts:234
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | ArrayLike | Sample 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 ? | ArrayLike | True values for X . |
Returns Promise
<number
>
Defined in generated/linear_model/LassoLarsIC.ts:267
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.copy_X ? | string | boolean | Metadata routing for copy_X parameter in fit . |
Returns Promise
<any
>
Defined in generated/linear_model/LassoLarsIC.ts:313
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | string | boolean | Metadata routing for sample_weight parameter in score . |
Returns Promise
<any
>
Defined in generated/linear_model/LassoLarsIC.ts:349