Fake News Detection using LSTM based deep learning approach

. The identification of false information has become a critical concern in the modern era of technology, as the ready availability of information and widespread utilization of social media platforms have accelerated the dissemination of inaccurate news. The ability to accurately identify false news can help to mitigate the negative effects of misinformation, such as public confusion, political polarization, and potential harm to public health and safety. This paper presents a comprehensive review of ML and DL based approaches for fake news detection. Our review provides insights and guidance for researchers and practitioners interested in developing effective fake news detection systems using ML and DL approaches. News reporters often need to verify authenticity of news stories before publishing or reporting them. By utilizing fake news detection models, reporters can filter out fake news and focus on reporting accurate and reliable information.


Introduction
This research investigates the application of ML and DL algorithms in detecting fake news. The study initially explores the characteristics of fake news and the challenges of detecting it. Then, it presents an overview of ML algorithms and their application to fake news detection. The study evaluates performance of several algorithms on a dataset of real and fake news articles. Results specify that ML algorithms cannot effectively distinguish between real and fake news articles with the high accuracy.
As such, we put forth a deep learning methodology that uses LSTM neural networks for identifying false news. The proposed approach takes the textual content of news articles as input and utilizes an LSTM architecture to capture the temporal dependencies of the text. The proposed LSTM-based model is trained on a dataset of news articles from Kaggle and achieved an accuracy of 94% in detecting fake news. This performance is a significant improvement over previous approaches for fake news detection.
The proposed approach is beneficial in real world scenarios where there is a high volume of news articles to analyse. It can also be useful for social media platforms to detect and remove fake news from their networks. Model's ability to capture the temporal dependencies of the text is especially relevant in the context of news articles, where the order of the words and phrases can significantly impact the article's meaning.
Our study contributes to the ongoing efforts in combatting the spread of misinformation and highlights the potential of DL approaches in detecting fake news. Proposed LSTM-based model is a promising tool for identifying fake news, and it can also be extended to other domains, such as social media posts and online reviews, where fake or malicious content can also spread. By deploying the proposed model in real-world applications, we can help users make informed decisions and reduce the impact of fake news. Overall, this study highlights potential of DL approaches in detecting false news and contributes to the ongoing efforts in combatting the spread of misinformation in digital media.

