Text Classification
Transformers
PyTorch
English
sentiment-analysis
emotion-classification
multi-label-classification
deberta-v3
nlp
Instructions to use Praphull1/Sentimental-Analyzer-V3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Praphull1/Sentimental-Analyzer-V3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Praphull1/Sentimental-Analyzer-V3")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Praphull1/Sentimental-Analyzer-V3", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- README.md +529 -0
- calibration/v3_isotonic_calibrators.pkl +3 -0
- config.json +85 -0
- labels/emotion_labels.json +30 -0
- labels/sentiment_labels.json +7 -0
- model/best_v3_model.pt +3 -0
README.md
ADDED
|
@@ -0,0 +1,529 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
library_name: transformers
|
| 5 |
+
license: mit
|
| 6 |
+
tags:
|
| 7 |
+
- sentiment-analysis
|
| 8 |
+
- emotion-classification
|
| 9 |
+
- text-classification
|
| 10 |
+
- multi-label-classification
|
| 11 |
+
- deberta-v3
|
| 12 |
+
- nlp
|
| 13 |
+
- pytorch
|
| 14 |
+
pipeline_tag: text-classification
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Sentimental Analyzer V3
|
| 18 |
+
|
| 19 |
+
**Sentimental Analyzer V3** is a multi-task Natural Language Processing (NLP) model designed to analyze English text through two complementary tasks:
|
| 20 |
+
|
| 21 |
+
1. **5-class sentiment classification**
|
| 22 |
+
2. **28-class multi-label emotion classification**
|
| 23 |
+
|
| 24 |
+
The model uses `microsoft/deberta-v3-base` as its transformer backbone and includes a frozen production calibration pipeline for emotion predictions.
|
| 25 |
+
|
| 26 |
+
## Model Overview
|
| 27 |
+
|
| 28 |
+
| Property | Value |
|
| 29 |
+
|---|---|
|
| 30 |
+
| Model | Sentimental Analyzer V3 |
|
| 31 |
+
| Backbone | `microsoft/deberta-v3-base` |
|
| 32 |
+
| Framework | PyTorch |
|
| 33 |
+
| Maximum sequence length | 256 |
|
| 34 |
+
| Sentiment classes | 5 |
|
| 35 |
+
| Emotion classes | 28 |
|
| 36 |
+
| Sentiment task | Single-label classification |
|
| 37 |
+
| Emotion task | Multi-label classification |
|
| 38 |
+
| Production calibration | `HYBRID_ISOTONIC_GLOBAL` |
|
| 39 |
+
| Calibrated emotion classes | 11 |
|
| 40 |
+
| Raw emotion classes | 17 |
|
| 41 |
+
| Global emotion threshold | 0.35 |
|
| 42 |
+
| Fallback strategy | `highest_calibrated_probability` |
|
| 43 |
+
|
| 44 |
+
## What the Model Does
|
| 45 |
+
|
| 46 |
+
Given an English text or comment, the model produces:
|
| 47 |
+
|
| 48 |
+
- One sentiment class from five possible sentiment categories.
|
| 49 |
+
- One or more emotion labels from 28 possible emotion categories, with a fallback selection when no class crosses the production threshold.
|
| 50 |
+
- A probability distribution over the five sentiment classes.
|
| 51 |
+
- A probability for each of the 28 emotion classes.
|
| 52 |
+
|
| 53 |
+
The model is designed for text analytics, exploratory NLP, research, educational demonstrations, and applications that analyze user feedback.
|
| 54 |
+
|
| 55 |
+
## Sentiment Classification
|
| 56 |
+
|
| 57 |
+
The model predicts one of five sentiment categories:
|
| 58 |
+
|
| 59 |
+
| ID | Sentiment |
|
| 60 |
+
|---:|---|
|
| 61 |
+
| 0 | Negative |
|
| 62 |
+
| 1 | Neutral |
|
| 63 |
+
| 2 | Positive |
|
| 64 |
+
| 3 | Very Negative |
|
| 65 |
+
| 4 | Very Positive |
|
| 66 |
+
|
| 67 |
+
Sentiment classification is a single-label classification task. The sentiment probabilities are normalized using softmax.
|
| 68 |
+
|
| 69 |
+
## Emotion Classification
|
| 70 |
+
|
| 71 |
+
The model performs multi-label emotion classification.
|
| 72 |
+
|
| 73 |
+
| ID | Emotion |
|
| 74 |
+
|---:|---|
|
| 75 |
+
| 0 | admiration |
|
| 76 |
+
| 1 | amusement |
|
| 77 |
+
| 2 | anger |
|
| 78 |
+
| 3 | annoyance |
|
| 79 |
+
| 4 | approval |
|
| 80 |
+
| 5 | caring |
|
| 81 |
+
| 6 | confusion |
|
| 82 |
+
| 7 | curiosity |
|
| 83 |
+
| 8 | desire |
|
| 84 |
+
| 9 | disappointment |
|
| 85 |
+
| 10 | disapproval |
|
| 86 |
+
| 11 | disgust |
|
| 87 |
+
| 12 | embarrassment |
|
| 88 |
+
| 13 | excitement |
|
| 89 |
+
| 14 | fear |
|
| 90 |
+
| 15 | gratitude |
|
| 91 |
+
| 16 | grief |
|
| 92 |
+
| 17 | joy |
|
| 93 |
+
| 18 | love |
|
| 94 |
+
| 19 | nervousness |
|
| 95 |
+
| 20 | neutral |
|
| 96 |
+
| 21 | optimism |
|
| 97 |
+
| 22 | pride |
|
| 98 |
+
| 23 | realization |
|
| 99 |
+
| 24 | relief |
|
| 100 |
+
| 25 | remorse |
|
| 101 |
+
| 26 | sadness |
|
| 102 |
+
| 27 | surprise |
|
| 103 |
+
|
| 104 |
+
Multiple emotions can be associated with the same text.
|
| 105 |
+
|
| 106 |
+
## Architecture
|
| 107 |
+
|
| 108 |
+
The model uses `microsoft/deberta-v3-base` as the transformer encoder.
|
| 109 |
+
|
| 110 |
+
```text
|
| 111 |
+
Input Text
|
| 112 |
+
|
|
| 113 |
+
v
|
| 114 |
+
DeBERTa-v3-base Encoder
|
| 115 |
+
|
|
| 116 |
+
v
|
| 117 |
+
Attention Pooling
|
| 118 |
+
|
|
| 119 |
+
v
|
| 120 |
+
Shared Representation
|
| 121 |
+
/ \
|
| 122 |
+
/ \
|
| 123 |
+
v v
|
| 124 |
+
Sentiment Head Emotion Head
|
| 125 |
+
| |
|
| 126 |
+
v v
|
| 127 |
+
5 Sentiments 28 Emotions
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
### Attention Pooling
|
| 131 |
+
|
| 132 |
+
The sequence-level hidden representations produced by DeBERTa are aggregated using learned attention pooling. Padding tokens are masked before the attention softmax so that padded positions do not contribute to the pooled representation.
|
| 133 |
+
|
| 134 |
+
### Shared Representation
|
| 135 |
+
|
| 136 |
+
The pooled representation is passed through:
|
| 137 |
+
|
| 138 |
+
- Linear projection
|
| 139 |
+
- GELU activation
|
| 140 |
+
- Layer normalization
|
| 141 |
+
- Dropout
|
| 142 |
+
|
| 143 |
+
The resulting representation is shared by the two task-specific prediction heads.
|
| 144 |
+
|
| 145 |
+
### Sentiment Head
|
| 146 |
+
|
| 147 |
+
The sentiment head produces five logits. Softmax is applied during inference to obtain the sentiment probability distribution.
|
| 148 |
+
|
| 149 |
+
### Emotion Head
|
| 150 |
+
|
| 151 |
+
The emotion head produces 28 logits. Sigmoid probabilities are used because emotion classification is multi-label.
|
| 152 |
+
|
| 153 |
+
## Production Calibration
|
| 154 |
+
|
| 155 |
+
The production emotion pipeline uses the frozen strategy:
|
| 156 |
+
|
| 157 |
+
`HYBRID_ISOTONIC_GLOBAL`
|
| 158 |
+
|
| 159 |
+
```text
|
| 160 |
+
Raw Emotion Logits
|
| 161 |
+
|
|
| 162 |
+
v
|
| 163 |
+
Sigmoid Probabilities
|
| 164 |
+
|
|
| 165 |
+
v
|
| 166 |
+
Class-wise Isotonic Calibration
|
| 167 |
+
|
|
| 168 |
+
v
|
| 169 |
+
Global Threshold = 0.35
|
| 170 |
+
|
|
| 171 |
+
v
|
| 172 |
+
Final Emotion Labels
|
| 173 |
+
```
|
| 174 |
+
|
| 175 |
+
### Calibration Configuration
|
| 176 |
+
|
| 177 |
+
- Calibration strategy: `HYBRID_ISOTONIC_GLOBAL`
|
| 178 |
+
- Calibrated emotion classes: 11
|
| 179 |
+
- Raw emotion classes: 17
|
| 180 |
+
- Minimum calibration support: 10
|
| 181 |
+
- Global threshold: 0.35
|
| 182 |
+
- Fallback: `highest_calibrated_probability`
|
| 183 |
+
|
| 184 |
+
The following 11 emotion classes use isotonic calibration:
|
| 185 |
+
|
| 186 |
+
- admiration
|
| 187 |
+
- anger
|
| 188 |
+
- annoyance
|
| 189 |
+
- approval
|
| 190 |
+
- disappointment
|
| 191 |
+
- disapproval
|
| 192 |
+
- disgust
|
| 193 |
+
- excitement
|
| 194 |
+
- joy
|
| 195 |
+
- love
|
| 196 |
+
- neutral
|
| 197 |
+
|
| 198 |
+
The following 17 rare classes retain their raw sigmoid probabilities:
|
| 199 |
+
|
| 200 |
+
- amusement
|
| 201 |
+
- caring
|
| 202 |
+
- confusion
|
| 203 |
+
- curiosity
|
| 204 |
+
- desire
|
| 205 |
+
- embarrassment
|
| 206 |
+
- fear
|
| 207 |
+
- gratitude
|
| 208 |
+
- grief
|
| 209 |
+
- nervousness
|
| 210 |
+
- optimism
|
| 211 |
+
- pride
|
| 212 |
+
- realization
|
| 213 |
+
- relief
|
| 214 |
+
- remorse
|
| 215 |
+
- sadness
|
| 216 |
+
- surprise
|
| 217 |
+
|
| 218 |
+
Calibration parameters and the threshold were selected using validation data. The final test set was not used for calibration or threshold selection.
|
| 219 |
+
|
| 220 |
+
## Evaluation
|
| 221 |
+
|
| 222 |
+
The final V3 checkpoint was evaluated on an untouched real-world test split containing **253 examples**.
|
| 223 |
+
|
| 224 |
+
### Sentiment Results
|
| 225 |
+
|
| 226 |
+
| Metric | Score |
|
| 227 |
+
|---|---:|
|
| 228 |
+
| Accuracy | 0.8024 |
|
| 229 |
+
| Macro F1 | 0.6499 |
|
| 230 |
+
| Weighted F1 | 0.7864 |
|
| 231 |
+
|
| 232 |
+
### Emotion Results
|
| 233 |
+
|
| 234 |
+
| Metric | Score |
|
| 235 |
+
|---|---:|
|
| 236 |
+
| Micro F1 | 0.5770 |
|
| 237 |
+
| Macro F1 | 0.3026 |
|
| 238 |
+
| Weighted F1 | 0.5968 |
|
| 239 |
+
| Macro Precision | 0.2791 |
|
| 240 |
+
| Macro Recall | 0.4198 |
|
| 241 |
+
|
| 242 |
+
These results correspond to the frozen V3 checkpoint and production calibration configuration.
|
| 243 |
+
|
| 244 |
+
## Evaluation Interpretation
|
| 245 |
+
|
| 246 |
+
The sentiment task shows stronger performance than the 28-class emotion task.
|
| 247 |
+
|
| 248 |
+
The emotion task is more challenging because:
|
| 249 |
+
|
| 250 |
+
- It is multi-label.
|
| 251 |
+
- Some emotions are substantially rarer than others.
|
| 252 |
+
- Emotion boundaries can be subjective.
|
| 253 |
+
- Multiple emotions can coexist in the same text.
|
| 254 |
+
- Some classes have limited calibration support.
|
| 255 |
+
|
| 256 |
+
Macro-level emotion metrics are particularly sensitive to performance on rare classes.
|
| 257 |
+
|
| 258 |
+
## Dataset and Labeling Limitation
|
| 259 |
+
|
| 260 |
+
The real-world adaptation dataset used during development contains **LLM/pseudo-labeled examples rather than a fully human-annotated gold-standard dataset**.
|
| 261 |
+
|
| 262 |
+
Therefore, the reported real-world adaptation results should be interpreted as evaluation against the project's labeling methodology rather than definitive human-gold benchmark performance.
|
| 263 |
+
|
| 264 |
+
The model may perform differently on text that differs substantially from the adaptation data, including different domains, writing styles, topics, vocabulary, slang, cultural contexts, levels of context, or forms of sarcasm and implicit meaning.
|
| 265 |
+
|
| 266 |
+
## Intended Use
|
| 267 |
+
|
| 268 |
+
Sentimental Analyzer V3 is intended for:
|
| 269 |
+
|
| 270 |
+
- Sentiment analysis of English comments and short text.
|
| 271 |
+
- Emotion analysis of user feedback.
|
| 272 |
+
- NLP research and experimentation.
|
| 273 |
+
- Educational demonstrations.
|
| 274 |
+
- Exploratory analysis of text datasets.
|
| 275 |
+
- Aggregate analysis of customer or user feedback.
|
| 276 |
+
- Integration into applications through an inference API.
|
| 277 |
+
|
| 278 |
+
The model can be used as an inference component behind a web application or API.
|
| 279 |
+
|
| 280 |
+
## Limitations
|
| 281 |
+
|
| 282 |
+
This model should not be considered a perfect representation of human emotion.
|
| 283 |
+
|
| 284 |
+
Important limitations include:
|
| 285 |
+
|
| 286 |
+
- Emotion classification can be subjective.
|
| 287 |
+
- Some emotion classes are substantially rarer than others.
|
| 288 |
+
- Multi-label emotion annotation can be difficult to validate consistently.
|
| 289 |
+
- Sarcasm and implicit meaning may be challenging.
|
| 290 |
+
- Domain shift may reduce performance.
|
| 291 |
+
- Rare emotion classes have limited calibration support.
|
| 292 |
+
- The real-world adaptation labels are not fully human-gold.
|
| 293 |
+
- The model has primarily been developed and evaluated for English text.
|
| 294 |
+
- Model predictions are statistical estimates and should not be treated as objective facts about a person's feelings.
|
| 295 |
+
- Predictions should not be interpreted as psychological, medical, or clinical assessments.
|
| 296 |
+
|
| 297 |
+
## Example
|
| 298 |
+
|
| 299 |
+
### Input
|
| 300 |
+
|
| 301 |
+
```text
|
| 302 |
+
I absolutely love this product! It is amazing.
|
| 303 |
+
```
|
| 304 |
+
|
| 305 |
+
### Example Production Output
|
| 306 |
+
|
| 307 |
+
```json
|
| 308 |
+
{
|
| 309 |
+
"sentiment": "Very Positive",
|
| 310 |
+
"sentiment_confidence": 0.987,
|
| 311 |
+
"emotions": [
|
| 312 |
+
"joy"
|
| 313 |
+
]
|
| 314 |
+
}
|
| 315 |
+
```
|
| 316 |
+
|
| 317 |
+
The exact probability values depend on the frozen checkpoint and production calibration artifacts.
|
| 318 |
+
|
| 319 |
+
## Model Artifacts
|
| 320 |
+
|
| 321 |
+
```text
|
| 322 |
+
Sentimental-Analyzer-V3/
|
| 323 |
+
│
|
| 324 |
+
├── README.md
|
| 325 |
+
├── config.json
|
| 326 |
+
│
|
| 327 |
+
├── model/
|
| 328 |
+
│ └── best_v3_model.pt
|
| 329 |
+
│
|
| 330 |
+
├── calibration/
|
| 331 |
+
│ └── v3_isotonic_calibrators.pkl
|
| 332 |
+
│
|
| 333 |
+
└── labels/
|
| 334 |
+
├── sentiment_labels.json
|
| 335 |
+
└── emotion_labels.json
|
| 336 |
+
```
|
| 337 |
+
|
| 338 |
+
### Artifact Descriptions
|
| 339 |
+
|
| 340 |
+
- `model/best_v3_model.pt`: Frozen V3 PyTorch checkpoint containing the trained model parameters.
|
| 341 |
+
- `calibration/v3_isotonic_calibrators.pkl`: Frozen emotion calibration parameters used by the production inference pipeline.
|
| 342 |
+
- `labels/sentiment_labels.json`: Mapping between sentiment class IDs and sentiment labels.
|
| 343 |
+
- `labels/emotion_labels.json`: Mapping between emotion class IDs and emotion labels.
|
| 344 |
+
- `config.json`: Frozen production configuration containing model, class, calibration, decision, selection, and checkpoint integrity information.
|
| 345 |
+
|
| 346 |
+
## Checkpoint Integrity
|
| 347 |
+
|
| 348 |
+
The published checkpoint corresponds to the frozen V3 production candidate.
|
| 349 |
+
|
| 350 |
+
SHA-256:
|
| 351 |
+
|
| 352 |
+
```text
|
| 353 |
+
4d3f5a97d352460d41fa884fd337b2de6f58549139135cad1b4b79beefcb2078
|
| 354 |
+
```
|
| 355 |
+
|
| 356 |
+
The checkpoint was verified against this SHA-256 hash before publication.
|
| 357 |
+
|
| 358 |
+
## Frozen Production Configuration
|
| 359 |
+
|
| 360 |
+
```text
|
| 361 |
+
Version:
|
| 362 |
+
V3_FINAL_CANDIDATE
|
| 363 |
+
|
| 364 |
+
Model:
|
| 365 |
+
microsoft/deberta-v3-base
|
| 366 |
+
|
| 367 |
+
Maximum sequence length:
|
| 368 |
+
256
|
| 369 |
+
|
| 370 |
+
Sentiment classes:
|
| 371 |
+
5
|
| 372 |
+
|
| 373 |
+
Emotion classes:
|
| 374 |
+
28
|
| 375 |
+
|
| 376 |
+
Calibration strategy:
|
| 377 |
+
HYBRID_ISOTONIC_GLOBAL
|
| 378 |
+
|
| 379 |
+
Calibrated emotion classes:
|
| 380 |
+
11
|
| 381 |
+
|
| 382 |
+
Raw emotion classes:
|
| 383 |
+
17
|
| 384 |
+
|
| 385 |
+
Minimum calibration support:
|
| 386 |
+
10
|
| 387 |
+
|
| 388 |
+
Global emotion threshold:
|
| 389 |
+
0.35
|
| 390 |
+
|
| 391 |
+
Fallback:
|
| 392 |
+
highest_calibrated_probability
|
| 393 |
+
|
| 394 |
+
Selection dataset:
|
| 395 |
+
validation
|
| 396 |
+
|
| 397 |
+
Test used for selection:
|
| 398 |
+
false
|
| 399 |
+
|
| 400 |
+
Threshold source:
|
| 401 |
+
validation
|
| 402 |
+
|
| 403 |
+
Calibration source:
|
| 404 |
+
validation
|
| 405 |
+
```
|
| 406 |
+
|
| 407 |
+
No additional training or calibration is performed during production inference.
|
| 408 |
+
|
| 409 |
+
## Inference Behavior
|
| 410 |
+
|
| 411 |
+
```text
|
| 412 |
+
Input text
|
| 413 |
+
|
|
| 414 |
+
v
|
| 415 |
+
Tokenization
|
| 416 |
+
|
|
| 417 |
+
v
|
| 418 |
+
DeBERTa-v3-base
|
| 419 |
+
|
|
| 420 |
+
v
|
| 421 |
+
Shared representation
|
| 422 |
+
|
|
| 423 |
+
+-------------------------+
|
| 424 |
+
| |
|
| 425 |
+
v v
|
| 426 |
+
Sentiment logits Emotion logits
|
| 427 |
+
| |
|
| 428 |
+
v v
|
| 429 |
+
Softmax Sigmoid
|
| 430 |
+
| |
|
| 431 |
+
v v
|
| 432 |
+
Sentiment label Frozen calibration
|
| 433 |
+
|
|
| 434 |
+
v
|
| 435 |
+
Threshold = 0.35
|
| 436 |
+
|
|
| 437 |
+
v
|
| 438 |
+
Emotion labels
|
| 439 |
+
```
|
| 440 |
+
|
| 441 |
+
The model is loaded in evaluation mode and its parameters are frozen during inference.
|
| 442 |
+
|
| 443 |
+
## API Integration
|
| 444 |
+
|
| 445 |
+
The model can be exposed through a FastAPI service.
|
| 446 |
+
|
| 447 |
+
A production API can provide:
|
| 448 |
+
|
| 449 |
+
```text
|
| 450 |
+
POST /predict
|
| 451 |
+
```
|
| 452 |
+
|
| 453 |
+
Example request:
|
| 454 |
+
|
| 455 |
+
```json
|
| 456 |
+
{
|
| 457 |
+
"text": "I absolutely love this product!"
|
| 458 |
+
}
|
| 459 |
+
```
|
| 460 |
+
|
| 461 |
+
Example response:
|
| 462 |
+
|
| 463 |
+
```json
|
| 464 |
+
{
|
| 465 |
+
"sentiment": "Very Positive",
|
| 466 |
+
"sentiment_confidence": 0.98,
|
| 467 |
+
"sentiment_probabilities": {
|
| 468 |
+
"Negative": 0.00,
|
| 469 |
+
"Neutral": 0.00,
|
| 470 |
+
"Positive": 0.01,
|
| 471 |
+
"Very Negative": 0.00,
|
| 472 |
+
"Very Positive": 0.98
|
| 473 |
+
},
|
| 474 |
+
"emotions": [
|
| 475 |
+
"joy"
|
| 476 |
+
],
|
| 477 |
+
"emotion_probabilities": {
|
| 478 |
+
"joy": 0.76
|
| 479 |
+
}
|
| 480 |
+
}
|
| 481 |
+
```
|
| 482 |
+
|
| 483 |
+
The API layer can be deployed separately from this model repository so that API users do not need to download the model checkpoint directly.
|
| 484 |
+
|
| 485 |
+
## Reproducibility
|
| 486 |
+
|
| 487 |
+
The V3 production candidate is frozen.
|
| 488 |
+
|
| 489 |
+
The following components are fixed:
|
| 490 |
+
|
| 491 |
+
- Model checkpoint
|
| 492 |
+
- Model architecture
|
| 493 |
+
- Tokenizer configuration
|
| 494 |
+
- Maximum sequence length
|
| 495 |
+
- Sentiment label mapping
|
| 496 |
+
- Emotion label mapping
|
| 497 |
+
- Emotion ordering
|
| 498 |
+
- Emotion calibration artifacts
|
| 499 |
+
- Global emotion threshold
|
| 500 |
+
- Fallback strategy
|
| 501 |
+
- Production configuration
|
| 502 |
+
|
| 503 |
+
The checkpoint can be verified using the published SHA-256 hash.
|
| 504 |
+
|
| 505 |
+
## Responsible Use
|
| 506 |
+
|
| 507 |
+
This model produces statistical predictions from textual patterns learned during training and adaptation.
|
| 508 |
+
|
| 509 |
+
Its outputs should not be presented as certain facts about:
|
| 510 |
+
|
| 511 |
+
- A person's actual emotional state
|
| 512 |
+
- A person's intentions
|
| 513 |
+
- A person's personality
|
| 514 |
+
- A person's psychological condition
|
| 515 |
+
- A person's medical or clinical status
|
| 516 |
+
|
| 517 |
+
Applications using this model should provide appropriate context and should avoid presenting model predictions as definitive judgments.
|
| 518 |
+
|
| 519 |
+
## Project Status
|
| 520 |
+
|
| 521 |
+
**V3 production candidate — frozen.**
|
| 522 |
+
|
| 523 |
+
The model, calibration configuration, and production inference behavior have been verified before publication.
|
| 524 |
+
|
| 525 |
+
Training and calibration are not performed during production inference.
|
| 526 |
+
|
| 527 |
+
## License
|
| 528 |
+
|
| 529 |
+
MIT
|
calibration/v3_isotonic_calibrators.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e119817ef570540dcbd59bb38eb66c44999815653c8a8370dd1f34d4590a9920
|
| 3 |
+
size 4796
|
config.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "V3_FINAL_CANDIDATE",
|
| 3 |
+
"model_name": "microsoft/deberta-v3-base",
|
| 4 |
+
"checkpoint": "model/best_v3_model.pt",
|
| 5 |
+
"checkpoint_sha256": "4d3f5a97d352460d41fa884fd337b2de6f58549139135cad1b4b79beefcb2078",
|
| 6 |
+
"max_length": 256,
|
| 7 |
+
"sentiment_classes": 5,
|
| 8 |
+
"emotion_classes": 28,
|
| 9 |
+
"emotions": [
|
| 10 |
+
"admiration",
|
| 11 |
+
"amusement",
|
| 12 |
+
"anger",
|
| 13 |
+
"annoyance",
|
| 14 |
+
"approval",
|
| 15 |
+
"caring",
|
| 16 |
+
"confusion",
|
| 17 |
+
"curiosity",
|
| 18 |
+
"desire",
|
| 19 |
+
"disappointment",
|
| 20 |
+
"disapproval",
|
| 21 |
+
"disgust",
|
| 22 |
+
"embarrassment",
|
| 23 |
+
"excitement",
|
| 24 |
+
"fear",
|
| 25 |
+
"gratitude",
|
| 26 |
+
"grief",
|
| 27 |
+
"joy",
|
| 28 |
+
"love",
|
| 29 |
+
"nervousness",
|
| 30 |
+
"neutral",
|
| 31 |
+
"optimism",
|
| 32 |
+
"pride",
|
| 33 |
+
"realization",
|
| 34 |
+
"relief",
|
| 35 |
+
"remorse",
|
| 36 |
+
"sadness",
|
| 37 |
+
"surprise"
|
| 38 |
+
],
|
| 39 |
+
"calibration": {
|
| 40 |
+
"strategy": "HYBRID_ISOTONIC_GLOBAL",
|
| 41 |
+
"calibrated_classes": [
|
| 42 |
+
"admiration",
|
| 43 |
+
"anger",
|
| 44 |
+
"annoyance",
|
| 45 |
+
"approval",
|
| 46 |
+
"disappointment",
|
| 47 |
+
"disapproval",
|
| 48 |
+
"disgust",
|
| 49 |
+
"excitement",
|
| 50 |
+
"joy",
|
| 51 |
+
"love",
|
| 52 |
+
"neutral"
|
| 53 |
+
],
|
| 54 |
+
"raw_classes": [
|
| 55 |
+
"amusement",
|
| 56 |
+
"caring",
|
| 57 |
+
"confusion",
|
| 58 |
+
"curiosity",
|
| 59 |
+
"desire",
|
| 60 |
+
"embarrassment",
|
| 61 |
+
"fear",
|
| 62 |
+
"gratitude",
|
| 63 |
+
"grief",
|
| 64 |
+
"nervousness",
|
| 65 |
+
"optimism",
|
| 66 |
+
"pride",
|
| 67 |
+
"realization",
|
| 68 |
+
"relief",
|
| 69 |
+
"remorse",
|
| 70 |
+
"sadness",
|
| 71 |
+
"surprise"
|
| 72 |
+
],
|
| 73 |
+
"minimum_support": 10
|
| 74 |
+
},
|
| 75 |
+
"decision": {
|
| 76 |
+
"global_threshold": 0.35,
|
| 77 |
+
"fallback": "highest_calibrated_probability"
|
| 78 |
+
},
|
| 79 |
+
"selection": {
|
| 80 |
+
"selection_dataset": "validation",
|
| 81 |
+
"test_used_for_selection": false,
|
| 82 |
+
"threshold_source": "validation",
|
| 83 |
+
"calibration_source": "validation"
|
| 84 |
+
}
|
| 85 |
+
}
|
labels/emotion_labels.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"0": "admiration",
|
| 3 |
+
"1": "amusement",
|
| 4 |
+
"2": "anger",
|
| 5 |
+
"3": "annoyance",
|
| 6 |
+
"4": "approval",
|
| 7 |
+
"5": "caring",
|
| 8 |
+
"6": "confusion",
|
| 9 |
+
"7": "curiosity",
|
| 10 |
+
"8": "desire",
|
| 11 |
+
"9": "disappointment",
|
| 12 |
+
"10": "disapproval",
|
| 13 |
+
"11": "disgust",
|
| 14 |
+
"12": "embarrassment",
|
| 15 |
+
"13": "excitement",
|
| 16 |
+
"14": "fear",
|
| 17 |
+
"15": "gratitude",
|
| 18 |
+
"16": "grief",
|
| 19 |
+
"17": "joy",
|
| 20 |
+
"18": "love",
|
| 21 |
+
"19": "nervousness",
|
| 22 |
+
"20": "neutral",
|
| 23 |
+
"21": "optimism",
|
| 24 |
+
"22": "pride",
|
| 25 |
+
"23": "realization",
|
| 26 |
+
"24": "relief",
|
| 27 |
+
"25": "remorse",
|
| 28 |
+
"26": "sadness",
|
| 29 |
+
"27": "surprise"
|
| 30 |
+
}
|
labels/sentiment_labels.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"0": "Negative",
|
| 3 |
+
"1": "Neutral",
|
| 4 |
+
"2": "Positive",
|
| 5 |
+
"3": "Very Negative",
|
| 6 |
+
"4": "Very Positive"
|
| 7 |
+
}
|
model/best_v3_model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4d3f5a97d352460d41fa884fd337b2de6f58549139135cad1b4b79beefcb2078
|
| 3 |
+
size 2220745459
|