Home

Awesome

Mining User-aware Multi-relations for Fake News Detection in Large Scale Online Social Networks

This repository is the official PyTorch implementation of Us-DeFake in the paper:

Mining User-aware Multi-relations for Fake News Detection in Large Scale Online Social Networks, accepted by the the 16th ACM International Conference on Web Search and Data Mining (WSDM '23) [arXiv].

Dependencies

Datasets

To show the input formats of datasets, we give an example dataset "toy" in /data/ directory. The toy dataset is just used to show the input format, it's not suitable for experiments. The structure of the /data/toy/ directory should be as follows.Download Example Dataset

data/
│
└───toy/
    │   class_map.json
    │   post_graph.txt
    │   text_adj_full.npz
    │   text_feats.npy
    │   user_adj_full.npz
    │   user_feats.npy
    │   user_graph
    │   user_post_graph.txt
    └───1/
        │    text_adj_train.npz
        │    text_role.json
        │    user_adj_train.npz
        └─── user_role.json

Cython Implemented Parallel Graph Sampler

We have a cython module which need compilation before training can start. Compile the module by running the following from the root directory:

python graphsaint/setup.py build_ext --inplace

Training Configuration

The hyperparameters needed in training can be set via the configuration file: ./train_config/<dataset_name>.yml.

Run Training

First of all, please compile cython samplers (see above). We suggest looking through the available command line arguments defined in ./utility/globals.py.

To run the code on CPU

python -m train --data_prefix ./data/<dataset_name> --fold <fold_k> --train_config ./train_config/<dataset_name>.yml --gpu -1

To run the code on GPU

python -m train --data_prefix ./data/<dataset_name> --fold <fold_k> --train_config ./train_config/<dataset_name>.yml --gpu 0

For example, to run dataset 'toy' on CPU:

python -m train --data_prefix ./data/toy --fold 1 --train_config ./train_config/toy.yml --gpu -1

Citation & Acknowledgement

We thank Hanqing Zeng et al. proposed the GraphSAINT paper and released the code. Us-DeFake employs GraphSAINT to learn representations of news and users in large scale online social networks.

If you find this method helpful for your research, please cite our paper.

@article{su2022mining,
  title={Mining User-aware Multi-relations for Fake News Detection in Large Scale Online Social Networks},
  author={Su, Xing and Yang, Jian and Wu, Jia and Zhang, Yuchen},
  journal={arXiv preprint arXiv:2212.10778},
  year={2022}
}