distilbert-emotion-hw2

《人工智能基础》大作业 2:英文短文本情绪识别(6 类)。

在 distilbert-base-uncased 上以 5e-5 学习率、5 个 epoch、batch size 8、最大长度 128 微调,数据为 emotion 数据集(train 16000 / validation 2000 / test 2000)。

标签

sadness, joy, love, anger, fear, surprise(id2label 已写入 config.json)。

结果

划分 Accuracy Macro-F1
Validation 94.45% 94.45%
Test 92.85% 92.85%

多数类基线为 35.20%。同任务下 TF-IDF + Logistic Regression 为 63.45%,LinearSVC 为 62.90%,RandomForest 为 52.45%,效果明显低于微调模型。

各类别在验证集上的表现:sadness F1 0.971、joy 0.958、love 0.874、anger 0.945、fear 0.920、surprise 0.863。主要错误集中在 joy 与 love 混淆(21 条)、anger 被判为 sadness(8 条)。

用法

from transformers import pipeline

clf = pipeline("text-classification", model="SXNNNN/distilbert-emotion-hw2")
print(clf("i feel so blessed and grateful today"))

训练超参数

  • learning_rate: 5e-5
  • train_batch_size: 8
  • eval_batch_size: 32
  • num_train_epochs: 5
  • max_length: 128
  • optimizer: AdamW
  • scheduler: linear warmup(warmup_ratio 0.1)
Downloads last month
15
Safetensors
Model size
67M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for SXNNNN/distilbert-emotion-hw2

Finetuned
(12,947)
this model

Dataset used to train SXNNNN/distilbert-emotion-hw2