๐Paper Review
[paper reivew] Multivariate Time-series Anomaly Detection via Graph Attention Network
AbstractIntroduction์๋ฃจ์
contributionRelated workMethodologyExperimentsAnalysesCase StudyConclusion
Abstract
๋ค๋ณ๋ ์๊ณ์ด ๋ฐ์ดํฐ๋ ์ฐ์
 ๋ถ์ผ์์ ๋ค์ํ๊ฒ ํ์ฉ์ด ๊ฐ๋ฅํ์ง๋ง, ๋ณ์๊ฐ์ ๊ด๊ณ๋ฅผ ๋ช
ํํ๊ฒ ์ ์ํ๊ธฐ๊ฐ ์ด๋ ต๋ค๋ ํ๊ณ๊ฐ ์์ด์, ์๋ชป๋ ์์ธก์ ํ  ์ ์๋ค. (false alarm) 
์ด์ ๋ณธ ๋
ผ๋ฌธ์ ๋ฐฉ๋ฒ์ ์ ์ํ๋ค.
๋ค๋ณ๋ ์๊ณ์ด์ ๋ณต์กํ ์์กด์ฑ์ ํ์ตํ๊ธฐ ์ํด ๋ณธ ์ฐ๊ตฌ์์๋ ๋จ๋ณ๋ ๋ณ์๋ฅผ ๋
๋ฆฝ๋ณ์๋ก ๊ฐ์ ํ๊ณ , ๊ฐ๊ฐ ๋๊ฐ์ graph attention layer๋ฅผ ๋ณ๋ ฌ๋ก ๋ฐฐ์นํจ
forecasting-based model ๊ณผ reconstruction based model์ jointly optimizeํ์ฌ, single timestamp prediction๊ณผ ์ ์ฒด tieme-series์ reconstruction์ ๊ณ ๋ คํ๋ time-series representation์ ํ  ์ ์๊ฒ ํจ
ย 
Introduction

- Malhotra et.al์ LSTM ๊ธฐ๋ฐ์ encoder - decoder network๋ฅผ ์ ์ํ๊ณ , multiple sensor๋ค์์ ์๋ฌ๋ฅผ ๋ํ ํ ํ๋๋ฐ ์ฌ์ฉ
 
- Hundman et. al์ prediction error๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ ๋ค๋ณ๋ ์๊ณ์ด ์ด์์น ํ์ง ์ฐ๊ตฌ๋ฅผ ์งํ
 
- OmniAnomaly๋ stochastic recurrent neuarl network๋ฅผ ์ฌ์ฉ, latent variable์ ํ์ฉํ์ฌ ๋ค๋ณ๋ ์๊ณ์ด modelling data ๋ถํฌ์ normal pattern์ ํ๋
 
- ์ 3๊ฐ์ ์์์ ๊ฐ์ด ์๊ณ์ด ์ด์์น ํ์ง๋ฅผ ์ํด, ๋ณ์๊ฐ ๊ด๊ณ๋ฅผ ํ์ ํ๋ ๊ฒ์ด ์ค์
 
์๋ฃจ์ 
MTAD-GAT(Multivariate Time-series Anomaly Detection via Graph Attention Network)
contribution
- self-supervised ๋ฅผ ํตํด multivariate-time series ๋ฌธ์ ๋ฅผ ๋ค๋ฃจ์ด ๋น์ SOTA score ๋ฌ์ฑ
 
- 2๊ฐ์ parallel ํ graph attention (GAT)๋ฅผ ํ์ฉํ์ฌ ๋ค๋ฅธ time-series์ timestamp์ relationship์ ์ด์ ์ ์ ๋ณด๊ฐ ๋ถํ์ํ ์ํ์์ ์ฐพ์
 
- forecasting(single time-stamp prediction ์ ๋ชฉ์ ) ๊ณผ reconstruction(entire time-series ์ latent representation ์ ๋ชฉ์ ) ๊ธฐ๋ฐ์ ๋ชจ๋ธ์ joint optimizing ํจ
 
- ํด์ ๊ฐ๋ฅํ๊ณ , ์ง๊ด์ ์ธ attention score ์ฌ์ฉ
 
ย 
Related work
- Univariate Anomaly Detection
 - Hypothesis testing, waveltet analysis, SVD, ARIMA
 - Netflix : PCA๋ฅผ ํตํ ์ด์์น ํ์ง
 - Twitter : Seasonal Hybrid Exteme Studyt Deviation test
 - DONUT : unsupervised anomaly detecion method based on Cariational Auto Encoder and SR-CNN
 
