Fake News Detection Using TF–IDF Text Features and a Bagging Ensemble Classifier
Abstract
Fake news spreads fast and creates real problems for society, so we need strong tools to spot it. In this work, a MATLAB framework has been proposed that sorts news into real or fake, using a variety of machine learning (ML) and deep learning (DL) models. The system is flexible, which can handle different types of datasets and pulls the relevant columns for news text and labels straight from CSV files, without much hassle. The way it finds these columns ignores capitalization, which really cuts down on errors and makes preprocessing smoother. The text goes through tokenization, gets lowercased, cleaned up from punctuation, and stripped of common stop words. It uses a Bag-of-Words approach and get rid of rare terms, then applies TF-IDF to capture which words actually matter in the context. For training and evaluation, holdout validation has been used. There are five classifiers in the proposed method which are linear SVM, a neural network (NN) with two ReLU-activated hidden layers, decision tree (DT), k-nearest neighbors (k=5), and an ensemble model based on bagging. All these models run under the same conditions. To measure performance, accuracy, precision, recall, and F1-score are evaluated. The ensemble model achieves accuracy of 1.0000, leaving the others behind. SVM and the neural network trail closely with an accuracy of 0.9955, and decision trees are also very close. It has been also observed that kNN, suffers with high-dimensional data, only hitting 0.5318 for accuracy. The proposed framework is both robust and scalable, and ensemble learning is the most reliable method of the rest.