DocumentationClassesMultiTaskLassoCV

Class: MultiTaskLassoCV

Multi-task Lasso model trained with L1/L2 mixed-norm as regularizer.

See glossary entry for cross-validation estimator.

The optimization objective for MultiTaskLasso is:

Python Reference

Constructors

new MultiTaskLassoCV()

new MultiTaskLassoCV(opts?): MultiTaskLassoCV

Parameters

ParameterTypeDescription
opts?object-
opts.alphas?ArrayLikeList of alphas where to compute the models. If not provided, set automatically.
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?numberLength of the path. eps=1e-3 means that alpha_min / alpha_max \= 1e-3.
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?numberThe maximum number of iterations.
opts.n_alphas?numberNumber of alphas along the regularization path.
opts.n_jobs?numberNumber of CPUs to use during the cross validation. Note that this is used only if multiple values for l1_ratio are given. undefined means 1 unless in a joblib.parallel_backend context. \-1 means using all processors. See Glossary for more details.
opts.random_state?numberThe seed of the pseudo random number generator that selects a random feature to update. Used when selection == ‘random’. Pass an int for reproducible output across multiple function calls. See Glossary.
opts.selection?"random" | "cyclic"If set to ‘random’, a random coefficient is updated every iteration rather than looping over features sequentially by default. This (setting to ‘random’) often leads to significantly faster convergence especially when tol is higher than 1e-4.
opts.tol?numberThe tolerance for the optimization: if the updates are smaller than tol, the optimization code checks the dual gap for optimality and continues until it is smaller than tol.
opts.verbose?number | booleanAmount of verbosity.

Returns MultiTaskLassoCV

Defined in generated/linear_model/MultiTaskLassoCV.ts:25

Properties

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

Accessors

alpha_

Get Signature

get alpha_(): Promise<number>

The amount of penalization chosen by cross validation.

Returns Promise<number>

Defined in generated/linear_model/MultiTaskLassoCV.ts:587


alphas_

Get Signature

get alphas_(): Promise<ArrayLike>

The grid of alphas used for fitting.

Returns Promise<ArrayLike>

Defined in generated/linear_model/MultiTaskLassoCV.ts:641


coef_

Get Signature

get coef_(): Promise<ArrayLike[]>

Parameter vector (W in the cost function formula). Note that coef_ stores the transpose of W, W.T.

Returns Promise<ArrayLike[]>

Defined in generated/linear_model/MultiTaskLassoCV.ts:560


dual_gap_

Get Signature

get dual_gap_(): Promise<number>

The dual gap at the end of the optimization for the optimal alpha.

Returns Promise<number>

Defined in generated/linear_model/MultiTaskLassoCV.ts:695


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/MultiTaskLassoCV.ts:749


intercept_

Get Signature

get intercept_(): Promise<ArrayLike>

Independent term in decision function.

Returns Promise<ArrayLike>

Defined in generated/linear_model/MultiTaskLassoCV.ts:533


mse_path_

Get Signature

get mse_path_(): Promise<ArrayLike[]>

Mean square error for the test set on each fold, varying alpha.

Returns Promise<ArrayLike[]>

Defined in generated/linear_model/MultiTaskLassoCV.ts:614


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/MultiTaskLassoCV.ts:722


n_iter_

Get Signature

get n_iter_(): Promise<number>

Number of iterations run by the coordinate descent solver to reach the specified tolerance for the optimal alpha.

Returns Promise<number>

Defined in generated/linear_model/MultiTaskLassoCV.ts:668


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/linear_model/MultiTaskLassoCV.ts:106

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/MultiTaskLassoCV.ts:160


fit()

fit(opts): Promise<any>

Fit MultiTaskLasso model with coordinate descent.

Fit is on grid of alphas and best alpha estimated by cross-validation.

Parameters

ParameterTypeDescription
optsobject-
opts.params?anyParameters to be passed to the CV splitter.
opts.X?ArrayLike[]Data.
opts.y?ArrayLike[]Target. Will be cast to X’s dtype if necessary.

Returns Promise<any>

Defined in generated/linear_model/MultiTaskLassoCV.ts:179


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/MultiTaskLassoCV.ts:225


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/MultiTaskLassoCV.ts:119


path()

path(opts): Promise<ArrayLike>

Compute Lasso path with coordinate descent.

The Lasso optimization function varies for mono and multi-outputs.

For mono-output tasks it is:

Parameters

ParameterTypeDescription
optsobject-
opts.alphas?ArrayLikeList of alphas where to compute the models. If undefined alphas are set automatically.
opts.coef_init?ArrayLikeThe initial values of the coefficients.
opts.copy_X?booleanIf true, X will be copied; else, it may be overwritten.
opts.eps?numberLength of the path. eps=1e-3 means that alpha_min / alpha_max \= 1e-3.
opts.n_alphas?numberNumber of alphas along the regularization path.
opts.params?anyKeyword arguments passed to the coordinate descent solver.
opts.positive?booleanIf set to true, forces coefficients to be positive. (Only allowed when y.ndim \== 1).
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.return_n_iter?booleanWhether to return the number of iterations or not.
opts.verbose?number | booleanAmount of verbosity.
opts.X?ArrayLikeTraining data. Pass directly as Fortran-contiguous data to avoid unnecessary memory duplication. If y is mono-output then X can be sparse.
opts.Xy?ArrayLikeXy = np.dot(X.T, y) that can be precomputed. It is useful only when the Gram matrix is precomputed.
opts.y?anyTarget values.

Returns Promise<ArrayLike>

Defined in generated/linear_model/MultiTaskLassoCV.ts:265


predict()

predict(opts): Promise<any>

Predict using the linear model.

Parameters

ParameterTypeDescription
optsobject-
opts.X?anySamples.

Returns Promise<any>

Defined in generated/linear_model/MultiTaskLassoCV.ts:373


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/MultiTaskLassoCV.ts:409


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.sample_weight?string | booleanMetadata routing for sample_weight parameter in fit.

Returns Promise<any>

Defined in generated/linear_model/MultiTaskLassoCV.ts:457


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/MultiTaskLassoCV.ts:497