- Multivariate Anomaly Detection
 - Forecasting-based Models : prediction error ๋ฅผ ํตํด ์ด์์น ํ์ง
 - LSTM-NDT : unsupervised ๋ฐ non-parametric thresholding์ ์ ์
 - Ding et. al : Hierarchical Temporal Memory(HTM) and Bayesian Netwrok ๊ธฐ๋ฐ real-time ์ด์์น ํ์ง ์๊ณ ๋ฆฌ์ฆ
 - Gugulothu et. al : non-temporal dimension reduction ๋ฐ recurrent auto-encoder๋ฅผ ํตํด end to end learning framework ์ ์
 - DAGMM : temporal dependency๋ฅผ ๊ณ ๋ คํ์ง ์๊ณ ์ด์์น ํ์ง ๊ณ ๋ คํ์ฌ ๋จ์ง ์ ์ฒด์ observation์ ์ธํ์ผ๋ก ํจ
 - Reconstruction-based Models : Latent variable์ ํตํด entire time-series๋ฅผ ๋ณต์ํ๋๋ก ํ์ต
 - Pankaj et. al : LSTM-based Encoder-Decoder framework๋ก normal ์๊ณ์ด data์ representation ํ์ต
 - Kitsune : unsupervised๋ก feature๋ฅผ instance๋ก mapping์ ํ๊ณ decoder๋ฅผ ํตํด reconstruction
 - MAD-GAN : entire variable set ์ ๊ณ ๋ คํ์ฌ latent interactions๋ฅผ capture
 - GAN-Li : GAN์ผ๋ก ํ์ต๋ discriminator์ ์ค์ ์ fake๋ฅผ ๋ฃ์ด residuals์ ๋ง๋ฆ
 - LSTM-VAE : LSTM์ variational auto-encoder์ integrates ํ์ฌ singals๋ฅผ fuse ํ๊ณ ๋ถํฌ๋ฅผ ์ฌ๊ตฌ์ฑ, temporal dependencies๋ฅผ latent space์ LSTM encoder๋ฅผ ํตํด ์์ถ
 - OmniAnomaly : deterministic method๋ก unpredictable instances ๋๋ฌธ์ ์ค์ํ ๊ฐ๋ฅ์ฑ์ด ๋์ผ๋ฏ๋ก stochastic model์ ์ ์ํ์ฌ ๋ค๋ณ๋ ์๊ณ์ด ์ด์์นํ์ง๋ฅผ ์งํํจ. ์ ์ pattern์ stochastic variable connection๊ณผ plannar normalizing flow๋ฅผ ํตํด normal pattern ์ captureํจ
 
Methodology
- overview
 - ์ฒซ๋ฒ์งธ ๋ ์ด์ด์ 1-D convolution์ ์ปค๋ ์ฌ์ด์ฆ 7์ ํ์ฉํ์ฌ ๊ณ ์ฐจ์์ feature ์ถ์ถํจ
 - ๊ณผ์  1์ feature๋ฅผ 2๊ฐ์ง GAT layer์ input์ผ๋ก ์ฌ์ฉ
 - 2 GAT layer output์ concatenate ํ ๋ค GRU ์ feed
 - GRU output์ forecasting ๊ณผ reconstruction model์ ๋ฃ์ด์ final result๋ฅผ ๋์ถ
 

ย 
- Data Preprocessing
 - Data normalization
 - Data cleaning
 - Spectral Residual
 

FFT ํ์ฉํ์ฌ, ๊ฐ ์๋์ฐ ๋ด์ ์ ํธ์์ ํ๊ท  spectrum์ ๋นผ๊ณ , ์ญ๋ณํํ์ฌ Saliency Map ์์ฑ
SR-CNN์ฒ๋ผ, Saliency Map์ ์ผ์  threshold ์ด์์ธ ๊ฐ์ anomaly๋ก ๋ผ๋ฒจ๋ง
ํด๋น ๋ผ๋ฒจ์ด ๋ถ์ ๊ฐ์ ์ฃผ๋ณ ๊ฐ์ผ๋ก imputationํ์ฌ cleaning
ย 
- Graph attention
 - Feature-oriented graph attention layer
 - ๋ค๋ณ๋์ ์๊ณ์ด์ graph๋ก ๋ค๋ฃจ๊ณ , ๊ฐ node๋ ํน์  feature๋ฅผ represent
 - ๊ฐ edge๋ 2๊ฐ์ ์ํธ์์ฉ feature์ relationship
 - ๊ฐ ๋ ธ๋ xi = {xi,t|t โ [0, n]} ์ด๋ฏ๋ก, k ๋ ธ๋๊ฐ ์๊ณ , timestamp์ ์๋ n, k๋ mulicariate features์ ์
 - Time-oriented graph attention layer
 - temporal dependency๋ฅผ captureํ๊ธฐ ์ํด ์ฌ์ฉ, ๋ชจ๋ ํ์์คํฌํ๋ฅผ ์ฌ๋ผ์ด๋ฉํ์ฌ complete graphํ
 - node xt๋ time stamp t์์์ feature vector๋ฅผ ๋ํ๋ด๋ฉฐ ์ฃผ๋ณ์ ๋ ธ๋๋ ํ์ฌ ์ฌ๋ผ์ด๋ฉ ์๋์ฐ์ ๋ชจ๋ ํ์์คํฌํ๋ฅผ ํฌํจ
 - ์ต์ข ์ ์ผ๋ก feature oriented graph attention layer์ ์์ํ (kxn์ ํ๋ ฌ)๊ณผ, time-oriented graph attention layer์ ์์ํ (nxk์ ํฌ๊ธฐ)๊ณผ, ์๋ณธ input์ concatenateํ์ฌ nx3k์ ํฌ๊ธฐ์ final node feature ์์ฑ
 - GRU๋ฅผ ์ฌ์ฉํ์ฌ final node feature๋ฅผ Joint Optimization (forecasting, Reconstruction)
 


