Member-only story
Building a Fake News Detection System with TensorFlow and LSTM
Fake news is a type of misinformation that can mislead readers, influence public opinion, and even damage reputations. Detecting fake news prevents its spread and protects individuals and organizations. Media outlets often use these models to help filter and verify content, ensuring that the news shared with the public is accurate.
In this article we’ll build a deep learning model using TensorFlow in Python to detect fake news from text.
Implementation of Fake News Detection Model
We will be building the model with following steps to make our model:
1. Importing Libraries
The libraries we will be using are numpy, pandas, scikit learn and tenserflow.
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.model_selection import train_test_split
from sklearn import preprocessing
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
2. Importing the Dataset
We will be using fake news dataset, which contains News text and corresponding label (FAKE or REAL). Dataset can be downloaded from this .