Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Marked Temporal Point Process — From Scratch and With NumPyro

Open In Colab

A marked TPP pairs each event time tit_i with a mark mim_i. Under the separable factorisation

λ(t,m)=λg(t)⋅f(m∣t,H),\lambda(t, m) = \lambda_g(t) \cdot f(m \mid t, \mathcal{H}),

the joint log-likelihood decomposes:

log⁡L=log⁡Lground({ti})+∑ilog⁡f(mi∣ti,Hi).\log L = \log L_\text{ground}(\{t_i\}) + \sum_i \log f(m_i \mid t_i, \mathcal{H}_i).

The mark distribution can be any NumPyro Distribution — continuous (Normal, Gamma, GPD for heavy-tailed marks), multivariate (MultivariateNormal), or discrete (Categorical). A natural use case for xtremax: marks drawn from a GeneralizedParetoDistribution to model storm-event intensities.

This notebook:

  1. From scratch — use the primitives marks_log_prob + ground-process sampler to simulate storm events with diurnal rate and GPD intensity marks.

  2. With NumPyro — jointly recover the diurnal amplitude, the GPD scale, and the GPD shape ξ\xi with NUTS.

Setup

/home/azureuser/localfiles/xtremax/.venv/bin/python: No module named pip
Note: you may need to restart the kernel to use updated packages.
/home/azureuser/localfiles/xtremax/.venv/lib/python3.13/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm

1. From Scratch: Simulated Storms

Ground process: diurnal IPP with 4 rate bins over a 24-hour window. Marks: GPD intensities whose scale tracks the time-of-day rate.

n events = 18

Events + marks overlay on top of the piecewise-constant ground intensity.

<Figure size 1000x400 with 1 Axes>

Log-likelihood decomposition sanity check

ll_joint = -48.415
ll_ground + ll_marks = -48.415
diff = 0.00e+00

2. With NumPyro: Joint Inference

Recover the diurnal amplitude and GPD shape ξ\xi with NUTS on a single observed sequence.

amplitude: posterior = 0.884 ± 0.193  (truth 0.8)
xi: posterior        = 0.131 ± 0.101  (truth 0.15)
<Figure size 900x350 with 2 Axes>

Both the diurnal amplitude and the heavy-tail shape ξ\xi are identified from only six observed sequences.