CompML / PRTS

Unofficial Python implementation of "Precision and Recall for Time Series".
https://papers.nips.cc/paper/2018/file/8f468c873a32bb0619eaeb2050ba45d1-Paper.pdf
Apache License 2.0
38 stars 4 forks source link

Assertion error when evaluating a groundtruth with zeros and ones against a prediction that is only made of zeros #76

Open nesrnesr opened 2 years ago

nesrnesr commented 2 years ago

Hello, thank you for the implementation. However, as the title indicates, when I want to assess the performance of a prediction (that says that the full time-serie is normal) compared to a ground-truth that says otherwise (contains anomalies), the code raises an assertion error. Shouldn't the score be indicating 0 since the predictions failed to predict that there are anomalies that were not detected?

sbuse commented 2 years ago

Unfortunately, I have the same issue and I think nesrnesr is absolutely right. If the prediction does not include any ones the precision should simply be zero. Luckily the case is easy to catch and fix.

sbuse commented 2 years ago

try something like ts_precision([0,1,0] , [0,0,0])

nesrnesr commented 2 years ago

@sbuse if you are in a hurry, you can use the official C++ implementation [https://github.com/IntelLabs/TSAD-Evaluator]().