|
Multivariate Point Process Package
0.1
|
SelfInhibitingProcess implements the standard multivariate Self-inhibiting (or self-correcting) process. More...
#include "include/SelfInhibitingProcess.h"
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... | |
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.
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.
|
inline |
The constructor.
| [in] | n | the number of parameters in total. |
| [in] | num_dims | the number of dimensions in the process. |
Definition at line 141 of file SelfInhibitingProcess.h.
Maximum likelihood estimation for the model parameters.
| [in] | data | vectors of observed sequences. |
| [in] | options | data structure sotring different configuration for the optimization algorithm and the respective regularizations. |
Definition at line 340 of file SelfInhibitingProcess.cc.
|
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}
| [out] | objvalue | negative loglikelihood. |
| [out] | gradient | gradient of the parameters. |
Definition at line 185 of file SelfInhibitingProcess.cc.
|
virtual |
Returns the gradient w.r.t. the model parameters on the k-th sequence.
| [in] | k | sequence index. |
| [out] | gradient | the gradient vector w.r.t. the model parameters. |
Implements IProcess.
Definition at line 335 of file SelfInhibitingProcess.cc.
|
protected |
Initialize the temporal features arrayK and arrayG from the input sequences.
| [in] | data | input collection of sequences |
Definition at line 17 of file SelfInhibitingProcess.cc.
|
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.
| [in] | t | the given time. |
| [in] | data | the given sequence of the past events until time t. |
| [out] | intensity_dim | a 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. |
Implements IProcess.
Definition at line 123 of file SelfInhibitingProcess.cc.
|
virtual |
Returns the integral of the intensity function \(\int_{a}^b\lambda^*(\tau)d\tau\) where \(a = lower\) and \(b = upper\).
| [in] | lower | starting point of the integral. |
| [in] | upper | ending point of the integral. |
| [in] | data | sequence of past events. |
Implements IProcess.
Definition at line 406 of file SelfInhibitingProcess.cc.
|
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.
| t | the starting time. |
| L | the duration. |
| data | the given sequence of the past events until time t. |
| intensity_upper_dim | a column vector of size num_dims_ storing the upper bound of the intensity function on each dimension from time t to t + L. |
Implements IProcess.
Definition at line 154 of file SelfInhibitingProcess.cc.
|
virtual |
Negative loglikelihood of self-inhibiting point process.
Call GetNegLoglikelihood with different types of regularization.
| [out] | objvalue | negative loglikelihood. |
| [out] | gradient | gradient of the parameters. |
Implements IProcess.
Definition at line 272 of file SelfInhibitingProcess.cc.
|
protected |
Post process the learned dependency structure.
Definition at line 381 of file SelfInhibitingProcess.cc.
|
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.
| [in] | data | the sequence of past events. |
| [in] | num_simulations | number of simulations we use to calculate the sample average. |
Implements IProcess.
Definition at line 401 of file SelfInhibitingProcess.cc.
|
protected |
restore to the default optimization configuration
Definition at line 411 of file SelfInhibitingProcess.cc.
|
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.
|
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.
|
protected |
Total number of observed sequences.
Definition at line 45 of file SelfInhibitingProcess.h.
|
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.
|
protected |
Definition at line 132 of file SelfInhibitingProcess.h.
1.8.11