ย 
- Joint Optimization
 - Forecasting-based model
 - ๋ค์ ์์ ์ ๊ฐ์ ์์ธกํ๋๋ก ํ์ต
 - anomaly score๋ฅผ ์ฐ์ถ ํ ๋, ๋ณํ์ ๋ฏผ๊ฐํ๊ฒ ๋ฐ์
 - Reconstruction-based model
 - a์ ๋ฐ์ดํฐ ๋ณํ์ ๋ํ ๊ฐ๊ฑด์ฑ ๋ฌธ์  ์ํ
 - input ๋ฐ์ดํฐ์ ๋ถํฌ ์ถ์ 
 - b๋ง ์ฌ์ฉํ ๊ฒฝ์ฐ ์ด์์น๊ฐ ํ์ต๋ ๋ถํฌ ์์ ํฌํจ๋ ๋ ํฌ์ฐฉ ๋ถ๊ฐ
 - Model Inference
 

ย 

ย 

((์์ธก๊ฐ๊ณผ ์ค์ ๊ฐ์ ์ฐจ์ด) ** 2 + * (reconstrction based model ์์ abnormal ํ๋ฅ )) / 1+
Experiments
ย 
- Datasets
 
SMAP (Soil Moisture Active Passive satellite)
MSL (Mars Science Laboratory rover)
TSA (Time Series Anomaly detection system) *
- Metrics
 
precision, recall and F1-score, AUC scores
- Setup
 - window size = 100
 - ์ grid search๋ฅผ ํตํด ์ค์  (0.8)
 - adam, 100 epoch, 0.001 learning rate
 
- Comparison with SOTAs
 

- Evaluation with Different Delays
 
delay delta ๊ฐ 10์ผ๋ 53.98%, 13.04%, 19.93% ์ ์ฐจ์ด๋ฅผ ๋ณด์
Analyses
- Effectiveness of Graph Attention
 


- Effectiveness of Joint Optimization
 

Forcasting based model์ ์๊ณ์ด์ ๋๋ค์ฑ์ ๊ฐ๊ฑดํ๊ณ , Reconstruction based model์ ์ก์, ๋ฐ์ดํฐ ๋ณํ์ ๊ฐ๊ฑดํ์ฌ, joint optimizationํ๋ ๊ฒ์ด f1 score ๊ฐ ๋๊ณ , anomaly detection์ ํจ๊ณผ์ ์์ ์
์ฆ
- Analysis of
 

ย 
Case Study
- ๋จ๋ณ๋์ผ ๊ฒฝ์ฐ ๋ช๋ช feature๋ฅผ ์ด์์น๋ก ํ์ง ํ๊ฒ ์ง๋ง, ๋ณธ ๋ชจ๋ธ์ feature๋ฅผ ์ข ํฉ์ ์ผ๋ก ๊ณ ๋ คํ์ ๋, ์ ์ฒด ๋ ธ๋๊ฐ์ ์๊ด๊ด๊ณ๊ฐ ๋ณํ์ง ์์๊ธฐ์ ์ ์์ผ๋ก ๋ถ๋ฅํ๊ณ , ์ค์  ์ ์์ธ ๊ฒฝ์ฐ
 

- ๋ค๋ฅธ feature๋ ์ ์์ด์ง๋ง,Checkpoint์ CPU๊ฐ ๋น์ ์ ํจํด์ ๋ณด์ด๊ณ , ๊ทธ ํจํด์ด ํ์ต๋ ์ ์ด ์๊ธฐ์ ์ ์ ์ํฉ์์๋ ์ด์์น๋ก ์ค๋ถ๋ฅํ ๊ฒฝ์ฐ
 

