DeBERTa v3 for Japanese Emotion Analysis (WRIME - Plutchik's 8 Emotions)

日本語の感情分析(プルチックの 8 感情)のための DeBERTa v3 モデル

このモデルはku-nlp/deberta-v3-base-japaneseWRIME v1 データセットの主観データ(writer)でファインチューニングしたものです。

🔄 重要:正規化について

このモデルは正規化された値を出力します

  • モデル出力: 0.0 ~ 1.0 の連続値(正規化済み)
  • 元のスケール: 0 ~ 3 の連続値
  • デノーマライズ方法: prediction_original = prediction_normalized * 3.0
# 推論後、必ずデノーマライズしてください
predictions = outputs.logits.cpu().numpy()[0]  # 0.0~1.0
predictions_original = predictions * 3.0        # 0~3に変換
predictions_original = np.clip(predictions_original, 0.0, 3.0)

Model Description

プルチックの 8 つの基本感情(喜び、悲しみ、期待、驚き、怒り、恐れ、嫌悪、信頼)を0 ~ 3 の連続値で予測する回帰モデルです。

  • ベースモデル: ku-nlp/deberta-v3-base-japanese
  • 言語: 日本語 (Japanese)
  • ライセンス: MIT
  • タスク: 感情分析(回帰)
  • データ: WRIME v1(主観データのみ)

Label Configuration

{
  "id2label": {
    "0": "joy",
    "1": "sadness",
    "2": "anticipation",
    "3": "surprise",
    "4": "anger",
    "5": "fear",
    "6": "disgust",
    "7": "trust"
  },
  "problem_type": "regression"
}

How to Use

インストール

pip install transformers torch

基本的な使い方

from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
import numpy as np

# モデルとトークナイザのロード
model_name = "neuralnaut/deberta-wrime-emotions"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

# 感情ラベル(出力の順序に対応)
EMOTION_LABELS = ["joy", "sadness", "anticipation", "surprise", "anger", "fear", "disgust", "trust"]

# 推論
text = "今日はとても楽しい一日でした!"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)

model.eval()
with torch.no_grad():
    outputs = model(**inputs)
    predictions = outputs.logits.cpu().numpy()[0]

# ⚠️ 重要:デノーマライズ (0-1 → 0-3)
predictions = predictions * 3.0
predictions = np.clip(predictions, 0.0, 3.0)

# 結果表示
print(f"テキスト: {text}\n")
for emotion, score in zip(EMOTION_LABELS, predictions):
    print(f"{emotion:15s}: {score:.2f}")

出力例

テキスト: 今日はとても楽しい一日でした!

joy            : 2.73
sadness        : 0.12
anticipation   : 1.48
surprise       : 0.65
anger          : 0.02
fear           : 0.05
disgust        : 0.08
trust          : 1.15

視覚化例

for emotion, score in zip(EMOTION_LABELS, predictions):
    bar = "█" * int(score * 10)
    print(f"{emotion:15s}: {score:.2f} {bar}")

Intended Uses

主な用途

  • テキストの詳細な感情分析(SNS 投稿、レビュー、コメントなど)
  • 8 次元の感情プロファイル作成
  • メンタルヘルス分野での複雑な感情理解
  • カスタマーフィードバックの詳細分析

制限事項

  • 主観データのみ: 筆者の主観的な感情のみを予測(読者の感情は対象外)
  • ドメイン: SNS 投稿風のカジュアルなテキストで最適化
  • 長さ: 最大 128 トークンまで
  • Trust 感情: trust(信頼)の相関が他より低い(0.2635)

Training Data

WRIME v1 データセット

  • 出典: shunk031/wrime (ver1)
  • 使用データ: 主観データ(writer)のみ
  • ラベル: プルチックの 8 感情
  • スケール: 0(無)~ 3(強)の連続値
Split サンプル数
Train 30,000
Validation 2,000
Test 2,000

Training Procedure

ハイパーパラメータ

パラメータ
学習率 1e-5
バッチサイズ 32 (16 × 2 gradient accumulation)
エポック数 7 (Early Stopping)
Warmup Ratio 0.1
Weight Decay 0.01
最大トークン長 128
最適化手法 AdamW
精度 FP16

データ正規化

  • 学習時: 0-3 → 0-1 に正規化
  • 推論時: 0-1 → 0-3 にデノーマライズが必要

Evaluation Results

テストセット性能 (WRIME v1 test split)

指標 スコア
RMSE (0-3 scale) 0.7527
MAE (0-3 scale) 0.5033
Pearson Correlation 0.4720

感情ごとの Pearson 相関係数

感情 相関係数
joy (喜び) 0.6661
sadness (悲しみ) 0.5032
anger (怒り) 0.5587
disgust (嫌悪) 0.4909
anticipation (期待) 0.4672
surprise (驚き) 0.4675
fear (恐れ) 0.3587
trust (信頼) 0.2635

感情ごとの RMSE (0-3 scale)

感情 RMSE
trust 0.6016
fear 0.6922
anger 0.6998
surprise 0.7466
joy 0.7837
disgust 0.8169
sadness 0.8166
anticipation 0.8344

Limitations and Bias

  • 主観データのみ: 筆者の感情のみを予測
  • ドメインバイアス: SNS 投稿のような短文に最適化
  • 文化的バイアス: 日本語話者の感情表現に特化
  • Trust 感情: 他の感情より予測精度が低い
  • 複雑な感情: 矛盾する複数の感情が同時に存在する場合は予測が難しい

Citation

このモデルの引用

@misc{neuralnaut2025deberta-wrime-emotions,
  title = {DeBERTa v3 for Japanese Emotion Analysis (WRIME - Plutchik's 8 Emotions)},
  author = {neuralnaut},
  year = {2025},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/neuralnaut/deberta-wrime-emotions}},
}

WRIME データセット

@inproceedings{kajiwara-etal-2021-wrime,
    title = "{WRIME}: A New Dataset for Emotional Intensity Estimation with Subjective and Objective Annotations",
    author = "Kajiwara, Tomoyuki and Chu, Chenhui and Takemura, Noriko and Nakashima, Yuta and Nagahara, Hajime",
    booktitle = "Proceedings of NAACL-HLT 2021",
    year = "2021",
    pages = "2095--2104",
}

ベースモデル

@misc{ku-nlp-deberta-v3-base-japanese,
  title = {DeBERTa V3 base Japanese model},
  author = {Kyoto University NLP Lab},
  year = {2023},
  publisher = {Hugging Face},
  howpublished = {\url{https://huggingface.co/ku-nlp/deberta-v3-base-japanese}},
}
Downloads last month
77
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for neuralnaut/deberta-wrime-emotions

Finetuned
(3)
this model

Dataset used to train neuralnaut/deberta-wrime-emotions

Evaluation results