omitakahiro / hawkes Goto Github PK
View Code? Open in Web Editor NEWa python package for simulation and inference of Hawkes processes.
License: MIT License
a python package for simulation and inference of Hawkes processes.
License: MIT License
Hi,
I discovered today you're nice package for Hawkes process and I'm trying to use it. However, for my purposes, I need to simulate and estimate very long time series, e.g. with a baseline = 1 , branching ratio almost critical = 0.99 and simulation interval of order of 2e6 (or even grater if possible...). I founded that, on simulation interval smaller than the ones I'm interested in and in the case of power law kernel, you're ibrary performs better (in terms of simulationtime) than tick (https://x-datainitiative.github.io/tick/index.html). However, it seems that there's an upper bound on the number of points that can be simulated, 1e6 + 1 I would say. Is there any way to change it?
Moreover, I was wondering whther in both the simulation part and in the estimaiton part you used or not the approximation of the power law kernel introduced in https://link.springer.com/article/10.1140/epjb/e2013-40107-3 .
Finally, I wanted to ask whther is possible to simulate and fit multiple instances from the same system and which papers, more or less, you referred to in the library.
Thank you so much
ModuleNotFoundError: No module named 'Hawkes.BasisFunction'
So I change it to from Hawkes.tools.BasisFunction import loglinear_COS
then it showed
AttributeError: 'loglinear_COS' object has no attribute 'M_BF'
Then I change plot function to plt.plot(x,loglinear.A[:,i],lt[i])
Are these changes correct?
Can I understand the log-linear baseline as the co-variates that will influence the occurence of the event?
Then in the patient example(how different kinds of medical activities excite each other and the chance of getting ill), can i describe the heterogeneity between patients with the log linear form of baseline intensity? Thx!
Dear Author,
I am interested in Hawkes package.
But I don't know how can I use the package, Might you give more detail instructions, please?
Thank you so much.
Best Regards,
Ruda
I am interested in mutually exciting processes and I was wondering if you have a package for multivariate hawkes process
Hi,
I met a troublesome issue. My event sequence is relatively long (with the length of 6000 that is split into 169 sub-intervals). The program generates a warning:
/opt/anaconda3/envs/env-37/lib/python3.9/site-packages/Hawkes/model.py:643: RuntimeWarning: overflow encountered in multiply
Int = Int + alpha[i] * ( np.exp( -beta[i] * x1 ) - np.exp( -beta[i] * x2 ) )
/opt/anaconda3/envs/env-37/lib/python3.9/site-packages/Hawkes/model.py:655: RuntimeWarning: overflow encountered in multiply
dInt[('alpha',i)] = np.exp( -beta[i] * x1 ) - np.exp( -beta[i] * x2 )
/opt/anaconda3/envs/env-37/lib/python3.9/site-packages/Hawkes/model.py:656: RuntimeWarning: overflow encountered in multiply
dInt[('beta',i) ] = alpha[i] * ( - x1 * np.exp( -beta[i] * x1 ) + x2 * np.exp( -beta[i] * x2 ) )
/opt/anaconda3/envs/env-37/lib/python3.9/site-packages/Hawkes/model.py:688: RuntimeWarning: overflow encountered in multiply
r = np.exp(-beta*step)
/opt/anaconda3/envs/env-37/lib/python3.9/site-packages/Hawkes/model.py:699: RuntimeWarning: overflow encountered in double_scalars
dl = { ('alpha',i):g[i]/alpha[i] for i in range(num_exp) }
/opt/anaconda3/envs/env-37/lib/python3.9/site-packages/Hawkes/model.py:709: RuntimeWarning: overflow encountered in add
g = g + alpha*beta
/opt/anaconda3/envs/env-37/lib/python3.9/site-packages/Hawkes/model.py:690: RuntimeWarning: invalid value encountered in multiply
g = g*r
It seems the resulting parameters are too large. Could you please give me some suggestions with such a situation?
My codes:
seq = [0, 0.001, 1, ...., 844.001, 844.002]
model = hk.estimator().set_kernel('exp').set_baseline('plinear')
model.fit(seq, (0, 844.1))
I would be really grateful if you could give me some help. Thanks in advance!
BTW, I also met another issue:
File "/opt/anaconda3/envs/env-37/lib/python3.9/site-packages/Hawkes/model.py", line 849, in set_data
dl,dInt = preprocess_data_nonpara_cython(Data['T'],self.bin_edge,itv[1])
when I set the baseline as 'plinear' and the kernel as 'nonpara'.
Hi, more than an issues this is rather a suggestion.
I'm trying minimize the loglikelihood function for a Hawkes process with kernel that is the sum of P exponentials. For work reasons I wrote the loss function by myself and, for each point (\mu, \alpha1, \alpha2, \beta1, \beta2) both the function value and its gradient coincide with yours. However, by using normal strategies from scipy.minimize, most of the time I find point different from the one of your estimator, especially when there are several order of magnitude of difference between the betas.
So I wanted to ask whether you use multiple guess as a starting point or what, thank you for the attention
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.