File size: 1,847 Bytes
c010a6d
 
 
 
 
 
 
 
 
 
 
 
f34ad4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9db0aef
 
f34ad4f
 
9db0aef
f34ad4f
 
9db0aef
f34ad4f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
language: ko
tags:
- text-classification
- emotion
- korean
license: mit
datasets:
- custom
model-name: korean-emotion-classifier
---

# Korean Emotion Classifier ๐Ÿ˜ƒ๐Ÿ˜ก๐Ÿ˜ข๐Ÿ˜จ๐Ÿ˜ฒ๐Ÿ˜Œ

๋ณธ ๋ชจ๋ธ์€ ํ•œ๊ตญ์–ด ํ…์ŠคํŠธ๋ฅผ **6๊ฐ€์ง€ ๊ฐ์ •(๋ถ„๋…ธ, ๋ถˆ์•ˆ, ์Šฌํ””, ํ‰์˜จ, ๋‹นํ™ฉ, ๊ธฐ์จ)**์œผ๋กœ ๋ถ„๋ฅ˜ํ•ฉ๋‹ˆ๋‹ค.
`klue/roberta-base` ๊ธฐ๋ฐ˜์œผ๋กœ ํŒŒ์ธํŠœ๋‹๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

---

## ๐Ÿ“Š Evaluation Results

| Emotion | Precision | Recall | F1-Score |
|---------|-----------|--------|----------|
| ๋ถ„๋…ธ    | 0.9801    | 0.9788 | 0.9795   |
| ๋ถˆ์•ˆ    | 0.9864    | 0.9848 | 0.9856   |
| ์Šฌํ””    | 0.9837    | 0.9854 | 0.9845   |
| ํ‰์˜จ    | 0.9782    | 0.9750 | 0.9766   |
| ๋‹นํ™ฉ    | 0.9607    | 0.9668 | 0.9652   |
| ๊ธฐ์จ    | 0.9857    | 0.9886 | 0.9872   |

**Accuracy**: 0.9831
**Macro Avg**: Precision=0.9791 / Recall=0.9804 / F1=0.9798
**Weighted Avg**: Precision=0.9831 / Recall=0.9831 / F1=0.9831

```python
from transformers import pipeline
import torch

model_id = "Seonghaa/korean-emotion-classifier-roberta"

device = 0 if torch.cuda.is_available() else -1  # GPU ์žˆ์œผ๋ฉด 0, ์—†์œผ๋ฉด CPU(-1)

clf = pipeline(
    "text-classification",
    model=model_id,
    tokenizer=model_id,
    device=device
)

texts = [
    "์˜ค๋Š˜ ๊ธธ์—์„œ 10๋งŒ์›์„ ์ฃผ์› ์–ด",
    "์˜ค๋Š˜ ์นœ๊ตฌ๋“ค์ด๋ž‘ ๋…ธ๋ž˜๋ฐฉ์— ๊ฐ”์–ด",
    "์˜ค๋Š˜ ์‹œํ—˜ ๋ง์ณค์–ด",
]

for t in texts:
    pred = clf(t, truncation=True, max_length=256)[0]
    print(f"์ž…๋ ฅ: {t}")
    print(f"โ†’ ์˜ˆ์ธก ๊ฐ์ •: {pred['label']}, ์ ์ˆ˜: {pred['score']:.4f}
")

```
## ์ถœ๋ ฅ ์˜ˆ์‹œ:
์ž…๋ ฅ: ์˜ค๋Š˜ ๊ธธ์—์„œ 10๋งŒ์›์„ ์ฃผ์› ์–ด</br>
โ†’ ์˜ˆ์ธก ๊ฐ์ •: ๊ธฐ์จ, ์ ์ˆ˜: 0.9619

์ž…๋ ฅ: ์˜ค๋Š˜ ์นœ๊ตฌ๋“ค์ด๋ž‘ ๋…ธ๋ž˜๋ฐฉ์— ๊ฐ”์–ด</br>
โ†’ ์˜ˆ์ธก ๊ฐ์ •: ๊ธฐ์จ, ์ ์ˆ˜: 0.9653

์ž…๋ ฅ: ์˜ค๋Š˜ ์‹œํ—˜ ๋ง์ณค์–ด</br>
โ†’ ์˜ˆ์ธก ๊ฐ์ •: ์Šฌํ””, ์ ์ˆ˜: 0.9602