X-DataInitiative / tick

Module for statistical learning, with a particular emphasis on time-dependent modelling
https://x-datainitiative.github.io/tick/
BSD 3-Clause "New" or "Revised" License
491 stars 108 forks source link

Simulation for HawkesConditionalLaw or HawkesCumulantMatching #480

Closed csaiedu closed 3 years ago

csaiedu commented 3 years ago

Hi I can't seem to be able after fitting HawkesConditionalLaw or HawkesCumulantMatching to simulate using SimuHawkesMulti on the resulting process, resulting in error messages. Is that the correct way to perform a prediction using simulation for those two non parametric processes?

Thank you

Mbompr commented 3 years ago

Hi,

csaiedu commented 3 years ago

Thanks for the explanation..

csaiedu commented 3 years ago

Actually for the HawkesConditionalLaw. there isn't any estimated_density() function. Assuming I fit the kernels using a power law curve fitting strategy to find parameters as per your comments "Otherwise you might use non parametric learners. I would suggest you to use HawkesConditionalLaw that has been specifically tested on power law kernels. Maybe can you then roughly estimate the powerlaw parameters by doing a linear regression in log-log space since \log( \phi(t)) = \log(\alpha) - \beta \log (t + \delta)log(ϕ(t))=log(α)−βlog(t+δ). Assuming \deltaδ is small, you can estimate correctly \alphaα and \betaβ for big values of tt and then estimate \deltaδ."

hawkes = SimuHawkes(
    kernels=[[
        HawkesKernelPowerLaw(multiplier[0], cutoff, exponent, support),
        HawkesKernelPowerLaw(multiplier[1], cutoff, exponent, support)
    ], [
        HawkesKernelPowerLaw(multiplier[2], cutoff, exponent, support),
        HawkesKernelPowerLaw(multiplier[3], cutoff, exponent, support)
    ]], baseline=[0.05, 0.05], seed=382, verbose=False)

How do I use that kernel to calculate the intensity on my own timestamps, rather than simulating one. I tried using set_intensity(own_time_stamps) but can't access the calculated intensity to be able to perform predictions.

Thank you

csaiedu commented 3 years ago

Sorry I got it,

I should use thereafter timestamps = hawkes.timestamps intensity = hawkes.tracked_intensity intensity_times = hawkes.intensity_tracked_times

to retrieve the intensity. Sorry about the trouble.

Kind regards