{'fraction_non_alphanumeric': 0.03787763133343511, 'fraction_numerical': 0.009838345800892236, 'mean_word_length': 4.7476845081407815, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 1, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Modeling Continuous Time Sequences with Intermittent Observations using Marked Temporal Point Processes

A large fraction of data generated via human activities such as online purchases, health records, spatial mobility etc. can be represented as a sequence of events over a continuous-time. Learning deep learning models over these continuous-time event sequences is a non-trivial task as it involves modeling the ever-increasing event timestamps, inter-event time gaps, event types, and the influences between different events within and across different sequences. In recent years neural enhancements to marked temporal point processes (MTPP) have emerged as a powerful framework to model the underlying generative mechanism of asynchronous events localized in continuous time. However, most existing models and inference methods in the MTPP framework consider only the complete observation scenario i.e. the event sequence being modeled is completely observed with no missing events -- an ideal setting that is rarely applicable in real-world applications. A recent line of work which considers missing events while training MTPP utilizes supervised learning techniques that require additional knowledge of missing or observed label for each event in a sequence, which further restricts its practicability as in several scenarios the details of missing events is not known apriori. In this work, we provide a novel unsupervised model and inference method for learning MTPP in presence of event sequences with missing events. Specifically, we first model the generative processes of observed events and missing events using two MTPP, where the missing events are represented as latent random variables. Then, we devise an unsupervised training method that jointly learns both the MTPP by means of variational inference. Such a formulation can effectively impute the missing data among the observed events and can identify the optimal position of missing events in a sequence.


INTRODUCTION
The amount of data constantly generated via several human activities has grown exponentially with time-series becoming pervasive across all such activities ranging from finance, social, online purchases, and many more [37,41,48]. Learning the dynamics of these sequences is a non-trivial task with the current neural models as it requires perpetual modeling of continuous-time and inter-event relationships [12,25,63]. In the recent years, marked temporal point processes (MTPP) [8,44,52,54] have shown an outstanding potential to characterize asynchronous events localized in continuous time that appear in a wide range of applications in healthcare [21,31,43], traffic [12,16], web and social networks [9, 12-14, 24, 25, 28, 50, 52], finance [1], activity sequences [19,34] and many more.
A temporal point process represents an event using two quantities: (i) the time of its occurrence and (ii) the associated mark, where the latter indicates the category of the event and therefore bears different meanings for different applications. For example, in a social network setting, the marks may indicate users' likes, topics, and opinions of the posts; in finance, they may correspond to the stock prices and the number of sales; in healthcare, they may indicate the state of the disease of an individual. In this context, most of the MTPP models [12,23,52,54,63,66]-with a few recent exceptions [36,47]-have considered only the settings where the training data is completely observed or, in other words, there is no missing observation at all. While working with fully observed data is ideal for understanding any dynamical system, this is not possible in many practical scenarios. We may miss observing events due to constraints such as crawling restrictions by social media platforms, privacy restrictions (certain users may disallow collection of certain types of data), budgetary factors such as data collection for exit polls, or other practical factors e.g. a patient may not be available at a certain time. This results in the poor predictive performance of MTPP models [12,63,66] that skirt this issue.
Statistical analysis in presence of missing data has been widely researched in literature in various contexts [6,49,51,62]. Little and Rubin [30] offer a comprehensive survey. It provides three models that capture data missing mechanisms in the increasing order of complexity, viz., MCAR (missing completely at random), MAR (missing at random), and MNAR (missing not at random). Recently, Shelton et al. [47] and Mei et al. [36] proposed novel methods to impute missing events in continuous-time sequences via MTPP from the viewpoint of the MNAR mechanism. However, they focus on imputing missing data in between a-priori available observed events, rather than predicting observed events in the face of missing events. Moreover, they deploy expensive learning and sampling mechanisms, which make them often intractable in practice, especially in the case of learning from a sequence of streaming events. For example, Shelton et al. [47] apply an expensive MCMC sampling procedure to draw missing events between the observation pairs, which requires several simulations of the sampling procedure upon arrival of a new sample. On the other hand, Mei et al. [36] uses bi-directional RNN which re-generates all missing events by making a completely new pass over the backward RNN, whenever one new observation arrives. As a consequence, it suffers from quadratic complexity with respect to the number of observed events. On the other hand, the proposal of Shelton et al. [47] depends on a pre-defined influence structure among the underlying events, which is available in linear multivariate parameterized point processes. In more complex point processes with neural architectures, such a structure is not explicitly defined, which further limits their applicability in real-world settings.

Present Work
In this work, we overcome the above limitations by devising a novel modeling framework for point processes called IMTPP (Intermittently-observed Marked Temporal Point Processes) 1 , which characterizes the dynamics of both observed and missing events as two coupled MTPP, conditioned on the history of previous events. In our setup, the generation of missing events depends both on the previously occurred missing events as well as the previously occurred observed events. Therefore, they are MNAR (missing not at random), in the context of the literature of missing data [30]. In contrast to the prior models [36,47], IMTPP aims to learn the dynamics of both observed and missing events, rather than simply imputing missing events in between the known observed events, which is reflected in its superior predictive power over those existing models.
Precisely, IMTPP represents the missing events as latent random variables, which together with the previously observed events, seed the generative processes of the subsequent observed and missing events. Then it deploys three generative models-MTPP for observed events, prior MTPP for missing events, and posterior MTPP for missing events, using recurrent neural networks (RNN) that capture the nonlinear influence of the past events. We also show that such a formulation can be easily extended to imputation tasks and still achieve significant performance gains over other models. IMTPP includes several technical innovations over other models, that significantly boost its training efficiency as well as its event prediction accuracy. We list them here: (1) In a notable departure from almost all existing MTPP models [9,12,36,50] which rely strongly on conditional intensity functions, we use a log-normal distribution to sample arrival times of the events. As suggested by Shchur et al. [46], such distribution allows efficient sampling as well as a more accurate prediction than the standard intensity function-based models. (2) The built-in RNNs in our model are designed to make forward computations. Therefore, they incrementally update the dynamics upon the arrival of a new observation. Consequently, unlike the prior models, it does not require to re-generate all the missing events responding to the arrival of an observation, which significantly boosts the efficiency of both learning and prediction as compared to both the previous approaches [36,47].
Our modeling framework allows us to train IMTPP using an efficient variational inference method, that maximizes the evidence lower bound (ELBO) of the likelihood of the observed events. Such a formulation highlights the connection of our model with the variational autoencoders (VAEs) [4,7]. However, in sharp contrast to traditional VAEs, where the random noises or seeds often do not have immediate interpretations, our random variables bear concrete physical explanations i.e. they are missing events, which renders our model more explainable than an off-the-shelf VAE. In addition, to further elucidate the predictive prowess of IMTPP, we constrain its optimization procedure to identify the optimal positions of missing events in a sequence.
Finally, we perform exhaustive experiments with six diverse real-world datasets across different domains to show that IMTPP can model missing observations within a stream of observed events and enhance the predictive power of the original generative process for a full observation scenario.

Organization
The rest of this paper is organized as follows. We review the relevant related work in Section 2 and present a formal problem formulation in Section 3, followed by an overview of IMTPP-including the description of coupled MTPP based model -in Section 4. Section 5 gives a detailed development of all components in IMTPP and Section 6 contains in-depth experimental analysis, qualitative, and imputation studies over all datasets before concluding in Section 7.

RELATED WORK
Our work is broadly related to the literature of (i) temporal point process, (ii) missing data models for discrete-time series, and (iii) missing data models for temporal point process.

Marked Temporal Point Process
Marked Temporal point processes are central to our work. In recent years, they emerged as a powerful tool to model asynchronous events localized in continuous time [8,22], which have a wide variety of applications e.g., information diffusion, disease modeling, finance, etc. Driven by these motivations, in recent years, there has been a surge of works on MTPP [13,14,43,44]. They predominantly follow two approaches. The first approach which includes the Hawkes process, self-correcting process, etc. considers fixed parameterization of the temporal point process.
Here, different parameterizations characterize the phenomena of interest. In particular, Hawkes process models the self-exciting event arrival process, which is often exhibited by online social networks. However, the fixed parameterization approach often constrains the expressive power of the underlying model, which is often reflected in the sub-optimal predictive performance. The second approach aims to overcome these challenges by modeling MTPP with a deep neural network [12,23,35,59]. For example, Du et al. [12] proposed recurrent marked temporal point process (RMTPP)-an RNN driven model-to encapsulate the sequence dynamics and obtain a low dimensional embedding of the event history. This led to further developments which include the Neural Hawkes process that formulates the point process with a continuous-time LSTM [35] and several other neural models of MTPP e.g., [23,40,59]. However, these approaches assume that the underlying data fed into the model is complete, i.e., with no missing entries. This assumption of an ideal setting leads to conjectured predictions if implemented in presence of missing data.

Missing Data Models for Discrete-Time Series
Our current work is also related to existing missing data models for discrete time-series, which do not necessarily consider MTPP. In principle, training sequential models in presence of missing data is essential for robust predictions across a wide range of applications e.g., traffic networks [51], modeling disease propagation [2,15] and wearable sensor data [55,56]. Motivated by these applications, in recent years, there has been a considerable effort in designing learning tools for sequence models with missing data [6,32,62]. In particular, the proposal by Che et al. [6] compensate for a missing event by applying a time decay factor to the previous hidden state in a GRU before calculating the new hidden state. Yoon et al. [62] capture the effect of missing data by incorporating future information using bidirectional-RNNs. While these approaches do not provide explicit generative models of missing events, few other models generate them by imputing them in between available observations. For example, Cao et al. [5] proposed a method of imputing missing events using a bi-directional RNN [5]; Luo et al. [32] employs a generative adversarial approach for generating missing events conditioned on the observed events. Luo et al. [33] and Li et al. [27] are used for imputing in time-series, however, cannot be used to sample marks of missing events and thus, cannot be extended to imputation in continuous-time event sequences. Thus, these models are complementary to our proposal as they do not work with temporal point processes.

Missing Data Models for Temporal Point Process
Very recently, there has been a growing interest in modeling MTPP in presence of missing observations. However, the design of their learning paradigms is tailored too much to operate in an offline setting. They deploy expensive learning and sampling mechanisms on an apriori-known complete sequence of observations. More specifically, Shelton et al. [47] proposed a way of incorporating missing data by generating children events for the observed events. They rely strongly on an expensive MCMC sampling procedure to draw missing events between the observation pairs. In order to adapt such a protocol, we need to run the entire sampling routine several times whenever a new observation arrives. Such a method is extremely time-consuming and often intractable in practice. Moreover, they require an underlying multi-variate parenthood structure which is not available in a complicated neural setting. Our work is closely related to the proposal by Mei et. al. [36]. It employs two RNNs, in which, the forward RNN-initialized on = 0-models the observation sequence and the backward RNN-initialized on = -models the missing observations. To operate a backward RNN in an online setting, we need to pass the entire sequence of observations into it, whenever a new sample arrives, which in turn makes it super expensive in practice. While re-running these methods after batch arrivals-instead of re-running after every single arrivalmay appear as a compromised solution, however, that is ineffective in practice. Other approaches include the proposal by Xu et al. [60], which proposes a training method for MTPP when the future and past events of a sequence window are censored; the work by Rasmussen [42], which assumes certain characteristics of missing data, and Zhuang et al. [65] is limited to spatial modeling.

PROBLEM SETUP
In this section, we first introduce the notations and then the setup of our problem of learning marked temporal point processes with observed and missing events over continuous time.

Preliminaries and Notations
A marked temporal point process (MTPP) is a stochastic process whose realization consists of a sequence of discrete localized in time. Formally, we characterize an MTPP using the sequence of observed events S = { = ( , )| ∈ [ ], < +1 }, where ∈ R + is the time of occurrence and ∈ C is a discrete mark of the -th observed event that occurred at time , with C to be the set of discrete marks. Here, S denotes the sequence with first observed events. We denote the inter-arrival times of the observed events as, Δ , = − −1 .
However as highlighted in Section 1, there may be instances where an event has actually taken place, but not recorded with the observed event sequence S. To this end, we introduce the MTPP for missing events-a latent MTPP-which is characterized by a sequence of hidden events M = { = ( , )| ∈ [ ], < +1 } where ∈ R + and ∈ C are the times and the marks of the -th missing events. Therefore, M defines the set of first missing events. Moreover, we denote the inter-arrival times of the missing events as, Δ , = − −1 .
Note that • , • , M • and Δ ,• for the MTPP of missing events share similar meanings with • , • , S • and Δ ,• respectively for the MTPP of observed events. For an intelligible description of our model, we further define two critical notations and as follows: Here, and are the indices of the first and the last missing events respectively, among those which have arrived between -th and + 1-th observed events. Figure 2 (a) illustrates our setup. In practice, the arrival times ( and ) of both observed and missing events are continuous random variables, whereas the marks ( and ) are discrete random variables. Therefore, following the state-of-the-art MTPP models [12,35], we model a density function to draw the event timings and a probability mass function to draw marks, which in turn induce a net density function characterizing the generative process.

Our Distinctive Goal
Our goal in this paper is to design an MTPP model which can generate the subsequent observed ( +1 ) and missing events ( +1 ) in a recursive manner, conditioned on the history of all events S ∪ M that have occurred thus far. Given the input sequence of observations S consisting of first observed events { 1 , 2 , ..., }, we first train our generative model and then recursively predict the next observed event +1 . Though IMTPP can also predict the missing events but we evaluate the predictive performance only on observed events since the missing events are not available in practice. We also evaluate the imputation performance of our model by predicting synthetically deleted events.
Note that, this setting is in contrast to the proposal of [36] that aims to impute the missing events based on the entire observation sequence S using a bi-directional RNN. Specifically, whenever one new observation arrives, it re-generates all missing events by making a completely new pass over the backward RNN. As a consequence, such an imputation method not only suffers from the quadratic complexity with respect to the number of observed events it also has limited practicability as in a streaming or an online setting the future events are also not available beyond the current timestamp. Furthermore, their approach is tailored towards imputing missing events based on the complete observations and not well suited to predict observed events in the face of missing observations. In contrast, our proposal is designed to generate subsequent observed and missing events in between previously observed events. Therefore, it does not require to re-generate all missing events whenever a new observation arrives, which allows it to enjoy a linear complexity with respect to the number of observed events and can be easily extended to online settings.

COMPONENTS OF IMTPP
At the very outset, IMTPP, our proposed generative model, connects two stochastic processesone for the observed events, which samples the observed and the other for the missing eventsbased on the history of previously generated missing and observed events. Note, that the sequence of training events that are given as input to IMTPP consists of only the observed events. We model the missing event sequence through latent random variables, which, along with the previously observed events, drive a unified generative model for the complete (observed and missing) event sequence. The overall neural architecture of IMTPP, including the different processes for observed and missing events is given in Figure 1.
More specifically, given a stream of observed events S = { 1 = ( 1 , 1 ), 2 = ( 2 , 2 ), . . . , = ( , )}, if we use the maximum likelihood principle to train IMTPP, then we should maximize the marginal log-likelihood of the observed stream of events, i.e., log (S ). However, computation of log (S ) demands marginalization with respect to the set of latent missing events M −1 , which is typically intractable. Therefore, we resort to maximizing a variational lower bound or evidence lower bound (ELBO) of the log-likelihood of the observed stream of events S . Mathematically, we note that: where, (M) is the measure of the set M, is an approximate posterior distribution which aims to interpolate missing events within the interval ( , +1 ), based on the knowledge of the next observed event , along with all previous events S ∪ M −1 , and , . Recall that ( ) is the index of the first (last) missing event among those which have arrived between -th and + 1-th observed events, i.e., = argmin { | < < +1 } and = argmax { | < < +1 }. Next, by applying Jensen inequality 2 over the likelihood function, log (S ) is at-least: While the above inequality holds for any distribution , the quality of this lower bound depends on the expressivity of , which we would model using a deep recurrent neural network. Moreover, the above lower bound suggests that our model consists of the following components.
(1) MTPP for observed events. The distribution ( +1 | S , M ) models the MTPP for observed events, which generates the ( + 1)-th event, +1 , based on the history of all observed events S and all missing events M generated so far.
(2) Prior MTPP for missing events. The distribution ( | S , M −1 ) is the prior model of the MTPP for missing events. It generates the -th missing event after the observed event , based on the prior information-the history with all observed events S and all missing events M −1 generated so far.
(3) Posterior MTPP for missing events. Given the set of observed events S +1 = { 1 , 2 , . . . , +1 }, the distribution ( | +1 , S , M −1 ) generates the -th missing event , after the knowledge of the subsequent observed event +1 is taken into account, along with information about all previously observed events S and all missing events M −1 generated so far.

ARCHITECTURE OF IMTPP
We first present a high-level overview of deep neural network parameterization of different components of IMTPP model and then describe component-wise architecture in detail. Finally, we briefly present the salient features of our proposal.

High-level Overview
We parameterize different components of IMTPP, introduced in the previous section using deep neural networks. More specifically, we approximate the MTPP for observed events, ( +1 | S , M ) using and the posterior MTPP for missing events ( | +1 , S , M −1 ) using , both implemented as neural networks with parameters and respectively. We set the prior MTPP for missing events Note that, the information of +1 here is used to truncate the log-normal distribution for missing data generation, whereas the log-normal distribution for observed is non-truncated.
( | S , M −1 ) as a known distribution prior using the history of all the events it is conditioned on. In this context, we design two recurrent neural networks (RNNs) which embed the history of observed events S into the hidden vectors and the missing events M into the hidden vector , similar to several state-of-the art MTPP models [12,35,36]. In particular, the embeddings and encode the influence of the arrival time and the mark of the first observed events from S and first missing events from M respectively. Therefore, we can represent the model for predicting the next observed event as: Following the above MTPP model for observed events, both the prior MTPP model and the posterior MTPP model for missing events offer similar conditioning with respect to • and • . Similar to other MTPP models [12,35], the RNN for the observed events updates −1 to by incorporating the effect of . Similarly, the RNN for the missing events updates −1 to by taking into account of the event .
As mentioned in Section 3, each event has two components, its mark and the arrival-time, which are discrete and continuous random variables respectively. Therefore, we characterize the event distribution as a density function which is the product of the density function ( ,Δ , ,Δ , prior,Δ ) of the inter-arrival time and the probability distribution (P , , Q , , P prior, ) of the mark, i.e., where, as mentioned, the inter-arrival times Δ , and Δ , are given as Δ , = − −1 and Δ = − −1 . Moreover, ,Δ , ,Δ and prior,Δ denote the density of the inter-arrival times for the observed events, posterior density and the prior density of the inter-arrival times of the missing events; and, P , , Q , and P prior, denote the corresponding probability mass functions of the mark distributions. Figure 2 denotes the neural architecture of the MTPP for observed events and the posterior MTPP for missing events in IMTPP. For brevity, we omitted the schematic diagram for the prior MTPP for missing events as it had a simpler architecture.

Parameterization of
Given observed events and = missing events, the generative model samples the next event +1 based on S and M . To this aim, the underlying neural network takes the embedding vectors and as input and provides the density ,Δ and P , as output, which in turn are used to draw the event +1 . More specifically, we realize in Eq. 6 using a three layer architecture.
(1) Input layer. The first level is the input layer, which takes the last event as input and represents it through a suitable vector. In particular, upon arrival of , it computes the corresponding vector as: where •,• and are trainable parameters.
(2) Hidden layer The next level is the hidden layer that embeds the sequence of observations into finite dimensional vectors • , computed using RNN. Such a layer takes as input and feed it into an RNN to update its hidden states in the following way.
where ,• and are trainable parameters. This hidden state can also be considered as a sufficient statistic of S , the sequence of the first observations.
(3) Output layer The next level is the output layer which computes both ,Δ (·) and P , (·) based on and . To this end, we have the density of inter-arrival times as with [ ( , ), ( , )] = ⊤ , + ⊤ , + ; and, the mark distribution as, The distributions are finally used to draw the inter-arrival time Δ , +1 and the mark +1 for the event +1 . The sampled inter-arrival time Δ , +1 gives +1 = + Δ , . Here, the mark distribution is independent of Δ , +1 . Finally, we note that We would like to highlight that, the proposed lognormal distribution of inter-arrival times Δ , allows an easy re-parameterization trick-Lognormal( , ) = exp( + ·Normal(0, 1))-which mitigates variance of estimated parameters and facilitates fast training and accurate prediction.

Parameterization of
At the very outset, (• | , , −1 ) (Eq. 7) generates missing events that are likely to be omitted during the interval ( , +1 ) after the knowledge of the subsequent observed event +1 is taken into account. To ensure that missing events are generated within desired interval, ( , +1 ), whenever an event is drawn with > +1 , then (• | +1 , , −1 ) is set to zero and is set to − 1. Otherwise, is flagged as . Note that, (• | , −1 ) generates all potential missing events in this interval. That said, it generates multiple events sequentially in one single run in contrast to the . Similar to the generator for observed events , it has also a three level neural architecture.
(2) Hidden layer Similar to the hidden layer used in the model, the hidden layer here too embeds the sequence of missing events into finite-dimensional vectors • , computed using RNN in a recurrent manner. Such a layer takes −1 as input and feeds it into an RNN to update its hidden states in the following way.
where •,• , •,• and are trainable parameters. (3) Output layer The next level is the output layer which computes both ,Δ (·) and Q , (·) based on and . To compute these quantities, it takes five signals as input: (i) the current update of the hidden state for the RNN in the previous layer, (ii) the current update of the hidden state that embeds the history of observed events, and (iii) the timing of the last observed event, , (iv) the timing of the last missing event, −1 and (v) the timing of the next observation, +1 . To this end, we have the density of inter-arrival times as ; and, the mark distribution as, Hence, we have: = ∞ (Allow more missing events) Otherwise: Here, note that the mark distribution depends on Δ , . = { •,• , •,• , •,• , • } are trainable parameters. The distributions in Eqs. 15 and 16 ensure that given the first + 1 observations, generates the missing events only for ( , +1 ) and not for further subsequent intervals.

Prior MTPP model prior
We model the prior density (Eq. 8) of the arrival times of the missing events as, with ; and, the mark distribution of the missing events as, All parameters •,• , •,• and are scaled a-priori using a hyper-parameter . Thus, determines the importance of the prior in the missing event sampling procedure of IMTPP. We specify the optimal value for based on the prediction performance in the validation set.

Training and
We compute optimal parameters * and * that maximizes ELBO( , ) using stochastic gradient descent (SGD) [45]. More details regarding the hyper-parameter values are given in Section 6.

Optimal Position for Missing Events
To better explain the missing event modeling procedure of IMTPP while simultaneously enhancing its practicability, we present a novel application of IMTPP++, a novel variant that offers a trade-off between the number of missing events and the model scalability. In sharp contrast to the original problem setting of generating missing events between observed events, IMTPP++ is designed to impute a fixed number of events in a sequence. Specifically, given an input sequence and a userdetermined parameter of the number of missing events to be imputed (denoted by ), IMTPP++ determines the optimal time and mark of events that when included with the observed MTPP achieve superior event prediction prowess. Note that these events may be missing at random positions that are not considered while training IMTPP++. IMTPP++ achieves this by constraining the missing event sampling procedure of the posterior MTPP ( ,Δ (•)) to limited iterations while simultaneously maximizing the likelihood of observed MTPP. Mathematically, it optimizes the following objective: where where imp,Δ and ( +1 ) denote the constrained posterior MTPP and the observed MTPP. However, determining the optimal position of missing events is a challenging task as while imputing events the generator must consider the dynamics of future events in the sequence. Therefore, IMTPP++ includes a two-step training procedure: (i) training observed and missing MTPP using the trainingset with unbounded missing events (as in Section 5.5); and then (ii) fine-tuning the parameters of the constrained posterior MTPP and observed MTPP by maximizing the objective in Eqn 20.
For the latter stage, we use the optimal positions of missing events sampled from the posterior MTPP determined by their occurrence probabilities. Later, we assume these events represent all missing events(M ), followed by a fine-tuning using Eqn 20 i.e. the likelihood of observed events.

Salient Features of IMTPP
It is worth noting the similarity of our modeling and inference framework to variational autoencoders [4,7,11], with and playing the roles of encoder and decoder respectively, while prior plays the role of the prior distribution of latent events. However, the random seeds in our model are not simply noise as they are interpreted in autoencoders. They can be concretely interpreted in IMTPP as missing events, making our model physically interpretable. Secondly, note that the proposal of [36] aims to impute the missing events based on the entire observation sequence S , rather than to predict observed events in the face of missing events. For this purpose, it uses a bi-directional RNN and, whenever a new observation arrives, it re-generates all missing events by making a completely new pass over the backward RNN. As a consequence, such an imputation method suffers from the quadratic complexity with respect to the number of observed events. In contrast, our proposal is designed to generate subsequent observed and missing events rather than imputing missing events in between observed events 3 . To that aim, we only make forward computations, and therefore, it does not require to re-generate all missing events whenever a new observation arrives, which makes it much more efficient than [36] in terms of both learning and prediction. Through our experiments, we also show the exceptionally time-effective operation of IMTPP over other missing-data models.
Finally, unlike most of the prior work [12,35,36,47,63,66] we model our distribution for interarrival times using log-normal. Such a modeling procedure has major advantages over intensitybased models -(i) scalable sampling during prediction as opposed to Ogata's thinning/inverse sampling; and (ii) efficient training via re-parametrization. Moreover, our generative procedure for missing events requires iterative sampling in the absence of new observed events and such an unsupervised procedure can largely benefit from the prowess of intensity-free models in forecasting future events in a sequence [10].
While Shchur et al. [46] also use model inter-arrival times using log-normal, they do not focus to predict observations in the face of missing events. However, it is important to reiterate (see Shchur et al. [46] for details) that this modeling choice offers significant advantages over intensity-based models in terms of providing ease of re-parameterization trick for efficient training, allowing a closed-form expression for expected arrival times, and usability for supervised training as well. Importance of IMTPP++. On a broader level, IMTPP++ may be similar to IMTPP, however, they vary significantly. Specifically, the main distinctions are (1) IMTPP++ offers higher practicability as it can be used for predicting future events and for imputing a fixed number of missing events; (2) IMTPP cannot achieve the latter as it involves an unconstrained procedure for generating missing events; and (3) IMTPP++ has an added feature to identify the optimal position of missing events in a sequence. Moreover, as the training procedure of IMTPP++ involves a pre-training step, the missing event generator has the knowledge of future events in a sequence. This is a sharp contrast to IMTPP which only involves forward temporal computations. To the best of our knowledge, IMTPP++ is the first-of-its-kind application of neural point process models that can be several real-world problems ranging from smooth learning curve and extending the sequence lengths.

EXPERIMENTS
In this section, we report a comprehensive empirical evaluation of IMTPP along with its comparisons with several state-of-the-art approaches. For our experiments in this paper, we make our code public at https://github.com/data-iitd/imtpp. Our code uses Tensorflow 4 v.1.13.1 and Tensorflow-Probability v0.6.0 5 . Through these experiments, we aim to answer the following research questions.

Experimental Setup
Here we present the details of all datasets, baselines, and the hyperparameter values for all models. Datasets. For our experiments, we use eight real datasets from different domains: Amazon movies (Movies) [39], Amazon toys (Toys) [39], NYC-Taxi (Taxi), Twitter [64], Stackoverflow (SO) [12], Foursquare [61], Celebrity [38], and Health [3]. The statistics of all datasets are summarized in Table 1 and we describe them as follows: (1) Amazon Movies [39]. For this dataset we consider the reviews given to items under the category "Movies" on Amazon. For each item we consider the time of the written review as the time of event in the sequence and the rating (1 to 5) as the corresponding mark.
(2) Amazon Toys [39]. Similar to Amazon Movies, but here we consider the reviews given to items under the category "Toys".
(3) NYC Taxi 6 . In this dataset, each sequence corresponds to a series of time-stamped pick-up and drop-off events of a taxi in New York City, and location-IDs are considered as event marks.
(4) Twitter [64]. Similar to [35], we group retweeting users into three classes based on their connectivity: ordinary user (degree lower than the median), a popular user (degree lower than 95-percentile), and influencers (degree higher than 95-percentile). Each stream of retweets is treated as a sequence of events with retweet time as the event time, and user class as the mark.
(5) Stack Overflow. Similar to [12], we treat the badge awarded to a user on the stack overflow forum as a mark. Thus we have each user corresponding a sequence of events with times corresponding to the time of mark affiliation.
(6) Foursquare. As a novel evaluation dataset, we use Foursquare (a location search and discovery app) crawls [18,61] to construct a collection of check-in sequences of different users from Japan. Each user has a sequence with the mark corresponding to the type of the check-in location (e.g. "Jazz Club") and the time as the timestamp of the check-in [17].
(7) Celebrity [38]. In this dataset, we consider the series of frames extracted from youtube videos of multiple celebrities as event sequences where event-time denotes the video-time and the type is decided upon the coordinates of the frame where the celebrity is located.
(8) Health [3]. The dataset contains ECG records for patients suffering from heart-related problems. Since the length of the ECG record for a single patient can be up to a few millions, we sample smaller individual sequences and consider each such sequence as independent with event type as the normalized change in the signal value and the time of recording as event time. Synthetic Dataset. In addition, we utilize a publicly available synthetic dataset [63] generated using the open-source library tick 7 . Specifically, it consists of a two-dimensional Hawkes process with base intensities 1 = 0.1 and 2 = 0.2, with triggering kernels as -power law, exponential, sum of two exponentials, and a sine kernel. Mathematically, (1) HP [22]. A conventional Hawkes process or self-exciting multivariate point process model with an exponential kernel i.e. the past events raise the intensity of the next event of the same type.
(2) SMHP [29]. A self-modulating Hawkes process wherein the intensity of the next event is not ever-increasing as in standard Hawkes but learned based on the past events.
(3) RMTPP [12]. A state-of-the-art neural point process that embeds sequence history using inter-event time-differences and event marks using a recurrent neural network.
(4) SAHP [63]. A self-attention-based Hawkes process that learns the embedding for the temporal dynamics using a weighted aggregation of all historical events.
(5) THP [66]. Transformer Hawkes process is the state-of-the-art MTPP framework that extends the transformer model [53] to include time and mark influences between events to calculate the conditional intensity function for the arrival of future events in the sequence.
(6) PFPP [36]. A particle filtering process for MTPP that learns the sequence dynamics using a bi-directional recurrent neural network.
(7) HPMD [47]. Models the sequences using a linear multivariate parameterized point processes and learns the inter-event influence using a predefined structure. We omit the comparisons with other MTPP models [35,40,46,57,58] as they have already been outperformed by these approaches. Moreover, recent research [26] has shown that the performance of other RNN based models such as Mei and Eisner [35] is comparable to RMTPP [12].
Evaluation protocol. Given a stream of observed events S , we split them into training S and test set S \S , where the training set (test set) consists of first 80% (last 20%) events, i.e., = ⌈0.8 ⌉. We train IMTPP and the baselines on S and then evaluate the trained models on the test set S \S in terms of (1) mean absolute error (MAE) of predicted times, and (2) mark prediction accuracy (MPA).
Here^and^are the predicted time and mark the -th event in the test set. Note that such predictions are made only on observed events in real datasets. For time prediction, given the varied temporal distribution across the datasets, we normalize event times across each dataset [12]. We report results and confidence intervals based on three independent runs.

Implementation Details
Parameter Settings. Baseline Implementation Details. For implementations regarding RMTPP we use the Pythonbased implementation 8 . For Hawkes process(HP) and self-modulating Hawkes process(SMHP), we use the codes 9 made available by Mei and Eisner [35]. Since HP and SMHP [29] generate a sequence of events of a specified length from the weights learned over the training set, we generate | | sequences as per the data as S = { 1 , 2 , · · · } each with maximum sequence length. For evaluation, we consider the first set of events for each sequence . For rest of the baselines, we used the implementations provided by the respective authors -PFPP 10 , HPMD 11 , THP 12 and SAHP 13 .
For Markov Chains, we use the code 14 made public by Du et al. [12]. For RMTPP, we set hidden dimension and BPTT is selected among {32, 64} and {20, 50} respectively. For THP, and SAHP, we set the number of attention heads as 2, hidden, key-matrix, value-matrix dimensions are selected among {32, 64}. If applicable, for each model we use a dropout of 0.1. For PFPP, we set = 1 and use a similar procedure to calculate the embedding dimension as in the THP. All other parameter values are the ones recommended by the respective authors.

Prediction of Missing Events (RQ1)
To address the research question RQ1, we first qualitatively demonstrate the ability of IMTPP in predicting missing events in sequences from the synthetic dataset. To do so, we randomly sample 10% events from each sequence and tag them to be missing. Later, we train IMTPP over the observed events and use our trained model to predict both observed and missing events. Figure 3 provides an illustrative setting of our results. It shows that IMTPP provides many accurate mark predictions. In addition, it qualitatively shows that the predicted inter-arrival times and marks closely match with the true inter-arrival times. Thus supporting the ability of IMTPP to accurately identify the marks and times of missing events as well as the total number of events missing between two timestamps. Note that we utilize synthetic deletion only for the results in Figure 3 and for other results in the paper, we use complete sequences unless mentioned specifically.

Event Prediction Performance (RQ2)
Next, we evaluate the event prediction ability of IMTPP. More specifically, we compare the performance of IMTPP with all the baselines introduced above across all six datasets. Tables 2 and 3 summarizes the results, which sketches the comparative analysis in terms of mean absolute error (MAE) on time and mark prediction accuracy (MPA), respectively. From the results we make the following observations:  (1) IMTPP exhibits steady improvement over all the baselines in most of the datasets, in case of both time and mark prediction. However, for Stackoverflow and Foursquare datasets, THP outperforms all other models including IMTPP in terms of MPA. (2) RMTPP is the second-best performer in terms of MAE of time prediction almost in all datasets.
In fact, in Stackoverflow (SO) dataset, it shares the lowest MAE together with IMTPP. However, there is no consistent second-best performer in terms of MPA. Notably, PFPP and IMTPP, which take into account missing events, are the second-best performers for four datasets. (3) Both PFPP [36] and HPMD [47] fare poorly with respect to IMTPP in terms of both MAE and MPA. This is because PFPP focuses on imputing missing events based on the complete observations and, is not well suited to predict observed events in the face of missing observations. In fact, PFPP does not offer a joint training mechanism for the MTPP for observed events and the imputation model. Rather it trains an imputation model based on the observation model learned a-priori. On the other hand, HPMD only assumes a linear Hawkes process with a known influence structure. Therefore it shows poor performance with respect to IMTPP.
Qualitative Analysis. In addition, we also perform a qualitative analysis to identify if IMTPP can model the inter-event time-intervals in a sequence. Figure 4 provides some real-life event sequences taken from Movies and Toys datasets and the time-intervals predicted by IMTPP. The results qualitatively show that the predicted inter-arrival times closely match with the true inter-arrival times. Moreover, the results also show that IMTPP can event efficiently model the large spikes in inter-event time-intervals. Drill-down Analysis. Next, we provide a comparative analysis of the time prediction performance at the level of every event in the test set. To this end, for each observed event in the test set, we compute the gain (or loss) IMTPP achieves in terms of the time-prediction error per event E[| −^|], i.e., AE(baseline) −AE(IMTPP) for two competitive baselines, e.g., RMTPP and PFPP for Movies and Toys datasets. Figure 5 summarizes the results, which shows that IMTPP outperforms the most competitive baseline i.e. RMTPP for more than 70% events across both Movies and Toys datasets. It also shows that the performance gain of IMTPP over PFPP is ever more significant.

Ablation Study
We also conduct an ablation study for two key contributions in IMTPP: missing event MTPP and the intensity-free modeling of time-intervals. We denote IMTPP S as the variants of IMTPP without the missing MTPP and IMTPP R as the variant without the lognormal distribution for inter-event arrival times. More specifically, for IMTPP R we follow [12] to determine an intensity function for observed events using the output of the RNN, .
Later, we use the intensity function at a given timestamp to estimate the probability distribution of future events as: Similar to RQ2, we report the performance of IMTPP and its variants in terms of MAE and MPA in Tables 4 and 5 respectively. The results show that IMTPP outperforms IMTPP S and IMTPP R across  all metrics. The performance gain of IMTPP over IMTPP S signifies the importance of including missing events for modeling event sequences. We also note that the performance gain of IMTPP over IMTPP R reinforces our modeling design of using an intensity-free model for MTPPs.

Forecasting Future Events (RQ3)
To make a more challenging evaluation of IMTPP against its competitors we design a difficult event prediction task, where we predict the next events given only the current event as input.
To do so, we keep sampling events using the trained model^and^till -th prediction. Such an evaluation protocol effectively requires accurate inference of the missing data distribution, since, unlike during the training phase, the future observations are not fed into the missing event model. To this end, we compare the forecasting performance of IMTPP against RMTPP, the most competitive baseline. Figure 6 summarizes the results for Movies and Toys datasets, which shows that (1) the performances of all the algorithms deteriorate as increases and; (2 IMTPP achieves 5.5% improvements in MPA and significantly better 10.12% improvements in MAE than RMTPP across both datasets. The results further reinforce the ability of IMTPP to model the long-term distribution of events in a sequence.

Performance Comparison with Markov Chains
Previous research [12] has shown that the mark prediction performance of neural MTPP models is comparable to Markov Chains (MCs). Therefore, in addition to the mark prediction experiments  with MTPP models in Table 3, we also report the results for the comparison between IMTPP and MCs of orders 1 to 3 in Table 6. Note that we only report the results of the best-performing MC. The results show that the Markov models perform quite well in terms of mark prediction accuracy across all datasets. A careful investigation revealed that the datasets exhibit significant repetitive characteristics of marks in a small window. Thus for some datasets with large repetitions within a short history window, using a deep point process-based model is an overkill. On the other hand, for NYC Taxi, the mobility distribution clearly shows long-term dependencies, thus severely hampering the performance of Markov Chains. In these cases, point process-based models show better performance by being able to model the inter-event complex dependencies more efficiently.

Performance with Missing Data
To further emphasize the applicability of IMTPP in the presence of missing data, we perform event prediction on sequences with limited training data. Specifically, we synthetically delete events from a sequence i.e. we randomly (via a normal distribution) delete 40% (and 60%) of events from the original sequence and then train and test our model on the rest 60% events(40%). Figure 7 summarizes the results across Movies, Toys, and the Synthetic dataset. From the results, we note that with synthetic data deletion, the performance improvement of IMTPP over best-performing  baselines -RMTPP, THP and PFPP-is significant event after 40% events are deleted. This is because IMTPP is trained to capture the missing events and as a result, it can exploit the underlying setting with data deletion more effectively than the other models. Though this performance gains saturate with further increase in missing data as the added noise in the datasets severely hampers the learning of both models. Interestingly, we note that RMTPP outperforms THP and PFPP even in the situations with limited data.

Scalability Analysis (RQ4)
Here we compare the runtime of IMTPP with PFPP [36] in two settings: (1) training over complete sequences, and (2) training in a streaming setting.
6.9.1 With Complete Sequences. To highlight the time-effective learning ability of IMTPP, we compare the runtimes of IMTPP and PFPP across no. of training epochs as well as the length of training sequence |S |. Figure 8 summarizes the results, which shows that IMTPP enjoys a better latency than PFPP. In particular, we observe that the runtime of PFPP increases quadratically with respect to |S |, whereas, the runtime of IMTPP increases linearly. The quadratic complexity of PFPP is due to the presence of a backward RNN which requires a complete pass whenever a new event arrives. The larger run-times of both models can be attributed to the massive size of Movies dataset with 1.4 million events.
6.9.2 Streaming-based Runtime. As mentioned in Section 4, our setting differs significantly from PFPP [36] as it requires the complete data distribution, missing as well as observed, upfront for operating. However, we evaluate if their model can be extended to our setting i.e. a streaming setting wherein complete sequences are not available upfront rather they arrive as we progress with time along a sequence. In a streaming setting, the model is trained as per the arrival of events, and the only way for PFPP to be extended in this setting is to update the parameters at each arrival. This repetitive training is expensive and can withdraw the practicability of the model. To further assert our proposition, we evaluate the runtime of their model across the different datasets and compare with IMTPP. We report the results for training across only a few epochs (10) in a streaming setting in Table 7 could be attributed to the two-phase training of their model; (1) particle filtering, where they learn the underlying complete data distribution, and (2) particle smoothing, in which they filter out the inadequate events generated during particle filtering. Secondly, since PFPP requires complete data during training, an online setting would require repetitive parameter optimization on the arrival of each event. Thus, their model cannot be extended to such a scenario while maintaining its practicality. Thus, IMTPP is the singular practical approach for learning MTPPs in an online setting with intermittent observational data.

Imputation Performance
Here, we evaluate the ability of IMTPP and PFPP to impute missing events in a sequence. Specifically, we evaluate the ability of both models to generate the missing events that were not present during training. Thus, for Movies and Toys datasets where we synthetically remove all the ratings between the first month and the third month for all the entities in both datasets. We evaluate across the imputed events for test sequences. One important thing to note is that IMTPP only takes into account the history, but PFPP uses both, history and future events. We report the results across the Movies and Toys datasets in Figure 9. To summarize, our results show that even with limited historical information, IMTPP outperforms PFPP in time-prediction whereas both models perform competitively for mark prediction of missing events.

Convergence Analysis
Here, we highlight the stable convergence of the optimization procedure of IMTPP event after modeling the dynamics of observed as well as missing events. Therefore, we plot the epoch-wise best event prediction performance of IMTPP in terms of MAE and MPA in Figure 10. The results show that despite the coupled MTPP model and its variational inference-based learning, IMTPP  exhibits stable optimization procedure. We also note that mark prediction performance shows better convergence and outperforms other models only in a few training iterations. However, the time prediction ability of IMTPP requires longer training to achieve state-of-the-art performance.

Performance of IMTPP++
In this section, we evaluate the performance of IMTPP++ across two settings -(1) predicting future observed events, and (2) imputing missing events.

Observed Event Prediction.
Here we evaluate the ability of IMTPP++ to predict the observed events in a sequence. Specifically, we report the time prediction performance of IMTPP++ across a different number of permitted missing events ( ) and compare them with IMTPP i.e. with an unbounded number of missing events. Figure 11 summarizes our results which show that as we increase , the time prediction performance for IMTPP++ increases and it narrows the performance gap with IMTPP. However, IMTPP still performs better than IMTPP++. From the results, we conclude that IMTPP++ acts as a trade-off between the number of missing events and the prediction quality. This is a significant improvement over IMTPP as sampling missing events can be an expensive procedure. Moreover, as IMTPP++ involves a fine-tuning over pre-trained IMTPP, it has an added advantage of fine-tuning at amounts of missing events. From our experiments, we found that fine-tuning IMTPP++ took less than 15 minutes across all values of . We also note that with small , IMTPP is comparable to RMTPP i.e. the best performer for time prediction.
6.12.2 Imputing Missing Events. Our main contribution via IMTPP++ is to predict the missing events located randomly in a sequence. We evaluate this by performing an additional experiment using synthetic deletion. Specifically, we randomly sample events from each sequence and tag them to be missing. Later, we evaluate the ability of IMTPP++ and PFPP in imputing these missing events. Figure 12 summarizes the results and we note that IMTPP++ easily outperforms PFPP across all values of . Moreover, we note that as we increase , the imputation performance becomes better. Naturally, it can be attributed to relatively lesser variance in position of missing events with large . We reiterate that all confidence intervals are calculated using three independent runs.

Performance Variation with prior
Here, we train our model with different values of the prior scaling factor (¯) and then probe the variation of predictive performance. We highlight that¯differs from the mean of the log-normal flow of prior MTPP, though they share similar notations. To get a deeper insight into the contribution of the prior MTPP and the dataset dynamics, we also experiment with different training set sizes as in Section 6.8. For this evaluation, we consider the Movies dataset across 40% and 60% training data and plot the MPA and MAE against¯. Figure 13 summarizes the results and we note that there exist two particular trends corresponding to MAE and MPA across different¯. For MAE, as¯increases its first decreases and then increases, whereas, for MPA, it first increases and then decreases. Both the trends indicate the presence of an optimal value of¯. This tendency of IMTPP is consistent across different subsets of training data as well. Moreover, we also note that the optimal value forā lso changes as per the size of the training set.

CONCLUSION
Modeling continuous-time events with irregular observations is a non-trivial task that requires learning the distribution of both -observed and missing events. Standard MTPP models ignore this aspect and assume that the underlying data is complete with no missing events -an ideal assumption that is not practicable in many settings. In order to solve these shortcomings, in this paper, we provide a method for incorporating missing events for training marked temporal point processes, that simultaneously samples missing as well as observed events across continuous time. The proposed model IMTPP uses a coupled MTPP approach with its parameters optimized via variational inference. Experiments on several real datasets from diverse application domains show that our proposal outperforms other state-of-the-art approaches for predicting the dynamics of observed events. We also evaluate the ability of IMTPP to impute synthetically deleted missing events within observed events. In this setting as well, IMTPP outperforms other alternatives along with better scalability and guaranteed convergence. Since including missing data, improves over standard learning procedures, this observation opens avenues for further research that includes modeling or sampling missing data. However, one unaddressed aspect of the missing data problem is partially missing events i.e. events with either the time or mark as missing. In addition, the constrained optimization procedure in IMTPP++ can be improved by using Lagrangian multipliers. This would prevent the two-step procedure mentioned in Section 5.6 while simultaneously facilitating faster convergence. Therefore, we plan to extend our model for modeling partially missing events and using the enhanced learning procedure for IMTPP++ as future works of this paper.