--- title: SentimentLens emoji: ๐Ÿง  colorFrom: indigo colorTo: purple sdk: docker app_file: app.py pinned: false --- # ๐Ÿง  SentimentLens โ€” TF-IDF vs Fine-tuned DistilBERT > NLP research project: Systematically comparing classical ML against transformer models on Amazon product reviews, with failure analysis. **Built for:** Amazon ML Summer School Application **Stack:** Python ยท FastAPI ยท HuggingFace Transformers ยท Scikit-learn ยท React ยท Vite --- ## ๐Ÿ“Š Results | Model | Accuracy | F1 Score | | ---------------------------- | -------- | -------- | | TF-IDF + Logistic Regression | 89.35% | 0.90 | | Fine-tuned DistilBERT | 91.70% | 0.92 | --- ## ๐Ÿ” Key Research Finding Mixed-opinion reviews remain **unsolvable** under binary classification. Both models perform at ~45% accuracy on reviews containing both positive and negative aspects โ€” suggesting binary sentiment labels are fundamentally insufficient for nuanced text. ### Error Analysis by Category | Category | TF-IDF Error | BERT Error | | ------------- | ------------ | ---------- | | Negation | 5.1% | 20.4% | | Mixed Opinion | 11.9% | 54.9% | | Very Long | 9.6% | 48.9% | | Normal | 10.5% | 51.1% | --- ## ๐Ÿš€ Quick Start ### 1. Train the model ```bash cd backend pip install -r requirements.txt python train.py ```