The problem
Fake reviews distort buying decisions and marketplace trust, and they are written to sound genuine — which makes them a natural text-classification problem. Most student spam-detection projects train on toy data or reuse a black-box API, leaving the student unable to explain what the model actually learned. This project works the opposite way: it trains on the published Deceptive Opinion Spam corpus (Ott, Choi, Cardie & Hancock, 2011) — 800 fake reviews commissioned from crowd workers and 800 truthful reviews mined from TripAdvisor — and learns which linguistic cues separate them. The pipeline is deliberately transparent: tokenization, TF-IDF unigram/bigram features, and logistic regression, so every weight can be inspected and every prediction explained with its top contributing n-grams. The web demo makes the model tangible: paste any review and watch the classifier score it with a per-signal breakdown of superlatives, exclamation use, pronoun patterns, specificity and repetition.
How it works
- The Deceptive Opinion Spam corpus is loaded: 1,600 labeled reviews (800 fake from crowdsourced writers, 800 truthful from TripAdvisor), all Chicago hotels.
- Text is preprocessed — lowercased, punctuation-stripped, stopwords removed — then vectorized with TF-IDF over unigrams and bigrams (design target ~10,000 features).
- The data is split 60/20/20 into train, validation and held-out test sets with stratification.
- Logistic regression is trained on the training split while the regularization strength C is tuned with 5-fold cross-validation on the validation data.
- The final model is evaluated exactly once on the held-out test split: accuracy, precision, recall, F1 and the confusion matrix are recorded for the report.
- In the web demo, a pasted review goes through the identical preprocessing and vectorization, and the trained model returns P(fake) with per-signal linguistic scores for the UI breakdown.
Tech stack:
- Python 3, scikit-learn (TF-IDF, logistic regression, cross-validation)
- pandas, NumPy, Matplotlib (analysis & plots)
- Jupyter Notebook (training & evaluation)
- HTML5 + CSS3 + vanilla JavaScript (interactive analyzer demo)
- Deceptive Opinion Spam corpus (Ott et al., 2011)
Dataset & model details
- Dataset: Deceptive Opinion Spam corpus (Ott, Choi, Cardie & Hancock, ACL 2011) — 1,600 hotel reviews: 800 fake (written by Amazon Mechanical Turk workers) and 800 truthful (from TripAdvisor), all for Chicago hotels, balanced classes.
- Task: Binary text classification; input = raw review text, output = P(fake) with per-signal linguistic scores.
- Model: TF-IDF vectorizer (unigrams + bigrams, design target ~10k features) feeding L2-regularized logistic regression; C tuned by 5-fold cross-validation.
- Metrics: Test accuracy ~89% (design target, matching published bigram-model benchmarks on this corpus — the built-to-order run's measured figure is reported after training), plus precision, recall, F1 and confusion matrix on the held-out 20% split. No accuracy is claimed as measured until the training run is executed for the order.
| Parameter | Value |
|---|---|
| Corpus size | 1,600 labeled reviews (800 fake / 800 truthful) |
| Feature space | Approximately 10,000 TF-IDF unigram+bigram features (design target) |
| Model | L2 logistic regression, C tuned by 5-fold CV |
| Test accuracy | ~89% (design target; measured figure reported after the training run) |
| Training time | A few minutes on a laptop CPU (expected) |
| Inference | Effectively instant per review on CPU (expected) |
| Demo | Single-file web app, runs offline after download |
Project features
- [Deceptive Opinion Spam corpus pipeline] Loads the real 1,600-review corpus (800 fake / 800 truthful Chicago hotel reviews), with documented train/validation/test splits and class-balance handling.
- [TF-IDF + logistic regression model] Transparent, inspectable classifier over unigram and bigram features — every prediction is explainable through its top-weighted n-grams, ideal for viva questions.
- [Interactive review analyzer demo] Paste any product or hotel review; the demo returns a fake/genuine verdict with confidence and a six-signal linguistic breakdown.
- [Top-signal inspection] The notebook lists the highest-weighted fake-indicative and genuine-indicative n-grams, turning "what did the model learn?" into a viva-ready discussion.
- [5-fold cross-validation] Regularization strength tuned on validation folds, with the full procedure documented for reproducibility.
- [Held-out evaluation] Accuracy, precision, recall and F1 reported once on a 20% test split that the model never saw during tuning.
- [Sample review gallery] Pre-loaded suspicious and genuine samples so the demo is impressive from the first click, plus a session history table of analyzed reviews.
What is included
- Complete training & evaluation Jupyter notebook
- Trained TF-IDF vectorizer + logistic-regression model files with inference code
- Interactive review-analyzer web demo with sample reviews and signal breakdown
- Top-weighted n-gram lists (fake-indicative vs genuine-indicative) with interpretation notes
- Project report PDF (background, NLP theory, corpus description, methodology, results)
- PPT presentation for final review
- Viva Q&A preparation document (TF-IDF, n-grams, regularization, precision vs recall, overfitting)
Limitations & prerequisites
- Trained on hotel reviews — performance on other domains (electronics, restaurants) is expected to drop without retraining, stated honestly in the report.
- The model reads linguistic style, not facts: a truthful but flowery review can score as suspicious, and a careful liar can evade it.
- ~89% is a design target matching published benchmarks, not a measured claim — the report documents the actual achieved figure after the training run.
- Very short reviews (under ~20 words) carry too little signal for a reliable verdict; the demo warns on these.
- This is a teaching build for fake-review linguistics, not a production moderation system.
Frequently Asked Questions
Which dataset is used and is it real?
Yes — the Deceptive Opinion Spam corpus by Ott, Choi, Cardie and Hancock (ACL 2011): 1,600 real labeled reviews, 800 fake ones commissioned from Mechanical Turk workers and 800 truthful ones from TripAdvisor, all Chicago hotels. It is the standard benchmark for this task.
Why logistic regression instead of a transformer?
Transparency. Every weight maps to an n-gram, so the student can show exactly which phrases push a review toward "fake" — that inspectability is the project's viva strength. BERT fine-tuning is documented as future scope.
What linguistic signals does it actually learn?
Published work on this corpus finds fake reviews overuse superlatives and first-person singular pronouns, underuse concrete specifics (numbers, spatial detail), and show different sentiment patterns. The notebook verifies these on the trained model.
Can I test it on my own reviews?
Yes — the demo accepts any pasted text and shows the verdict, confidence, and per-signal breakdown instantly, with a history table of your session's analyses.
Does it work on non-English or code-mixed reviews?
Not as shipped — the corpus and preprocessing are English-only. Multilingual extension is listed as future scope.
Is this project suitable for a final-year project?
Yes — for Computer Science, IT and AI/ML programs. It demonstrates the full NLP pipeline (corpus, preprocessing, features, training, evaluation) with an explainable model and a working demo. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.
Components & software requirements
- Python 3, scikit-learn (TF-IDF, logistic regression, cross-validation)
- pandas, NumPy, Matplotlib (analysis & plots)
- Jupyter Notebook (training & evaluation)
- HTML5 + CSS3 + vanilla JavaScript (interactive analyzer demo)
- Deceptive Opinion Spam corpus (Ott et al., 2011)
Dataset & model details
- Dataset: Deceptive Opinion Spam corpus (Ott, Choi, Cardie & Hancock, ACL 2011) — 1,600 hotel reviews: 800 fake (written by Amazon Mechanical Turk workers) and 800 truthful (from TripAdvisor), all for Chicago hotels, balanced classes.
- Task: Binary text classification; input = raw review text, output = P(fake) with per-signal linguistic scores.
- Model: TF-IDF vectorizer (unigrams + bigrams, design target ~10k features) feeding L2-regularized logistic regression; C tuned by 5-fold cross-validation.
- Metrics: Test accuracy ~89% (design target, matching published bigram-model benchmarks on this corpus — the built-to-order run's measured figure is reported after training), plus precision, recall, F1 and confusion matrix on the held-out 20% split. No accuracy is claimed as measured until the training run is executed for the order.
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.