Skip to content

Python implementation of the Latent Space Hawkes (LSH) model for continuous-time dynamic networks

License

Notifications You must be signed in to change notification settings

IdeasLabUT/Latent-Space-Hawkes

Repository files navigation

Latent-Space-Hawkes

Python implementation of the Latent Space Hawkes (LSH) model for continuous-time dynamic networks

This repo contains the Python implementation and code to replicate experiments for LSH model in the paper A Mutually Exciting Latent Space Hawkes Process Model for Continuous-time Networks, accpeted by UAI 2022.


Abstract

Networks and temporal point processes serve as fundamental building blocks for modeling complex dynamic relational data in various domains. We propose the latent space Hawkes (LSH) model, a novel generative model for continuous-time networks of relational events, using a latent space representation for nodes. We model relational events between nodes using mutually exciting Hawkes processes with baseline intensities dependent upon the distances between the nodes in the latent space and sender and receiver specific effects. We propose an alternating minimization algorithm to jointly estimate the latent positions of the nodes and other model parameters. We demonstrate that our proposed LSH model can replicate many features observed in real temporal networks including reciprocity and transitivity, while also achieves superior prediction accuracy and provides more interpretability compared to existing models.


Running the experiments

Requirements

Dependencies (with python >= 3.7)

  • numpy==1.18.5
  • scikit-learn==0.23.1
  • matplotlib==3.2.2
  • networkx==2.4
  • dynetworkx==0.3.2
  • seaborn==0.10.1
  • scipy==1.5.0
  • autograd=1.3
  • pickle=4.0

Datasets and results

enron-events.pckl: stores the Enron data provided in Yang's github-repo. All other datasets are available in the storage/datasets; All results will be stored in the storage/results

Model running

Future events prediction tasks:

It will run the estimation and save estimated parameters in a pickle file.

# run the model on reality mining dataset with a 2 dimendion LSH model
python LSH_model_fit.py --data 'reality' --dim 2

Dynamic link prediction tasks:

This task requires running the future events prediction tasks (model estimation) first to load the estimated parameters from the pickle file.

# run dynamic link prediction on reality mining dataset with a 2 dimendion model
python dynamic_link_pred.py --data 'reality' --dim 2

Genetative tasks (Posterior predictive check):

This task requires running the future events prediction tasks (model estimation) first to load the estimated parameters from the pickle file.

# run the generative test on reality mining dataset with a 2 dimendion model
python LSH_generative.py --data 'reality' --dim 2

Simulation tasks

# run the simulation experiments
python LSH_model_sim.py

General flags

optional arguments:
--data   		Dataset to use (eg. reality, Enron-Yang, MID, fb-forum)
-d --dim  		Latent dimensions for LSH model
-c --continent  	Whether to plot 2D MID latent space with continent colored
-a --alternating 	Whether to use alternating minimization for latent space model estimation
-n --negative    	Whether to use negative slope for latent space model

About

Python implementation of the Latent Space Hawkes (LSH) model for continuous-time dynamic networks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages