milia.anomaly.models.copod#

COPOD: a skew-weighted empirical copula.

Classes

COPOD([contamination])

Parameter-free copula detector (Li et al., 2020, IEEE ICDM).

COPODConfig(*[, name, kind, space, ...])

Validated hyperparameters of the COPOD detector.

class milia.anomaly.models.copod.COPOD(contamination=0.1)#

Bases: BaseDetector

Parameter-free copula detector (Li et al., 2020, IEEE ICDM).

Per dimension, both tail terms are kept; the tail favoured by the training skewness is compared with the two-tail average and the larger is summed. This matches pyod’s combination rule, implemented directly.

Parameters:

contamination (float) – Expected share of outliers, used for the default threshold.

Examples

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> train, cal = rng.normal(size=(200, 2)), rng.normal(size=(100, 2))
>>> model = COPOD().fit(train).calibrate(cal, alpha=0.1)
>>> model.flag(np.array([[0.0, 0.0], [8.0, 8.0]])).tolist()
[False, True]
class milia.anomaly.models.copod.COPODConfig(*, name='copod', kind='detector', space=None, contamination=0.1)#

Bases: BaseModelConfig

Validated hyperparameters of the COPOD detector.

Fields mirror COPOD’s constructor; space is the default Optuna search space. Build the detector with make("detector", "copod", ...) or COPOD(**config.params()).

Examples

>>> COPODConfig().name
'copod'