Multivariate Point Process Package  0.1
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SelfInhibitingProcess Class Reference

SelfInhibitingProcess implements the standard multivariate Self-inhibiting (or self-correcting) process. More...

#include "include/SelfInhibitingProcess.h"

Inheritance diagram for SelfInhibitingProcess:
IProcess

Classes

struct  OPTION
 Options used to configure the fitting of the terminating point process. More...
 

Public Types

enum  Regularizer { L1, L22, NONE }
 Supported regularizations used to fit the standard Hawkes Process. More...
 
enum  RegCoef { LAMBDA0, LAMBDA }
 Regularization coefficients. More...
 

Public Member Functions

 SelfInhibitingProcess (const unsigned &n, const unsigned &num_dims)
 The constructor. More...
 
void fit (const std::vector< Sequence > &data, const OPTION &options)
 Maximum likelihood estimation for the model parameters. More...
 
virtual void NegLoglikelihood (double &objvalue, Eigen::VectorXd &gradient)
 Negative loglikelihood of self-inhibiting point process. More...
 
virtual void Gradient (const unsigned &k, Eigen::VectorXd &gradient)
 Returns the gradient w.r.t. the model parameters on the k-th sequence. More...
 
virtual double Intensity (const double &t, const Sequence &data, Eigen::VectorXd &intensity_dim)
 Intensity function of self-inhibiting point process. More...
 
virtual double IntensityUpperBound (const double &t, const double &L, const Sequence &data, Eigen::VectorXd &intensity_upper_dim)
 Returns the upper bound of the summation of the intensity value on each dimension from time t to t + L given the history of past events in sequence data. Let \({\lambda_d^*(t)}\) be the conditional intensity function on the d-th dimension where \(d=1\dotso D\), and num_dims_ = D. This function returns

\begin{align} \lambda_0^D(t) \geq \sum_{d=1}^D\sup_{\tau\in[t, t + \tau(t)]}\lambda^*_d(\tau), \end{align}

where the returned value \(\lambda_0^D(t)\) will be used for Ogata's Thinning algorithm. More...

 
virtual double IntensityIntegral (const double &lower, const double &upper, const Sequence &data)
 Returns the integral of the intensity function \(\int_{a}^b\lambda^*(\tau)d\tau\) where \(a = lower\) and \(b = upper\). More...
 
virtual double PredictNextEventTime (const Sequence &data, const unsigned &num_simulations)
 Predict the next event timing by the expectation \(\int_{t_n}^\infty tf^*(t)dt\). Currently, we use the sample average by simulations to approximate the expectation since the conditional density \(f^*(t)\) normally does not have an analytic form. More...
 
- Public Member Functions inherited from IProcess
 IProcess (const unsigned &n, const unsigned &num_dims)
 The constructor. More...
 
const Eigen::VectorXd & GetParameters ()
 Return the column vector of model parameters. More...
 
unsigned GetNumDims ()
 Return the number of dimensions in the process. More...
 
void SetParameters (const Eigen::VectorXd &v)
 Set the model parameters. More...
 
void PlotIntensityFunction (const Sequence &data)
 Plots the intensity functions based on the given sequence. It plots the intensity function and the associated event points up of each dimension in the same figure. More...
 
void PlotIntensityFunction (const Sequence &data, const unsigned &dim_id)
 Plots the intensity function and the associated event points of the dimension dim_id. More...
 

Protected Member Functions

void Initialize (const std::vector< Sequence > &data)
 Initialize the temporal features arrayK and arrayG from the input sequences. More...
 
void RestoreOptionToDefault ()
 restore to the default optimization configuration More...
 
void GetNegLoglikelihood (double &objvalue, Eigen::VectorXd &gradient)
 Negative loglikelihood of self-inhibiting point process. More...
 
void PostProcessing ()
 Post process the learned dependency structure. More...
 
- Protected Member Functions inherited from IProcess
void InitializeDimension (const std::vector< Sequence > &data)
 

Protected Attributes

std::vector< std::vector< Eigen::MatrixXd > > arrayK_
 Temporal features associated with the intensity function. More...
 
std::vector< std::vector< std::vector< std::vector< std::pair< double, unsigned > > > > > arrayG_
 Temporal features associated with the integral of the intensity function. More...
 
unsigned num_sequences_
 Total number of observed sequences. More...
 
Eigen::VectorXd observation_window_T_
 A column vector of length \(C\) which is the total number of sequences. Each component records the observation window in the respective sequence. More...
 
OPTION options_
 
- Protected Attributes inherited from IProcess
Eigen::VectorXd parameters_
 A column vector represents all model parameters of the process. More...
 
unsigned num_dims_
 The total number of dimensions of the process. More...
 
std::vector< std::vector< std::vector< double > > > all_timestamp_per_dimension_
 all_timestamp_per_dimension_ is a 3-d array where all_timestamp_per_dimension_[c][n][i] records the i-th event on the n-th dimension in the c-th sequence. More...
 

