microsoft / anomalydetector

SR-CNN
MIT License
257 stars 70 forks source link

Extend Series #11

Open RNKuhns opened 4 years ago

RNKuhns commented 4 years ago

The accompanying paper (https://arxiv.org/pdf/1906.03821.pdf) notes the SR part of the algorithm is extending the series by taking the gradient between the last observed point and the 'm' prior points.

The extend_series method to the SpectralResidual class is calculating the extension to the series as:

extension = [SpectralResidual.predict_next(values[-look_ahead - 2:-1])] * extend_num

The -look_ahead-2:-1 slice is passing the 6th to last to 2nd to last values to the predict_next method. This seems to stand in constrast to formula 8 in the paper, that indicates the average gradient used in the prediction is calculated by comparing the last observation with the prior 5 observations.

Wouldn't the predict_next method be comparing the 2nd to last value to the its prior five values as coded?

It seems like values[-look_ahead - 1:] would fit more with the description in the paper by passing the last observed value and the prior 5 values to the function.

guinao commented 4 years ago

The value at the last position is to be detected, so its value is not used to extend the series. The predict_next method uses value before it to predict a value for the last position.