Giter Club home page Giter Club logo

cflp's Introduction

Learning from Counterfactual Links for Link Prediction

This repository contains the source code for the ICML 2022 paper:

Learning from Counterfactual Links for Link Prediction

by Tong Zhao ([email protected]), Gang Liu, Daheng Wang, Wenhao Yu, and Meng Jiang.

Requirements

This code package was developed and tested with Python 3.8.5, PyTorch 1.6.0, and PyG 1.6.1. All dependencies specified in the requirements.txt file. The packages can be installed by

pip install -r requirements.txt

Usage

The step of finding all the counterfactual links can be slow for the first run, please adjust the --n_workers parameter according to available processes if you are trying out different settings. The cached files for the counterfactual links that were used in our experiments can be found here, please download and put them under data/T_files/ before reproducing our experiments.

Following are the commands to reproduce our experiment results on different datasets.

# Cora
python main.py --dataset cora --metric auc --alpha 1 --beta 1 --gamma 30 --lr 0.1 --embraw mvgrl --t kcore --neg_rate 50 --jk_mode mean --trail 20

# CiteSeer
python main.py --dataset citeseer --metric auc --alpha 1 --beta 1 --gamma 30 --lr=0.1 --embraw dgi --t kcore --neg_rate 50 --jk_mode mean --trail 20

# PubMed
python main.py --dataset pubmed --metric auc --alpha 1 --beta 1 --gamma 30 --lr 0.1 --embraw mvgrl --t kcore --neg_rate 40 --jk_mode mean --batch_size 12000 --epochs 200 --patience 50 --trail 20

# Facebook
python main.py --dataset facebook --metric hits@20 --alpha 1e-3 --beta 1e-3 --gamma 30 --lr 0.005 --embraw mvgrl --t louvain --neg_rate 1 --jk_mode mean --trail 20

# OGBL-ddi
python main.py --dataset ogbl-ddi --metric hits@20 --alpha 1e-3 --beta 1e-3 --gamma 10 --lr 0.01 --embraw dgi --t louvain  --neg_rate 1 --jk_mode mean --epochs=200 --epochs_ft=200 --patience=50 --trail 20

Cite

If you find this repository useful in your research, please cite our paper:

@inproceedings{zhao2022learning,
  title={Learning from Counterfactual Links for Link Prediction},
  author={Zhao, Tong and Liu, Gang and Wang, Daheng and Yu, Wenhao and Jiang, Meng},
  booktitle={International Conference on Machine Learning},
  pages={26911--26926},
  year={2022},
  organization={PMLR}
}

cflp's People

Contributors

zhao-tong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cflp's Issues

about the codes of JKNet

How can I use the encoder JKNet? I found the encoder was limited to GCN and GraphSage. thanks!

Function does not exist in scikit_network library:membership_matrix

Hello, I tried to cite your work and reproduce your code. But I met a serious problem.
You guys use the library ‘scikit_network’ in cf_utils.py, but I find this line of code reports an error:
from sknetwork.utils import membership_matrix.
The file ‘sknetwork.utils’ does not include the function ‘membership_matrix ’ at all.
I checked all the references for this library,and I did not find this function.
At the same time,there is a version error in requirements you offered.
pytorch = 1.6.0 is too old and is not available.
I hope you guys can provide a usable code.
Thank you again for your excellent work!

_pickle.UnpicklingError

I got this running 3rd example 'main.py --dataset facebook --metric hits@20 --alpha 1e-3 --beta 1e-3 --gamma 30 --lr 0.005 --embraw mvgrl --t louvain --neg_rate 1 --jk_mode mean --trail 20'

Traceback (most recent call last):
File "/content/drive/MyDrive/CFLP-main/main.py", line 338, in
main(args)
File "/content/drive/MyDrive/CFLP-main/main.py", line 327, in main
res = train(args, logger)
File "/content/drive/MyDrive/CFLP-main/main.py", line 84, in train
T_f, edges_cf_t1, edges_cf_t0, T_cf, adj_cf = load_t_files(args, T_file, logger, adj_train)
File "/content/drive/MyDrive/CFLP-main/cf_utils.py", line 28, in load_t_files
T_f, T_cf, adj_cf, edges_cf_t0, edges_cf_t1 = pickle.load(open(T_file, 'rb'))
_pickle.UnpicklingError: A load persistent id instruction was encountered,
but no persistent_load function was specified.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.