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
- ✅ 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.pyand the Streamlit app
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 Run the following command to train and save the fake news detection model:
python train_model.pyThis 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
To start the web interface: streamlit run app.py