Skip to content

Who fakes news better? Comparing quality of "fake" news generated with Markov chains and LSTMs. Final project for the machine learning class.

License

Notifications You must be signed in to change notification settings

oneturkmen/news-generation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

News generation

Fake news generation using Markov chains (n-gram language modeling) and long-short term memory network (LSTM).

Usage

Install dependencies (keras, tensorflow, numpy, pandas):

# Upgrade your pip3
python3 -m pip install --upgrade pip

# Install deps
pip3 install -U -r src/requirements.txt

Then, clean up your CSV containing tweets (e.g., remove stopwords):

python3 src/data_processing <input.csv> <output_clean.csv>

If you want to run n-gram model, run the following command with the output csv file from the previous one:

python3 src/model_ngrams.py <output_clean.csv>

If you would like to run LSTM model based on characters, run the following the same way:

python3 src/model_lstm_chars.py <output_clean.csv>

These will either output results to command line, or generate a file called generated_text_rnn_chars.txt. Feel free to modify, play with the code, and contribute if you find a bug.

Project report

To see the report, click here.

Data clean-up

Code here

Examples of generated text

Using n-grams (markov chain)

Using LSTM

About

Who fakes news better? Comparing quality of "fake" news generated with Markov chains and LSTMs. Final project for the machine learning class.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages