Git Product home page Git Product logo

fake_news_detection_gnns's Introduction

A GNN-based model for Fake News Detection

Setup

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

Usage

To reproduce the results on the 2 datasets

sh run.sh

To run the model with different parameters

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

Datasets

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.



Model



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

Team Members

Chau Pham, Sheng Huang, and Efe Sencan

References

Title Tag Conference Links Notes
Semi-Supervised Classification with Graph Convolutional Networks GCN 2016 PaperVideo
Inductive Representation Learning on Large Graphs Graph SAGE 2017 PaperVideo
Graph Attention Networks GAT ICLR 2018 PaperVideoDGLblogMainCodeCode2Code3
A Generalization of Transformer Networks to Graphs Graph Transformers AAAI 2021 PaperCode General form of GAT
Understanding Convolutions on Graphs GNN tutorials Distill 2021 part2part1
Geometric Deep Learning: Grids, Groups, Graphs, Geodesics, and Gauges small book + tutorials on GNNs 2021 PaperTutorialsICLR2021MLStreetTalk
Attention is all you need Transformer Neurips 2017 Papervideo
Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention Linear Transformer ICML 2020 Papervideo Reduce time complexity O(N^2) to O(N)
GNN papers + DGL examples DGL Tutorials
User Preference-aware Fake News Detection UPFD SIGIR 2021 PaperCode datasets, our model was based on this awesome paper

Acknowledgement

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/

fake_news_detection_gnns's People

Contributors

chaudatascience avatar efesencan avatar shengh1997 avatar

Watchers

 avatar

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.