pgos-behavior-agent / README.md
nuguri01's picture
Update README.md
8712e37 verified
|
Raw History Blame Contribute Delete
3.52 kB
---
language: ko
license: mit
tags:
- korean
- psychology
- behavior-classification
- counseling
- kcelectra
metrics:
- f1
---
# PGOS Behavior Agent
**Psychological Growth OS(PGOS)** ν”„λ‘œμ νŠΈμ˜ 행동 νŒ¨ν„΄ λΆ„λ₯˜ λͺ¨λΈμž…λ‹ˆλ‹€.
## λͺ¨λΈ κ°œμš”
심리상담 λŒ€ν™”μ—μ„œ λ‚΄λ‹΄μžμ˜ 행동 νŒ¨ν„΄μ„ 5κ°€μ§€λ‘œ λΆ„λ₯˜ν•©λ‹ˆλ‹€.
| 클래슀 | μ„€λͺ… | μ˜ˆμ‹œ |
|---|---|---|
| μ ‘κ·Ό (Approach) | 문제/감정을 λŠ₯λ™μ μœΌλ‘œ 탐색 | "ν•œλ²ˆ λ§ν•΄λ΄€μ–΄μš”", "직접 λ¬Όμ–΄λ΄€μ–΄μš”" |
| νšŒν”Ό (Avoidance) | λΆˆνŽΈν•œ 상황/감정을 피함 | "κ·Έλƒ₯ μ‹ κ²½ μ•ˆ μ¨μš”", "μ–΄μ°¨ν”Ό" |
| μœ„μΆ• (Withdrawal) | 관계/ν™œλ™μ—μ„œ μ‚¬νšŒμ  철수 | "μš”μ¦˜ 아무도 μ•ˆ λ§Œλ‚˜μš”", "혼자 있고 μ‹Άμ–΄μš”" |
| 지속 (Persistence) | λΉ„νš¨κ³Όμ  νŒ¨ν„΄μ„ μ•Œλ©΄μ„œ 반볡 | "또 이러고 μžˆμ–΄μš”", "맀번 μ΄λ ‡κ²Œ λΌμš”" |
| 쀑립 (Neutral) | μœ„ νŒ¨ν„΄μ΄ λšœλ ·ν•˜μ§€ μ•Šμ€ 일반 λŒ€ν™” | 일상 μ„œμˆ , 정보 전달 |
## μ„±λŠ₯
| μ§€ν‘œ | κ°’ |
|---|---|
| Top-1 Macro F1 | **0.754** |
| Top-2 Hit Rate | **0.899** |
| Top-3 Hit Rate | **0.985** |
### ν΄λž˜μŠ€λ³„ F1
| 클래슀 | F1 |
|---|---|
| μœ„μΆ• | 0.976 |
| 지속 | 0.956 |
| 쀑립 | 0.657 |
| νšŒν”Ό | 0.617 |
| μ ‘κ·Ό | 0.567 |
## ν•™μŠ΅ 데이터
- **μ›μ²œ 데이터**: AI Hub 심리상담 데이터 (우울증/λΆˆμ•ˆμž₯μ• /쀑독/일반ꡰ, 75개 회기)
- **μž…λ ₯ λ‹¨μœ„**: 연속 3ν„΄ μŠ¬λΌμ΄λ”© μœˆλ„μš°
- **GPT 증강**: μœ„μΆ•/지속 클래슀 λΆ€μ‘±λΆ„ GPT-4o-mini둜 보강
- **μ΅œμ’… ν•™μŠ΅ 데이터**: ν΄λž˜μŠ€λ‹Ή 750개 κ· λ“± (총 3,750개)
## 베이슀 λͺ¨λΈ
[beomi/KcELECTRA-base-v2022](https://huggingface.co/beomi/KcELECTRA-base-v2022)
## ν•™μŠ΅ μ„€μ •
```python
TrainingArguments(
num_train_epochs=6,
per_device_train_batch_size=32,
learning_rate=2e-5,
weight_decay=0.03,
loss="CrossEntropy" # ν•˜λ“œ 라벨
)
```
## μ‚¬μš© 방법
```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "nuguri01/pgos-behavior-agent"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# μž…λ ₯: 3ν„΄ λŒ€ν™” (μŠ¬λΌμ΄λ”© μœˆλ„μš°)
text = "[λ‚΄λ‹΄μž] μš”μ¦˜ μΉœκ΅¬λ“€ 연락이 와도 λ‹΅μž₯을 μ•ˆ ν•˜κ²Œ λΌμš”. | [상담사] μ–΄λ–€ 마음인 것 κ°™μ•„μš”? | [λ‚΄λ‹΄μž] κ·Έλƒ₯ 혼자 있고 μ‹Άμ–΄μš”."
inputs = tokenizer(text, return_tensors="pt", max_length=256, truncation=True)
with torch.no_grad():
logits = model(**inputs).logits
probs = torch.softmax(logits, dim=-1)
labels = ["μ ‘κ·Ό", "νšŒν”Ό", "μœ„μΆ•", "지속", "쀑립"]
top1_idx = probs.argmax().item()
top2_idx = probs.topk(2).indices[0][1].item()
print(f"μ£ΌνŒ¨ν„΄: {labels[top1_idx]} ({probs[0][top1_idx]:.3f})")
print(f"λ³΄μ‘°νŒ¨ν„΄: {labels[top2_idx]} ({probs[0][top2_idx]:.3f})")
# 볡합 νŒ¨ν„΄ ν”Œλž˜κ·Έ (λ³΄μ‘°νŒ¨ν„΄ 25% 이상)
if probs[0][top2_idx] >= 0.25:
print(f"볡합 νŒ¨ν„΄: {labels[top1_idx]}+{labels[top2_idx]}")
```
## PGOS μ•„ν‚€ν…μ²˜μ—μ„œμ˜ μ—­ν• 
μ‚¬μš©μž λ°œν™” β†’ Behavior Agent (이 λͺ¨λΈ)
{
"primary_behavior": "μœ„μΆ•",
"primary_score": 0.87,
"secondary_behavior": "νšŒν”Ό",
"secondary_score": 0.09,
"is_complex": false
}
β†’ Coordinator β†’ λŒ€ν™” μ „λž΅ κ²°μ •
## ν”„λ‘œμ νŠΈ
- **μ„œλΉ„μŠ€**: Psychological Growth OS (PGOS)
- **μ² ν•™**: Carl Rogers μΈκ°„μ€‘μ‹¬μΉ˜λ£Œ + ACT Hexaflex
- **Emotion Agent**: [nuguri01/pgos-emotion-stage1-major](https://huggingface.co/nuguri01/pgos-emotion-stage1-major)