git clone [email protected]:chaudatascience/fake_news_detection_gnns.git
cd fake_news_detection_gnns
conda env create -f environment.yml
conda activate fake_news
sh run.sh
python -m src.fake_news.fake_news_detection --dataset gossipcop --epochs 300 --early_stopping 50 --batch 128
Arguments
'--dataset', type=str, default="gossipcop",
help="name of the dataset, either 'gossipcop' or 'politifact' "
'--early_stopping', type=int, default=50,
help="stop training after `early_stopping` non-decreasing val loss epochs"
'--cuda', type=str, default="auto",
help="choose x for 'cuda:x', or using most available GPU by default"
'--batch', type=int, default=128,
help="batch size for training"
'--lr', type=float, default=0.001,
help="learning rate"
'--weight_decay', type=float, default=0.01,
help="weight decay for lr"
'--epochs', type=int, default=300,
help="training epochs"
'--dropout', type=float, default=0,
help="dropout"
'--pooling', type=str, default="global_max_pool",
help="one of [global_mean_pool, global_max_pool, global_attention, global_attention_with_relu, global_attention_with_relu_linear]"
'--gat_layer', type=str, default="GATConv",
help="one of ['OurGATNet', GATConv', 'GATv2Conv', 'SuperGATConv']"
'--hid_dims', type=List[int], default=[32],
help="hidden dimensions for GATs"
'--news_dim', type=int, default=64,
help="dimensions for news"
'--readout_dim', type=int, default=64,
help="dimensions for graph readout"
'--num_heads', type=int, default=1,
help="num attention heads for each GAT layer"
'--feature', type=str, default='content',
help="feature type: [profile, spacy, bert, content],`content` means 300-d word2vec+10-d profile"
'--only_gat', type=bool, default=False,
help="Only use GAT (testing purpose)"
For hyper-param tuning, use --hyper_param
flag, and use --config_file
to point to the yaml
config file.
Example of the config file can be found here.
python -m src.fake_news.fake_news_detection --hyper_param --config_file demo
Some important files
- fake_news_detection.py: Main file for fake news detection
- fake_news_net.py: Our implementation for Fake News Net
- GAT package: Our implementation of Graph Attention Networks (GATs)
- GAT package v2: Another version of our implementation of GATs.
Datasets from UPFD (SIGIR'21) paper.
Fake and Real news on Twitter verified by
- Politifact: Journalists and domain experts review the political news and provide fact-checking evaluation results.
- Gossipcop: GossipCop provides rating scores on the scale of 0 to 10 to classify a news story.
Train and val losses on Gossipcop dataset
Resulting table
Analyse Results: More details of the results (e.g., train and val losses, accuracy by number of attention heads) can be found at this Jupyter notebooks
Chau Pham, Sheng Huang, and Efe Sencan
Title | Tag | Conference | Links | Notes |
---|---|---|---|---|
Semi-Supervised Classification with Graph Convolutional Networks | GCN | 2016 | Paper Video | |
Inductive Representation Learning on Large Graphs | Graph SAGE | 2017 | Paper Video | |
Graph Attention Networks | GAT | ICLR 2018 | Paper Video DGLblog MainCode Code2 Code3 | |
A Generalization of Transformer Networks to Graphs | Graph Transformers | AAAI 2021 | Paper Code | General form of GAT |
Understanding Convolutions on Graphs | GNN tutorials | Distill 2021 | part2 part1 | |
Geometric Deep Learning: Grids, Groups, Graphs, Geodesics, and Gauges | small book + tutorials on GNNs | 2021 | Paper Tutorials ICLR2021 MLStreetTalk | |
Attention is all you need | Transformer | Neurips 2017 | Paper video | |
Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention | Linear Transformer | ICML 2020 | Paper video | Reduce time complexity O(N^2) to O(N) |
GNN papers + DGL examples | DGL | Tutorials | ||
User Preference-aware Fake News Detection | UPFD | SIGIR 2021 | Paper Code | datasets, our model was based on this awesome paper |
To compare our own GAT implementation with the original GAT implementation, and compare our fake news net with UPFD, we borrow official implentations from https://github.com/PetarV-/GAT and https://github.com/pyg-team/pytorch_geometric/
-
paper_gat.py are from https://github.com/PetarV-/GAT
-
upfd.py: UPFD implementation