hildensia / bayesian_changepoint_detection

Methods to get the probability of a changepoint in a time series.
MIT License
670 stars 213 forks source link

Zeros in the log function for online detection #14

Open aimeeh0527 opened 6 years ago

aimeeh0527 commented 6 years ago

I ran the entire sample code and got an error on the log function for online detection. It says "divide by zero encountered in log". I constantly got this error for the random time series or my own time series data. I am wondering why there are zeros and how to avoid them. Could you please take a look when you get some time? Thank you so much!

hildensia commented 6 years ago

Can you explain a bit more in detail what you tried. I just run the notebook without any problems.

aimeeh0527 commented 6 years ago

Thanks for the reply! I ran the code in Python 3, and here is the RuntimeWarning I got from the online detection: image

Then the graphs turned out a bit weird. The second graph does not have an all-black background (I believe that indicates a probability of 0), and the third graph seems missing one or two changepoints. image

For the offline detection everything went well. For the online one I am sure I didn't make any change on the code so I am confused why I got different results from yours. Thanks for looking into my problem!

hildensia commented 6 years ago

Sorry I'm quite busy. I promise to look into it at some point.

aimeeh0527 commented 6 years ago

No worries! This error had almost no effect on the results, only on the graph. And I think I almost figured out how to fix it in the numpy arrays. Thanks a ton for your time!

hedgeon commented 5 years ago

I have exactly the same problem when I run the code