SlowGuess/NeurIPS_2023_OCR huggingface dataset:
David Lüdke<sup>1,2</sup> Marin Biloš<sup>1,3</sup> Oleksandr Shchur<sup>1,4,†</sup> Marten Lienen<sup>1,2</sup> Stephan Gunnemann<sup>1,2</sup>
$^{1}$ School of Computation, Information and Technology, Technical University of Munich, Germany  
 $^{2}$ Munich Data Science Institute, Technical University of Munich, Germany  
 $^{3}$ Machine Learning Research, Morgan Stanley, United States  
 $^{4}$ Amazon Web Services, Germany  
{d.luedke, m.bilos, o.shchur, m.lienen, s.guennemann}@tum.de
Autoregressive neural networks within the temporal point process (TPP) framework have become the standard for modeling continuous-time event data. Even though these models can expressively capture event sequences in a one-step-ahead fashion, they are inherently limited for long-term forecasting applications due to the accumulation of errors caused by their sequential nature. To overcome these limitations, we derive ADD-THIN, a principled probabilistic denoising diffusion model for TPPs that operates on entire event sequences. Unlike existing diffusion approaches, ADD-THIN naturally handles data with discrete and continuous components. In experiments on synthetic and real-world datasets, our model matches the state-of-the-art TPP models in density estimation and strongly outperforms them in forecasting.
Many machine learning applications involve the analysis of continuous-time data, where the number of events and their times are random variables. This data type arises in various domains, including healthcare, neuroscience, finance, social media, and seismology. Temporal point processes (TPPs) provide a sound mathematical framework to model such event sequences, where the main problem is finding a parametrization that can capture the seasonality and complex interactions (e.g., excitation and inhibition) within point processes.
Traditional TPP models [17, 20] employ simple parametric forms, limiting their flexibility to capture the intricacies of arbitrary TPPs. In recent years, various neural TPPs have been proposed (see [43] for an overview) that capture complex event interactions in an autoregressive manner,
Figure 1: Proposed noising and denoising process for ADD-THIN. (Left) Going from step  $n - 1$  to step  $n$ , we add and remove some points at random. (Right) Given  $t^{(n)}$  and  $t^{(0)}$  we know the intensity of points at step  $n - 1$ . We approximate this intensity with our model, which enables sampling new sequences.
Code is available at https://www.cs.cit.tum.de/daml/add-thin
†Work done while at the Technical University of Munich.
often using recurrent neural networks (RNN) or transformer architectures. While autoregressive models are expressive and have shown good performance for one-step-ahead prediction, their suitability for forecasting remains limited due to the accumulation of errors in sequential sampling.
We propose to take a completely different approach: instead of autoregressive modeling, we apply a generative diffusion model, which iteratively refines entire event sequences from noise. Diffusion models [18, 45] have recently shown impressive results for different data domains, such as images [15, 18, 25], point clouds [31, 32], text [27] and time-series [1, 3, 24, 46]. But how can we apply diffusion models to TPPs? We cannot straightforwardly apply existing Gaussian diffusion models to learn the mapping between TPPs due to the particular requirements that must be met, namely, the randomness in the number of events and the strictly positive arrival times.
We present a novel diffusion-inspired model for TPPs that allows sampling entire event sequences at once without relying on a specific choice of a parametric distribution. Instead, our model learns the probabilistic mapping from complete noise, i.e., a homogeneous Poisson process (HPP), to data. More specifically, we learn a model to reverse our noisiging process of adding (superposition) and removing (thinning) points from the event sequence by matching the conditional inhomogeneous denoising intensity  $\lambda_{n-1}(t \mid t^{(0)}, t^{(n)})$  as presented in Figure 1. Thereby, we achieve a natural way to generate sequences with varying numbers of events and expressively model arbitrary TPPs. In short, our contributions are as follows:
- We connect diffusion models with TPPs by introducing a novel model that naturally handles the discrete and continuous nature of point processes.
- We propose a model that is flexible and permits parallel and closed-form sampling of entire event sequences, overcoming common limitations of autoregressive models.
- We show that our model matches the performance of state-of-the-art TPP models in density estimation and outperforms them in forecasting.
2.1 Temporal point processes (TPPs)
Temporal point processes (TPPs) [8, 9] are stochastic processes that define a probability distribution over event sequences whose number of points (events)  $K$  and their locations (arrival times)  $t_i$  are random. A realization of a TPP can be represented as a sequence of strictly increasing arrival times:  $\pmb{t} = (t_1, \dots, t_K)$ ,  $0 < t_1 < \dots < t_K \leq T$ . Viewing a TPP as a counting process, we can equivalently represent a TPP realization by a counting measure  $N(t) = \sum_{i}^{K} \mathbb{I}(t_i \leq t)$ , for  $t \in [0, T]$ . The intensity characterizing a TPP can be interpreted as the expected number of events per unit of time and is defined as:
$$
\lambda (t \mid \mathcal {H} _ {t}) = \lim  _ {\Delta t \downarrow 0} \frac {\mathbb {E} [ N (t + \Delta t) - N (t) \mid \mathcal {H} _ {t} ]}{\Delta t}, \tag {1}
$$
where  $\mathcal{H}_t = \{t_i : t_i < t\}$  is the event history until time  $t$ , which acts as a filtration to the process.
TPPs have a number of convenient theoretical properties, two of which will be central to our derivation of a noising process for TPPs later in the paper. The first property is superposition: If we combine events generated by TPPs with intensities  $\lambda_1(t)$  and  $\lambda_{2}(t)$ , the resulting event sequence will again follow a TPP, but now with intensity  $\lambda_1(t) + \lambda_2(t)$ . Conversely, randomly removing each event generated by a TPP process with intensity  $\lambda (t)$  with probability  $p$  is known as independent thinning. This is equivalent to sampling from a TPP with intensity  $(1 - p)\lambda (t)$  [9].
Poisson process. A (in)homogeneous Poisson process is the simplest class of TPPs, where the rate of event occurrence is independent of the history. Then the number of points on  $[0,T]$  follows a Poisson distribution with rate  $\Lambda (T) = \int_0^T\lambda (t)\mathrm{d}t$ . In the context of our model, the Poisson process with a constant intensity on  $[0,T]$ , called homogeneous Poisson Process (HPP), represents the noise distribution. Even though Poisson processes can model seasonality, i.e., time-varying rates of event occurrence, they assume the events to be independent and do not capture the exciting or inhibiting behavior present in the real world, e.g., a large earthquake increasing the likelihood of observing other earthquakes soon after.
Conditional intensity. Most TPP models leverage the conditional intensity function  $\lambda(t \mid \mathcal{H}_t)$  or equivalently the conditional density  $p(t \mid \mathcal{H}_t)$  to overcome the independence of points limitation of an inhomogeneous Poisson process. Historically, these intensity models were parameterized using hand-crafted functions [17, 20], whereas now, it is more common to use neural networks for learning intensities from data [12, 33, 41]. While the conditional intensity provides a general framework to model TPPs, sampling from these models is inherently autoregressive.
2.2 Denoising diffusion probabilistic models
Diffusion models [18, 45] are a class of latent variable models that learn a generative model to reverse a fixed probabilistic noising process  $\pmb{x}_0 \rightarrow \pmb{x}_1 \rightarrow \dots \rightarrow \pmb{x}_N$ , which gradually adds noise to clean data  $\pmb{x}_0$  until no information remains, i.e.,  $\pmb{x}_N \sim p(\pmb{x}_N)$ . For continuous data, the forward (noising) process is usually defined as a fixed Markov chain  $q(\pmb{x}_n \mid \pmb{x}_{n-1})$  with Gaussian transitions. Then the Markov chain of the reverse process is captured by approximating the true posterior  $q(\pmb{x}_{n-1} \mid \pmb{x}_0, \pmb{x}_n)$  with a model  $p_\theta(\pmb{x}_{n-1} \mid \pmb{x}_n)$ . Ultimately, sampling new realizations  $\pmb{x}_0$  from the modeled data distribution  $p_\theta(\pmb{x}_0) = \int p(\pmb{x}_N) \prod_{n=1}^N p_\theta(\pmb{x}_{n-1} \mid \pmb{x}_n) \, \mathrm{d}\pmb{x}_1 \ldots \pmb{x}_N$  is performed by starting with a sample from pure noise  $\pmb{x}_N \sim p(\pmb{x}_N)$  and gradually denoising it with the learned model over  $N$  steps  $\pmb{x}_N \rightarrow \pmb{x}_{N-1} \rightarrow \dots \rightarrow \pmb{x}_0$ .
3 ADD-THIN
In the following, we derive a diffusion-like model for TPPs—ADD-THIN. The two main components of this model are the forward process, which converts data to noise (noising), and the reverse process, which converts noise to data (denoising). We want to emphasize again that existing Gaussian diffusion models [18, 45] are not suited to model entire event sequences, given that the number of events is random and the arrival times are strictly positive. For this reason, we will derive a new noising and denoising process (Sections 3.1 & 3.2), present a learnable parametrization and appropriate loss to approximate the posterior (Section 3.3) and introduce a sampling procedure (Sections 3.4 & 3.5).
3.1 Forward process - Noising
Let  $\pmb{t}^{(0)} = (t_1,\dots ,t_K)$  denote an i.i.d. sample from a TPP (data process) with  $T = 1$  specified by the unknown (conditional) intensity  $\lambda_0$ . We define a forward noisin process as a sequence of TPPs that start with the true intensity  $\lambda_0$  and converge to a standard HPP, i.e.,  $\lambda_0\rightarrow \lambda_1\rightarrow \dots \rightarrow \lambda_N$ :
$$
\lambda_ {n} (t) = \underbrace {\alpha_ {n} \lambda_ {n - 1} (t)} _ {\text {(i) T h i n}} + \underbrace {(1 - \alpha_ {n}) \lambda_ {\mathrm {H P P}}} _ {\text {(i i) A d d}}, \tag {2}
$$
where  $1 > \alpha_{1} > \alpha_{2} > \dots >\alpha_{N} > 0$  and  $\lambda_{\mathrm{HPP}}$  denotes the constant intensity of an HPP. Equation 2 corresponds to a superposition of (i) a process  $\lambda_{n - 1}$  thinned with probability  $1 - \alpha_{n}$  (removing old points), and (ii) an HPP with intensity  $(1 - \alpha_{n})\lambda_{\mathrm{HPP}}$  (adding new points).
Property (Stationary intensity). For any starting intensity  $\lambda_0$ , the intensity function  $\lambda_N$  given by Equation 2 converges towards  $\lambda_{\mathrm{HPP}}$ . That is, the noised TPP will be an HPP with  $\lambda_{\mathrm{HPP}}$ .
Proof. In Appendix B.1 we show that, given  $\lambda_0$  and Equation 2,  $\lambda_{n}$  is given by:
$$
\lambda_ {n} (t) = \bar {\alpha} _ {n} \lambda_ {0} (t) + (1 - \bar {\alpha} _ {n}) \lambda_ {\mathrm {H P P}}, \tag {3}
$$
where  $\bar{\alpha}_n = \prod_j^n\alpha_j$  . Since  $\prod_j^N\alpha_j\to 0$  as  $N\to \infty$  , thus  $\lambda_N(t)\rightarrow \lambda_{\mathrm{HPP}}$
If all  $\alpha_{n}$  are close to 1, each consecutive realization will be close to the one before because we do not remove a lot of original points, nor do we add many new points. And if we have enough steps, we will almost surely converge to the HPP. Both of these properties will be very useful in training a generative model that iteratively reverses the forward noising process.
But how can we sample points from  $\lambda_{n}$  if we do not have access to  $\lambda_0$ ? Since we know the event sequence  $\pmb{t}^{(0)}$  comes from a true process which is specified with  $\lambda_0$ , we can sample from a thinned process  $\bar{\alpha}_n\lambda_0(t)$ , by thinning the points  $\pmb{t}^{(0)}$  independently with probability  $1 - \bar{\alpha}_{n}$ . This shows that even though we cannot access  $\lambda_0$ , we can sample from  $\lambda_{n}$  by simply thinning  $\pmb{t}^{(0)}$  and adding new points from an HPP.
Posterior intensity:  $\lambda_{n - 1}(t\mid t^{(0)},t^{(n)})$
Figure 2: (Left) Illustration of all possible disjoint sets that we can reach in our forward process going from  $\pmb{t}^{(0)}$  to  $\pmb{t}^{(n)}$  through  $\pmb{t}^{(n-1)}$ . (Right) Posterior intensity describing the distribution of  $\pmb{t}^{(n-1)} \mid \pmb{t}^{(0)}, \pmb{t}^{(n)}$ , where each subset  $\mathbf{B}-\mathbf{E}$  can be generated by sampling from the intensity functions.
To recap, given a clean sequence  $\pmb{t}^{(0)}$ , we obtain progressively noisier samples  $\pmb{t}^{(n)}$  by both removing original points from  $\pmb{t}^{(0)}$  and adding new points at random locations. After  $N$  steps, we reach a sample corresponding to an HPP—containing no information about the original data.
3.2 Reverse process - Denoising
To sample realizations  $t \sim \lambda_0$  starting from  $\pmb{t}^{(N)} \sim \lambda_{HPP}$ , we need to learn to reverse the Markov chain of the forward process, i.e.,  $\lambda_N \rightarrow \dots \rightarrow \lambda_0$ , or equivalently  $\pmb{t}^{(N)} \rightarrow \dots \rightarrow \pmb{t}^{(0)}$ . Conditioned on  $\pmb{t}^{(0)}$ , the reverse process at step  $n$  is given by the posterior  $q(\pmb{t}^{(n-1)} \mid \pmb{t}^{(0)}, \pmb{t}^{(n)})$ , which is an inhomogeneous Poisson process for the chosen forward process (Section 3.1). Therefore, the posterior can be represented by a history-independent intensity function  $\lambda_{n-1}(t \mid \pmb{t}^{(0)}, \pmb{t}^{(n)})$ .
As the forward process is defined by adding and thinning event sequences, the points in the random sequence  $\pmb{t}^{(n-1)}$  can be decomposed into disjoint sets of points based on whether they are also in  $\pmb{t}^{(0)}$  or  $\pmb{t}^{(n)}$ . We distinguish the following cases: points in  $\pmb{t}^{(n-1)}$  that were kept from 0 to  $n$  (B), points in  $\pmb{t}^{(n-1)}$ , that were kept from 0 to  $n-1$  but thinned at the  $n$ -th step (C), added points in  $\pmb{t}^{(n-1)}$  that are thinned in the  $n$ -th step (D) and added points in  $\pmb{t}^{(n-1)}$  that are kept in the  $n$ -th step (E). Since the sets B-E are disjoint, the posterior intensity is a superposition of the intensities of each subsets of  $\pmb{t}^{(n-1)}$ :  $\lambda_{n-1}(t \mid \pmb{t}^{(0)}, \pmb{t}^{(n)}) = \lambda^{(B)}(t) + \lambda^{(C)}(t) + \lambda^{(D)}(t) + \lambda^{(E)}(t)$ .
To derive the intensity functions for cases B-E, we additionally define the following helper sets: A the points  $\pmb{t}^{(0)} \setminus \pmb{t}^{(n-1)}$  that were thinned until  $n-1$  and F the points  $\pmb{t}^{(n)} \setminus \pmb{t}^{(n-1)}$  that have been added at step  $n$ . The full case distinction and derived intensities are further illustrated in Figure 2. In the following paragraphs, we derive the intensity functions for cases B-E:
Case B: The set  $\pmb{t}^{(B)}$  can be formally defined as  $\pmb{t}^{(0)} \cap \pmb{t}^{(n)}$  since  $(\pmb{t}^{(0)} \cap \pmb{t}^{(n)}) \setminus \pmb{t}^{(n-1)} = \emptyset$  almost surely. This is because adding points at any of the locations  $t \in \pmb{t}^{(0)} \cap \pmb{t}^{(n)}$  carries zero measure at every noisig step. Hence, given  $\pmb{t}^{(0)} \cap \pmb{t}^{(n)}$  the intensity can be written as a sum of Dirac measures:  $\lambda^{(B)}(t) = \sum_{t_i \in (\pmb{t}^{(0)} \cap \pmb{t}^{(n)})} \delta_{t_i}(t)$ . Similar to how the forward process generated  $\pmb{t}^{(B)}$  by preserving some points from  $\pmb{t}^{(0)}$ , sampling from the reverse process preserves points from  $\pmb{t}^{(n)}$ .
Case C: Given  $\pmb{t}^{(A\cup C)} = \pmb{t}^{(0)}\setminus \pmb{t}^{(n)},\pmb{t}^{(C)}$  can be found by thinning and consists of points that were kept by step  $n - 1$  and removed at step  $n$ . Using the thinning of Equations 2 and 3, we know the probability of a point from  $t^{(0)}$  being in  $t^{(C)}$  and  $\pmb{t}^{(A\cup C)}$  is  $\bar{\alpha}_{n - 1}(1 - \alpha_n)$  and  $1 - \bar{\alpha}_n$ , respectively. Since we already know  $\pmb{t}^{(B)}$  we can consider the probability of finding a point in  $t^{(C)}$ , given  $t^{(A\cup C)}$  which is equal to  $\frac{\bar{\alpha}_{n - 1} - \bar{\alpha}_n}{1 - \bar{\alpha}_n}$ . Consequently,  $\lambda^{(C)}(t)$  is given as a thinned sum of Dirac measures over  $t^{(A\cup C)}$  (cf., Figure 2).
Case D: The set  $\pmb{t}^{(D)}$  contains all points  $t \notin (\pmb{t}^{(0)} \cup \pmb{t}^{(n)})$  that were added until step  $n - 1$  and thinned at step  $n$ . Again using Equations 2 and 3, we can see that these points were added with intensity  $(1 - \bar{\alpha}_{n-1})\lambda_{HPP}$  and then removed with probability  $\alpha_n$  at the next step. Equivalently, we can write down the intensity that governs this process as  $\lambda^{(D)}(t) = (1 - \bar{\alpha}_{n-1})(1 - \alpha_n)\lambda_{HPP}$ , i.e., sample points from an HPP and thin them to generate a sample  $\pmb{t}^{(D)}$ .
Figure 3: Architecture of our model predicting  $\pmb{t}_0$  from  $\pmb{t}_n$ .
Case E: The set  $\pmb{t}^{(E)}$  can be found by thinning  $\pmb{t}^{(E\cup F)} = \pmb{t}^{(n)}\setminus \pmb{t}^{(0)}$  and contains the points that were added by step  $n - 1$  and then kept at step  $n$ . The processes that generated  $\pmb{t}^{(E)}$  and  $\pmb{t}^{(F)}$  are two independent HPPs with intensities  $\lambda^{(E)} = (1 - \bar{\alpha}_{n - 1})\alpha_n\lambda_{HPP}$  and  $\lambda^{(F)} = (1 - \alpha_{n})\lambda_{HPP}$ , respectively, where  $\lambda^{(E)}(t)$  is derived in a similar way to  $\lambda^{(D)}(t)$ . Since  $\pmb{t}^{(E)}$  and  $\pmb{t}^{(F)}$  are independent HPPs and we know  $\pmb{t}^{(E\cup F)}$ , the number of points in  $\pmb{t}^{(E)}$  follows a Binomial distribution with probability  $p = \frac{\lambda^{(E)}}{\lambda^{(E)} + \lambda^{(F)}}$  (see Appendix B.2 for details). That means we can sample  $\pmb{t}^{(E)}$  given  $\pmb{t}^{(n)}$  and  $\pmb{t}^{(0)}$  by simply thinning  $\pmb{t}^{(E\cup F)}$  with probability  $1 - p$  and express the intensity as a thinned sum of Dirac functions (cf., Figure 2).
For sequences of the training set, where  $\pmb{t}^{(0)}$  is known, we can compute these intensities for all samples  $\pmb{t}^{(n)}$  and reverse the forward process. However,  $\pmb{t}^{(0)}$  is unknown when sampling new sequences. Therefore, similarly to the denoising diffusion approaches [18], in the next section, we show how to approximate the posterior intensity, given only  $\pmb{t}^{(n)}$ . Further, in Section 3.4, we demonstrate how the trained neural network can be leveraged to sample new sequences  $\pmb{t} \sim \lambda_0$ .
3.3 Parametrization and training
In the previous section we have derived the intensity  $\lambda_{n - 1}(t\mid t^{(0)},t^{(n)})$  of the posterior  $q(\pmb{t}^{(n - 1)}\mid \pmb{t}^{(0)},\pmb{t}^{(n)})$  for the reverse process, i.e., the intensity of points at step  $n - 1$  given  $\pmb{t}^{(n)}$  and  $\pmb{t}^{(0)}$ . Now we want to approximate this posterior using a model  $p_{\theta}(\pmb{t}^{(n - 1)}\mid \pmb{t}^{(n)},n)$  to learn to sample points  $\pmb{t}^{(n - 1)}$  given only  $\pmb{t}^{(n)}$ . As we are only missing information about  $\pmb{t}^{(0)}$  we will learn to model  $\lambda^{(B)}(t)$  and  $\lambda^{(A\cup C)}(t)$  to approximate  $\hat{\pmb{t}}^{(0)}\approx \pmb{t}^{(0)}$  (cf., Figure 3) for each  $n$  and then have access to the full posterior intensity from Section 3.2 to reverse the noising process.
Sequence embedding. To condition our model on  $\pmb{t}^{(n)}$  and  $n$  we propose the following embeddings. We use a sinusoidal embedding [47] to embed the diffusion time  $n$ . Further, we encode each arrival time  $t_i \in \pmb{t}^{(n)}$  and inter-event time  $\tau_{i} = t_{i} - t_{i - 1}$ , with  $t_0 = 0$ , to produce a temporal event embedding  $e_i \in \mathbb{R}^d$  by applying a sinusoidal embedding [47]. Then we leverage a three-layered 1D-Convolutional Neural Network (CNN) with circular padding, dilation, and residual connections to compute a context embedding  $c_{i} \in \mathbb{R}^{d}$ . Compared to attention and RNN-based encoders, the CNN is computationally more efficient and scales better with the length of event sequences while allowing us to capture long-range dependencies between the events. Finally, a global sequence embedding  $\overline{c}$  is generated by a mean aggregation of the context embeddings.
Posterior approximation. The posterior defining  $\pmb{t}^{(D)}$  is independent of  $\pmb{t}^{(0)}$  and  $\pmb{t}^{(n)}$  and can be sampled from directly. The set  $\pmb{t}^{(B)}$  corresponds to those points that were kept from  $\pmb{t}^{(0)}$  until the  $n$ -th step. Since all of these points are also included in  $\pmb{t}^{(n)}$  we specify a classifier  $g_{\theta}(e_i, c_i, n)$  with an MLP that predicts which points from  $\pmb{t}^{(n)}$  belong to  $\pmb{t}^{(0)}$ . As  $\pmb{t}^{(0)}$  is known during training, this is a standard classification setting. We use the binary cross entropy (BCE) loss  $\mathcal{L}_{\mathrm{BCE}}$  to train  $g_{\theta}$ . Note that classifying  $\pmb{t}^{(B)}$  from  $\pmb{t}^{(n)}$  simultaneously predicts  $\pmb{t}^{(n)} \setminus \pmb{t}^{(0)} = \pmb{t}^{(E \cup F)}$ . Therefore we can subsequently attain  $\pmb{t}^{(E)}$  by thinning  $\pmb{t}^{(E \cup F)}$  as explained in Section 3.2.
To sample points  $t^{(C)}$  we have to specify the intensity function  $\lambda^{(A\cup C)}(t)$  that will be thinned to attain  $t^{(C)}$  (cf., Section 3.2). As  $\lambda^{(A\cup C)}(t)$  is a mixture of Dirac functions we use an unnormalized mixture of  $H$  weighted and truncated Gaussian density functions  $f$  on  $[0,T]$  to parameterize the
inhomogeneous intensity:
$$
\lambda_ {\theta} ^ {(A \cup C)} (t) = K \sum_ {j = 1} ^ {H} w _ {j} f (t; \mu_ {j}, \sigma_ {j}), \tag {4}
$$
where  $w_{j} = \mathrm{Softplus}(\mathrm{MLP}_{w}([n,\overline{\mathbf{c}}])$ ,  $\mu_{j} = \mathrm{Sigmoid}(\mathrm{MLP}_{\mu}([n,\overline{\mathbf{c}}]))$  and  $\sigma_{j} = \exp(-|\mathrm{MLP}_{\sigma}([n,\overline{\mathbf{c}}])|)$  are parameterized by MLPs with two layers, a hidden dimension of  $d$  and a ReLU activation. Note that the Gaussian function is the standard approximation of the Dirac delta function and can, in the limit  $\sigma \to 0$ , perfectly approximate it. We include  $K$ , the number of points in  $t^{(n)}$ , in the intensity to more directly model the number of events. Then  $\lambda_{\theta}^{(A\cup C)}(t)$  is trained to match samples  $t^{(A\cup C)} \sim \lambda^{(A\cup C)}$  by minimizing the negative log-likelihood (NLL):
$$
\mathcal {L} _ {\mathrm {N L L}} = - \log p (\boldsymbol {t} ^ {(A \cup C)}) = - \sum_ {t _ {i} \in \boldsymbol {t} ^ {(A \cup C)}} \log \lambda_ {\theta} ^ {(A \cup C)} \left(t _ {i}\right) + \int_ {0} ^ {T} \lambda_ {\theta} ^ {(A \cup C)} (t) \mathrm {d} t. \tag {5}
$$
Thanks to the chosen parametrization, the integral term in  $\mathcal{L}_{\mathrm{NLL}}$  can be efficiently computed in any deep-learning framework using the 'erf' function, without relying on Monte Carlo approximation. We present an overview of our model architecture to predict  $t^{(0)}$  from  $t^{(n)}$  in Figure 3.
Training objective. The full model is trained to minimize  $\mathcal{L} = \mathcal{L}_{\mathrm{NLL}} + \mathcal{L}_{\mathrm{BCE}}$ . During training, we do not have to evaluate the true posterior or sample events from any of the posterior distributions. Instead, we can simply sample  $n$  and subsequently  $\pmb{t}^{(n)}$  and minimize  $\mathcal{L}$  for  $\pmb{t}^{(n)}$ . Interestingly, in Appendix A, we show that  $\mathcal{L}$  is equivalent to the Kullback-Leibler (KL) divergence between the approximate posterior  $p_{\theta}(t^{(n-1)} \mid t^{(n)}, n)$  and the true posterior  $q(t^{(n-1)} \mid t^{(0)}, t^{(n)})$ . Ultimately, this shows that optimizing the evidence lower bound (ELBO) of the proposed model boils down to simply learning a binary classification and fitting an inhomogeneous intensity.
3.4 Sampling