Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language: en
|
4 |
+
tags:
|
5 |
+
- sentiment-analysis
|
6 |
+
- roberta
|
7 |
+
- fine-tuned
|
8 |
+
datasets:
|
9 |
+
- custom
|
10 |
+
metrics:
|
11 |
+
- accuracy
|
12 |
+
- precision
|
13 |
+
- recall
|
14 |
+
- f1
|
15 |
+
base_model:
|
16 |
+
- FacebookAI/roberta-base
|
17 |
+
pipeline_tag: text-classification
|
18 |
+
---
|
19 |
+
|
20 |
+
# Final Sentiment Model - Go-Raw
|
21 |
+
|
22 |
+
## Model description
|
23 |
+
This is a fine-tuned `roberta-base` model for multi-class sentiment classification.
|
24 |
+
It was trained on a custom dataset of ~240k examples with 3 sentiment classes:
|
25 |
+
- 0: Negative
|
26 |
+
- 1: Positive
|
27 |
+
- 2: Neutral
|
28 |
+
|
29 |
+
The model shows significant improvement over the base model on this task.
|
30 |
+
|
31 |
+
## Intended uses & limitations
|
32 |
+
- ✅ Suitable for English text sentiment analysis.
|
33 |
+
- 🚫 Not tested on other languages or domains beyond training data.
|
34 |
+
- 🚫 Not suitable for detecting abusive, toxic, or hate speech.
|
35 |
+
|
36 |
+
## Training details
|
37 |
+
- Base model: `roberta-base`
|
38 |
+
- Epochs: 3
|
39 |
+
- Learning rate: 2e-5
|
40 |
+
- Batch size: 8
|
41 |
+
- Optimizer: AdamW
|
42 |
+
|
43 |
+
## Evaluation
|
44 |
+
|
45 |
+
### Dataset
|
46 |
+
- Train set: 1,94,038 examples
|
47 |
+
- Test set: 48,510 examples
|
48 |
+
|
49 |
+
### Performance
|
50 |
+
|
51 |
+
| Metric | Base Model | Fine-tuned Model |
|
52 |
+
|-------|------------|-------------------|
|
53 |
+
| Accuracy | 34.1% | **88.1%** |
|
54 |
+
| Macro F1 | 24.3% | **87.5%** |
|
55 |
+
| Weighted F1 | 27.1% | **88.1%** |
|
56 |
+
|
57 |
+
### Per-class metrics
|
58 |
+
|
59 |
+
| Class | Precision | Recall | F1-score |
|
60 |
+
|------|-----------|--------|---------|
|
61 |
+
| **0 (Negative)** | 85.3% | 83.1% | 84.2% |
|
62 |
+
| **1 (Neutral)** | 91.4% | 89.8% | 90.5% |
|
63 |
+
| **2 (Positive)** | 86.0% | 89.4% | 87.7% |
|
64 |
+
|
65 |
+
## How to use
|
66 |
+
```python
|
67 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
68 |
+
|
69 |
+
model = AutoModelForSequenceClassification.from_pretrained("Go-Raw/final-sentiment-model-go-raw")
|
70 |
+
tokenizer = AutoTokenizer.from_pretrained("Go-Raw/final-sentiment-model-go-raw")
|
71 |
+
|
72 |
+
text = "I absolutely love this!"
|
73 |
+
inputs = tokenizer(text, return_tensors="pt")
|
74 |
+
outputs = model(**inputs)
|
75 |
+
predicted_class = outputs.logits.argmax().item()
|
76 |
+
print(predicted_class)
|