Solved – Time Series Anomaly Detection with Python

anomaly detectioncomputational-statisticsmachine learningpythontime series

I need to implement anomaly detection on several time-series datasets. I've never done this before and was hoping for some advice. I'm very comfortable with python, so I would prefer the solution be implemented in it (most of my code is python for other parts of my work).

Description of the data:
It's monthly time-series data that has only just begun to be collected in the past 2 years or so (i.e. only 24-36 time periods). Essentially, there are several metrics being monitored on a monthly basis for several clients.

time_period    client    metric    score
01-2013        client1   metric1   100
02-2013        client1   metric1   119
01-2013        client2   metric1   50
02-2013        client2   metric2   500
...

Here's what I'm thinking: pull data into a dataframe (pandas), then calculate a rolling 6 month average for each client / metric pair. If the current time period's value exceeds some threshold based on the 6-month avg., then raise flag. The problem seems rather simple. I just want to make sure I'm taking a solid approach.

Any advice to flesh this idea out a bit would be greatly appreciated. I know the question is a bit abstract, and I apologize for that.

Best Answer

I think an approach similar to statistical process control, with control charts etc. might be useful here.

Related Question