This project focuses on detecting fake news articles using advanced Natural Language Processing (NLP) techniques and classical machine learning models. Leveraging spaCy embeddings and ensemble learning, the project achieves high accuracy in distinguishing between real and fake news.
With the explosion of misinformation online, detecting fake news automatically has become crucial. This project presents a machine learning pipeline that converts news text into dense semantic vectors using spaCy, followed by classification using multiple supervised learning algorithms.
Source: Kaggle - Fake News Dataset
Columns:
Title: Title of the news article.Text: Full content of the article.Label: Fake (1) or Real (0).
- Python 3
- Natural Language Processing (NLP)
- spaCy (Large Language Model for word embeddings)
- Machine Learning
- Multinomial Naive Bayes (
MultinomialNB) - K-Nearest Neighbors (
KNeighborsClassifier) - Random Forest (
RandomForestClassifier) - Gradient Boosting (
GradientBoostingClassifier)
- Multinomial Naive Bayes (
- Preprocessing
- Text cleaning (lowercasing, punctuation removal, stopword removal)
- Word vectorization (300-dimensional vectors via spaCy)
- Feature stacking to form fixed-length input
- Feature Scaling
MinMaxScalerfor normalization
- Model Training
PipelineRandomizedSearchCVfor hyperparameter tuning
- Evaluation
- Accuracy, Precision, Recall, F1-score
- Confusion Matrix
- Classification Report
- Clean text (lowercase, remove symbols, etc.)
- Binary label encoding (Fake = 1, Real = 0)
- Convert text into vectors using spaCy large model
- Stack vectors to 2D array suitable for ML input
- 80% training, 20% testing
- Apply MinMaxScaler to ensure numerical stability
- Multinomial Naive Bayes
- K-Nearest Neighbors
- Random Forest (with hyperparameter tuning)
- Gradient Boosting (with hyperparameter tuning)