X-DataInitiative / tick

Module for statistical learning, with a particular emphasis on time-dependent modelling
https://x-datainitiative.github.io/tick/
BSD 3-Clause "New" or "Revised" License
484 stars 105 forks source link

SimuHawkesMulti hangs after numpy's matrix_power #439

Closed sumau closed 4 years ago

sumau commented 4 years ago

This is a very strange bug! SimuHawkesMulti.simulate() hangs if I try to use numpy's matrix_power(). However SimuHawkesExpKernels.simulate() works fine:

import numpy as np
from tick.hawkes import SimuHawkesExpKernels, SimuHawkesMulti

n_nodes = 100
adjacency = np.eye(100,k=1) + np.eye(100,k=-1) + np.eye(100,k=2) + np.eye(100,k=-2)
nn2 = sum(sum(np.linalg.matrix_power(adjacency,2)))

hawkes = SimuHawkesExpKernels(adjacency=0.1*adjacency,
                              decays=3,
                              baseline=1*np.ones(n_nodes),
                              end_time=100,
                              verbose=True, )
# hawkes.simulate()

multi = SimuHawkesMulti(hawkes, 1)
multi.simulate()

I'm not sure if this is related but SimuHawkesMulti.simulate() also hangs if you first try to call SimuHawkesExpKernels.simulate().

PhilipDeegan commented 4 years ago

it finishes for m

python3 run.py 
/opt/py/py/lib/python3.7/site-packages/sklearn/externals/joblib/__init__.py:15: DeprecationWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.
  warnings.warn(msg, category=DeprecationWarning)
---------------------------------------------
Launching simulation using SimuHawkesMulti...
--------------------------------------------------
Launching simulation using SimuHawkesExpKernels...
Done simulating using SimuHawkesExpKernels in 4.56e-01 seconds.
Done simulating using SimuHawkesMulti in 7.09e-01 seconds.
python3 -V
Python 3.7.6
sumau commented 4 years ago

How bizarre... Maybe because I'm using python 3.6.10? Anyway I have a workaround so happy to close this bug.