Class: GraphicalLassoCV
Sparse inverse covariance w/ cross-validated choice of the l1 penalty.
See glossary entry for cross-validation estimator.
Read more in the User Guide.
Constructors
new GraphicalLassoCV()
new GraphicalLassoCV(
opts?):GraphicalLassoCV
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | object | - |
opts.alphas? | number | ArrayLike | If an integer is given, it fixes the number of points on the grids of alpha to be used. If a list is given, it gives the grid to be used. See the notes in the class docstring for more details. Range is [1, inf) for an integer. Range is (0, inf] for an array-like of floats. |
opts.assume_centered? | boolean | If true, data are not centered before computation. Useful when working with data whose mean is almost, but not exactly zero. If false, data are centered before computation. |
opts.cv? | number | Determines the cross-validation splitting strategy. Possible inputs for cv are: |
opts.enet_tol? | number | The tolerance for the elastic net solver used to calculate the descent direction. This parameter controls the accuracy of the search direction for a given column update, not of the overall parameter estimate. Only used for mode=’cd’. Range is (0, inf]. |
opts.eps? | number | The machine-precision regularization in the computation of the Cholesky diagonal factors. Increase this for very ill-conditioned systems. Default is np.finfo(np.float64).eps. |
opts.max_iter? | number | Maximum number of iterations. |
opts.mode? | "cd" | "lars" | The Lasso solver to use: coordinate descent or LARS. Use LARS for very sparse underlying graphs, where number of features is greater than number of samples. Elsewhere prefer cd which is more numerically stable. |
opts.n_jobs? | number | Number of jobs to run in parallel. undefined means 1 unless in a joblib.parallel_backend context. \-1 means using all processors. See Glossary for more details. |
opts.n_refinements? | number | The number of times the grid is refined. Not used if explicit values of alphas are passed. Range is [1, inf). |
opts.tol? | number | The tolerance to declare convergence: if the dual gap goes below this value, iterations are stopped. Range is (0, inf]. |
opts.verbose? | boolean | If verbose is true, the objective function and duality gap are printed at each iteration. |
Returns GraphicalLassoCV
Defined in generated/covariance/GraphicalLassoCV.ts:25
Properties
| Property | Type | Default value | Defined in |
|---|---|---|---|
_isDisposed | boolean | false | generated/covariance/GraphicalLassoCV.ts:23 |
_isInitialized | boolean | false | generated/covariance/GraphicalLassoCV.ts:22 |
_py | PythonBridge | undefined | generated/covariance/GraphicalLassoCV.ts:21 |
id | string | undefined | generated/covariance/GraphicalLassoCV.ts:18 |
opts | any | undefined | generated/covariance/GraphicalLassoCV.ts:19 |
Accessors
alpha_
Get Signature
get alpha_():
Promise<number>
Penalization parameter selected.
Returns Promise<number>
Defined in generated/covariance/GraphicalLassoCV.ts:568
costs_
Get Signature
get costs_():
Promise<any>
The list of values of the objective function and the dual gap at each iteration. Returned only if return_costs is true.
Returns Promise<any>
Defined in generated/covariance/GraphicalLassoCV.ts:541
covariance_
Get Signature
get covariance_():
Promise<ArrayLike[]>
Estimated covariance matrix.
Returns Promise<ArrayLike[]>
Defined in generated/covariance/GraphicalLassoCV.ts:487
cv_results_
Get Signature
get cv_results_():
Promise<any>
A dict with keys:
Returns Promise<any>
Defined in generated/covariance/GraphicalLassoCV.ts:595
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/covariance/GraphicalLassoCV.ts:676
location_
Get Signature
get location_():
Promise<ArrayLike>
Estimated location, i.e. the estimated mean.
Returns Promise<ArrayLike>
Defined in generated/covariance/GraphicalLassoCV.ts:460
n_features_in_
Get Signature
get n_features_in_():
Promise<number>
Number of features seen during fit.
Returns Promise<number>
Defined in generated/covariance/GraphicalLassoCV.ts:649
n_iter_
Get Signature
get n_iter_():
Promise<number>
Number of iterations run for the optimal alpha.
Returns Promise<number>
Defined in generated/covariance/GraphicalLassoCV.ts:622
precision_
Get Signature
get precision_():
Promise<ArrayLike[]>
Estimated precision matrix (inverse covariance).
Returns Promise<ArrayLike[]>
Defined in generated/covariance/GraphicalLassoCV.ts:514
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge):void
Parameters
| Parameter | Type |
|---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/covariance/GraphicalLassoCV.ts:101
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/covariance/GraphicalLassoCV.ts:155
error_norm()
error_norm(
opts):Promise<number>
Compute the Mean Squared Error between two covariance estimators.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.comp_cov? | ArrayLike[] | The covariance to compare with. |
opts.norm? | "frobenius" | "spectral" | The type of norm used to compute the error. Available error types: - ‘frobenius’ (default): sqrt(tr(A^t.A)) - ‘spectral’: sqrt(max(eigenvalues(A^t.A)) where A is the error (comp_cov \- self.covariance_). |
opts.scaling? | boolean | If true (default), the squared error norm is divided by n_features. If false, the squared error norm is not rescaled. |
opts.squared? | boolean | Whether to compute the squared error norm or the error norm. If true (default), the squared error norm is returned. If false, the error norm is returned. |
Returns Promise<number>
Defined in generated/covariance/GraphicalLassoCV.ts:172
fit()
fit(
opts):Promise<any>
Fit the GraphicalLasso covariance model to X.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.params? | any | Parameters to be passed to the CV splitter and the cross_val_score function. |
opts.X? | ArrayLike[] | Data from which to compute the covariance estimate. |
opts.y? | any | Not used, present for API consistency by convention. |
Returns Promise<any>
Defined in generated/covariance/GraphicalLassoCV.ts:227
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 MetadataRouter encapsulating routing information. |
Returns Promise<any>
Defined in generated/covariance/GraphicalLassoCV.ts:273
get_precision()
get_precision(
opts):Promise<any>
Getter for the precision matrix.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.precision_? | ArrayLike[] | The precision matrix associated to the current covariance object. |
Returns Promise<any>
Defined in generated/covariance/GraphicalLassoCV.ts:309
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/covariance/GraphicalLassoCV.ts:114
mahalanobis()
mahalanobis(
opts):Promise<ArrayLike>
Compute the squared Mahalanobis distances of given observations.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.X? | ArrayLike[] | The observations, the Mahalanobis distances of the which we compute. Observations are assumed to be drawn from the same distribution than the data used in fit. |
Returns Promise<ArrayLike>
Defined in generated/covariance/GraphicalLassoCV.ts:345
score()
score(
opts):Promise<number>
Compute the log-likelihood of X_test under the estimated Gaussian model.
The Gaussian model is defined by its mean and covariance matrix which are represented respectively by self.location_ and self.covariance_.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts | object | - |
opts.X_test? | ArrayLike[] | Test data of which we compute the likelihood, where n_samples is the number of samples and n_features is the number of features. X_test is assumed to be drawn from the same distribution than the data used in fit (including centering). |
opts.y? | any | Not used, present for API consistency by convention. |
Returns Promise<number>
Defined in generated/covariance/GraphicalLassoCV.ts:381
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.X_test? | string | boolean | Metadata routing for X_test parameter in score. |
Returns Promise<any>
Defined in generated/covariance/GraphicalLassoCV.ts:424