Fake news classification in NLP


In this tutorial, we will train a LSTM based deep learning model to detect fake news from a given news corpus. This tutorial could be practically used by any media company to automatically predict whether the circulating news is fake or not. The process could be done automatically without having humans manually review thousands of news related articles.

So i have implemented a Fake news classifier. This is Natural Language Processing based project which classifies the news is fake or genuine(not) and my model gave a 93% accuracy on the test data.

Let’s start :-

So first of all import all the required libraries which we are using to implement our fake news classifier project.

Now sometimes some code gives a warning and warning may be different according to the code. So warnings look like this

So to ignore the warnings , we write a code

Now it’s time for load the data of our fake news and let’s show the starting 5 news. In our data , there are 5 features which you can see in below screenshot id, title, author, text and label. But i am implementing a fake news classifier. So our news are title and our target feature is label.

1 stands for Real news or genuine news

0 stands for fake news

Visit website to read complete tutorial :




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store