AAKTUNotes

Fake News Detection System using Machine Learning

A trained ML model that classifies news articles as fake or real with 97% accuracy - and shows which words decided it.

PythonFlaskSQLiteadvanced3182 lines
999

One-time purchase — source code, database, README and report outline, all in a single ZIP.

No account needed — pay & download instantly

Screenshots

Tap any screenshot to open it full size. These are from the project actually running — not mockups.

About this project

A complete machine learning web application that decides whether a news article is fake or real. The model is trained on 12,000 labelled articles and reaches 97.17% accuracy on 2,400 articles it has never seen - and the trained model ships with the project, so it works the moment you run it.

What lifts this above a normal ML demo is that it explains itself. Every verdict comes with a confidence score and the exact words that pushed the decision each way, calculated from the model's own weights - so in the viva you can answer "why did it say that?" with real arithmetic instead of a shrug.

The project also documents a data leakage problem found in the dataset and fixed. In the raw data, 96.8% of the real articles were Reuters wire copy beginning "WASHINGTON (Reuters) -", while only 1.03% of the fake ones mentioned Reuters at all. The proof of how much that matters: with no machine learning at all, the one-line rule "if it says Reuters, call it real" scores 97.88% on this dataset - slightly better than a model trained on the uncleaned text (97.71%). Stripping datelines and agency names costs 0.54 points and makes the remaining 97.17% mean something. A bundled script reproduces all three numbers, and that single finding is usually the strongest thing in the report.

Around the model sits a real application: user accounts with PBKDF2-hashed passwords, per-user history, CSV batch checking of up to 500 articles at once with a per-file accuracy score, a feedback loop where users correct wrong verdicts, an admin dashboard with 7-day trends and a disagreement rate, one-click retraining from the browser, and a REST API with per-user keys.

Four algorithms - Logistic Regression, Linear SVM, Passive Aggressive and Multinomial Naive Bayes - are trained on identical data and compared in the app itself, so the choice of model is evidence rather than assertion.

Features

  • 97.17% accuracy on 2,400 unseen articles (Logistic Regression, 5-fold CV 97.0% +/- 0.31)
  • Trained model ships with the project - no training needed before the demo
  • Word-level explanation of every verdict, computed from the model's own weights
  • Data leakage in the dataset identified, proved and removed - with a bundled script that reproduces the proof
  • Four algorithms compared side by side inside the app
  • Confidence score with a fake/real probability meter
  • Warns you when the text is too short to judge reliably
  • 20 held-out sample articles built in - one click to demo a fair test
  • Batch checking: upload a CSV of up to 500 articles, download the results
  • Per-file accuracy if your CSV carries a label column
  • User accounts with PBKDF2-SHA256 hashed passwords and per-user salt
  • Feedback loop - users report wrong verdicts, admin sees the disagreement rate
  • Admin dashboard with 7-day trend chart, fake/real split and most active users
  • Retrain the model from the browser, in the background, with a live log
  • REST API with per-user API keys, documented in the app
  • Confusion matrix, ROC curve and comparison charts generated as PNGs for the report
  • Every SQL query parameterised; a SQL injection attempt is part of the test suite
  • ON DELETE CASCADE with foreign keys enforced - deleting a user clears their data
  • 18 automated self-tests you can run in front of the examiner
  • No CDN anywhere - the whole UI works with the internet switched off

Modules

Authentication (register, login, roles)Single article check with explanationBatch CSV checkPrediction historyFeedback and correctionsAdmin dashboard and analyticsModel performance reportModel retrainingREST API

Tools

  • Python 3.8+
  • Flask (web framework)
  • scikit-learn, pandas, NumPy
  • SQLite (bundled with Python)
  • VS Code (or any editor)
  • Any web browser

Requirements

Python 3.8 or newer, then one command: pip install -r requirements.txt (Flask, scikit-learn, pandas, NumPy, joblib, matplotlib). The trained model is already inside the ZIP, so you do not have to train anything before the demo. SQLite ships with Python. Works on Windows, Linux and Mac. Roughly 300 MB of disk space is needed for the libraries.

How to run

1. Extract the ZIP.
2. Open CMD and go to the folder:  cd path\to\fake-news-detection
3. Install the libraries:  pip install -r requirements.txt
4. Load the demo data:  python demo.py
5. Start the app:  python app.py
6. Open http://127.0.0.1:5000 in your browser.
7. Login:  admin / admin123   (or  student / student123)

Before a viva, also run 'python selftest.py' - 18 checks pass in front of the examiner.
To train the model yourself:  python -m ml.train  (takes about a minute).

The same steps are in README.md inside the ZIP, along with a troubleshooting table.

What you get in the ZIP

  • 📁 Full source code — commented throughout, so you can explain it in the viva
  • 🗄️ Database — the schema builds itself on first run, with sample data
  • 📖 README.md — step-by-step run instructions, database design, viva questions and troubleshooting
  • 📝 docs/report-outline.md — the full AKTU project report outline (DFD, ER diagram, testing table, screenshots)
Share on WhatsApp

Other projects