C.W.K.
Stream
Lesson 03 of 04 · published

Anomaly Detection

~28 min · anomaly, outliers, isolation-forest

Level 0Scout
0 XP0/48 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

두 flavor

Supervised anomaly detection이 알려진 anomaly에 label 있음 — extreme imbalance 동반한 classification으로 다뤄. Unsupervised anomaly detection이 label 없고 anomaly가 rare하고 구조적으로 다르다고 가정. unsupervised case가 보통 사람들이 의미하는 거.

중요한 알고리즘

  • IsolationForest — 빠름, scale 잘됨, distance 가정 X.
  • LocalOutlierFactor — density-based, local 맥락에 민감.
  • One-class SVM — normal 데이터 주변 boundary. 큰 dataset엔 비쌈.
  • Autoencoder reconstruction error — high-dimensional input(image, sensor)용.

label 없는 evaluation

ground truth 없이 evaluation은 절반 예술. top score sample 후 사람 review. precision-at-K(top K alert 중 진짜 비율) 추적. 사람 review를 label로 wire back 하고 점진적으로 supervised classification으로 이동.

Code

빠른 first cut으로 IsolationForest·python
from sklearn.ensemble import IsolationForest

iso = IsolationForest(
    n_estimators=300, contamination=0.01, random_state=7, n_jobs=-1
).fit(X_train)
scores = -iso.score_samples(X_new)  # higher = more anomalous
on-call team을 위한 top-K alert·python
import numpy as np

K = 100
top_idx = np.argsort(-scores)[:K]
alerts = X_new.iloc[top_idx].assign(score=scores[top_idx])
alerts.to_csv("alerts/today.csv", index=False)

External links

Exercise

contamination=0.01로 IsolationForest를 dataset에 돌려. top 50 anomaly sampling 해서 real / false / ambiguous label. precision@50 계산. 모델이 on-call rotation 준비 됐는지 결정.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.