A Thai text classification model that detects scam/fraud messages. Fine-tuned from airesearch/wangchanberta-base-att-spm-uncased.
Full web app: GitHub
| Label | Meaning |
|---|---|
| 0 | [Normal message] |
| 1 | [Scam / fraud message] |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_id = "P1g/fraud-message-detector-model"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
text = "ยินดีด้วย คุณได้รับรางวัล กดลิงก์เพื่อรับเงิน"
inputs = tokenizer(text, return_tensors="pt", truncation=True)
with torch.no_grad():
probs = model(**inputs).logits.softmax(dim=-1)
print(probs)
The training data includes a study dataset from Rangsit University (source), together with additional messages prepared for this project. The full training dataset is not released, as it may contain personal information.
Evaluated on a test set of 269 messages (142 scam, 127 normal).
| Metric | Score |
|---|---|
| F2 (primary metric) | 91.9% |
| Recall | 90.8% |
| Precision | 96.3% |
| F1 | 93.5% |
| Accuracy | 93.3% |
F2 is used as the primary metric because it weights recall higher than precision — missing a scam message is considered more costly than flagging a normal one.
airesearch/wangchanberta-base-att-spm-uncased