Skip to content

MohammadAliiiii/Fake-News-Detection-Using-Machine-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ฐ Fake News Detection using Machine Learning

A machine learning project that detects whether a news article is fake or real based on its content.
Built in Google Colab using scikit-learn and custom text preprocessing.


๐Ÿ” Overview

This project applies Natural Language Processing (NLP) and Machine Learning to classify news articles as FAKE or REAL.

It includes:

  • Regex-based text cleaning
  • Vectorization with TF-IDF
  • Models: Logistic Regression, Random Forest, Gradient Boosting
  • Evaluation using accuracy, precision, recall, F1-score

๐Ÿ“ Dataset

The dataset used was the Fake and Real News Dataset available on Kaggle.
Columns used: text (main content), label (REAL or FAKE)
Other columns like title, subject, and date were dropped.


๐Ÿ› ๏ธ Features

Component Description
โœ… Text Cleaning Removed URLs, HTML tags, punctuation, digits using regex
โœ… Vectorization TF-IDF with TfidfVectorizer from sklearn
โœ… Model Training Trained 3 classifiers (LR, RFC, GBC) on the processed data
โœ… Manual Testing Custom input function to test any text against trained models
โœ… Evaluation classification_report used to show performance metrics

๐Ÿš€ How to Run

  1. Open the project in Google Colab
  2. Run all cells in order (use "Runtime > Run all")
  3. Use the manual_testing() function to test your own headlines or articles

๐Ÿ”ง Tech Stack

  • Python ๐Ÿ
  • pandas ๐Ÿงฎ
  • scikit-learn โš™๏ธ
  • re (Regex for text cleaning)
  • Google Colab โ˜๏ธ

๐Ÿง  Key Learning (80/20 Principle Applied)

  • 20% of the pipeline (cleaning + vectorization + model) delivers 80% of the classification performance
  • Fitting vectorizers only once and reusing them prevents 100% of vector mismatch errors
  • Restarting runtime and rerunning in sequence fixes most runtime issues efficiently

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published