Giter Site home page Giter Site logo

fakenewsdeeplearning's Introduction

This is the code to reproduce the results in the paper:

"The Language of Fake News: Opening the Black-Box of Deep Learning Based Detectors", O'Brien et al. (2018)

Running the code from scratch

  1. Pre-requisites: Python3 + packages: nltk, numpy, sklearn, Tensorflow (tested in version 1.12.0rc0)

  2. Download and ungzip GoogleNews-vectors-negative300.bin.gz. Save the uncompressed GoogleNews-vectors-negative300.bin in the root directory of the repository (same directory as train.py). You can get the file here:

    https://github.com/mmihaltz/word2vec-GoogleNews-vectors

  3. Run pattern removal script, clean_data.py:

python clean_data.py
  1. Train the Neural Network: train.py (experiment could be either Trump or all)
python train.py --experiment=Trump

Stop the training when the validation accuracy does not increase anymore. The validation accuracy is displayed every 100 training steps. A directory in 'run' that cointains the network parameters is created.

  1. Test the Neural Network eval.py
python eval.py --experiment=Trump
  1. Get the most relevant patterns for each article:
python get_patterns.py --experiment=Trump
  1. Display the most relevant patters accross all the dataset by parts of speech:
python parts_of_speech.py --experiment=Trump
  1. We obtained the following patterns:

Frequent patterns useful in fake and real news

Dataset

The dataset consists on the Fake News Dataset by Kaggle collected by the BS detector (7,401 articles) + articles collected from "The Guardian" and "The New York Times" (8,999 articles).

In the data directory it can be found:

  • data/raw: the original articles

  • data/processed: the articles after removing words that are not in the English dictionary via PyEnchant

  • data/clean: the articles after cleaning advertisements and announcements, punctuation, etc. This is the data before going to the detector.

fakenewsdeeplearning's People

Watchers

James Cloos avatar  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.