MasterShomya commited on
Commit
1c4bb04
Β·
verified Β·
1 Parent(s): f53d8be

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -1
README.md CHANGED
@@ -11,4 +11,70 @@ license: mit
11
  short_description: Real-Time Tweet Sentiment Analyzer
12
  ---
13
 
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  short_description: Real-Time Tweet Sentiment Analyzer
12
  ---
13
 
14
+ # 🧠 Sentiment Analysis from Scratch (BiLSTM + Attention)
15
+
16
+ Welcome to this live interactive demo of a sentiment analysis model trained completely from scratch using a **Deep Bidirectional LSTM** architecture enhanced with a **custom attention mechanism**. This project is designed to classify short texts or tweets into **Positive** or **Negative** sentiments with a confidence score.
17
+
18
+ ---
19
+
20
+ ## πŸ“Œ Project Highlights
21
+
22
+ - βœ… **Trained from scratch**: The embedding layer is trained on the dataset itself (not using pretrained embeddings).
23
+ - 🧠 **Model Architecture**:
24
+ - Bidirectional LSTM layers
25
+ - Custom attention layer (`BetterAttention`)
26
+ - Final dense ANN for binary classification
27
+ - πŸ“Š **Output**: Label (Positive/Negative) and confidence score (0–1)
28
+ - πŸ”  **Tokenizer**: Also trained from scratch and saved as `tokenizer.joblib`
29
+ - πŸ“ **Model Format**: Saved as `.keras` and loaded efficiently during inference
30
+
31
+ ---
32
+
33
+ ## πŸš€ Try it Out
34
+
35
+ Enter a tweet or short sentence below and see real-time prediction:
36
+
37
+ πŸ‘‰ *Example*:
38
+ `"I absolutely loved the performance!"`
39
+ **Output**: Positive (0.91)
40
+
41
+ ---
42
+
43
+ ## πŸ›  Model Files
44
+
45
+ You can also explore/download the trained artifacts here:
46
+ - [`sentiment_model.keras`](https://huggingface.co/MasterShomya/Sentiment_Analysis-Tweets/blob/main/sentiment_model.keras)
47
+ - [`tokenizer.joblib`](https://huggingface.co/MasterShomya/Sentiment_Analysis-Tweets/blob/main/tokenizer.joblib)
48
+
49
+ ---
50
+
51
+ ## πŸ§ͺ How It Works
52
+
53
+ 1. The input text is tokenized using the trained tokenizer (`joblib`).
54
+ 2. The padded sequence is passed through:
55
+ - `Embedding β†’ BiLSTM β†’ BiLSTM β†’ Attention β†’ Dense Layers`
56
+ 3. The final sigmoid-activated output represents the **probability of positivity**.
57
+ 4. A confidence-aware label is returned using Gradio’s `Label` component.
58
+
59
+ ---
60
+
61
+ ## πŸ“ˆ Model Performance
62
+
63
+ Despite training from scratch without pretrained embeddings (like GloVe or FastText), the model performs comparably well. Experiments with `glove.27B.200d` embeddings yielded **similar accuracy**, and hence were excluded for clarity.
64
+
65
+ Training plots and confusion matrix are available in the original [Kaggle Notebook](https://www.kaggle.com/code/mastershomya/sentiment-analysis-deep-bilstm).
66
+
67
+ ---
68
+
69
+ ## πŸ§‘β€πŸ’» Author
70
+
71
+ **Shomya Soneji**
72
+ Machine Learning & Deep Learning Enthusiast
73
+ Connect on [Kaggle](https://www.kaggle.com/mastershomya)
74
+
75
+ ---
76
+
77
+ ## 🀝 Support
78
+
79
+ If you find this project helpful, please consider giving it a 🌟 and sharing it!
80
+ Your feedback and suggestions are always welcome πŸ’¬