MCPcopy Index your code
hub / github.com/ant-research/EasyTemporalPointProcess

github.com/ant-research/EasyTemporalPointProcess @0.2.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.2.1 ↗ · + Follow
488 symbols 1,526 edges 74 files 297 documented · 61%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

EasyTPP [ICLR 2024]

Python Version Code License Last Commit

PyPI version Downloads Hugging Face Open Issues

EasyTPP is an easy-to-use development and application toolkit for Temporal Point Process (TPP), with key features in configurability, compatibility and reproducibility. We hope this project could benefit both researchers and practitioners with the goal of easily customized development and open benchmarking in TPP.

| Features | Model List | Dataset | Quick Start | Benchmark |Documentation |Todo List | Citation |Acknowledgement | Star History |

News

Click to see previous news

Features [Back to Top]

  • Configurable and customizable: models are modularized and configurable,with abstract classes to support developing customized TPP models.
  • PyTorch-based implementation: EasyTPP implements state-of-the-art TPP models using PyTorch 1.7.0+, providing a clean and modern deep learning framework.
  • Reproducible: all the benchmarks can be easily reproduced.
  • Hyper-parameter optimization: a pipeline of optuna-based HPO is provided.

Model List [Back to Top]

We provide reference implementations of various state-of-the-art TPP papers:

No Publication Model Paper Implementation
1 KDD'16 RMTPP Recurrent Marked Temporal Point Processes: Embedding Event History to Vector PyTorch
2 NeurIPS'17 NHP The Neural Hawkes Process: A Neurally Self-Modulating Multivariate Point Process PyTorch
3 NeurIPS'19 FullyNN Fully Neural Network based Model for General Temporal Point Processes PyTorch
4 ICML'20 SAHP Self-Attentive Hawkes process PyTorch
5 ICML'20 THP Transformer Hawkes process PyTorch
6 ICLR'20 IntensityFree Intensity-Free Learning of Temporal Point Processes PyTorch
7 ICLR'21 ODETPP Neural Spatio-Temporal Point Processes (simplified) PyTorch
8 ICLR'22 AttNHP Transformer Embeddings of Irregularly Spaced Events and Their Participants PyTorch
9 NeurIPS'25 S2P2 Deep Continuous-Time State-Space Models for Marked Event Sequences PyTorch

Dataset [Back to Top]

We preprocessed one synthetic and five real world datasets from widely-cited works that contain diverse characteristics in terms of their application domains and temporal statistics: - Synthetic: a univariate Hawkes process simulated by Tick library. - Retweet (Zhou, 2013): timestamped user retweet events. - Taxi (Whong, 2014): timestamped taxi pick-up events. - StackOverflow (Leskovec, 2014): timestamped user badge reward events in StackOverflow. - Taobao (Xue et al, 2022): timestamped user online shopping behavior events in Taobao platform. - Amazon (Xue et al, 2022): timestamped user online shopping behavior events in Amazon platform.

Per users' request, we processed two non-anthropogenic datasets - Earthquake: timestamped earthquake events over the Conterminous U.S from 1996 to 2023, processed from USGS. - Volcano eruption: timestamped volcano eruption events over the world in recent hundreds of years, processed from The Smithsonian Institution.

All datasets are preprocess to the Gatech format dataset widely used for TPP researchers, and saved at Google Drive with a public access.

Quick Start [Back to Top]

Colab Tutorials

Explore the following tutorials that can be opened directly in Google Colab:

  • Open in Colab Tutorial 1: Dataset in EasyTPP.
  • Open in Colab Tutorial 2: Tensorboard in EasyTPP.
  • Open in Colab Tutorial 3: Training and Evaluation of TPPs.

End-to-end Example

We provide an end-to-end example for users to run a standard TPP model with EasyTPP.

Step 1. Installation

First of all, we can install the package either by using pip or from the source code on Github.

To install the latest stable version:

pip install easy-tpp

To install the latest on GitHub:

git clone https://github.com/ant-research/EasyTemporalPointProcess.git
cd EasyTemporalPointProcess
python setup.py install

Step 2. Prepare datasets

We need to put the datasets in a local directory before running a model and the datasets should follow a certain format. See OnlineDoc - Datasets for more details.

Suppose we use the taxi dataset in the example.

Step 3. Train the model

Before start training, we need to set up the config file for the pipeline. We provide a preset config file in Example Config. The details of the configuration can be found in OnlineDoc - Training Pipeline.

After the setup of data and config, the directory structure is as follows:


    data
     |______taxi
             |____ train.pkl
             |____ dev.pkl
             |____ test.pkl

    configs
     |______experiment_config.yaml

Then we start the training by simply running the script


import argparse
from easy_tpp.config_factory import Config
from easy_tpp.runner import Runner


def main():
    parser = argparse.ArgumentParser()

    parser.add_argument('--config_dir', type=str, required=False, default='configs/experiment_config.yaml',
                        help='Dir of configuration yaml to train and evaluate the model.')

    parser.add_argument('--experiment_id', type=str, required=False, default='NHP_train',
                        help='Experiment id in the config file.')

    args = parser.parse_args()

    config = Config.build_from_yaml_file(args.config_dir, experiment_id=args.experiment_id)

    model_runner = Runner.build_from_config(config)

    model_runner.run()


if __name__ == '__main__':
    main()

A more detailed example can be found at OnlineDoc - QuickStart.

Documentation [Back to Top]

The classes and methods of EasyTPP have been well documented so that users can generate the documentation by:

```shell cd doc pip install -r requ

Core symbols most depended-on inside this repo

get
called by 119
easy_tpp/config_factory/config.py
items
called by 16
easy_tpp/preprocess/event_tokenizer.py
parse_from_yaml_config
called by 12
easy_tpp/config_factory/config.py
format
called by 10
easy_tpp/utils/log_utils.py
to
called by 10
easy_tpp/preprocess/event_tokenizer.py
compute_loglikelihood
called by 9
easy_tpp/model/torch_model/torch_basemodel.py
make_dtime_loss_samples
called by 9
easy_tpp/model/torch_model/torch_basemodel.py
values
called by 8
easy_tpp/preprocess/event_tokenizer.py

Shape

Method 308
Function 107
Class 73

Languages

Python100%

Modules by API surface

easy_tpp/model/torch_model/torch_baselayer.py27 symbols
easy_tpp/ssm/models.py21 symbols
easy_tpp/config_factory/model_config.py21 symbols
easy_tpp/runner/base_runner.py17 symbols
easy_tpp/preprocess/event_tokenizer.py16 symbols
easy_tpp/model/torch_model/torch_intensity_free.py16 symbols
examples/train_nhp_with_features.py15 symbols
easy_tpp/utils/misc.py15 symbols
easy_tpp/model/torch_model/torch_ode_tpp.py15 symbols
easy_tpp/hpo/optuna_hpo.py14 symbols
easy_tpp/preprocess/data_loader.py13 symbols
easy_tpp/model/torch_model/torch_s2p2.py13 symbols

For agents

$ claude mcp add EasyTemporalPointProcess \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact