Why Use K-Means for Time Series Data? (Part Two)
Posted on October 10, 2018
In "Why Use K-Means for Time Series Data? (Part One)," I give an overview of how to use different statistical functions and K-Means Clustering for anomaly detection for time series data. I recommend checking that out if you’re unfamiliar with either. In this post I will share:
- Some code showing how K-Means is used.
- Why you shouldn’t use K-Means for contextual time series anomaly detection.
Some Code Showing How It’s Used
I am borrowing the code and dataset for this portion from Amid Fish’s tutorial. Please take a look at it, it’s pretty awesome. In this example, I will show you how you can detect anomalies in EKG data via contextual anomaly detection with K-Means Clustering. A break in rhythmic EKG data is a type of collective anomaly but with it we will analyze the anomaly with respect to the shape (or context) of the data.