Edge Selection for the Effective use of Piecewise-Constant Distributions as Neural Network Outputs for Event Prediction
Authors: Kevin Doran, Tom Baden
Organizations: School of Life Sciences, University of Sussex, UK · School of Engineering and Informatics, University of Sussex, UK · Institute of Ophthalmic Research, University of Tübingen, Germany
We study the output representation of a neural network used for next event prediction. We propose partitioning the time axis into a fixed set of intervals and having a neural network output a categorical distribution over them, which we map to a (mostly) piecewise-constant probability density. We present an optimization procedure that selects interval edges in order to maximize data likelihood under the representation. The representation is well suited to processes whose inter-event distribution is a mixture of smooth and sharply peaked components\unicodex2013a pattern we find common in event data recorded from real-world processes.
Figures & tables
Figure 1: Histogram of inter-event times (< 0.6 quantile) for the NYC taxi dataset ( Whong, 2014 ) .
Figure 2: The next event prediction task. Given a history of inter-event times τ1,τ2,…,τi up to the present, the task is to emit a probability distribution p(τi+1∣τi,τi−1,…) for the time until the next event, τi+1 . This paper considers a density that is piecewise-constant over bins of non-uniform width, with an exponential tail over the final infinite interval.
Figure 3: The intervals, logits and probability masses defining the categorical output.
Figure 4: Probability distributions corresponding to outputs from 3 trained models with different heads: a piecewise-constant density, a mixture of lognormals density and a softplus hazard; these are labelled as rnn-pc , rnn-logmix , and rnn-softplus , respectively. See Section 5 for model and head details. Each model is given the same input history from three datasets: Amazon, Last.fm and PUBG (datasets are introduced in Section 5.3 and histograms of inter-event times are in Section C.1 ).
Figure 5: Edge selection as a dynamic program. Choosing edges a=[a1,…,aN] (with a1=e1=0 , aN=eE ) to maximize F(a)=∑i=1N−1g(ai,ai+1) is equivalent to finding the highest-scoring path between the candidate edges E={e1,…,eE} , where the score of interval [ea,eb) is the table entry gab (a). A small candidate set is shown; in practice E is large.
Label
Stem description
Input
Layers
Heads
Embed dim.
Parameters
rnn
gated recurrent unit ( Cho et al., 2014 )
32
1
NA
64
13k
gpt-a
GPT-2 transformer ( Radford et al., 2019 )
128
2
4
16
108k
gpt-b
GPT-2 transformer
128
6
4
32
1.20M
Table 1: Model stems used in experiments. See Appendix D for implementation details. Most heads from Section 5.1 were originally studied with recurrent neural network (RNN) stems.
NLL ↓
MAE ↓
Dataset
Unit
rnn-logmix
rnn-pc
rnn-logmix
rnn-pc
Yelp airport
minutes
4.71
4.69
34.68
35.04
Yelp Mississauga
minutes
3.92
3.26
21.36
21.30
Twitter
minutes
4.04
3.02
37.23
37.34
Wikipedia
minutes
4.36
1.96
198.2
198.4
Yelp Toronto
hours
4.81
4.60
62.82
62.75
Table 2: rnn-pc and rnn-logmix evaluated on 14 real-world datasets in terms of test-set NLL and MAE. Both models share the same architecture up until the output representation. Values are means over 10 training repeats where each repeat uses a different random data split. Cells are coloured when the score difference, Δ , is statistically significant with respect to the standard errors (SE) of the means: ∣Δ∣>1.96SErnn-logmix2+SErnn-pc2 ; green when rnn-pc scores better, red when worse.
Figure 6: Left: NLL scores for rnn-pc and rnn-logmix on the MOOC dataset with jittered event times. Event times are jittered by adding Gaussian noise with standard deviation proportional to the median inter-event time, τ~ . That is, ti∗=ti+η where η∼N(0,(τ~q)2) . Five values of q are used, from 1×10−5 to 1×10−1 . Right: histograms of the MOOC dataset’s inter-event times for the two extreme values of the noise scale, q=0 and q=1×10−1 .
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
Dataset
rnn-logmix
rnn-pc
Yelp airport
4.715 ± 2.16e-02
4.685 ± 3.74e-02
Yelp Mississauga
3.916 ± 1.93e-02
3.260 ± 3.89e-02
Twitter
4.043 ± 4.44e-02
3.017 ± 7.35e-02
Wikipedia
4.364 ± 6.35e-02
1.962 ± 1.18e-01
Yelp Toronto
4.810 ± 6.27e-02
4.598 ± 6.98e-02
MOOC
1.023 ± 1.38e-01
-6.227 ± 2.90e-02
Appendix
Table 3: Confidence intervals for Table 2 ’s NLL results (from Section 6 ). The rnn-logmix and rnn-pc models evaluated in terms of test set NLL (lower is better) on 14 real-world datasets. 10 training repeats were carried out. Datasets were randomly split on each repeat. Point estimates are the mean over the trials. Variability is expressed as 95% confidence intervals calculated assuming a normal distribution of the mean: ±1.9610s , where s is the sample standard deviation.
Dataset
rnn-logmix
rnn-pc
Yelp airport
34.68 ± 7.42e-01
35.04 ± 7.75e-01
Yelp Mississauga
21.36 ± 4.65e-01
21.30 ± 5.27e-01
Twitter
37.23 ± 6.05e-01
37.34 ± 6.28e-01
Wikipedia
198.2 ± 7.39e+00
198.4 ± 7.44e+00
Yelp Toronto
62.82 ± 2.18e+00
62.75 ± 2.19e+00
MOOC
290.5 ± 4.07e+00
290.4 ± 4.08e+00
Appendix
Table 4: Confidence intervals for Table 2 ’s MAE results (from Section 6 ). The rnn-logmix and rnn-pc models evaluated in terms of test set MAE (lower is better) on 14 real-world datasets. 10 training repeats were carried out. Datasets were randomly split on each repeat. Point estimates are the mean over the trials. Variability is expressed as 95% confidence intervals calculated assuming a normal distribution of the mean: ±1.9610s , where s is the sample standard deviation.
NLL rank ↓
MAE rank ↓
Model
#
mean
#
mean
rnn-logmix
5
5.36
2
5.29
gpt-a-logmix
4
4.86
7
6.71
gpt-b-logmix
6
5.71
5
6.29
rnn-pc
2
2.14
1
5.14
gpt-a-pc
1
1.50
6
6.64
Appendix
Table 7: Mean rank of models across all 14 datasets, in terms of NLL and MAE. The scores are taken from Table 5 and Table 6 . Bold entries are the lowest (best) mean rank for each metric (i.e. per column).
NLL rank ↓
MAE rank ↓
Head
rnn
gpt-a
gpt-b
rnn
gpt-a
gpt-b
logmix
2.21
1.50
2.29
1.71
2.07
2.21
pc
2.07
1.50
2.43
1.71
2.07
2.21
nn
1.93
1.79
2.29
1.79
2.00
2.21
softplus
1.79
1.79
2.43
1.93
1.86
2.21
exp
1.64
2.21
2.14
1.79
2.14
2.07
Appendix
Table 8: Mean rank of three model stems— rnn , gpt-a and gpt-b —in terms of NLL and MAE across the 14 real-world datasets. In addition to this rank (which appears in the final row), the mean rank is also calculated (for the same datasets) by first aggregating by output head. Each row has an NLL and a MAE ranking. The scores are taken from Table 5 and Table 6 . Bold entries are the lowest (best) mean rank across the three model stems (i.e. per row, but separate for the two metrics).
NLL ↓
MAE ↓
Dataset
rnn-logmix
rnn-pc
rnn-qpc
rnn-wpc
rnn-logmix
rnn-pc
rnn-qpc
rnn-wpc
Yelp airport
4.715
4.685
4.779
4.772
34.68
35.04
35.11
35.10
Yelp Miss.
3.916
3.260
3.949
3.968
21.36
21.30
21.64
21.52
Twitter
4.043
3.017
4.089
4.173
37.23
37.34
37.54
37.50
Wiki.
4.364
1.962
4.385
5.417
198.2
198.4
198.5
211.6
Yelp Toronto
4.810
4.598
4.808
5.005
62.82
62.75
62.75
62.79
Appendix
Table 9: With rnn-logmix as a reference, the three edge selection methods are compared: rnn-wpc (equal-width), rnn-qpc (equal-quantile) and rnn-pc (maximum likelihood). All models share the same architecture up until the output representation. They are evaluated on 14 datasets in terms of test-set NLL and MAE. Values are means over 10 training repeats, where each repeat uses a random data split. Cells are coloured when the score difference to the rnn-logmix model, Δ , is statistically significant with respect to the standard errors (SE) of the means, ∣Δ∣>1.96SErnn-logmix2+SEmodel2 ; green when a model is better than rnn-logmix , red when worse.
Figure 8: NLL scores for rnn-pc and rnn-logmix on 14 datasets with jittered event times. Event times are jittered by adding Gaussian noise with standard deviation proportional to the median inter-event time, τ~ . That is, ti∗=ti+η where η∼N(0,(τ~q)2) . Five values of q are used, from 1×10−5 to 1×10−1 . Values are means over 10 repeats, where each repeat involves a new random data split and noise seed. Both models’ scores improve under lower noise, but more so for rnn-pc .
NLL ↓
MAE ↓
Dataset
rnn-pc
rnn-qpch
rnn-pch
rnn-pc
rnn-qpch
rnn-pch
Yelp airport
4.685
4.781
4.682
35.04
35.22
35.16
Yelp Mississauga
3.260
3.947
3.234
21.30
21.78
21.61
Twitter
3.017
4.089
2.998
37.34
37.55
37.37
Wikipedia
1.962
4.376
1.927
198.4
198.7
198.4
Yelp Toronto
4.598
4.805
4.646
62.75
62.76
62.77
Appendix
Table 12: Density versus hazard. A piecewise-constant hazard output paired with the rnn model is compared to the rnn-pc model. Two piecewise-constant hazard outputs are considered: rnn-qpch and rnn-pch . They differ in the edge choice method— rnn-qpch uses the equal-quantile method and rnn-pch uses the maximum likelihood method. The models are evaluated on the 14 real-world datasets in terms of test-set NLL and MAE. All models share the same architecture up until the output representation. Values are means over 10 training repeats, where each repeat uses a random data split. Cells are coloured when the score difference to the rnn-pc model, Δ , is statistically significant with respect to the standard errors (SE) of the means, ∣Δ∣>1.96SErnn-pc2+SErnn-x2 ; green when a model is better than rnn-pc , red when worse.
model
NLL ↓
MAE ↓
rnn-logmix
-0.036 ± 2.32e-03
0.954 ± 1.56e-03
gpt-a-logmix
-0.036 ± 3.75e-03
0.954 ± 2.44e-03
gpt-b-logmix
-0.035 ± 3.60e-03
0.954 ± 2.42e-03
rnn-pc
-0.029 ± 3.74e-03
0.955 ± 2.43e-03
gpt-a-pc
-0.034 ± 3.75e-03
0.954 ± 2.45e-03
gpt-b-pc
-0.031 ± 3.70e-03
0.954 ± 2.47e-03
Appendix
Table 13: Hawkes process dataset results. NLL and MAE results for all models. 10 training repeats were carried out, where variability is in the random dataset split, random model initialization and training stochasticity. Point estimates are means over the repeats, and variability is expressed as 95% confidence intervals calculated assuming a normal distribution of the mean: ±1.9610s , where s is the sample standard deviation. The Hawkes process is defined by a conditional hazard function: λ(t∣Ht)=μ+∑ti<t∑j=1Mαjβjexp−βj(t−ti) , with the parameters set as in Omi et al. (2019) to M=2,μ=0.2,α1=0.4,β1=1,α2=0.4, and β2=20 . Bold highlights the lowest (best) point estimate.
Dataset
Event type
Unit
Source
Yelp airport
Time between check-ins at McCarran International Airport.
minutes
( Lüdke et al., 2023 )
Yelp Mississauga
Time between check-ins at businesses in Mississauga.
minutes
( Lüdke et al., 2023 )
Twitter
Time between tweets of a single user.
minutes
( Lüdke et al., 2023 )
Wikipedia
Time between edits of the site’s top edited pages.
minutes
( Shchur et al., 2020 )
Yelp Toronto
Time between check-ins at restaurants in Toronto.
hours
( Shchur et al., 2020 )
MOOC
Time between user interactions on an online course system.
minutes
( Shchur et al., 2020 ; Kumar et al., 2019 )
Appendix
Table 14: Sources of the event sequences. The unit column reports the units used in this work, which may differ from the units used in the original source (see Section C.4 ).
Dataset
Gini coefficient
Amazon
0.000
Stack Overflow
0.141
Yelp airport
0.148
Yelp Toronto
0.192
Yelp Mississauga
0.361
Twitter
0.438
Appendix
Table 15: Gini coefficients for the distribution of inter-event times of the real-world datasets.
Figure 9: Histograms for 7 real-world datasets. Histograms extend until the 0.95 quantile ( left ) and 0.6 quantile ( right ). All histograms have 128 bins. The y -axis shows normalized counts.
Figure 10: Histograms for 7 real-world datasets. Histograms extend until the 0.95 quantile ( left ) and 0.6 quantile ( right ). All histograms have 128 bins. The y -axis shows normalized counts.
Figure 11: Distribution of pairs of inter-event times, τi and τi+1 for 6 real-world datasets. The first 4 datasets ( MOOC – Reddit Politics ) appear to have a grid structure on account of the resolution at which the data was recorded. The last 2 datasets ( NYC Taxi and Last.fm ) have a grid structure embedded within a smoother distribution. Each figure has a quantile threshold chosen so that the structure is visible. Each figure is a rasterization of event counts into a 256×256 pixel grid.
Figure 13: The instability of a logmix output head when a dataset has a probability mass at a certain point. (a): shows the distribution of inter-event times. The dataset is formed from a mixture where 10% of values come from a point source at t=exp(2) , and the remaining values are drawn from a lognormal distribution with parameters μ=0 and σ=1.0 . All events are independent. The model used is a gpt-a stem with a 2-component lognormal mixture output. The model is trained using stochastic gradient descent with momentum (0.9) and a learning rate of 5×10−4 . (b): shows the mixture parameters (the model output) and the NLL (calculated on an evaluation set) over the course of training. The six model parameters are the mixing parameters ( τ0,τ1 ) and the means and variances ( μ0,μ1,σ0,σ1 ) of the two underlying Gaussian distributions. Notably, neither μ0 nor μ1 approach 2.0 in a stable manner. Training stopped when evaluating the distribution median produced NaN values. This instability occurs reliably across runs.
Figure 14: An nn head where the first embedding vector u is 2-dimensional. The matrix projecting τ into u -space, Wτ∈R2×1 , is the unit vector [0.86,0.51]T . The second and third layers have 5 and 3 units respectively ( W1∈R5×2,W2∈R5×3,Wout∈R3×1 ). (b) shows the altitude change along the τ -paths from (a) ; this is the cumulative intensity Λ . The derivative, λ , is a solid curve. The corresponding probability densities are shown in (c) . All possible probability densities for this head correspond to a different starting position in the u -space.
Figure 15: Empirical and predicted cumulative distribution function (CDF) for the PUBG dataset. The green curve is the empirical CDF of the training set’s inter-event times. The other curves are mean CDFs calculated from rnn-nn , rnn-logmix and rnn-pc outputs, meaned over 4096 input histories drawn from the training set.
Figure 16: Probability distributions emitted by rnn-nn , rnn-pc and rnn-logmix models trained on a synthetic sequence where inter-event times are drawn from a stationary mixture (lognormal and five narrow Gaussian peaks). The true distribution of the inter-event times is shown in green . The rnn-nn ’s distribution contains five peaks at the correct locations. A black dashed line is the mean of five training runs. The individual runs are shown as semi-transparent gray curves; however, all are close to the mean and difficult to distinguish.
Figure 17: Two different outputs for three models trained on a synthetic sequence where the distribution of the next inter-event time switches between having and not having a narrow peak. The distribution of τi+1 depends only on τi : if τi≥1 , then p(τi+1∣τi)∼lognormal(0,1) , else p(τi+1∣τi) is a mixture of the same lognormal distribution and a narrow Gaussian ( σ=0.02 ) centered at τi+1=2 . The mixture is 0.7⋅LogNormal(0,1)+0.3⋅N(2,0.022) . Both rnn-pc and rnn-logmix can (somewhat) use the history input to modulate the probability density at the peak location. We do not observe the rnn-nn model carrying out this modulation. This experiment was repeated five times with different random seeds, and the same pattern was observed each time (the figures above show just one run).
Figure 18: Three models trained on a synthetic sequence in which the distribution of the next inter-event time has a narrow peak whose center is equal to the previous inter-event duration. The distribution of τi+1 is a mixture of a background lognormal and a Gaussian ( σ=0.03τi ) centered at τi . Specifically, p(τi+1∣τi)=0.6⋅LogNormal(0,1)+0.4⋅N(τi,(0.03τi)2) . All three models can use the history input to translate the location of a peak.
Figure 19: NLL evaluated every 5k steps throughout 200k-step training runs for the three models ( rnn-nn , rnn-pc and rnn-logmix ) on the three synthetic datasets (fixed peaks, binary peaks, and moving peaks). The NLL is calculated on 216 samples from a held-out set. There are 5 individual runs displayed as semi-transparent curves, and the mean across them is opaque.
Figure 20: Decomposition of ϕ(h)∈R64 (from Equation 6 ) along the unit direction W^τ=Wτ/∥Wτ∥ , and the (63-dimensional) orthogonal complement, Wτ⊥ . This is done for two datasets, the present/absent peaks dataset ( left ) and the translated peaks dataset ( right ). The component of ϕ(h) parallel to W^τ is ⟨W^τ,ϕ(h)⟩ ( top ) and the norm of the 63-d orthogonal component is ∥ϕ(h)−⟨W^τ,ϕ(h)⟩W^τ∥ , which we denote as ∥ϕ⊥(h)∥ ( bottom ). For each dataset we draw 217 histories from a held-out set and evaluate ϕ(h) , making note of τi−1 . This is done for 5 runs (grey), and the mean across runs is plotted in black. All runs have their individual mean subtracted to bring the curves into the same range. The per-run mean operates on values binned by the x-axis, τi−1 into 64 bins from the 5th until the 95th quantile of τi−1 . The parallel component is strongly correlated with τi−1 for the translated peaks dataset, and not for the present/absent peaks dataset.
Figure 21: Probability distributions emitted by gpt-a-nn , gpt-a-pc and gpt-a-logmix models trained on a synthetic sequence where inter-event times are drawn from a stationary mixture (lognormal and five narrow Gaussian peaks). The true distribution of the inter-event times is shown in green . The gpt-a-nn ’s distribution contains five peaks at the correct locations. A black dashed line is the mean of five training runs. The individual runs are shown as semi-transparent gray curves; however, all are close to the mean and difficult to distinguish.
Figure 22: Three models trained on a synthetic sequence in which the distribution of the next inter-event time has a narrow peak whose center is equal to the previous inter-event duration. The distribution of τi+1 is a mixture of a background lognormal and a Gaussian ( σ=0.03τi ) centered at τi . Specifically, p(τi+1∣τi)=0.6⋅LogNormal(0,1)+0.4⋅N(τi,(0.03τi)2) . All three models can use the history input to translate the location of a peak.
Figure 23: NLL evaluated every 5k steps throughout 200k-step training runs for the three models ( gpt-a-nn , gpt-a-pc and gpt-a-logmix ) on the three synthetic datasets (fixed peaks, binary peaks, and moving peaks). The NLL is calculated on 216 samples from a held-out set. There are 5 individual runs displayed as semi-transparent curves, and the mean across them is opaque.
Figure 24: Decomposition of ϕ(h)∈R64 (from Equation 6 ) along the unit direction W^τ=Wτ/∥Wτ∥ , and the (63-dimensional) orthogonal complement, Wτ⊥ . This is done for two datasets, the present/absent peaks dataset ( left ) and the translated peaks dataset ( right ). The component of ϕ(h) parallel to W^τ is ⟨W^τ,ϕ(h)⟩ ( top ) and the norm of the 63-d orthogonal component is ∥ϕ(h)−⟨W^τ,ϕ(h)⟩W^τ∥ , which we denote as ∥ϕ⊥(h)∥ ( bottom ). For each dataset we draw 217 histories from a held-out set and evaluate ϕ(h) , making note of τi−1 . This is done for 5 runs (grey), and the mean across runs is plotted in black. All runs have their individual mean subtracted to bring the curves into the same range. The per-run mean operates on values binned by the x-axis, τi−1 into 64 bins from the 5th until the 95th quantile of τi−1 . The parallel component is strongly correlated with τi−1 for the translated peaks dataset, and not for the present/absent peaks dataset.
Multi-class event streams arise in numerous real-world applications, where uncovering structured, interpretable inter-event relationships, together with accurate prediction, remains a central challenge. Existing neural point process models are highly expressive but encode event interactions in a black-box manner, preventing explicit discovery of structured dependencies. In this paper, we propose a structured neural marked point process (SNMPP) that achieves high modeling flexibility while enabling explicit event-wise and class-wise relationship discovery from data. Our model constructs a product-form neural influence kernel composed of a signed interaction network over event types and a delay-aware monotonic temporal network. This design enables explicit characterization of inter-class influence topology -- including excitation, inhibition, and neutrality -- while flexibly capturing diverse temporal decay patterns and potential influence delays. For efficient learning, we develop a stratified Monte Carlo estimator for stochastic training. Extensive experiments on synthetic and real-world benchmark datasets validate the ability of our approach to uncover structured relationships and deliver strong predictive performance.
Zhitong Xu, Qiwei Yuan, Yinghao Chen +2
Kahlert School of Computing, University of Utah · Celonis AI
Current-status data arise when an event time is observed only through an indicator of whether it occurred before an examination time. This paper studies a nonparametric neural-network sieve maximum likelihood estimator of the conditional cumulative distribution function of the event time. Under Hölder smoothness assumptions, we establish an explicit convergence rate by combining approximation theory for rectified linear unit neural networks with empirical-process arguments. This result provides theoretical support for neural-network estimation and subsequent inference under current-status observation.
Yuan Wu, Tianhui Zhou
Department of Biostatistics and Bioinformatics, Duke University, Durham, North Carolina, USA
We compare lightweight automata-based models (n-grams) with neural architectures (LSTM, Transformer) for next-activity prediction in streaming event logs. Experiments on synthetic patterns and five real-world process mining datasets show that n-grams with appropriate context windows achieve comparable accuracy to neural models while requiring substantially fewer resources. Unlike windowed neural architectures, which show unstable performance patterns, n-grams provide stable and consistent accuracy. While we demonstrate that classical ensemble methods like voting improve n-gram performance, they require running many agents in parallel during inference, increasing memory consumption and latency. We propose an ensemble method, the promotion algorithm, that dynamically selects between two active models during inference, reducing overhead compared to classical voting schemes. On real-world datasets, these ensembles match or exceed the accuracy of non-windowed neural models with lower computational cost.
Benedikt Bollig, Matthias Függer, Thomas Nowak +1
Université Paris-Saclay, CNRS, ENS Paris-Saclay, LMF, Gif-sur-Yvette, France · Institut Universitaire de France, Paris, France · Direction Générale de l’Armement, Paris, France