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.
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.
- Data Ingestion (
data_loader.py): Handles batch CSV loading and data partitioning. - Text Preprocessing (
text_cleaner.py): NLTK-based pipeline for tokenization, lemmatization, and stop-word removal. - Feature Engineering (
feature_extractor.py): Computes VADER sentiment, text readability scores, and behavioral velocity metrics. - Ensemble Modeling (
ensemble.py): Manages model training, evaluation, and serialization. - API & Dashboard (
app.py,index.html): A REST API serving a clean, responsive web interface for single and batch predictions.
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.txtGenerate the 50,000-row synthetic dataset that includes the necessary behavioral metadata:
python data/generate_sample_dataset.pyExtract features, train the ensemble, and generate SHAP baseline plots:
python src/models/train_and_evaluate.py --data data/sample_dataset.csv --models-dir models/ --shappython src/api/app.pyAccess the dashboard at http://localhost:5000.
pytest tests/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-sentryEvaluated on a stratified 20% holdout test set (10,000 reviews):
- Accuracy: ~89%
- F1 Score: ~87%
- ROC-AUC: ~0.92
- 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