Skip to content

TejasD-13/Fake-News-Detection-using-Machine-Learning

Repository files navigation

📰 Fake News Detection using Machine Learning

Python Streamlit License Status


📘 Overview

This project is a Fake News Detection System built using Machine Learning (ML) and Natural Language Processing (NLP).
It classifies news articles as Real or Fake based on their textual content.

The project includes:

  • 🧩 A training pipeline (train_model.py)
  • 💻 An interactive Streamlit web app (app.py)
  • 🧠 A debugging script (debug_check.py) to verify prediction consistency

🧠 Features

  • ✅ Detects whether a news article is Real or Fake
  • ✅ Uses TF-IDF Vectorization for feature extraction
  • ✅ Trains multiple models — Logistic Regression, Naive Bayes, and XGBoost
  • ✅ Handles class imbalance using SMOTE
  • ✅ Interactive Streamlit web interface
  • ✅ Ensures consistent prediction between debug_check.py and the Streamlit app

🧩 Project Structure

Fake-News-Detection/
│
├── preprocess.py              
├── train_model.py             
├── debug_check.py             
├── app.py                     
│
├── saved_model/
│   ├── fake_news_pipeline.pkl 
│   └── label_map.pkl          
│
├── News_dataset/
│   ├── Fake.csv              
│   └── Real.csv              
│
├── requirements.txt          
└── README.md                  

🧠 Model Training

Run the following command to train and save the fake news detection model:

python train_model.py

This will: Clean and preprocess the dataset Apply TF-IDF vectorization Balance classes using SMOTE Train Logistic Regression, Naive Bayes, and XGBoost models Save the best-performing pipeline to saved_model/fake_news_pipeline.pkl


🌐 Run the Streamlit App

To start the web interface: streamlit run app.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published