{"id":18283629,"url":"https://github.com/xovee/ccgl","last_synced_at":"2025-04-05T07:30:59.234Z","repository":{"id":111914608,"uuid":"291713452","full_name":"Xovee/ccgl","owner":"Xovee","description":"TKDE 2022. CCCL: Contrastive Cascade Graph Learning.","archived":false,"fork":false,"pushed_at":"2024-03-12T09:57:23.000Z","size":14171,"stargazers_count":38,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T23:42:04.206Z","etag":null,"topics":["acm","aps","data-augmentation","dblp","graph","information-cascade","information-diffusion","popularity-prediction","self-supervised-learning","twitter","weibo"],"latest_commit_sha":null,"homepage":"https://www.xoveexu.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Xovee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-31T12:47:29.000Z","updated_at":"2025-02-24T03:28:31.000Z","dependencies_parsed_at":"2024-11-05T13:11:20.805Z","dependency_job_id":"c70ec1d0-f263-45c5-ab3e-f53c53eb4231","html_url":"https://github.com/Xovee/ccgl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xovee%2Fccgl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xovee%2Fccgl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xovee%2Fccgl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xovee%2Fccgl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xovee","download_url":"https://codeload.github.com/Xovee/ccgl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305264,"owners_count":20917194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acm","aps","data-augmentation","dblp","graph","information-cascade","information-diffusion","popularity-prediction","self-supervised-learning","twitter","weibo"],"created_at":"2024-11-05T13:10:11.815Z","updated_at":"2025-04-05T07:30:54.227Z","avatar_url":"https://github.com/Xovee.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CCGL: Contrastive Cascade Graph Learning\n\n![](https://img.shields.io/badge/TKDE-22-blue)\n![](https://img.shields.io/badge/python-3.7-green)\n![](https://img.shields.io/badge/tensorflow-2.3-green)\n![](https://img.shields.io/badge/cudatoolkit-10.1-green)\n![](https://img.shields.io/badge/cudnn-7.6.5-green)\n\nThis repo provides a reference implementation of Contrastive Cascade Graph Learning (**CCGL**) framework as described in the paper:\n\n\u003e CCGL: Contrastive Cascade Graph Learning   \n\u003e [Xovee Xu](https://www.xoveexu.com), [Fan Zhou](https://dblp.org/pid/63/3122-2.html), [Kunpeng Zhang](http://www.terpconnect.umd.edu/~kpzhang/), and [Siyuan Liu](https://directory.smeal.psu.edu/sxl68)  \n\u003e IEEE Transactions on Knowledge and Data Engineering (TKDE), vol. 35, no. 5, pp. 4539--4554, May 2023   \n\u003e [arXiv:2107.12576](https://arxiv.org/abs/2107.12576)  \n\u003e https://doi.org/10.1109/TKDE.2022.3151829  \n\n\n## Dataset\n\nYou can download all five datasets (Weibo, Twitter, ACM, APS, and DBLP) via any one of the following links:\n\nGoogle Drive|Dropbox|Onedrive|Baidu Netdisk\n:---:|:---:|:---:|:---:\n\u003ca href='https://drive.google.com/file/d/1wmUa7hvJlF5oCLVJ72OgyKnVkHZJX8jX/view?usp=sharing' target='_black'\u003e\u003cimg src='./.assets/200px-Google_Drive_logo.png' height=30px\u003e|\u003ca href='https://www.dropbox.com/s/0kadkjyuwffcuw2/datasets.zip?dl=0' target='_black'\u003e\u003cimg src='./.assets/140px-Microsoft_Office_OneDrive_(2018–present).png' height=30px\u003e\u003c/a\u003e|\u003ca href='https://1drv.ms/u/s!AsVLooK4NjBruTngZWgx1p0psD1k?e=5iMcVB' target='_black'\u003e\u003cimg src='.assets/dropbox.png' height=30px\u003e\u003c/a\u003e|\u003ca href='https://pan.baidu.com/s/16A5SvCVEtPYxelyYIlYAQg' target='_black'\u003e\u003cimg src='./.assets/baidu-netdisk.jpg' height=30px\u003e `trqg`\u003c/a\u003e\n\n\n## Environmental Settings\n\nOur experiments are conducted on Ubuntu 20.04, a single NVIDIA 1080Ti GPU, 48GB RAM, and Intel i7 8700K. CCGL is implemented by `Python 3.7`, `TensorFlow 2.3`, `Cuda 10.1`, and `Cudnn 7.6.5`.\n\nCreate a virtual environment and install GPU-support packages via [Anaconda](https://www.anaconda.com/):\n```shell\n# create virtual environment\nconda create --name=ccgl python=3.7 cudatoolkit=10.1 cudnn=7.6.5\n\n# activate virtual environment\nconda activate ccgl\n\n# install other dependencies\npip install -r requirements.txt\n```\n\n## Usage\n\nHere we take Weibo dataset as an example to demonstrate the usage.\n\n### Preprocess\n\nStep 1: divide, filter, generate labeled and unlabeled cascades:\n```shell\ncd ccgl\n# labeled cascades\npython src/gene_cas.py --input=./datasets/weibo/ --unlabel=False\n# unlabeled cascades\npython src/gene_cas.py --input=./datasets/weibo/ --unlabel=True\n```\n\nStep 2: augment both labeled and unlabeled cascades (here we use the `AugSIM` strategy):\n```shell\npython src/augmentor.py --input=./datasets/weibo/ --aug_strategy=AugSIM\n```\n\nStep 3: generate cascade embeddings:\n```shell\npython src/gene_emb.py --input=./datasets/weibo/ \n```\n\n### Pre-training\n\n```shell\npython src/pre_training.py --name=weibo-0 --input=./datasets/weibo/ --projection_head=4-1\n```\nThe saved pre-training model is named as `weibo-0`. \n\n### Fine-tuning\n\n```shell\npython src/fine_tuning.py --name=weibo-0 --num=0 --input=./datasets/weibo/ --projection_head=4-1\n```\nHere we load the pre-trained model `weibo-0` and save the teacher network as `weibo-0-0`.\n\n### Distillation\n\n```shell\npython src/distilling.py --name=weibo-0-0 --num=0 --input=./datasets/weibo/ --projection_head=4-1\n```\nHere we load the teacher network `weibo-0-0` and save the student network as `weibo-0-0-student-0`. \n\n### (Optional) Run the Base model\n\n```shell\npython src/base_model.py --input=./datasets/weibo/ \n```\n\n## CCGL model weights\n\nWe provide pre-trained, fine-tuned, and distilled CCGL model weights. Please see details in the following table. \n\nModel|Dataset|Label Fraction|Projection Head|MSLE|Weights\n:---|:---|:---|:---|:---|:---\nPre-trained CCGL model|Weibo|100%|4-1|-|[Download](./results/pre_training_weight/weibo-100.h5)\nPre-trained CCGL model|Weibo|10%|4-4|-|[Download](./results/pre_training_weight/weibo-10.h5)\nPre-trained CCGL model|Weibo|1%|4-3|-|[Download](./results/pre_training_weight/weibo-1.h5)\nFine-tuned CCGL model|Weibo|100%|4-1|2.70|[Download](./results/fine_tuning_weight/weibo-100-0.h5)\nFine-tuned CCGL model|Weibo|10%|4-4|2.87|[Download](./results/fine_tuning_weight/weibo-10-0.h5)\nFine-tuned CCGL model|Weibo|1%|4-3|3.30|[Download](./results/fine_tuning_weight/weibo-1-0.h5)\n\nLoad weights into the model:\n```python\n# construct model, carefully check projection head designs:\n# use different number of Dense layers\n...\n# load weights for fine-tuning, distillation, or evaluation\nmodel.load_weights(weight_path)\n```\nCheck `src/fine_tuning.py` and `src/distilling.py` for *weights loading* examples.\n\n## Default hyper-parameter settings\n\nUnless otherwise specified, we use following default hyper-parameter settings.\n\nParam|Value|Param|Value\n:---|---:|:---|---:\nAugmentation strength|0.1|Pre-training epochs|30\nAugmentation strategy|AugSIM|Projection Head (100%)|4-1\nBatch size|64|Projection Head (10%)|4-4\nEarly stopping patience|20|Projection Head (1%)|4-3\nEmbedding dimension|64|Model size|128 (4x)\nLearning rate|5e-4|Temperature|0.1\n\n## Change Logs\n\n- Jul 21, 2021: fix a bug and some annotations\n\n## Cite\n\nIf you find our paper \u0026 code are useful for your research, please consider citing us 😘:\n\n```bibtex\n@article{xu2022ccgl, \n  author = {Xovee Xu and Fan Zhou and Kunpeng Zhang and Siyuan Liu}, \n  title = {{CCGL}: Contrastive Cascade Graph Learning}, \n  journal = {IEEE Transactions on Knowledge and Data Engineering (TKDE)},\n  volume = {35},\n  number = {5},\n  pages = {4539--4554},\n  year = {2022},\n  doi = {10.1109/TKDE.2022.3151829}, \n}\n```\n\nWe also have a [survey paper](https://dl.acm.org/doi/10.1145/3433000?cid=99659687041) you might be interested:\n\n```bibtex\n@article{zhou2021survey,\n  author = {Fan Zhou and Xovee Xu and Goce Trajcevski and Kunpeng Zhang}, \n  title = {A Survey of Information Cascade Analysis: Models, Predictions, and Recent Advances}, \n  journal = {ACM Computing Surveys (CSUR)}, \n  volume = {54},\n  number = {2},\n  year = {2021},\n  articleno = {27},\n  numpages = {36},\n  doi = {10.1145/3433000},\n}\n```\n\n## Acknowledgment\n\nWe would like to thank [Xiuxiu Qi](https://qhemu.github.io/xiuxiuqi/), [Ce Li](https://github.com/celi52), [Qing Yang](https://www.linkedin.com/in/庆-杨-43ba1a142), and Wenxiong Li for sharing their computing resources and help us to test the codes. We would also like to show our gratitude to the authors of [SimCLR](https://github.com/google-research/simclr) (and [Sayak Paul](https://github.com/sayakpaul)), [node2vec](https://github.com/eliorc/node2vec), [DeepHawkes](https://github.com/CaoQi92/DeepHawkes), and others, for sharing their codes and datasets. \n\n## Contact\n\nFor any questions please open an issue or drop an email to: `xovee at live.com`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxovee%2Fccgl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxovee%2Fccgl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxovee%2Fccgl/lists"}