stmorse / hawkes Goto Github PK
View Code? Open in Web Editor NEWPython class for generation and parameter estimation of multivariate Hawkes processes
License: MIT License
Python class for generation and parameter estimation of multivariate Hawkes processes
License: MIT License
Hello,
You appear to have forgotten to link the blog post in the README.
Current markdown is [this blog post]()
Thanks,
David
Hi Steve, I have been using hawkes
library, and I found an issue regarding an availability of time horizon in EM
method.
For generating a sequence, we need to give a horizon
parameter (e.g., P.generate_seq(10)
), so that we can obtain the simulated data up to t=10. However, the EM
method does not get any information from the last event, which does not produce the right parameter estimation.
In below example, I share a case when the event happens in the early beginning of the time horizon, thus the EM
method fails by estimating parameter by only using the information until the last event.
### A single case
m = np.array([0.1])
a = np.array([[0]])
w = 1
P = MHP(mu=m, alpha=a, omega=w)
### In this example, an event appeared in a very early stage of the time horizon.
P.generate_seq(10)
Out[1]: array([[1.69135373, 0. ]])
# Since the input of the EM method is only P.data,
# it does not have any information that no event happens from [1.69, 10]
# So the predicted 'mu' value is very big (0.59124238 = 1/1.69135373)
P.EM(a, m, w, verbose=False)
Out[2]: (array([[0.]]), array([0.59124238]))
Is there any walkaround that I can put extra time_horizon
parameter to make a right parameter estimation? I think the right solution might look like this.
# Add or have a time horizon in P, so that EM algorithm can utilize a timeline after the last event.
P.time_horizon = [10]
P.EM(a, m, w, verbose=False) # or P.EM(a, m, w, time_horizon=[10], verbose=False)
Out[2]: (array([[0.]]), array([0.1]))
Thanks for effort on publicizing your work, I think your library is much more intuitive than tick
.
Just running the example:
from MHP import MHP
P = MHP()
P.generate_seq(60)
fails with:
.../hawkes/MHP.py", line 102, in generate_seq
self.data = np.array(self.data)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (14, 2) + inhomogeneous part.
Hello,
Thank you for posting this code.
I have a doubt regarding this line of code : (line 71 of MHP.py)
Istar = np.sum(lastrates) + self.omega * np.sum(self.alpha[:,uj])
, why is there the self.omega ? I'm not sure of your notation but the use would be only the np.sum(lastrates) + np.sum(self.alpha[:,uj]) , no ?
Kind regards,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.