Skip to content

Latest commit

 

History

History
640 lines (378 loc) · 18.4 KB

EllipticEnvelope.md

File metadata and controls

640 lines (378 loc) · 18.4 KB

EllipticEnvelope

An object for detecting outliers in a Gaussian distributed dataset.

Read more in the User Guide.

Python Reference

Constructors

constructor()

Signature

new EllipticEnvelope(opts?: object): EllipticEnvelope;

Parameters

Name Type Description
opts? object -
opts.assume_centered? boolean If true, the support of robust location and 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.contamination? number The amount of contamination of the data set, i.e. the proportion of outliers in the data set. Range is (0, 0.5]. Default Value 0.1
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. If undefined, the minimum value of support_fraction will be used within the algorithm: \[n\_sample + n\_features + 1\] / 2. Range is (0, 1).

Returns

EllipticEnvelope

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

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/EllipticEnvelope.ts:139

decision_function()

Compute the decision function of the given observations.

Signature

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

Parameters

Name Type Description
opts object -
opts.X? ArrayLike[] The data matrix.

Returns

Promise<ArrayLike>

Defined in: generated/covariance/EllipticEnvelope.ts:177

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/EllipticEnvelope.ts:120

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/EllipticEnvelope.ts:214

fit()

Fit the EllipticEnvelope model.

Signature

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

Parameters

Name Type Description
opts object -
opts.X? ArrayLike[] Training data.
opts.y? any Not used, present for API consistency by convention.

Returns

Promise<any>

Defined in: generated/covariance/EllipticEnvelope.ts:274

fit_predict()

Perform fit on X and returns labels for X.

Returns -1 for outliers and 1 for inliers.

Signature

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

Parameters

Name Type Description
opts object -
opts.X? ArrayLike The input samples.
opts.y? any Not used, present for API consistency by convention.

Returns

Promise<ArrayLike>

Defined in: generated/covariance/EllipticEnvelope.ts:316

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/EllipticEnvelope.ts:358

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/EllipticEnvelope.ts:395

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/EllipticEnvelope.ts:72

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/EllipticEnvelope.ts:433

predict()

Predict labels (1 inlier, -1 outlier) of X according to fitted model.

Signature

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

Parameters

Name Type Description
opts object -
opts.X? ArrayLike[] The data matrix.

Returns

Promise<ArrayLike>

Defined in: generated/covariance/EllipticEnvelope.ts:468

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/EllipticEnvelope.ts:505

score()

Return the mean accuracy on the given test data and labels.

In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.

Signature

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

Parameters

Name Type Description
opts object -
opts.X? ArrayLike[] Test samples.
opts.sample_weight? ArrayLike Sample weights.
opts.y? ArrayLike True labels for X.

Returns

Promise<number>

Defined in: generated/covariance/EllipticEnvelope.ts:545

score_samples()

Compute the negative Mahalanobis distances.

Signature

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

Parameters

Name Type Description
opts object -
opts.X? ArrayLike[] The data matrix.

Returns

Promise<ArrayLike>

Defined in: generated/covariance/EllipticEnvelope.ts:594

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.sample_weight? string | boolean Metadata routing for sample\_weight parameter in score.

Returns

Promise<any>

Defined in: generated/covariance/EllipticEnvelope.ts:635

Properties

_isDisposed

boolean = false

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

_isInitialized

boolean = false

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

_py

PythonBridge

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

id

string

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

opts

any

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

Accessors

covariance_

Estimated robust covariance matrix.

Signature

covariance_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/covariance/EllipticEnvelope.ts:700

dist_

Mahalanobis distances of the training set (on which fit is called) observations.

Signature

dist_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/covariance/EllipticEnvelope.ts:889

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/EllipticEnvelope.ts:943

location_

Estimated robust location.

Signature

location_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/covariance/EllipticEnvelope.ts:673

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/covariance/EllipticEnvelope.ts:916

offset_

Offset used to define the decision function from the raw scores. We have the relation: decision\_function \= score\_samples \- offset\_. The offset depends on the contamination parameter and is defined in such a way we obtain the expected number of outliers (samples with decision function < 0) in training.

Signature

offset_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/covariance/EllipticEnvelope.ts:781

precision_

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

Signature

precision_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/covariance/EllipticEnvelope.ts:727

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/covariance/EllipticEnvelope.ts:59

Signature

py(pythonBridge: PythonBridge): void;

Parameters

Name Type
pythonBridge PythonBridge

Returns

void

Defined in: generated/covariance/EllipticEnvelope.ts:63

raw_covariance_

The raw robust estimated covariance before correction and re-weighting.

Signature

raw_covariance_(): Promise<ArrayLike[]>;

Returns

Promise<ArrayLike[]>

Defined in: generated/covariance/EllipticEnvelope.ts:835

raw_location_

The raw robust estimated location before correction and re-weighting.

Signature

raw_location_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/covariance/EllipticEnvelope.ts:808

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/EllipticEnvelope.ts:862

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/EllipticEnvelope.ts:754