milia.anomaly.models.hbos#
HBOS: histogram-based outlier score.
Classes
|
Per-dimension histogram detector (Goldstein and Dengel, 2012). |
|
Validated hyperparameters of the HBOS detector. |
- class milia.anomaly.models.hbos.HBOS(bins=10, alpha=0.1, contamination=0.1)#
Bases:
BaseDetectorPer-dimension histogram detector (Goldstein and Dengel, 2012).
Each feature gets a static-width histogram, normalised so its tallest bin is one. A point’s score is the sum over features of
-log(height + alpha), where values outside the training range fall in an empty bin.- 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 = HBOS().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.hbos.HBOSConfig(*, name='hbos', kind='detector', space=SearchSpace(bins=(5, 50)), bins=10, alpha=0.1, contamination=0.1)#
Bases:
BaseModelConfigValidated hyperparameters of the HBOS detector.
Fields mirror
HBOS’s constructor;spaceis the default Optuna search space. Build the detector withmake("detector", "hbos", ...)orHBOS(**config.params()).Examples
>>> HBOSConfig().name 'hbos'