hawkeslib icon indicating copy to clipboard operation
hawkeslib copied to clipboard

Exception: Convergence problem, the log likelihood did not increase

Open wildbunny opened this issue 5 years ago • 10 comments

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 avatar Aug 06 '19 10:08 wildbunny

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?

wildbunny avatar Aug 06 '19 11:08 wildbunny

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

canerturkmen avatar Aug 06 '19 11:08 canerturkmen

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

wildbunny avatar Aug 06 '19 11:08 wildbunny

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.

canerturkmen avatar Aug 06 '19 13:08 canerturkmen

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

wildbunny avatar Aug 06 '19 13:08 wildbunny

@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'.

sara-02 avatar Sep 24 '19 10:09 sara-02

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

canerturkmen avatar Sep 25 '19 07:09 canerturkmen

@canerturkmen It is a different dataset.

sara-02 avatar Sep 25 '19 08:09 sara-02

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

canerturkmen avatar Sep 25 '19 08:09 canerturkmen

@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.

wildbunny avatar Sep 25 '19 08:09 wildbunny