Skip to content

Latest commit

 

History

History
396 lines (233 loc) · 11.4 KB

ShrunkCovariance.md

File metadata and controls

396 lines (233 loc) · 11.4 KB

ShrunkCovariance

Covariance estimator with shrinkage.

Read more in the User Guide.

Python Reference

Constructors

constructor()

Signature

new ShrunkCovariance(opts?: object): ShrunkCovariance;

Parameters

Name Type Description
opts? object -
opts.assume_centered? boolean If true, data will not be centered before computation. Useful when working with data whose mean is almost, but not exactly zero. If false, data will be centered before computation. Default Value false
opts.shrinkage? number Coefficient in the convex combination used for the computation of the shrunk estimate. Range is [0, 1]. Default Value 0.1
opts.store_precision? boolean Specify if the estimated precision is stored. Default Value true

Returns

ShrunkCovariance

Defined in: generated/covariance/ShrunkCovariance.ts:23

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/ShrunkCovariance.ts:106

error_norm()

Compute the Mean Squared Error between two covariance estimators.

Signature

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

Parameters

Name 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\_). Default Value 'frobenius'
opts.scaling? boolean If 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? 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. Default Value true

Returns

Promise<number>

Defined in: generated/covariance/ShrunkCovariance.ts:123

fit()

Fit the shrunk covariance model to X.

Signature

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

Parameters

Name Type Description
opts object -
opts.X? ArrayLike[] Training data, where n\_samples is the number of samples and n\_features is the number of features.
opts.y? any Not used, present for API consistency by convention.

Returns

Promise<any>

Defined in: generated/covariance/ShrunkCovariance.ts:183

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Signature

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

Parameters

Name Type Description
opts object -
opts.routing? any A MetadataRequest encapsulating routing information.

Returns

Promise<any>

Defined in: generated/covariance/ShrunkCovariance.ts:225

get_precision()

Getter for the precision matrix.

Signature

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

Parameters

Name Type Description
opts object -
opts.precision_? ArrayLike[] The precision matrix associated to the current covariance object.

Returns

Promise<any>

Defined in: generated/covariance/ShrunkCovariance.ts:262

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/covariance/ShrunkCovariance.ts:62

mahalanobis()

Compute the squared Mahalanobis distances of given observations.

Signature

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

Parameters

Name 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/ShrunkCovariance.ts:300

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

Name 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/ShrunkCovariance.ts:337

set_score_request()

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:

Signature

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

Parameters

Name Type Description
opts object -
opts.X_test? string | boolean Metadata routing for X\_test parameter in score.

Returns

Promise<any>

Defined in: generated/covariance/ShrunkCovariance.ts:383

Properties

_isDisposed

boolean = false

Defined in: generated/covariance/ShrunkCovariance.ts:21

_isInitialized

boolean = false

Defined in: generated/covariance/ShrunkCovariance.ts:20

_py

PythonBridge

Defined in: generated/covariance/ShrunkCovariance.ts:19

id

string

Defined in: generated/covariance/ShrunkCovariance.ts:16

opts

any

Defined in: generated/covariance/ShrunkCovariance.ts:17

Accessors

covariance_

Estimated covariance matrix

Signature

covariance_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/covariance/ShrunkCovariance.ts:420

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/ShrunkCovariance.ts:528

location_

Estimated location, i.e. the estimated mean.

Signature

location_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/covariance/ShrunkCovariance.ts:447

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/covariance/ShrunkCovariance.ts:501

precision_

Estimated pseudo inverse matrix. (stored only if store_precision is true)

Signature

precision_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/covariance/ShrunkCovariance.ts:474

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/covariance/ShrunkCovariance.ts:49

Signature

py(pythonBridge: PythonBridge): void;

Parameters

Name Type
pythonBridge PythonBridge

Returns

void

Defined in: generated/covariance/ShrunkCovariance.ts:53