Revamp detector.py Into AnomalyDetector class
This purpose of this MR is to set building blocks of new command polaris detect which would produce output of the input data provided in json.
Note: Function detect_individual_events on line 266 in anomaly_detector.py needs special attention.
some background on how anomaly detector currently works.
- At First autoencoder model finds bests group of parameters(features) of data that represents its nature.
- Then we calculate the distance array by:
- First take the sum of each row and then that sum represents data of all the features at that time stamp
- Then we take difference between consecutive values and normalize them
- This is called distance array as the value represent distance between two consecutive rows
- Then we calculate events from this distance array
What does this function do?
For each parameter(feature):
- First it calculate distance array by calculating difference between consecutive values and normalizing them
- Then it calculate events for this distance array which represents data of only one particular feature
So in this way events are calculated for each parameter separately
That's okay but why we have to do it?
- First It will help in generating event reports for individual parameters, say if a user wants to detect anomalies in battery temperature alone like when it's probably going to rise above some threshold.
- It will enable us to generate graphs for each parameters.
- Most important, currently when an event is detected we don't have any clue about which parameters are responsible for this. but after detecting individual events, we can theoritically say that if 10 out of 200 parameters have shown anomaly at say saturday noon. then these 10 parameters will be most likely responsible for the anomaly detected overall.
Major Contents of MR:
Make new class AnomalyDetector to perform detector functionality
Make test cases for AnomalyDetector
Signed-off-by: Ayush Bansal email@example.com