All Projects
NLP

Fake News Detection

13-model NLP pipeline on 44,898 news articles. Soft Voting Ensemble & Stacking both achieve 99.86% accuracy, AUC=1.0. Only 2 errors on the full test set. DistilBERT matches at 99.87% on 6K subset.

99.86%
Voting/Stacking Acc
1.0000
Linear SVC AUC
99.87%
DistilBERT Accuracy
2
Total test errors
Dataset

44,898 articles (21K real + 23K fake), 70/15/15 split

Approach

Combined TF-IDF (word + char n-grams) → 13-model benchmark → transformer fine-tuning

Tech Stack
PythonScikit-learnXGBoostLightGBMHuggingFace DistilBERTNLTK
Keywords
LinearSVCTF-IDFXGBoostLightGBMDistilBERTVoting EnsembleStacking
Visualizations6 Charts
Deep Dive

Comprehensive fake news detection benchmarking classical ML and transformers on a balanced 44,898-article dataset.

Dataset

  • 21,417 real + 23,481 fake news articles
  • 70/15/15 stratified train/val/test split
  • Features: TF-IDF word n-grams (1–2, 50K features) + char n-grams (3–5, 30K features) combined

Full 13-Model Benchmark

ModelAccuracyAUC
Complement NB96.52%0.9936
Logistic Regression99.65%0.9999
Linear SVC99.81%1.0000
SGD Classifier99.72%1.0000
Decision Tree99.63%0.9950
Random Forest99.70%0.9998
Extra Trees99.37%0.9997
XGBoost99.83%0.9997
LightGBM99.81%0.9996
Soft Voting99.86%1.0000
Stacking99.86%1.0000
BiLSTM98.5%
DistilBERT99.87%0.9999

Error Analysis Full test set: 1 false positive + 1 false negative. The dataset has strong source signals — Reuters/AP wire service language vs conspiracy-style language — that combined TF-IDF captures almost perfectly.

Why Combined TF-IDF Beats Standalone Word n-grams capture semantic content; character n-grams capture writing style artifacts (punctuation abuse, ALL-CAPS, unusual spacin g). Combining both gives >99.8% across all reasonable models.

DistilBERT Finding Fine-tuned on only 6K articles (subset) → 99.87% accuracy. Demonstrates transformers generalize better under limited labeled data than classical models trained on full dataset.