MinCovDet
Minimum Covariance Determinant (MCD): robust estimator of covariance.
The Minimum Covariance Determinant covariance estimator is to be applied on Gaussian-distributed data, but could still be relevant on data drawn from a unimodal, symmetric distribution. It is not meant to be used with multi-modal data (the algorithm used to fit a MinCovDet object is likely to fail in such a case). One should consider projection pursuit methods to deal with multi-modal datasets.
Read more in the User Guide.
Python Reference (opens in a new tab)
Constructors
constructor()
Signature
new MinCovDet(opts?: object): MinCovDet;
Parameters
Name | Type | Description |
---|---|---|
opts? | object | - |
opts.assume_centered? | boolean | If true , the support of the robust location and the covariance estimates is computed, and a covariance estimate is recomputed from it, without centering the data. Useful to work with data whose mean is significantly equal to zero but is not exactly zero. If false , the robust location and covariance are directly computed with the FastMCD algorithm without additional treatment. Default Value false |
opts.random_state? | number | Determines the pseudo random number generator for shuffling the data. Pass an int for reproducible results across multiple function calls. See Glossary. |
opts.store_precision? | boolean | Specify if the estimated precision is stored. Default Value true |
opts.support_fraction? | number | The proportion of points to be included in the support of the raw MCD estimate. Default is undefined , which implies that the minimum value of support_fraction will be used within the algorithm: (n\_sample + n\_features + 1) / 2 . The parameter must be in the range (0, 1]. |
Returns
Defined in: generated/covariance/MinCovDet.ts:25 (opens in a new tab)
Properties
_isDisposed
boolean
=false
Defined in: generated/covariance/MinCovDet.ts:23 (opens in a new tab)
_isInitialized
boolean
=false
Defined in: generated/covariance/MinCovDet.ts:22 (opens in a new tab)
_py
PythonBridge
Defined in: generated/covariance/MinCovDet.ts:21 (opens in a new tab)
id
string
Defined in: generated/covariance/MinCovDet.ts:18 (opens in a new tab)
opts
any
Defined in: generated/covariance/MinCovDet.ts:19 (opens in a new tab)
Accessors
covariance_
Estimated robust covariance matrix.
Signature
covariance_(): Promise<ArrayLike[]>;
Returns
Promise
<ArrayLike
[]>
Defined in: generated/covariance/MinCovDet.ts:499 (opens in a new tab)
dist_
Mahalanobis distances of the training set (on which fit
is called) observations.
Signature
dist_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/covariance/MinCovDet.ts:568 (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/MinCovDet.ts:616 (opens in a new tab)
location_
Estimated robust location.
Signature
location_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/covariance/MinCovDet.ts:476 (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/MinCovDet.ts:591 (opens in a new tab)
precision_
Estimated pseudo inverse matrix. (stored only if store_precision is true
)
Signature
precision_(): Promise<ArrayLike[]>;
Returns
Promise
<ArrayLike
[]>
Defined in: generated/covariance/MinCovDet.ts:522 (opens in a new tab)
py
Signature
py(): PythonBridge;
Returns
PythonBridge
Defined in: generated/covariance/MinCovDet.ts:54 (opens in a new tab)
Signature
py(pythonBridge: PythonBridge): void;
Parameters
Name | Type |
---|---|
pythonBridge | PythonBridge |
Returns
void
Defined in: generated/covariance/MinCovDet.ts:58 (opens in a new tab)
raw_covariance_
The raw robust estimated covariance before correction and re-weighting.
Signature
raw_covariance_(): Promise<ArrayLike[]>;
Returns
Promise
<ArrayLike
[]>
Defined in: generated/covariance/MinCovDet.ts:426 (opens in a new tab)
raw_location_
The raw robust estimated location before correction and re-weighting.
Signature
raw_location_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/covariance/MinCovDet.ts:401 (opens in a new tab)
raw_support_
A mask of the observations that have been used to compute the raw robust estimates of location and shape, before correction and re-weighting.
Signature
raw_support_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/covariance/MinCovDet.ts:451 (opens in a new tab)
support_
A mask of the observations that have been used to compute the robust estimates of location and shape.
Signature
support_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/covariance/MinCovDet.ts:545 (opens in a new tab)
Methods
correct_covariance()
Apply a correction to raw Minimum Covariance Determinant estimates.
Correction using the empirical correction factor suggested by Rousseeuw and Van Driessen in [RVD].
Signature
correct_covariance(opts: object): Promise<ArrayLike[]>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.data? | ArrayLike [] | The data matrix, with p features and n samples. The data set must be the one which was used to compute the raw estimates. |
Returns
Promise
<ArrayLike
[]>
Defined in: generated/covariance/MinCovDet.ts:129 (opens in a new tab)
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/MinCovDet.ts:110 (opens in a new tab)
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/MinCovDet.ts:162 (opens in a new tab)
fit()
Fit a Minimum Covariance Determinant with the FastMCD algorithm.
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/MinCovDet.ts:220 (opens in a new tab)
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/MinCovDet.ts:258 (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
Name | Type |
---|---|
py | PythonBridge |
Returns
Promise
<void
>
Defined in: generated/covariance/MinCovDet.ts:67 (opens in a new tab)
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/MinCovDet.ts:291 (opens in a new tab)
reweight_covariance()
Re-weight raw Minimum Covariance Determinant estimates.
Re-weight observations using Rousseeuw’s method (equivalent to deleting outlying observations from the data set before computing location and covariance estimates) described in [RVDriessen].
Signature
reweight_covariance(opts: object): Promise<ArrayLike>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.data? | ArrayLike [] | The data matrix, with p features and n samples. The data set must be the one which was used to compute the raw estimates. |
Returns
Promise
<ArrayLike
>
Defined in: generated/covariance/MinCovDet.ts:326 (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
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/MinCovDet.ts:361 (opens in a new tab)