Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
konqr opened this issue Dec 1, 2023 · 1 comment
Closed

Comments

@konqr
Copy link

konqr commented Dec 1, 2023

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
Copy link
Author

konqr commented Dec 1, 2023

Found the method threshold_negative_intensity()

@konqr konqr closed this as completed Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant