iTHP#

Summary#

A candidate-type attention model following the original public-code architecture, with a separate positive intensity decoder for each mark.

Intensity and objective#

_marked_intensity_chunks concatenates candidate-type and query-time embeddings, attends to preceding history, and applies a mark-specific linear decoder followed by softplus:

\[\lambda_k(t\mid\mathcal H_t)=\operatorname{softplus} (w_k^\top z_k(t,\mathcal H_t)+b_k).\]

This is the executed public-code variant described in the class docstring; it is not a claim of the exact additive form of the original reference’s Equation (7). The implementation conditions on the first event and uses per-sequence integration. integration_method selects mc, trapezoid, or fixed_grid. Training may add the next-type cross-entropy term controlled by use_type_loss and type_loss_weight; validation and testing use pure point-process NLL.

The model requires num_layers: 1, positive even hidden_size, and model_specs.d_v equal to twice hidden_size. num_heads is not used. See the class docstring for the documented architecture and integration differences from the original implementation.

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

Original reference#

Interpretable Transformer 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: 16
  shuffle: False
  optimizer: adam
  learning_rate: 5.e-4
  valid_freq: 1
  use_tfb: False
  metrics: null
  seed: 2019
  gpu: -1
model_config:
  hidden_size: 16
  num_layers: 1
  dropout_rate: 0.0
  loss_integral_num_sample_per_step: 20
  model_specs:
    d_inner: 128
    d_k: 16
    d_v: 32
    integration_method: mc
    query_chunk_size: 256
    use_type_loss: true
    type_loss_weight: 0.5
  thinning:
    num_seq: 10
    num_sample: 1
    num_exp: 500
    look_ahead_time: 10
    patience_counter: 5
    over_sample_rate: 5
    num_samples_boundary: 21
    dtime_max: 5
    num_step_gen: 1

API#

easy_tpp.model.ITHP · EasyTPP Models