Conclusion
framework ์ ์, ์ฑ๋ฅ ๊ฒ์ฆ, ์ฌ๋ฌ ๋ฐฉ๋ฒ๋ก  ์ฆ๋ช
์ถ๊ฐ์ ์ผ๋ก ๋๋ฉ์ธ ์ง์ ๋ฐ ํผ๋๋ฐฑ์ ํตํ ์ฑ๋ฅ ํฅ์ ๊ฐ๋ฅํ  ๊ฒ์ผ๋ก ๊ธฐ๋
ย 
ย 
ํ์ฉ ๋ฐฉ์ : 
- ๋ณธ ์ฐ๊ตฌ์ GAT๋ฅผ ํ์ฉํ์ฌ, ์ปดํจํฐ ์์๊ฐ ๊ด๊ณ, ์๋ฒ๊ฐ ๊ด๊ณ, host๊ฐ ๊ด๊ณ๋ฅผ ํ์ตํ ์ ์์ ๊ฒ์ผ๋ก ๊ธฐ๋.
 
- ๋ฏธ๋ ์์ ์ ๋ํ ์์ธก ๊ฐ์ ํ์ฉํ์ฌ ๋ฏธ๋ ์์ ์ ๋ํ ์ด์์ฌ๋ถ๋ฅผ ํ๋จ ํ ์ ์๋๋ก ์คํ ์ค๊ณ ํ์.
 
์ด ๋ฐฉ๋ฒ ๋ํ ๋ฐ์ดํฐ์ ๋น์ ์์ฑ, ๊ณ์ ์ฑ์ด ํฌ์ฐฉ๋๋ค๋ฉด, ๋ชจ์ง๋จ์ ์๋ ๋ชจ๋  ํจํด์ ํ์ต ํ  ์๋ ์๊ธฐ์ ์๊ฐ์ ๋ฐ๋ผ ๋ณํํ๋ ๋
ธ๋ ๊ฐ ๊ด๊ณ๋ฅผ ๊ณ ๋ คํ๊ธฐ ์ด๋ ต๊ณ , ๋จผ ๋ฏธ๋์ ๋ํ ์ด์ ํ์ง๋ ์ด๋ ค์ธ ์ ์๋ค๊ณ  ์๊ฐ. 
์๋ฒ๊ฐ ์ด๋์ ๋ ์์ ํ ๋ ์ํ์์ ์ธก์ ํ ๋ฐ์ดํฐ ๋๋ ๋ฐ์ดํฐ์ ์ ์ฒด ์ถ์ด๋ฅผ ํ์ต ํ  ์ ์๋ ๋ชจ๋ธ ํ์.
ย 
ย 
MTAD-GAT ์คํ
ํ๋ผ๋ฏธํฐ ์ค์ 
Class SlidingWindowDataset(Dataset) : ๋ฐ์ดํฐ๋ฅผ ์ค์ ๋ window_size๋ก ์ฌ๋ผ์ด๋ฉํ์ฌ ์์ฑ
window_size๋ โarg.lookbackโ ์ผ๋ก ์ง์ , default๋ 100 โ 60์ผ๋ก ๋ณ๊ฒฝ
okestro ๋ฐ์ดํฐ์ ๋๋ฉ์ธ ๊ธฐ๋ฐ์ผ๋ก ์ ์ ๋ feature 12๊ฐ๋ฅผ data_dim์ผ๋ก ์ค์ 

okestro ๋ฐ์ดํฐ์ ์ข
์๋ณ์ 7๊ฐ๋ฅผ target_dim์ผ๋ก ์ค์ 

ย 
ย 
์ฒ์๋ถํฐ ์ฌ๊ตฌ์ถ ํ ๊ฒฝ์ฐ
- โx = window + 1โ ๊น์ง๋ก ์ค์  ํ recon = x-1, reg = window_size๋ก ์ค์  (data loader ์ฌ๊ตฌ์ถ)
 
- forecast ๋ ๋ง์ง๋ง ์ธ๋ฑ์ค, reconstruct๋ ๋ง์ง๋ง ์ธ๋ฑ์ค ํ๋ ์ ๊น์ง ์ฌ์ฉ
 
forecast_loss = torch.sqrt(self.forecast_criterion(y[:,19,:], preds)) recon_loss = torch.sqrt(self.recon_criterion(x, recons))
- out_dim = 12
 
- TemporalAttention์ ๊ฒฝ์ฐ num_nodes๋ฅผ window_size๋ก ์ค์  (์๋๋ features)
 
- predict ์ label์ test๊ธธ์ด - window ๊ธธ์ด
 
