Skip to content

safe-graph/GNN-FakeNews

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GNN-based Fake News Detection

Open in Code Ocean PyPI

Installation | Datasets | User Guide | Leader Board | How to Contribute

This repo includes the Pytorch-Geometric implementation of a series of Graph Neural Network (GNN) based fake news detection models. All GNN models are implemented and evaluated under the User Preference-aware Fake News Detection (UPFD) framework. The fake news detection problem is instantiated as a graph classification task under the UPFD framework.

You can run the code on virtual machine hosted by Code Ocean.

We welcome contributions of SOTA results of existing models and results new models based on our dataset. You can check the Leader Board for implemented models and their performances.

If you use the code in your project, please cite the following paper:

SIGIR'21 (PDF)

@inproceedings{dou2021user,
  title={User Preference-aware Fake News Detection},
  author={Dou, Yingtong and Shu, Kai and Xia, Congying and Yu, Philip S. and Sun, Lichao},
  booktitle={Proceedings of the 44nd International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year={2021}
}

Installation

To run the code in this repo, you need to have Python>=3.6, PyTorch>=1.6, and PyTorch-Geometric>=1.6.1. Please follow the installation instructions of PyTorch-Geometric to install PyG.

Other dependencies can be installed using the following commands:

git clone https://github.com/safe-graph/GNN-FakeNews.git
cd GNN-FakeNews
pip install -r requirements.txt

Datasets

The dataset can be loaded using the PyG API. You can download the dataset via the link below:

https://mega.nz/file/jwggTC4D#MT1cOOzAOOjMU8i_kBTJ07vO-jQUW6Tu_YKY_ON97h4

The dataset includes fake&real news propagation networks on Twitter built according to fact-check information from Politifact and Gossipcop. The news retweet graphs were originally extracted by FakeNewsNet. We crawled near 20 million historical tweets from users participated in fake news propagation in FakeNewsNet to generate user features in the dataset.

The statistics of the dataset is shown below:

Data #Graphs #Total Nodes #Total Edges #Avg. Nodes per Graph
Politifact 314 41,054 40,740 131
Gossipcop 5464 314,262 308,798 58

Due to the Twitter policy, we could not release the crawled user historical tweets publicly. To get the corresponding Twitter user information, you can refer to news list under \data and map the news id to FakeNewsNet. Then, you can get the twitter user id and their information accordint to instructions on FakeNewsNet. In our case, we use Tweepy and Twitter Developer API to get the user information.

We incorporate four feature types in the dataset, the 768-dimensional bert and 300-dimensional spacy features are encoded using pretrained BERT and spaCy word2vec, respectively. The 10-dimensional profile feature is obtained from a Twitter account's profile. You can refer to profile_feature.py for profile feature extraction. The 310-dimensional content feature is composed of 300-dimensional user comment word2vec (spaCy) embeddings plus 10-dimensional profile features.

The graph data is a tree-structured social context graph where the root node represents the news, the leaf nodes are Twitter users who retweeted the root news. The following figure shows the UPFD framework including the dataset construction details You can refer to the paper for more details about the dataset.



User Guide

All GNN-based fake news detection models are under the \gnn_model directory. You can fine-tune each model according to arguments specified in the argparser of each code.

Since the UPFD framework is built upon the PyG, you can easily try other graph classification models like GIN and HGP-SL under our dataset.

Leader Board

To be updated.

Politifact

Model Feature Accuracy F1
GNN-CL
GCNFN
BiGCN
UPFD-GCN
UPFD-GAT
UPFD-SAGE

Gossipcop

Model Feature Accuracy F1
GNN-CL
GCNFN
BiGCN
UPFD-GCN
UPFD-GAT
UPFD-SAGE

How to Contribute

You are welcomed to submit your model, hyper-parameters, and results to this repo via create a pull request. After verifying the results, your model will be added to the repo and the result will be updated to the leaderboard. For other inquiries, please send email to [email protected].