Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FakeReview Sentry

FakeReview Sentry is an end-to-end Machine Learning pipeline designed to detect manipulated product reviews on e-commerce platforms. Rather than relying solely on text analysis, it uses a multi-signal ensemble approach that evaluates Natural Language Processing (NLP) metrics alongside reviewer behavioral patterns and metadata.

Architecture & Engineering Focus

This project was built to demonstrate a production-ready ML workflow, from data engineering to model serving.

  • Multi-Signal Ensemble: Combines a Naive Bayes NLP model (trained on TF-IDF vectors), a Random Forest behavioral classifier, and an XGBoost model. Predictions are aggregated using a weighted soft-voting mechanism.
  • Explainable AI (XAI): Integrated SHAP (SHapley Additive exPlanations) to provide transparency into model decisions, highlighting which specific features (e.g., account age, review velocity, text sentiment) drove the final prediction.
  • Optimized Serving: The inference pipeline is decoupled from the training environment. The Flask API and frontend dashboard are containerized via Docker with a minimal dependency footprint (requirements.txt), isolating the heavy training tools (requirements-dev.txt).
  • Synthetic Data Engineering: Includes a custom data generation script that models realistic fraud vectors (like burst reviews and bot-network behavior), allowing the ensemble to learn complex interactions that standard Kaggle datasets often lack.

System Components

  1. Data Ingestion (data_loader.py): Handles batch CSV loading and data partitioning.
  2. Text Preprocessing (text_cleaner.py): NLTK-based pipeline for tokenization, lemmatization, and stop-word removal.
  3. Feature Engineering (feature_extractor.py): Computes VADER sentiment, text readability scores, and behavioral velocity metrics.
  4. Ensemble Modeling (ensemble.py): Manages model training, evaluation, and serialization.
  5. API & Dashboard (app.py, index.html): A REST API serving a clean, responsive web interface for single and batch predictions.

Local Development Guide

1. Environment Setup

git clone <your-repo>
cd FakeReview-Sentry
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements-dev.txt

2. Generate Training Data

Generate the 50,000-row synthetic dataset that includes the necessary behavioral metadata:

python data/generate_sample_dataset.py

3. Model Training

Extract features, train the ensemble, and generate SHAP baseline plots:

python src/models/train_and_evaluate.py --data data/sample_dataset.csv --models-dir models/ --shap

4. Run the Dashboard

python src/api/app.py

Access the dashboard at http://localhost:5000.

5. Run Tests

pytest tests/

Docker Deployment

The application is containerized for easy deployment to cloud providers (e.g., Hugging Face Spaces, Render, AWS ECS).

docker build -t fakereview-sentry .
docker run -p 5000:5000 fakereview-sentry

Model Performance

Evaluated on a stratified 20% holdout test set (10,000 reviews):

  • Accuracy: ~89%
  • F1 Score: ~87%
  • ROC-AUC: ~0.92

Technology Stack

  • Core Data Science: Pandas, NumPy, SciPy
  • NLP & Features: NLTK, TextBlob, VADER, Textstat
  • Machine Learning: Scikit-learn, XGBoost, Imbalanced-learn, SHAP
  • Backend & Deployment: Flask, Docker, Pytest

About

End-to-end Machine Learning pipeline for detecting fake and manipulated product reviews using NLP, reviewer behavior, and review metadata. Combines multiple signals through an ensemble approach for more reliable detection

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages