Intensity-Free Learning of Temporal Point Processes

1 INTRODUCTION . Visits to hospitals , purchases in e-commerce systems , financial transactions , posts in social media — various forms of human activity can be represented as discrete events happening at irregular intervals . The framework of temporal point processes is a natural choice for modeling such data . By combining temporal point process models with deep learning , we can design algorithms able to learn complex behavior from real-world data . Designing such models , however , usually involves trade-offs along the following dimensions : flexibility ( can the model approximate any distribution ? ) , efficiency ( can the likelihood function be evaluated in closed form ? ) , and ease of use ( is sampling and computing summary statistics easy ? ) . Existing methods ( Du et al. , 2016 ; Mei & Eisner , 2017 ; Omi et al. , 2019 ) that are defined in terms of the conditional intensity function typically fall short in at least one of these categories . Instead of modeling the intensity function , we suggest treating the problem of learning in temporal point processes as an instance of conditional density estimation . By using tools from neural density estimation ( Bishop , 1994 ; Rezende & Mohamed , 2015 ) , we can develop methods that have all of the above properties . To summarize , our contributions are the following : • We connect the fields of temporal point processes and neural density estimation . We show how normalizing flows can be used to define flexible and theoretically sound models for learning in temporal point processes . • We propose a simple mixture model that performs on par with the state-of-the-art methods . Thanks to its simplicity , the model permits closed-form sampling and moment computation . • We show through a wide range of experiments how the proposed models can be used for prediction , conditional generation , sequence embedding and training with missing data . 2 BACKGROUND . Definition . A temporal point process ( TPP ) is a random process whose realizations consist of a sequence of strictly increasing arrival times T = { t1 , ... , tN } . A TPP can equivalently be represented ∗Equal contribution Code and datasets are available under https : //github.com/shchur/ifl-tpp . as a sequence of strictly positive inter-event times τi = ti− ti−1 ∈ R+ . Representations in terms of ti and τi are isomorphic — we will use them interchangeably throughout the paper . The traditional way of specifying the dependency of the next arrival time t on the history Ht = { tj ∈ T : tj < t } is using the conditional intensity function λ∗ ( t ) : = λ ( t|Ht ) . Here , the ∗ symbol reminds us of dependence on Ht . Given the conditional intensity function , we can obtain the conditional probability density function ( PDF ) of the time τi until the next event by integration ( Rasmussen , 2011 ) as p∗ ( τi ) : = p ( τi|Hti ) = λ∗ ( ti−1 + τi ) exp ( − ∫ τi 0 λ∗ ( ti−1 + s ) ds ) . Learning temporal point processes . Conditional intensity functions provide a convenient way to specify point processes with a simple predefined behavior , such as self-exciting ( Hawkes , 1971 ) and self-correcting ( Isham & Westcott , 1979 ) processes . Intensity parametrization is also commonly used when learning a model from the data : Given a parametric intensity function λ∗θ ( t ) and a sequence of observations T , the parameters θ can be estimated by maximizing the log-likelihood : θ∗ = arg maxθ ∑ i log p ∗ θ ( τi ) = arg maxθ [ ∑ i log λ ∗ θ ( ti ) − ∫ tN 0 λ∗θ ( s ) ds ] . The main challenge of such intensity-based approaches lies in choosing a good parametric form for λ∗θ ( t ) . This usually involves the following trade-off : For a ” simple ” intensity function ( Du et al. , 2016 ; Huang et al. , 2019 ) , the integral Λ∗ ( τi ) : = ∫ τi 0 λ∗ ( ti−1+s ) ds has a closed form , which makes the log-likelihood easy to compute . However , such models usually have limited expressiveness . A more sophisticated intensity function ( Mei & Eisner , 2017 ) can better capture the dynamics of the system , but computing log-likelihood will require approximating the integral using Monte Carlo . Recently , Omi et al . ( 2019 ) proposed fully neural network intensity function ( FullyNN ) — a flexible , yet computationally tractable model for TPPs . The key idea of their approach is to model the cumulative conditional intensity function Λ∗ ( τi ) using a neural network , which allows to efficiently compute the log-likelihood . Still , in its current state , the model has downsides : it doesn ’ t define a valid PDF , sampling is expensive , and the expectation can not be computed in closed form1 . This work . We show that the drawbacks of the existing approaches can be remedied by looking at the problem of learning in TPPs from a different angle . Instead of modeling the conditional intensity λ∗ ( t ) , we suggest to directly learn the conditional distribution p∗ ( τ ) . Modeling distributions with neural networks is a well-researched topic , that , surprisingly , is not usually discussed in the context of TPPs . By adopting this alternative point of view , we are able to develop new theoretically sound and effective methods ( Section 3 ) , as well as better understand the existing approaches ( Section 4 ) . 3 MODELS . We develop several approaches for modeling the distribution of inter-event times . First , we assume for simplicity that each inter-event time τi is conditionally independent of the history , given the model parameters ( that is , p∗ ( τi ) = p ( τi ) ) . In Section 3.1 , we show how state-of-the-art neural density estimation methods based on normalizing flows can be used to model p ( τi ) . Then in Section 3.2 , we propose a simple mixture model that can match the performance of the more sophisticated flowbased models , while also addressing some of their shortcomings . Finally , we discuss how to make p ( τi ) depend on the historyHti in Section 3.3 . 1A more detailed discussion of the FullyNN model follows in Section 4 and Appendix C. 3.1 MODELING p ( τ ) WITH NORMALIZING FLOWS The core idea of normalizing flows ( Tabak & Turner , 2013 ; Rezende & Mohamed , 2015 ) is to define a flexible probability distribution by transforming a simple one . Assume that z has a PDF q ( z ) . Let x = g ( z ) for some differentiable invertible transformation g : Z → X ( where Z , X ⊆ R ) 2 . We can obtain the PDF p ( x ) of x using the change of variables formula as p ( x ) = q ( g−1 ( x ) ) ∣∣ ∂ ∂xg −1 ( x ) ∣∣ . By stacking multiple transformations g1 , ... , gM , we obtain an expressive probability distribution p ( x ) . To draw a sample x ∼ p ( x ) , we need to draw z ∼ q ( z ) and compute the forward transformation x = ( gM ◦ · · · ◦ g1 ) ( z ) . To get the density of an arbitrary point x , it is necessary to evaluate the inverse transformation z = ( g−11 ◦ · · · ◦ g −1 M ) ( x ) and compute q ( z ) . Modern normalizing flows architectures parametrize the transformations using extremely flexible functions fθ , such as polynomials ( Jaini et al. , 2019 ) or neural networks ( Krueger et al. , 2018 ) . The flexibility of these functions comes at a cost — while the inverse f−1θ exists , it typically doesn ’ t have a closed form . That is , if we use such a function to define one direction of the transformation in a flow model , the other direction can only be approximated numerically using iterative root-finding methods ( Ho et al. , 2019 ) . In this work , we don ’ t consider invertible normalizing flows based on dimension splitting , such as RealNVP ( Dinh et al. , 2017 ) , since they are not applicable to 1D data . In the context of TPPs , our goal is to model the distribution p ( τ ) of inter-event times . In order to be able to learn the parameters of p ( τ ) using maximum likelihood , we need to be able to evaluate the density at any point τ . For this we need to define the inverse transformation g−1 : = ( g−11 ◦· · ·◦g −1 M ) . First , we set zM = g−1M ( τ ) = log τ to convert a positive τ ∈ R+ into zM ∈ R. Then , we stack multiple layers of parametric functions fθ : R → R that can approximate any transformation . We consider two choices for fθ : deep sigmoidal flow ( DSF ) from Krueger et al . ( 2018 ) and sum-ofsquares ( SOS ) polynomial flow from Jaini et al . ( 2019 ) fDSF ( x ) = σ−1 ( K∑ k=1 wkσ ( x− µk sk ) ) fSOS ( x ) = a0 + K∑ k=1 R∑ p=0 R∑ q=0 ap , kaq , k p+ q + 1 xp+q+1 ( 1 ) where a , w , s , µ are the transformation parameters , K is the number of components , R is the polynomial degree , and σ ( x ) = 1/ ( 1 + e−x ) . We denote the two variants of the model based on fDSF and fSOS building blocks as DSFlow and SOSFlow respectively . Finally , after stacking multiple g−1m = fθm , we apply a sigmoid transformation g −1 1 = σ to convert z2 into z1 ∈ ( 0 , 1 ) . For both models , we can evaluate the inverse transformations ( g−11 ◦ · · · ◦ g −1 M ) , which means the model can be efficiently trained via maximum likelihood . The density p ( τ ) defined by either DSFlow or SOSFlow model is extremely flexible and can approximate any distribution ( Section 3.4 ) . However , for some use cases , this is not sufficient . For example , we may be interested in the expected time until the next event , Ep [ τ ] . In this case , flow-based models are not optimal , since for them Ep [ τ ] does not in general have a closed form . Moreover , the forward transformation ( gM ◦ · · · ◦g1 ) can not be computed in closed form since the functions fDSF and fSOS can not be inverted analytically . Therefore , sampling from p ( τ ) is also problematic and requires iterative root finding . This raises the question : Can we design a model for p ( τ ) that is as expressive as the flow-based models , but in which sampling and computing moments is easy and can be done in closed form ? 3.2 MODELING p ( τ ) WITH MIXTURE DISTRIBUTIONS Model definition . While mixture models are commonly used for clustering , they can also be used for density estimation . Mixtures work especially well in low dimensions ( McLachlan & Peel , 2004 ) , which is the case in TPPs , where we model the distribution of one-dimensional inter-event times τ . Since the inter-event times τ are positive , we choose to use a mixture of log-normal distributions to model p ( τ ) . The PDF of a log-normal mixture is defined as p ( τ |w , µ , s ) = K∑ k=1 wk 1 τsk √ 2π exp ( − ( log τ − µk ) 2 2s2k ) ( 2 ) 2All definitions can be extended to RD for D > 1 . We consider the one-dimensional case since our goal is to model the distribution of inter-event times τ ∈ R+ . z1 zm τ q1 ( z1 ) qm ( zm ) p ( τ ) ... ... g1 gm−1 gM g−11 g−1M Figure 2 : Normalizing flows define a flexible distribution via transformations . where w are the mixture weights , µ are the mixture means , and s are the standard deviations . Because of its simplicity , the log-normal mixture model has a number of attractive properties . Moments . Since each component k has a finite mean , the mean of the entire distribution can be computed as Ep [ τ ] = ∑ k wk exp ( µk+s 2 k/2 ) , i.e. , a weighted average of component means . Higher moments can be computed based on the moments of each component ( Frühwirth-Schnatter , 2006 ) . Sampling . While flow-based models from Section 3.1 require iterative root-finding algorithms to generate samples , sampling from a mixture model can be done in closed form : z ∼ Categorical ( w ) ε ∼ Normal ( 0 , 1 ) τ = exp ( sTz · ε+ µTz ) where z is a one-hot vector of size K. In some applications , such as reinforcement learning ( Upadhyay et al. , 2018 ) , we might be interested in computing gradients of the samples w.r.t . the model parameters . The samples τ drawn using the procedure above are differentiable with respect to the means µ and scales s. By using the Gumbel-softmax trick ( Jang et al. , 2017 ) when sampling z , we can obtain gradients w.r.t . all the model parameters ( Appendix D.6 ) . Such reparametrization gradients have lower variance and are easier to implement than the score function estimators typically used in other works ( Mohamed et al. , 2019 ) . Other flexible models ( such as multi-layer flow models from Section 3.1 ) do not permit sampling through reparametrization , and thus are not well-suited for the above-mentioned scenario . In Section 5.4 , we show how reparametrization sampling can also be used to train with missing data by performing imputation on the fly .

Summary: The authors propose a new paradigm for learning models for point processes which circumvents the need to explicitly model the conditional intensity. This utilizes recent work on Normalizing flows and upends a long-standing paradigm. The paper is a true tour-de-force and the authors make a very convincing case for why instead of modelling conditional intensity, one could (and should) model the distribution of times directly.