Literature Review
Fake news has resulted as a significant concern in today's digital age because of the widespread availability of information and the rapid spread of misinformation through social media platforms. Scholars and experts have been actively investigating diverse methodologies, including ML and DL techniques, with the aim to effectively detect fake news and minimize its detrimental impacts. In this section, we provide a comprehensive review of the existing literature on ML and DL based approaches for fake news detection. Several studies have focused on ML algorithms to detect fake news. Logistic Regression Decision Tree, Random Forest, Multinomial NB, and K-neighbors Classifier are commonly used ML algorithms for detecting fake news. These algorithms are trained on labeled datasets of the fake and real news articles to learn patterns and features that can distinguish between the two categories. Julio C. S. Reis al [1] presented a supervised learning-based approach using a combination of linguistic, semantic, and social features. The proposed approach outperforms baseline approaches in terms of accuracy, recall, precision and F1-score. Future enhancements include exploring the use of additional features, DL techniques, and unsupervised learning techniques to improve the system's performance. Akshay Jain al [2] proposed ML based approach for detecting fake news using textual features and classifiers. The SVM classifier has outperformed the decision tree classifier in terms of precision, recall, accuracy, and F1-score. Future enhancements include exploring the use of additional features, DL techniques, and ensemble models to improve the system's performance. The "COVID Fake News Dataset" presented by Sumit Banik [3] involves using a dataset of COVID fake news, preprocessing the data by cleaning and filtering techniques, vectorizing the text using the bag-of-words technique with TF-IDF, building classification models using different ML algorithms. Kelly Stahl * B.S. proposed "Fake news detection in social media [4]. The proposed method for fake news detection in social media is the combination of SVM, Naïve Bayes classifier, and semantic analysis. This integrated algorithm aims to increase accuracy and applicability in the social media domain. The combination of SVM and Naïve Bayes classifier has been shown to be effective in minimizing false positives and maximizing balance detection rates in other domains, such as intrusion detection systems. Additionally, adding semantic analysis to both SVM and Naïve Bayes classifier addresses the limitations of assuming independence among features in Naïve Bayes classifier and improves the efficiency of SVM by focusing on informative subspaces of the feature spaces. Hadeer Ahmed al [5] introduced a fake news detection model in their study, which incorporated machine learning techniques along with n-gram analysis. Through extensive investigations and comparisons of two feature extraction techniques and six ML classification techniques, experimental evaluations demonstrated that the most effective combination was using TF-IDF for feature extraction and LSVM as the classifier. This approach achieved an impressive accuracy rate of 92%. One of the papers proposed by Rohit Kuamr Kaliyar al, Soumendu Sinha al [6] where they present a deep convolutional approach (FNDNet) for fake news detection that achieves improved results compared to existing methods. The model was evaluated on a real-world fake news dataset and showed promising performance, making it a potential solution for accurately detecting fake news in various applications. Recently there is a notable interest in DL based methodologies, specifically those utilizing RNNs such as LSTM for fake news detection. LSTM is a type of RNN which can capture the temporal dependencies in sequential data, making it appropriate for processing text data with complex and long-term dependencies, such as news articles. Jamal Abdul Nasir al [7] presented a paper that proposed an LSTM-based model that achieved a high accuracy of 94%. According to a paper titled "A Comprehensive Review on Fake News Detection with Deep Learning" presents a comprehensive study which reviews different features and representations used in DL models for fake news detection, such as visual features, textual features, and social context features. The authors Shu K al [8] highlight the importance of incorporating contextual information, like user behavior, social network structure, temporal dynamics, into DL models for more accurate fake news detection.
Bibek Upadhayay, Vahid Behzada al [9] presented a hybrid DL model to detect fake news on social networks. They extended LIAR dataset and used a BERT-based model for text representation. Their approach combines style-based and network-based detection using Graph Attention Networks. The model was evaluated on the Fake-NewsNet benchmark and achieved high accuracy. The authors suggest incorporating temporal, user credibility, and geographic features to further enhance the model. The paper titled "Fake News Detection Using Machine Learning Approaches: A Systematic Review" provides a comprehensive examination of different machine learning approaches employed in the detection of fake news. Syed Ishfaq Manzoor al [10] analyzed and compared the performance of different algorithms, features, and datasets used in previous studies. The most commonly used ML algorithms are Decision tree, Support Vector Machine, Naive Bayes and Random ForesT. The authors suggest future enhancements such as incorporating more advanced natural language processing techniques, developing more comprehensive datasets, using ensemble methods, and developing explainable and interpretable machine learning models. Uma Sharma al [11] presented a method for detecting fake news using ML algorithms. The proposed method involves feature extraction, data preprocessing and classification using various machine learning algorithms. The authors found that SVM classifier gave an accuracy of 94.5%. The study suggests future enhancements, such as using more advanced natural language processing techniques and incorporating more features for improved accuracy. Z Khanam al [12] presented a method for detecting fake news using ML approaches, including feature extraction, data preprocessing, and classification using various ML algorithms. The authors found that SVM classifier achieved an accuracy of 93.83%. The study suggests future enhancements, such as incorporating social network analysis and using deep learning algorithms for improved accuracy. Yang Yang al [13] proposed a CNN model called TI-CNN, which incorporates both textual and visual information. The model achieved an accuracy of 94.34% on the dataset and 91.6% on an external dataset. Future enhancements include using pre-trained word embeddings, incorporating attention mechanisms, and exploring other deep learning architectures for improved accuracy. The study demonstrates the potential of using CNN models for detecting fake news. I. Kadek Sastrawan al [14] proposed a method for detecting false news using CNN-RNN based methods. The model's robustness was tested on various types of fake news. Future enhancements include incorporating user credibility, adding other modalities, and exploring other deep learning architectures for improved accuracy. The study highlights the potential of using DL models for detecting fake news. Qamber Abbas all [15] proposed a CNN-RNN-based model. The model outperforms existing models in accuracy, precision, recall, and F1-score on the LIAR-PLUS dataset. Future enhancements include exploring other deep learning architectures, additional sources of information, and using ensemble models and active learning to improve the system.
In short, the literature on fake news detection has explored different approaches, including ML algorithms, NLP techniques, deep learning-based approaches such as LSTM, ensemble techniques, and the use of different features.

Methodology
The Kaggle dataset "news.csv" is commonly utilized for the purpose of identifying fake news, as it consists of a compilation of news articles accompanied by labels that indicate whether the news is genuine or fraudulent. With this data, machine learning models can be trained to recognize patterns in the text and make predictions about the authenticity of news articles. The dataset has been compiled from several reliable sources such as Politico, NPR, CNN, and Reuters. It is well-curated, and the sources are trusted news outlets. The dataset contains a mix of news articles from different categories, including politics, business, and entertainment, among others

Import necessary libraries:
The code begins by importing the required libraries, including pandas for data manipulation, seaborn and matplotlib for visualization of data, and various modules from nltk for text preprocessing.

Load and preprocess the data:
The news data is loaded from a CSV file using the pandas library. The 'title' column is dropped from the data, and the remaining columns are checked for any missing values. The 'text' column is then preprocessed using the preprocess_text() function, which performs text cleaning, tokenization, and stopword removal.

Generate word clouds:
Word clouds are generated for both the 'REAL' and 'FAKE' labels using the WordCloud library. Word clouds are visual representations of the most frequently occurring words in a text, with word size indicating word frequency. These word clouds provide a visual summary of most common words in the news articles for each label.

Analyze stop words:
The most common words from the news articles are analyzed using get_top_n_words() function, which uses CountVectorizer to convert text data into a bag of words representation and calculates the word frequencies. A bar chart is then plotted to display the top words and their frequencies.

