X-DataInitiative/tick

how to turn on the bool threshold_negative_intensity from the python wrapper?

konqr opened this issue · 1 comments

konqr commented

Hi, I am trying to simulate a Hawkes Process using the python wrapper and since it contains some negative intensity kernels, the total intensity is sometimes going negative leading to this error:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-33-19fe5542c7ec> in <module>
      2 if True:
      3     hawkes.track_intensity(dt)
----> 4     hawkes.simulate()
      5     timestamps = hawkes.timestamps
      6 

~/.local/lib/python3.6/site-packages/tick/base/simulation/simu.py in simulate(self)
     89         """
     90         self._start_simulation()
---> 91         result = self._simulate()
     92         self._end_simulation()
     93         return result

~/.local/lib/python3.6/site-packages/tick/hawkes/simulation/simu_hawkes.py in _simulate(self)
    266                 "really want to simulate it" % self.spectral_radius())
    267 
--> 268         SimuPointProcess._simulate(self)
    269 
    270     def spectral_radius(self):

~/.local/lib/python3.6/site-packages/tick/hawkes/simulation/base/simu_point_process.py in _simulate(self)
    159 
    160         elif self.end_time is not None and self.max_jumps is None:
--> 161             self._pp.simulate(float(self.end_time))
    162 
    163         elif self.end_time is None and self.max_jumps is not None:

~/.local/lib/python3.6/site-packages/tick/hawkes/simulation/build/hawkes_simulation.py in simulate(self, *args)
    124         simulate(PP self, double run_time, ulong n_points)
    125         """
--> 126         return _hawkes_simulation.PP_simulate(self, *args)
    127 
    128     def reset(self) -> "void":

RuntimeError: Simulation stopped because intensity went negative (you could call ``threshold_negative_intensity`` to allow it)

How can I set this boolean to True from the python wrapper? Any help is highly appreciated.

konqr commented

Found the method threshold_negative_intensity()