milia.anomaly.models.lof#
Local Outlier Factor: local density relative to a point’s own neighbours.
Classes
|
Local density detector (Breunig et al., 2000), in novelty mode. |
|
Validated hyperparameters of the Local Outlier Factor detector. |
- class milia.anomaly.models.lof.LOF(n_neighbors=20, metric='minkowski', contamination=0.1)#
Bases:
BaseDetectorLocal density detector (Breunig et al., 2000), in novelty mode.
- Parameters:
Examples
>>> import numpy as np >>> rng = np.random.default_rng(0) >>> train, cal = rng.normal(size=(200, 2)), rng.normal(size=(100, 2)) >>> model = LOF().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.lof.LOFConfig(*, name='lof', kind='detector', space=SearchSpace(n_neighbors=(5, 100)), n_neighbors=20, metric='minkowski', contamination=0.1)#
Bases:
BaseModelConfigValidated hyperparameters of the Local Outlier Factor detector.
Fields mirror
LOF’s constructor;spaceis the default Optuna search space. Build the detector withmake("detector", "lof", ...)orLOF(**config.params()).Examples
>>> LOFConfig().name 'lof'