Detailed Description

SelfInhibitingProcess implements the standard multivariate Self-inhibiting (or self-correcting) process.

In a multivariate Self-inhibiting process, the intensity of each dimension \(n\) is defined as:

\begin{align} \lambda^*_n(t) = exp\bigg(\lambda^n_0t - \sum_{m=1}^D\sum_{t^m_j < t}\beta_{mn}\bigg), \end{align}

where \(\{\lambda^n_0\}\) and \(\{\beta_{mn}\}\) are the model parameters. In contrast to the Hawkes process, the intuition here is that while the intensity increases steadily with the rate \(\lambda^n_0\), every time when a new event appears, it is decreased by multiplying a constant $e^{-{mn}} < 1$, so the chance of new points decreases after an event has occurred recently.

Definition at line 23 of file SelfInhibitingProcess.h.

Member Enumeration Documentation

Regularization coefficients.

Enumerator
LAMBDA0 

Regularization coefficient for \(\|\boldsymbol{\lambda}_0\|\)

LAMBDA 

Regularization coefficient for \(\|\boldsymbol{\beta}\|\)

Definition at line 99 of file SelfInhibitingProcess.h.

Supported regularizations used to fit the standard Hawkes Process.

Enumerator
L1 

Sparse L1 norm \(\|\cdot\|_1\)

L22 

L22 norm \(\|\cdot\|_2^2\)

NONE 

No regularization

Definition at line 82 of file SelfInhibitingProcess.h.

Constructor & Destructor Documentation

SelfInhibitingProcess::SelfInhibitingProcess ( const unsigned &  n,
const unsigned &  num_dims 
)
inline

The constructor.

Parameters
[in]nthe number of parameters in total.
[in]num_dimsthe number of dimensions in the process.

Definition at line 141 of file SelfInhibitingProcess.h.

Member Function Documentation

void SelfInhibitingProcess::fit ( const std::vector< Sequence > &  data,
const OPTION options 
)

Maximum likelihood estimation for the model parameters.

Parameters
[in]datavectors of observed sequences.
[in]optionsdata structure sotring different configuration for the optimization algorithm and the respective regularizations.

Definition at line 340 of file SelfInhibitingProcess.cc.

void SelfInhibitingProcess::GetNegLoglikelihood ( double &  objvalue,
Eigen::VectorXd &  gradient 
)
protected

Negative loglikelihood of self-inhibiting point process.

\begin{align} -\frac{1}{C}\sum_{c=1}^C\bigg\{\sum_{n = 1}^D\bigg(\sum_{i=1}^{n_c}\bigg(\lambda^n_0t^n_{i,c} - \sum_{m=1}^D\sum_{t^m_{j,c} < t^n_{i,c}}\beta_{mn} - \int_{t^n_{i-1,c}}^{t^n_{i,c}}\exp(\lambda^n_0t - \sum_{m=1}^D\sum_{t^m_{j,c} < t}\beta_{mn})dt\bigg) - \int_{t^n_{n_c,c}}^{T_c}\exp(\lambda^n_0t - \sum_{m=1}^D\sum_{t^m_{j,c} < t}\beta_{mn})dt\bigg)\bigg\} \end{align}

Parameters
[out]objvaluenegative loglikelihood.
[out]gradientgradient of the parameters.

Definition at line 185 of file SelfInhibitingProcess.cc.

void SelfInhibitingProcess::Gradient ( const unsigned &  k,
Eigen::VectorXd &  gradient 
)
virtual

Returns the gradient w.r.t. the model parameters on the k-th sequence.

Parameters
[in]ksequence index.
[out]gradientthe gradient vector w.r.t. the model parameters.

Implements IProcess.

Definition at line 335 of file SelfInhibitingProcess.cc.

void SelfInhibitingProcess::Initialize ( const std::vector< Sequence > &  data)
protected

Initialize the temporal features arrayK and arrayG from the input sequences.

Parameters
[in]datainput collection of sequences

Definition at line 17 of file SelfInhibitingProcess.cc.

double SelfInhibitingProcess::Intensity ( const double &  t,
const Sequence data,
Eigen::VectorXd &  intensity_dim 
)
virtual

Intensity function of self-inhibiting point process.

In a multivariate Self-inhibiting process, the intensity of each dimension \(n\) is defined as:

\begin{align} \lambda^*_n(t) = exp\bigg(\lambda^n_0t - \sum_{m=1}^D\sum_{t^m_j < t}\beta_{mn}\bigg), \end{align}

where \(\{\lambda^n_0\}\) and \(\{\beta_{mn}\}\) are the model parameters. In contrast to the Hawkes process, the intuition here is that while the intensity increases steadily with the rate \(\lambda^n_0\), every time when a new event appears, it is decreased by multiplying a constant $e^{-{mn}} < 1$, so the chance of new points decreases after an event has occurred recently.