Train and evaluate ML models:
Sklearn.model_selection's train_test_split() is used to partition the data into training and testing sets.. The text data is vectorized using TfidfVectorizer, and two ML models, Logistic Regression and Decision Tree Classifier, are trained and evaluated using accuracy_score. The Confusion Matrix is also plotted to visualize performance of Decision Tree Classifier as showed in Fig 1  Fig. 1

. Confusion matrix of Decision Tree
Performance parameters for above machine learning parameters: To evaluate the performance of our fake news detection model, we employed multiple assessment measures.  We noticed, Machine learning algorithms can use previous data during training to learn patterns, but they do not inherently have built-in memory to explicitly store and recall previous data points during prediction, which is a capability that deep learning models, specifically designed for sequential data. So, we implemented the LSTM model in order to increase the performance of fake news detection system. LSTM models can capture longterm dependencies and patterns in sequential data, making them suitable for text classification tasks like news classification. LSTM models can be implemented using deep learning libraries such as Keras or PyTorch. The code trains an LSTM model on a dataset consisting of news articles that are labeled to indicate their authenticity (real or fake). The code follows following series of steps:

Load and preprocess the dataset:
The news dataset is loaded from a CSV file and only the first 1000 rows are used. The null values are dropped and the index is reset. The label column is converted to binary values, 1 represents real news and 0 represents false news.

Divide the data into training dataset and testing dataset:
The data is allocated into 80% for training and 20% for testing.

Tokenize and pad the text data:
Tokenization is the process of converting text into numerical data which the neural network can process. The text is tokenized using Keras Tokenizer class and then padded to ensure that all sequences have the same length.

Define the LSTM model architecture:
To define the model, a Keras Sequential model is utilized. The initial layer is an embedding layer that maps the tokenized text into a dense vector. Following this, a bidirectional LSTM layer is implemented to capture the contextual information of the text. To increase the non-linearity of the model, a dense layer with ReLU activation function is included. Finally, a dense layer with sigmoid activation function is added to produce a binary output that indicates whether the news is real or fake.
• Deciding the value of epoch: We started by defining a maximum number of epochs that we wanted to allow for training. • Update epoch: We checked if the current accuracy meets the desired threshold. If it did, we finalized the current epoch value.

Compile the model:
Binary cross-entropy loss function along with Adam optimizer and accuracy metric are used to compile the model.

Save the trained model:
The trained model is saved in a file with a .h5 extension.

Load the trained model:
The saved model is loaded back into memory.

Make predictions on new data:
The loaded model is used to make predictions on new data, such as text. Text is tokenized and padded before being passed to the model. The output is a binary value indicating whether the result is true or false.
i) Fowcharts and chart of model:

Results
The study aimed to develop a fake news detection system using various machine learning (ML) algorithms and a deep learning model, Long Short-Term Memory (LSTM). The study utilized a dataset consisting of news articles labeled as real or fake to train and evaluate the models. The following ML algorithms were implemented: Decision Tree, Logistic Regression, Random Forest, Multinomial Naive Bayes, and K-Nearest Neighbors Classifier. The models were evaluated based on their training and testing accuracy, precision, recall, F1score, true negative rate, and false positive rate. The LSTM model was also implemented and evaluated.
The Decision Tree and Random Forest models showed 100% training accuracy, indicating that they overfit the data. The Logistic Regression model showed the highest testing accuracy of 0.9122, followed by the Random Forest model with 0.8907. The Multinomial Naive Bayes and K-Nearest Neighbors Classifier models showed lower testing accuracies of 0.7941 and 0.7468, respectively. These results suggest that Logistic Regression and Random Forest are better suited for fake news detection than the other ML algorithms tested in this study. The LSTM model was trained on the same dataset as the ML algorithms. The dataset was preprocessed by tokenizing and padding the text data. The LSTM model showed an accuracy of 0.8667 on the testing set. The LSTM model outperformed the Multinomial Naive Bayes and K-Nearest Neighbors Classifier models in terms of testing accuracy. The results suggest that the LSTM model has potential for use in fake news detection. In conclusion, the study developed and evaluated fake news detection models using various ML algorithms and a deep learning model. The Logistic Regression and Random Forest models showed the highest testing accuracies among the ML algorithms tested, with the LSTM model showing potential for use in fake news detection.

Conclusion and future work
The proposed LSTM-based model can be applied to other domains, like social media posts and online reviews, to detect fake or malicious content. By using multiple models, such as combining an LSTM model with a rule-based or machine learning model, we can help users make informed decisions and reduce the impact of fake news. The project can also develop a browser extension for users to detect fake news articles on the fly. Additionally, the model can incorporate multimedia content like images and videos, which can also spread fake news.
To summarize, this study showcases the effectiveness of LSTM-based neural network models in identifying fake news, offering a valuable tool in combatting the dissemination of false information online. The prospect of conducting additional research to improve the precision and robustness of fake news detection systems is promising, especially when leveraging larger and more varied datasets. By incorporating a broader range of examples into the training data, these models can better differentiate between genuine and fake news, minimizing the risk of biases or inaccuracies. Therefore, this study represents a significant stride towards developing effective solutions for identifying and combating fake news.