Skip to content
Learning

Emotion classification from text

Classify six GoEmotions annotation categories

The updated text example uses 5,272 selected GoEmotions records and six labels: love, anger, joy, sadness, surprise and fear. Its saved report evaluates 1,054 held-out texts.

5,272Source records
45Encoded input values
1,054Testing-role records
6Model outputs

1. Business decision

Text analysts can organize annotated language and inspect class-specific errors before using model scores for qualitative review. An emotion label describes the dataset annotation, not a person’s mental state or intent.

Updated annotation source

Use the packaged GoEmotions selection.

Class-specific evidence

Inspect the complete held-out confusion table.

Interpretation boundary

Treat labels as annotations, not psychological assessments.

Text analyticsLanguage researchModel evaluation
Single-label English text classification for research and text organization.

2. Data set

The package contains an adapted GoEmotions subset from Google Research, with its selection and attribution documented in LICENSES/OPENNN-SOURCE.md. The current label order is love, anger, joy, sadness, surprise, fear; it differs from the former DAIR.AI example.

Source: GoEmotions. Dataset license: CC-BY-4.0. The downloadable ZIP includes the adapted data and attribution notices.

Dataset measureSaved value
Analysis unitlabelled text
Records5,272
Raw variables2
Encoded model inputs45
Model outputs6
Training roles3164
Validation / selection roles1054
Testing roles1054
Unused roles0
FieldRoleTypeCategories
input_sequenceInputNumeric
target_sequenceTargetCategoricallove, anger, joy, sadness, surprise, fear
The saved project assigns rows to training, validation and testing as shown above. This is internal record-level evaluation; it does not demonstrate separation by subject, device, site or acquisition batch.

3. Model

The model has 45 encoded inputs and 6 outputs. No architecture-selection experiment is recorded in this project. The diagram shows the topology used by the saved model.

LayerInput shapeOutput shapeActivation
Embedding4545 × 64
MultiHeadAttention45 × 6445 × 64
Pooling3d45 × 6464
Dense6464ReLU
Dense646Softmax

Output values are uncalibrated model scores. Use the output encodings and decision rule documented with this project; do not assume independent sigmoid scores sum to one.

Emotion classification from text — initial network architecture
Topology of the saved current model; no architecture selection is recorded.

4. Training strategy

The saved training configuration uses Adam with CrossEntropy.

Adaptive moment estimation results

MeasureValue
Epochs number75
Elapsed time00:00:08
Stopping criterionMaximum epochs number
Training error0.632
Validation error1.03
Adaptive moment estimation error history
Adaptive moment estimation error history. Native Neural Designer report for this project.

5. Model selection

No model selection experiment is recorded for this version. The validation subset guides fitting where a training report is present; it is distinct from the held-out test rows.

6. Testing analysis

The figures and tables below refer to the current project’s saved testing analysis. The subset uses testing role 2; it contains 1054 source records.

The multiclass decision uses the largest output score. The confusion matrix gives class prevalence and per-class errors; binary sensitivity, specificity, precision and a single ROC AUC are not interchangeable with this multiclass accuracy.

Confusion table

MeasurePredicted lovePredicted angerPredicted joyPredicted sadnessPredicted surprisePredicted fearTotal
Actual love258 (24.5%)11 (1.0%)14 (1.3%)9 (0.9%)3 (0.3%)2 (0.2%)297 (28.2%)
Actual anger12 (1.1%)131 (12.4%)12 (1.1%)21 (2.0%)16 (1.5%)10 (0.9%)202 (19.2%)
Actual joy15 (1.4%)19 (1.8%)106 (10.1%)15 (1.4%)12 (1.1%)6 (0.6%)173 (16.4%)
Actual sadness12 (1.1%)23 (2.2%)15 (1.4%)94 (8.9%)11 (1.0%)14 (1.3%)169 (16.0%)
Actual surprise7 (0.7%)10 (0.9%)9 (0.9%)6 (0.6%)95 (9.0%)6 (0.6%)133 (12.6%)
Actual fear6 (0.6%)15 (1.4%)6 (0.6%)14 (1.3%)9 (0.9%)30 (2.8%)80 (7.6%)
Total310 (29.4%)209 (19.8%)162 (15.4%)159 (15.1%)146 (13.9%)68 (6.5%)1054 (100.0%)
Test measureValue
Testing records1054
Accuracy67.74%
Largest-class baseline28.18%

7. Model deployment

Open the downloaded project in Neural Designer, inspect the dataset roles and preprocessing, then review the saved task report. Use the same input schema and category order when calculating outputs. The ZIP contains the exact current .nd, its source data and the applicable dataset notices.

Workflow: source measurements → schema and availability checks → model output → domain review. Keep model versions, validation evidence and incoming-data monitoring together.

8. Evidence and limitations

Context, irony and mixed emotions can cause errors. The selected subset does not represent the prevalence of emotion in another text collection. Evaluate the same tokenizer, class order and text preprocessing, and review rare-class errors before applying the model to another domain.

References

  • GoEmotions. Dorottya Demszky, Dana Movshovitz-Attias, Jeongwoo Ko, Alan Cowen,. 10.18653/v1/2020.acl-main.372
  • Dataset terms: Creative Commons Attribution 4.0 International. Full attribution and transformations are included in LICENSES/DATASET-LICENSE.txt.
  • Current Neural Designer project and saved task report, snapshot 6 October 2026.