Fake News Detection Using Machine Learning and Natural Language Processing
Tags: Logistic Regression, Gradient Boosting, Fake News Detection, Bi Lstm, Machine Learning

— by Vineet Maheshwari, Palak Tiwari, Deepankar Kansal

Fake news is misleading news stories that come from non-reputable sources which are having a significant impact on our social life. Fake news detection is an emerging research area which is gaining interest but involved some challenges due to the limited amount of resources (i.e., datasets, published literature) available.

To make sure that our machine learning models give accurate results, we need to check the dataset on which we are training our models i.e. dataset should be unbiasedly containing an equal number of fake news instances and real news instances. Today we will look into this problem and propose some machine learning algorithms, that are helpful in predicting whether a news is fake or not.

Unbiased Dataset (Good for training the models)

Biased Dataset (Not give accurate results on future data)

So we will see the results of various machine learning models, for which we first apply the natural language processing techniques on the text data of the unbiased dataset.

Text Preprocessing

For all the below functions, you can use libraries like ‘nltk, re, etc.’

Tokenization: First we create tokens of the text data. Removing Stopwords: Remove the stopwords like “a, an, the, then, etc.” Because we know that these words have no or very less impact on whether a news is fake or not. Stemming: Converting the word into its base form, for example: converting ‘worked’ to its base form which is ‘work’.

After the above preprocessing, we can apply the ‘Bag of Words’ feature extraction technique using CountVectorizer class from the sklearn library “sklearn.feature_extraction.text”. This class can also build ‘Bag of Words’ using Unigram and Bigram combinations. For training the model we are using these Unigram and Bigram combinations.

We also apply RNN’s(recurrent neural network) variant ‘Bi-LSTM’, for which we will use ‘Glove embeddings’ to convert the words into their embedding.

Models

Machine Learning Models that we used:

Logistic Regression Support Vector Machines Multinomial Naive Bayes (Naive Bayes Variant) Gradient Boosting Bi-LSTM (Bidirectional Long Short Term Memory)

Why we choose Text+Title corpus for training the models?

We try multiple variations of the corpus such as choosing the title of the news, the text of the news and both together. We train the logistic regression(LR) model using all the three variants of corpus and observed that Text+Title combination of the corpus is giving good results. We can observe the accuracies for the same from the below table:

So, for further training, we have applied Text+Title corpus on the models mentioned above and achieved encouraging accuracies mentioned in the below table and also visual from the plot:

Table for accuracies on mentioned models

Conclusion

Using the above-mentioned algorithms, i.e. Naive Bayes classifier, Support Vector Machine and Logistic Regression, Gradient Boosting and Bidirectional LSTM. The maximum accuracy obtained is using Text+Title with Gradient Boosting Classifier. LR and Gradient Boosting were giving almost similar accuracy, SVM and Bidirectional LSTM were little less, however, the accuracy obtained from Naive Bayes was relatively lesser than other models. LR and Gradient Boosting were performing better because the features that we are extracting from the corpus are well separated that both logistic regression and gradient boosting are able to capture the context.

Link to the source-code:

https://github.com/VineetMaheshwari/FakeNewsDetection

Dataset Used from Kaggle and Codalab’s competition

Blog Authors and Contributions:

Deepankar Kansal (linkedin.com/in/deepankar-kansal-255911152): Literature Survey, Unigram & Bigram combinations for Bag of words, Logistic Regression, Multinomial Naive Bayes, Report & Analysis of models.

Vineet Maheshwari (linkedin.com/in/vineet-maheshwari-9117b3180): Literature Survey, Datasets Handling, SVM, Glove+Bi-LSTM, Report & Analysis of models.

Palak Tiwari (linkedin.com/in/palak-2810-tiwari): Literature Survey, Text Preprocessing, Gradient Boosting, Data & Results Visualization, Report & Analysis of models.

Under the guidance of

Professor: linkedin.com/in/tanmoy-chakraborty-89553324 Prof. Website: faculty.iiitd.ac.in/~tanmoy/ Teaching Fellow: Ms Ishita Bajaj Teaching Assistants: Pragya Srivastava, Shiv Kumar Gehlot, Chhavi Jain, Vivek Reddy, Shikha Singh and Nirav Diwan.

References