SAHP#

Summary#

A self-attentive history encoder with mark-specific states that relax exponentially toward a learned asymptote.

Intensity and objective#

state_decay computes the pre-intensity state from the history encoding. The mu and eta heads use GELU; gamma uses softplus. The loss and sampling paths apply scaled softplus:

\[\begin{split}z_k(u)&=\mu_k+(\eta_k-\mu_k)\exp(-\gamma_k u),\\ \lambda_k(u)&=\operatorname{ScaledSoftplus}_k(z_k(u)).\end{split}\]

The loss is the negative marked event log-intensity sum plus the integrated total intensity, using the shared Likelihood integration helper.

Implementation: easy_tpp/model/sahp.py. The formulas above summarize this implementation, including its numerical choices, rather than asserting equivalence to every variant in the reference.

Original reference#

Self-Attentive Hawkes process (as listed in the repository README).

Shipped preset#

This is the packaged model fragment. Configuration and presets explains how it merges with the dataset and shared trainer presets.

trainer_config:
  batch_size: 256
  shuffle: False
  optimizer: adam
  learning_rate: 1.e-3
  valid_freq: 1
  use_tfb: False
  metrics: [ 'acc', 'rmse' ]
  seed: 2019
  gpu: -1
model_config:
  hidden_size: 32
  time_emb_size: 16
  num_layers: 2
  num_heads: 2
  loss_integral_num_sample_per_step: 20
  use_ln: False
  thinning:
    num_seq: 10
    num_sample: 1
    num_exp: 500 # number of i.i.d. Exp(intensity_bound) draws at one time in thinning algorithm
    look_ahead_time: 10
    patience_counter: 5 # the maximum iteration used in adaptive thinning
    over_sample_rate: 5
    num_samples_boundary: 21
    dtime_max: 5
    num_step_gen: 1

API#

easy_tpp.model.SAHP · EasyTPP Models