This is simple implementation of anomaly detection based on k-means clustering. URL : http://amid.fish/anomaly-detection-with-k-means-clustering
Algorithm
-
Sampling normal data (input: time series, output: segmented time series)
-
Make starting and end points zero, multiplying window functions. (input: output of 1 , output windowed segments)
-
Learn K-means clustering model.
-
Construct reconstruction model. 4-1) sampling original data. 4-2) Find closest cluster centroid of each sampled segment. 4-3) Reconstuct data with 4-2 result.
-
Decide anomaly based on reconstruction error.