Skip to content

afmontoya/fake-news-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📰 Fake News Detection Using Machine Learning 🔍🤖

📌 Project Overview

Fake news is a major issue in today's digital world, where misinformation spreads rapidly. This project aims to detect fake news articles using machine learning techniques. By analyzing text patterns and linguistic features, the model predicts whether a given news article is real or fake.


🚀 Features

  • 📝 Text Preprocessing (Tokenization, Stopword Removal, Lemmatization)
  • 🔢 TF-IDF Vectorization to convert text into numerical features
  • 🤖 Machine Learning Models (Logistic Regression, Naive Bayes)
  • 📊 Exploratory Data Analysis (EDA)
  • 🌐 API Integration (Planned) (Serve the model via Flask/FastAPI)
  • 🎨 Web App (Planned) (User-friendly frontend using Streamlit/React)

💻 Installation & Setup

Follow these steps to set up and run the project locally.

1️⃣ Clone the Repository

git clone https://github.com/your-username/fake-news-detection.git
cd fake-news-detection

2️⃣ Create a Virtual Environment

python3 -m venv venv
source venv/bin/activate  # Mac/Linux
venv\Scripts\activate     # Windows

3️⃣ Install Dependencies

pip install -r requirements.txt

4️⃣ Download the Dataset

  • This project uses the Fake News Dataset from Kaggle.
  • Place the train.csv, test.csv, and submit.csv files inside the data/ folder.

📂 Project Structure

fake-news-detection/
│── README.md              # Project documentation  
│── LICENSE                # Open-source license (MIT)  
│── .gitignore             # Ignore unnecessary files  
│── requirements.txt       # Dependencies  
│── setup.py               # Setup file (if needed)  
│  
├── data/                  # Dataset files  
│   ├── train.csv  
│   ├── test.csv  
│   ├── submit.csv  
│  
├── notebooks/             # Jupyter Notebooks  
│   ├── eda.ipynb          # Exploratory Data Analysis  
│  
├── models/                # Saved trained models  
│  
├── src/                   # Source code  
│   ├── preprocess.py      # Data preprocessing script  
│   ├── train_model.py     # Model training script  
│   ├── predict.py         # Fake news classification script  
│  
├── api/                   # API backend (Flask or FastAPI)  
│  
├── frontend/              # UI for interacting with the model  
│  
└── tests/                 # Testing scripts  

🔬 Running the Project

1️⃣ Run Exploratory Data Analysis

View dataset statistics and visualizations using Jupyter Notebook:

jupyter notebook notebooks/eda.ipynb

2️⃣ Train the Model

Train a machine learning model on the dataset:

python src/train_model.py

3️⃣ Make Predictions

Use the trained model to classify news articles:

python src/predict.py --text "Breaking news: AI can now detect fake news!"

4️⃣ (Optional) Run the API

To serve the model using an API (Flask/FastAPI), navigate to the api/ folder and run:

python api/app.py

🛠️ Technology Stack

  • Programming Language → Python 🐍
  • Libraries → Pandas, NLTK, Scikit-Learn, Matplotlib, Seaborn
  • Machine Learning → Logistic Regression, Naive Bayes, SVM (Optional)
  • Text Processing → TF-IDF Vectorization, Tokenization, Stopword Removal
  • API (Planned) → Flask or FastAPI
  • Frontend (Planned) → Streamlit or React

🚀 Future Improvements

  • Deploy API for Predictions (Flask/FastAPI)
  • Build a Web UI (Streamlit/React)
  • Deep Learning Models (LSTMs, Transformers)
  • Optimize Accuracy with Hyperparameter Tuning

👨‍💻 Contributing

Contributions are welcome! Feel free to submit a pull request or open an issue.

🔹 Steps to Contribute

  1. Fork the repo.
  2. Create a feature branch (git checkout -b feature-name).
  3. Commit your changes (git commit -m "Added new feature").
  4. Push to the branch (git push origin feature-name).
  5. Create a pull request.

📜 License

This project is licensed under the MIT License.


📞 Contact

👤 [Albert F Montoya Jr]
🔗 [twitter.com/montoyamedia]
📧 [albert@montoyamedia.com]


About

Fake News Detection Using Machine Learning

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors