This package implements FaDIn and UNHaP. FaDIn and UNHaP are inference methods for parametric Hawkes Processes (HP) with finite-support kernels, with the following features:
- Fast: computation time is low compared to other methods.
- Compatible in univariate and multivariate settings.
- Flexible: various kernel choices are implemented, with classical ones (exponential, truncated Gaussian, raised cosine) and an API to add custom kernels for inference.
- Masking: if some parameters can be fixed, the user can mask them easily.
- Smart initialization of parameters before optimization: the user can choose between
random
(purely random),moment_matching_max
(moment matching with maximum mode) andmoment_matching_mean
(moment matching with mean mode). The moment matching options are implemented for UNHaP.
FaDIn does classical Hawkes inference with gradient descent. UNHaP does Hawkes inference where the Hawkes Process is marked and mixed with a noisy Poisson process.
To install this package, make sure you have an up-to-date version of pip
.
python3 -m pip install --upgrade pip
In a dedicated Python env, run:
pip install FaDIn
git clone https://github.com/mind-inria/FaDIn.git
cd FaDIn
In a dedicated Python env, run:
pip install -e .
Contributors should also install the development dependencies in order to test and automatically format their contributions.
pip install -e ".[dev]"
pre-commit install
Before running the experiments of the FaDIn and UNHaP papers located in the experiments
directory, please install the corresponding dependencies beforehand.
pip install -e ".[experiments]"
A few illustrative examples are provided in the examples
folder of this repository, in particular:
plot_univariate_fadin
: simulate an univariate unmarked Hawkes process, infer Hawkes Process parameters using FaDIn, and plot inferred kernel.plot_multivariate_fadin
: same asplot_univariate_fadin
but in the multivariate case.plot_unhap
: simulate an univariate marked Hawkes process and a marked Poisson process, infer Hawkes Process parameters using UNHaP, ald plot inferred kernels.
If this package was useful to you, please cite it in your work:
@inproceedings{staerman2023fadin,
title={Fadin: Fast discretized inference for hawkes processes with general parametric kernels},
author={Staerman, Guillaume and Allain, C{\'e}dric and Gramfort, Alexandre and Moreau, Thomas},
booktitle={International Conference on Machine Learning},
pages={32575--32597},
year={2023},
organization={PMLR}
}
@inproceedings{loison2025unhap,
title={UNHaP: Unmixing Noise from Hawkes Process},
author={Loison, Virginie and Staerman, Guillaume and Moreau, Thomas},
booktitle={International Conference on Artificial Intelligence and Statistics},
pages={1342--1350},
year={2025}
}