canerturkmen / hawkeslib

fast parameter estimation for simpler Hawkes processes
MIT License
68 stars 20 forks source link

Exception: Convergence problem, the log likelihood did not increase #14

Open wildbunny opened 5 years ago

wildbunny commented 5 years ago

I've run into this problem fitting a small MV dataset, any ideas how I might resolve it?

`import numpy as np import pandas as pd from matplotlib import pyplot as plt from hawkeslib.model.mv_exp import MultivariateExpHawkesProcess as MVHP

t = np.array([0,5.492,34.706,82.29,82.296,85.736,85.74,86.319,100.588,137.282,149.952,152.673,162.754,170.819,174.751,178.928,178.986,179.043,179.901,181.345]) c = np.array([1,1,0,1,1,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0])

mv = MVHP() mv.fit(t, c)`

wildbunny commented 5 years ago

Note, that if I change the first mark to a 0 (edit: and divide the times by 100), the problem goes away, so maybe this is related to t=0 somehow?

canerturkmen commented 5 years ago

Hi @wildbunny, can you drop a dump of the error (stack trace) here as well please?

wildbunny commented 5 years ago

python mvhawkes.py (-72.68775556214808, -72.7284425112135) Traceback (most recent call last): File "mvhawkes.py", line 10, in <module> mv.fit(t, c) File "/home/coinbox/env3.6/lib/python3.6/site-packages/hawkeslib/model/mv_exp.py", line 188, in fit ll, params, _ = mv_exp_fit_em(t, c, T, **emkwargs) File "hawkeslib/model/c/c_mv_exp.pyx", line 198, in hawkeslib.model.c.c_mv_exp.mv_exp_fit_em Exception: Convergence problem, the log likelihood did not increase

canerturkmen commented 5 years ago

It will likely take me a while to dive into it, though I wonder if it's a numerical issue. Your inter-event times range in about 5 orders of magnitude, which (in multivariate, and a tied tail exponent) often doesn't help.

wildbunny commented 5 years ago

It's possible. The same event times as a univariate model converges ok.

sara-02 commented 5 years ago

@wildbunny were you able to find any solution to your error? I am also facing the same problem with both uni/multivariate. I tried with t = t/100, that also did not work. In my case, the univariate is converging if I set the method='gd'.

canerturkmen commented 5 years ago

Hi Sara, are you working on the same data or a different one?

sara-02 commented 5 years ago

@canerturkmen It is a different dataset.

canerturkmen commented 5 years ago

Any way you can post an example case with the new data?

wildbunny commented 5 years ago

@sara-02 Not found a solution to the exception. For me this only occurs in the multivariate case, however. My event times are from real transaction data, for reference.