This repository contains:
- A discrete implementation of the Hawkes process.
- A simulation for the Hawkes process which returns the branching structure.
- A demo showing how to use this code.
- python3
- numpy
- scipy
- tick
Load tick.base.TimeFunction, Hawkes and numpy.
from tick.base import TimeFunction
from Hawkes import Hawkes
import numpy as np
The baseline and triggering kernel are defined by tick.base.TimeFunction. Both functions are defined piecewise (discrete).
For example, a power function on can be realized as
ts = np.append([0],np.logspace(-5,np.log10(np.pi),256))
ys = 0.21/(ts+0.05)**1.1
phi = TimeFunction([ts, ys], inter_mode=TimeFunction.InterConstRight, dt=1e-6)
mu = TimeFunction([ts, 5*np.ones(len(ts))], inter_mode=TimeFunction.InterConstRight, dt=1e-6)
hawkes = Hawkes(mu,phi)
The simulation returns a time sequence and the corresponding triggering relations.
t,p = hawkes.simulation(np.pi)
- Test