arunppsg / TadGAN

Code for the paper "TadGAN: Time Series Anomaly Detection Using Generative Adversarial Networks"
MIT License
153 stars 34 forks source link

Problem running the model #2

Closed aleflabo closed 3 years ago

aleflabo commented 3 years ago

Hi,

Thanks for the translation of TadGan into pytorch. I'm trying to run the code present in this github just running:

python main.py

and I'm having the following error

Traceback (most recent call last):
  File "main.py", line 251, in <module>
    anomaly_detection.test(test_loader, encoder, decoder, critic_x)
  File "/content/drive/MyDrive/TadGAN/anomaly_detection.py", line 27, in test
    find_scores(y_true, y_predict)
  File "/content/drive/MyDrive/TadGAN/anomaly_detection.py", line 131, in find_scores
    precision = tp / (tp + fp)
ZeroDivisionError: division by zero

what could be problem causing this error?

In addition I'd try other dataset mentioned in the TadGan paper, like MSL for example. Is that possible with the code already present?

Thanks in advance.

Alessandro

arunppsg commented 3 years ago

Hi Alessandro,

The error occurs when the model makes all prediction as negative. One reason is that the dataset here exchange-2_cpc_results.csv itself has only one or two positive point and the model might fails to detect it. You may checkout other numenta dataset for more details.

Yes, you can reuse the code for other dataset. You need to retrain the model. See here on how to use it for other dataset.

Thanks!