Parameters
[in]tthe given time.
[in]datathe given sequence of the past events until time t.
[out]intensity_dima column vector of size num_dims_ where each component stores the intensity value of the respetive dimension at time t given the sequence of past events in data.
Returns
the summation of the intensity value from each dimension.

Implements IProcess.

Definition at line 123 of file SelfInhibitingProcess.cc.

double SelfInhibitingProcess::IntensityIntegral ( const double &  lower,
const double &  upper,
const Sequence data 
)
virtual

Returns the integral of the intensity function \(\int_{a}^b\lambda^*(\tau)d\tau\) where \(a = lower\) and \(b = upper\).

Parameters
[in]lowerstarting point of the integral.
[in]upperending point of the integral.
[in]datasequence of past events.
Returns
\(\int_{a}^b\lambda^*(\tau)d\tau\) where \(a = lower\) and \(b = upper\).

Implements IProcess.

Definition at line 406 of file SelfInhibitingProcess.cc.

double SelfInhibitingProcess::IntensityUpperBound ( const double &  t,
const double &  L,
const Sequence data,
Eigen::VectorXd &  intensity_upper_dim 
)
virtual

Returns the upper bound of the summation of the intensity value on each dimension from time t to t + L given the history of past events in sequence data. Let \({\lambda_d^*(t)}\) be the conditional intensity function on the d-th dimension where \(d=1\dotso D\), and num_dims_ = D. This function returns

\begin{align} \lambda_0^D(t) \geq \sum_{d=1}^D\sup_{\tau\in[t, t + \tau(t)]}\lambda^*_d(\tau), \end{align}

where the returned value \(\lambda_0^D(t)\) will be used for Ogata's Thinning algorithm.

Parameters
tthe starting time.
Lthe duration.
datathe given sequence of the past events until time t.
intensity_upper_dima column vector of size num_dims_ storing the upper bound of the intensity function on each dimension from time t to t + L.
Returns
the summation of the upper-bound of each intensity function from the respetive dimension within the interval [t, t + L].

Implements IProcess.

Definition at line 154 of file SelfInhibitingProcess.cc.

void SelfInhibitingProcess::NegLoglikelihood ( double &  objvalue,
Eigen::VectorXd &  gradient 
)
virtual

Negative loglikelihood of self-inhibiting point process.

Call GetNegLoglikelihood with different types of regularization.

Parameters
[out]objvaluenegative loglikelihood.
[out]gradientgradient of the parameters.

Implements IProcess.

Definition at line 272 of file SelfInhibitingProcess.cc.

void SelfInhibitingProcess::PostProcessing ( )
protected

Post process the learned dependency structure.

Definition at line 381 of file SelfInhibitingProcess.cc.

double SelfInhibitingProcess::PredictNextEventTime ( const Sequence data,
const unsigned &  num_simulations 
)
virtual

Predict the next event timing by the expectation \(\int_{t_n}^\infty tf^*(t)dt\). Currently, we use the sample average by simulations to approximate the expectation since the conditional density \(f^*(t)\) normally does not have an analytic form.

Parameters
[in]datathe sequence of past events.
[in]num_simulationsnumber of simulations we use to calculate the sample average.
Returns
the prediction of the next event timing.

Implements IProcess.

Definition at line 401 of file SelfInhibitingProcess.cc.

void SelfInhibitingProcess::RestoreOptionToDefault ( )
protected

restore to the default optimization configuration

Definition at line 411 of file SelfInhibitingProcess.cc.

Member Data Documentation

std::vector<std::vector<std::vector<std::vector<std::pair<double, unsigned> > > > > SelfInhibitingProcess::arrayG_
protected

Temporal features associated with the integral of the intensity function.

arrayG_[c][n][i] is a vector of pairs. Each pair records how many events have occurred on each dimension between the \((i-1)\)-th event and the \(i\)-th event on the dimension \(n\).

Definition at line 40 of file SelfInhibitingProcess.h.

std::vector<std::vector<Eigen::MatrixXd > > SelfInhibitingProcess::arrayK_
protected

Temporal features associated with the intensity function.

arrayK_[c][n] is an \(n_c\) by \(D\) matrix where arrayK_[c][n][i][m] records how many events have occurred on dimension \(m\) before the \(i\)-th event on dimension \(n\) in the given sequence \(c\).

Definition at line 33 of file SelfInhibitingProcess.h.

unsigned SelfInhibitingProcess::num_sequences_
protected

Total number of observed sequences.

Definition at line 45 of file SelfInhibitingProcess.h.

Eigen::VectorXd SelfInhibitingProcess::observation_window_T_
protected

A column vector of length \(C\) which is the total number of sequences. Each component records the observation window in the respective sequence.

Definition at line 50 of file SelfInhibitingProcess.h.

OPTION SelfInhibitingProcess::options_
protected

Definition at line 132 of file SelfInhibitingProcess.h.


The documentation for this class was generated from the following files: