"매 normal 의 boundary 를 학습하고 그 밖을 flag 한다.". Anomaly detection 은 fraud, intrusion, equipment failure, log spike 등을 unsupervised 로 발견하는 매 core observability/security primitive. 2026 의 standard 는 Isolation Forest + LSTM-AE + transformer-based time-series (PatchTST, TimesNet).
매 핵심
매 Anomaly Type 3가지
Point anomaly: 매 single observation 이 outlier — credit card 단일 거래.
Contextual anomaly: 매 context 에서만 anomaly — 여름의 영하 온도.
Collective anomaly: 매 group 으로만 anomaly — DDoS 의 packet sequence.
매 Algorithm Family
Statistical: z-score, MAD, Grubbs, EWMA — 매 univariate baseline.
Distance-based: kNN, LOF — 매 density 차이로 detect.
Tree-based: Isolation Forest, Extended IF — 매 high-dim 잘 작동.
Reconstruction: Autoencoder, VAE — 매 reconstruction error = anomaly score.
Time-series DL: LSTM-AE, Transformer (PatchTST 2024, TimesNet) — 매 SOTA 2026.
One-class: One-Class SVM, Deep SVDD — 매 normal-only training.
fromsklearn.ensembleimportIsolationForestimportnumpyasnp# 매 contamination = expected anomaly fractionclf=IsolationForest(contamination=0.01,n_estimators=200,random_state=42)clf.fit(X_train)scores=-clf.score_samples(X_test)# 매 high score = more anomalouspreds=clf.predict(X_test)# -1=anomaly, 1=normal
importtorch.nnasnnclassAE(nn.Module):def__init__(self,d=64):super().__init__()self.enc=nn.Sequential(nn.Linear(d,32),nn.ReLU(),nn.Linear(32,8))self.dec=nn.Sequential(nn.Linear(8,32),nn.ReLU(),nn.Linear(32,d))defforward(self,x):returnself.dec(self.enc(x))# 매 train on normal only — anomaly = high reconstruction errorrecon=model(x)score=((x-recon)**2).mean(dim=1)