GithubHelp home page GithubHelp logo

hawkes's People

Contributors

stmorse avatar sumau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hawkes's Issues

README's blog post link is dead

Hello,

You appear to have forgotten to link the blog post in the README.

Current markdown is [this blog post]()

Thanks,
David

Need to add 'horizon' for EM method in MHP.py.

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.

The examples from README.md fail with Python 3.10, Numpy 1.25.2

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.

Question about one line of the implementation

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,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.