Skip to content

Files

Latest commit

d9b74b0 · Dec 16, 2023

History

History

lstm_ad

LSTM-AD

Citekey MalhotraEtAl2015Long
Source code own
Learning type semi-supervised
Input dimensionality multivariate

Dependencies

  • python 3
  • pytorch

Notes

LSTM-AD outputs anomaly scores for windows. The results require post-processing. The scores for each point can be assigned by aggregating the anomaly scores for each window the point is included in.

You can use the following code snippet for the post-processing step in TimeEval (default parameters directly filled in from the source code):

from timeeval.utils.window import ReverseWindowing
# post-processing for LSTM-AD
def post_lstm_ad(scores: np.ndarray, args: dict) -> np.ndarray:
    window_size = args.get("hyper_params", {}).get("window_size", 30)
    prediction_window_size = args.get("hyper_params", {}).get("prediction_window_size", 1)
    return ReverseWindowing(window_size=window_size + prediction_window_size).fit_transform(scores)