Documentation
Classes
GraphicalLassoCV

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.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new GraphicalLassoCV(opts?: object): GraphicalLassoCV;

Parameters

NameTypeDescription
opts?object-
opts.alphas?number | ArrayLikeIf 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. Default Value 4
opts.assume_centered?booleanIf 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. Default Value false
opts.cv?numberDetermines the cross-validation splitting strategy. Possible inputs for cv are:
opts.enet_tol?numberThe 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]. Default Value 0.0001
opts.max_iter?numberMaximum number of iterations. Default Value 100
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. Default Value 'cd'
opts.n_jobs?numberNumber of jobs to run in parallel. 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.n_refinements?numberThe number of times the grid is refined. Not used if explicit values of alphas are passed. Range is [1, inf). Default Value 4
opts.tol?numberThe tolerance to declare convergence: if the dual gap goes below this value, iterations are stopped. Range is (0, inf]. Default Value 0.0001
opts.verbose?booleanIf verbose is true, the objective function and duality gap are printed at each iteration. Default Value false

Returns

GraphicalLassoCV

Defined in: generated/covariance/GraphicalLassoCV.ts:25 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/covariance/GraphicalLassoCV.ts:23 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/covariance/GraphicalLassoCV.ts:22 (opens in a new tab)

_py

PythonBridge

Defined in: generated/covariance/GraphicalLassoCV.ts:21 (opens in a new tab)

id

string

Defined in: generated/covariance/GraphicalLassoCV.ts:18 (opens in a new tab)

opts

any

Defined in: generated/covariance/GraphicalLassoCV.ts:19 (opens in a new tab)

Accessors

alpha_

Penalization parameter selected.

Signature

alpha_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/covariance/GraphicalLassoCV.ts:476 (opens in a new tab)

covariance_

Estimated covariance matrix.

Signature

covariance_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/covariance/GraphicalLassoCV.ts:422 (opens in a new tab)

cv_results_

A dict with keys:

Signature

cv_results_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/covariance/GraphicalLassoCV.ts:503 (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/covariance/GraphicalLassoCV.ts:584 (opens in a new tab)

location_

Estimated location, i.e. the estimated mean.

Signature

location_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/covariance/GraphicalLassoCV.ts:395 (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/covariance/GraphicalLassoCV.ts:557 (opens in a new tab)

n_iter_

Number of iterations run for the optimal alpha.

Signature

n_iter_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/covariance/GraphicalLassoCV.ts:530 (opens in a new tab)

precision_

Estimated precision matrix (inverse covariance).

Signature

precision_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/covariance/GraphicalLassoCV.ts:449 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/covariance/GraphicalLassoCV.ts:96 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/covariance/GraphicalLassoCV.ts:100 (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/covariance/GraphicalLassoCV.ts:161 (opens in a new tab)

error_norm()

Compute the Mean Squared Error between two covariance estimators.

Signature

error_norm(opts: object): Promise<number>;

Parameters

NameTypeDescription
optsobject-
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\_). Default Value 'frobenius'
opts.scaling?booleanIf true (default), the squared error norm is divided by n_features. If false, the squared error norm is not rescaled. Default Value true
opts.squared?booleanWhether 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. Default Value true

Returns

Promise<number>

Defined in: generated/covariance/GraphicalLassoCV.ts:178 (opens in a new tab)

fit()

Fit the GraphicalLasso covariance model to X.

Signature

fit(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Data from which to compute the covariance estimate.
opts.y?anyNot used, present for API consistency by convention.

Returns

Promise<any>

Defined in: generated/covariance/GraphicalLassoCV.ts:238 (opens in a new tab)

get_precision()

Getter for the precision matrix.

Signature

get_precision(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.precision_?ArrayLike[]The precision matrix associated to the current covariance object.

Returns

Promise<any>

Defined in: generated/covariance/GraphicalLassoCV.ts:278 (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

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/covariance/GraphicalLassoCV.ts:109 (opens in a new tab)

mahalanobis()

Compute the squared Mahalanobis distances of given observations.

Signature

mahalanobis(opts: object): Promise<ArrayLike>;

Parameters

NameTypeDescription
optsobject-
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:316 (opens in a new tab)

score()

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\_.

Signature

score(opts: object): Promise<number>;

Parameters

NameTypeDescription
optsobject-
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?anyNot used, present for API consistency by convention.

Returns

Promise<number>

Defined in: generated/covariance/GraphicalLassoCV.ts:353 (opens in a new tab)