Histogram-based outlier score (HBOS) detects unusual observations by examining each feature independently and combining the rarity of values across their binned distributions. Its main advantage is speed, but it identifies univariate outliers rather than rare combinations of features. section 6.2
Use HBOS when:
- Data contains many features and testing multiple features together is impractical. section 6.2
- Features have little association, or manually reviewing every flagged observation makes additional subtle detections less useful. section 6.2
- Avoid treating its flags as automatically meaningful: subtle multivariate outliers may be missed, and domain experts may be needed to judge unusual values. section 6.2
Speech-feature screening
A speech dataset contains 400 i-vector features representing segments of spoken English. HBOS can quickly score the records, while a score histogram shows the score distribution. A 99.5th-percentile cutoff can label candidate outliers for follow-up; plotting feature distributions for flagged and unflagged records helps investigate which variables differ. section 6.2
Listing 6.4 Using HBOS with the speech dataset
import pandas as pd from pyod.models.hbos import HBOS from sklearn.datasets import fetch_openml import matplotlib.pyplot as plt import seaborn as sns data = fetch_openml(“speech”, version=1, parser='auto') df = pd.DataFrame(data.data, columns=data.feature_names) print(df.head()) det = HBOS() det.fit(df) pred = det.decision_scores_ sns.histplot(pred) plt.show()
Shows a concise PyOD workflow: load the OpenML speech dataset, fit HBOS, and inspect decision scores. section 6.2
