Learn how to use NLP and passive aggressive algorithm to spot fake news online.

Image for post

The booming development of online social networks in the recent years has spiked the volume of fake news for various commercial and political purposes across many online platforms.

We all have stumbled upon fake news of politicians dying, some leader giving out statement about temples and mosques and what not.

The misleading news has tremendously affected the readers and has brought a very negative effect on the offline society already.

Thus, an important goal in improving the trustworthiness of information on online social networks is to identify the fake news timely and correctly.

In this post I’ll be guiding you through building a **Fake news detection **classifier using Passive Agressive Algorithm.


The data-set used for the classifier can be downloaded here.

The data-set contains three columns namely:

  1. Title: Title of the news article
  2. Text: Content of the news article
  3. Label: Two labels- FAKE and REAL.

Image for post

A subset of the data-set

In a nutshell, using sklearn, a TfidfVectorizer is built on the data-set. Then, a Passive Aggressive Classifier is initialized and the model is fit. In the end, the accuracy score and the confusion matrix quantitatively explain how well the model fares.

#data-science #fake-news #machine-learning #deep learning

Detecting Fake Political News Online
1.45 GEEK