chickenbestlover / RNN-Time-series-Anomaly-Detection

RNN based Time-series Anomaly detector model implemented in Pytorch.
Apache License 2.0
1.2k stars 318 forks source link

[BUG]: Model saving logic is wrong #35

Closed dagap closed 4 years ago

dagap commented 4 years ago

The code seems to be doing the wrong thing:

is_best = val_loss > best_val_loss
best_val_loss = max(val_loss, best_val_loss)

best_val_loss is initialized to 1.0 and once the validation loss drops below 1.0, any further decrease will not be taken into account due to the use of max. I am not sure about the logic here but perhaps best_val_loss should be set to None or inf initially and min should be used instead of max.

chickenbestlover commented 4 years ago

Thanks for finding the bug. The code is now corrected.