/casflow

TKDE 2021. CasFlow: Exploring Hierarchical Structures and Propagation Uncertainty for Cascade Prediction.

Primary LanguagePythonMIT LicenseMIT

CasFlow

This repo provides a reference implementation of CasFlow as described in the paper:

CasFlow: Exploring Hierarchical Structures and Propagation Uncertainty for Cascade Prediction
Xovee Xu, Fan Zhou, Kunpeng Zhang, Siyuan Liu, and Goce Trajcevski
IEEE Transactions on Knowledge and Data Engineering (TKDE), 2021

Basic Usage

Requirements

The code was tested with python 3.9.7, tensorflow 2.9.1, cudatoolkit 11.2, and cudnn 8.1.0. Install the dependencies via Anaconda:

# create virtual environment
conda create --name casflow python=3.9 

# activate environment
conda activate casflow

# install tensorflow and other requirements
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
pip install -r requirements.txt

A note from 2024: fu*k tensorflow

If you fail to initialize the GPU

It could be your environment incorrectly loads the system-wide installation of CUDA instead of the version CUDA 11.2. You can follow this to use the 11.2 version temporarily. First, open a new shell window. Then, run the following codes:

unset CUDA_HOME
unset LD_LIBRARY_PATH

export PATH=$CONDA_PREFIX/lib:$PATH
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH

Then you can try using the GPU:

import tensorflow as tf
print(tf.config.list_physical_devices('GPU'))

Run the code

cd ./casflow

# generate information cascades
python gene_cas.py --input=./dataset/sample/

# generate cascade graph and global graph embeddings 
python gene_emb.py --input=./dataset/sample/

# run CasFlow model
python casflow.py --input=./dataset/sample/

More running options are described in the codes, e.g.,

  • Using the Weibo dataset: --input=./dataset/weibo/
  • Change observation time: --observation_time=3600

Datasets

See some sample cascades in ./dataset/sample/.

Datasets download link: Google Drive or Baidu Drive (password: 1msd).

The datasets we used in the paper are come from:

Cite

If you find CasFlow useful for your research, please consider citing us 😘:

@article{xu2021casflow,  
  author = {Xovee Xu and Fan Zhou and Kunpeng Zhang and Siyuan Liu and Goce Trajcevski},  
  title = {Cas{F}low: Exploring Hierarchical Structures and Propagation Uncertainty for Cascade Prediction},
  journal = {IEEE Transactions on Knowledge and Data Engineering (TKDE)},
  year = {2021}, 
  volume = {35}, 
  number = {4}, 
  pages={3484-3499}, 
  doi = {10.1109/TKDE.2021.3126475}, 
}

This paper is an extension of VaCas:

@inproceedings{zhou2020variational,
  author = {Fan Zhou and Xovee Xu and Kunpeng Zhang and Goce Trajcevski and Ting Zhong},
  title = {Variational Information Diffusion for Probabilistic Cascades Prediction}, 
  booktitle = {IEEE International Conference on Computer Communications (INFOCOM)},
  year = {2020},
  pages = {1618--1627},
  doi = {10.1109/INFOCOM41043.2020.9155359},
}

We also have a survey paper you might be interested:

@article{zhou2021survey,
  author = {Fan Zhou and Xovee Xu and Goce Trajcevski and Kunpeng Zhang}, 
  title = {A Survey of Information Cascade Analysis: Models, Predictions, and Recent Advances}, 
  journal = {ACM Computing Surveys}, 
  volume = {54},
  number = {2},
  year = {2021},
  articleno = {27},
  numpages = {36},
  doi = {10.1145/3433000},
}

Contact

For any questions please open an issue or drop an email to: xovee at live.com