NLP-Project-Fake-News-Detection
Paper : https://arxiv.org/abs/1705.00648
Data : https://www.cs.ucsb.edu/~william/data/liar_dataset.zip
The paper did not release the source code.
Run all the cells in the ipython notebook.
function : train(model,architecture, use_pos, use_meta, use_dep)
- params :
- model : keras Sequential model
- architecture : 'lstm' or 'cnn'
- use_pos : boolean (tells whether the POS embeddings are to be used as input to the model for training)
- use_meta : boolean (tells whether the metadata is to be used as input to the model for training)
- use_dep : boolean (tells whether the Dependency parse embeddings are to be used as input to the model for training)
- model : keras Sequential model
function_1 : (false_predicted,true_predicted) = evaluate(model, use_pos, use_meta, use_dep)
- params :
- model : keras Sequential model
- use_pos : boolean (tells whether the POS embeddings were used as input to the model while training)
- use_meta : boolean (tells whether the metadata was used as input to the model while training)
- use_dep : boolean (tells whether the Dependency parse embeddings were used as input to the model while training)
- model : keras Sequential model
- returns :
- false_predicted : dictionary with keys as indices of test samples that were classified as "pants-on-fire" (false news) and values as the softmax probability for this class label.
- true_predicted : dictionary with keys as indices of test samples that were classified as "true" (not a fake news) and values as the softmax probability for this class label.
- false_predicted : dictionary with keys as indices of test samples that were classified as "pants-on-fire" (false news) and values as the softmax probability for this class label.
function_2 : print_best_false_true_predicted(false_predicted,true_predicted)
- params :
- outputs from the above mentioned evaluate() function.
- outputs from the above mentioned evaluate() function.
- outputs :
- prints top 5 sentences which where predicted as "pants-on-fire" (fake news) with highest softmax probabilities.
- prints top 5 sentences which where predicted as "true" (not fake news) with highest softmax probabilities.
- prints top 5 sentences which where predicted as "pants-on-fire" (fake news) with highest softmax probabilities.
Keras==2.2.2
matplotlib==2.1.2
numpy==1.15.4
pandas==0.22.0
pydot==1.4.0
scikit-learn==0.19.1
scipy==1.0.0
sklearn==0.0
spacy==2.0.18
tensorboard==1.9.0
tensorflow==1.9.0
spacy==2.0.18
nltk==3.4