Maximum likelihood covariance estimator.
Read more in the User Guide.
new EmpiricalCovariance(opts?: object): EmpiricalCovariance;
Name | Type | Description |
---|---|---|
opts? |
object |
- |
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 (default), data are centered before computation. Default Value false |
opts.store_precision? |
boolean |
Specifies if the estimated precision is stored. Default Value true |
Defined in: generated/covariance/EmpiricalCovariance.ts:23
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
dispose(): Promise<void>;
Promise
<void
>
Defined in: generated/covariance/EmpiricalCovariance.ts:99
Compute the Mean Squared Error between two covariance estimators.
error_norm(opts: object): Promise<number>;
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 |
Promise
<number
>
Defined in: generated/covariance/EmpiricalCovariance.ts:116
Fit the maximum likelihood covariance estimator to X.
fit(opts: object): Promise<any>;
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. |
Promise
<any
>
Defined in: generated/covariance/EmpiricalCovariance.ts:179
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
get_metadata_routing(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.routing? |
any |
A MetadataRequest encapsulating routing information. |
Promise
<any
>
Defined in: generated/covariance/EmpiricalCovariance.ts:221
Getter for the precision matrix.
get_precision(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.precision_? |
ArrayLike [] |
The precision matrix associated to the current covariance object. |
Promise
<any
>
Defined in: generated/covariance/EmpiricalCovariance.ts:259
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
init(py: PythonBridge): Promise<void>;
Name | Type |
---|---|
py |
PythonBridge |
Promise
<void
>
Defined in: generated/covariance/EmpiricalCovariance.ts:55
Compute the squared Mahalanobis distances of given observations.
mahalanobis(opts: object): Promise<ArrayLike>;
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. |
Promise
<ArrayLike
>
Defined in: generated/covariance/EmpiricalCovariance.ts:297
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\_
.
score(opts: object): Promise<number>;
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. |
Promise
<number
>
Defined in: generated/covariance/EmpiricalCovariance.ts:336
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:
set_score_request(opts: object): Promise<any>;
Name | Type | Description |
---|---|---|
opts |
object |
- |
opts.X_test? |
string | boolean |
Metadata routing for X\_test parameter in score . |
Promise
<any
>
Defined in: generated/covariance/EmpiricalCovariance.ts:382
boolean
=false
Defined in: generated/covariance/EmpiricalCovariance.ts:21
boolean
=false
Defined in: generated/covariance/EmpiricalCovariance.ts:20
PythonBridge
Defined in: generated/covariance/EmpiricalCovariance.ts:19
string
Defined in: generated/covariance/EmpiricalCovariance.ts:16
any
Defined in: generated/covariance/EmpiricalCovariance.ts:17
Estimated covariance matrix
covariance_(): Promise<ArrayLike[]>;
Promise
<ArrayLike
[]>
Defined in: generated/covariance/EmpiricalCovariance.ts:446
Names of features seen during fit. Defined only when X
has feature names that are all strings.
feature_names_in_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/covariance/EmpiricalCovariance.ts:527
Estimated location, i.e. the estimated mean.
location_(): Promise<ArrayLike>;
Promise
<ArrayLike
>
Defined in: generated/covariance/EmpiricalCovariance.ts:419
Number of features seen during fit.
n_features_in_(): Promise<number>;
Promise
<number
>
Defined in: generated/covariance/EmpiricalCovariance.ts:500
Estimated pseudo-inverse matrix. (stored only if store_precision is true
)
precision_(): Promise<ArrayLike[]>;
Promise
<ArrayLike
[]>
Defined in: generated/covariance/EmpiricalCovariance.ts:473
py(): PythonBridge;
PythonBridge
Defined in: generated/covariance/EmpiricalCovariance.ts:42
py(pythonBridge: PythonBridge): void;
Name | Type |
---|---|
pythonBridge |
PythonBridge |
void
Defined in: generated/covariance/EmpiricalCovariance.ts:46