ZenyxS/indobert-emotion-emotionclf
๐ค IndoBERT Emotion Classifier
A fine-tuned IndoBERT model for Indonesian-language emotion classification in conversational or chatbot contexts. This model was developed as part of a research project on detecting user satisfaction and emotional states from short-text feedback and responses.
It classifies input text into one of five emotions:
- ๐ Senang โ Happy / satisfied
- ๐ Netral โ Neutral / indifferent
- ๐ค Bingung โ Confused / unsure
- ๐ค Frustrasi โ Frustrated / unsatisfied
- ๐ก Marah โ Angry / annoyed
๐ Model Details
- Model name:
username/indobert-emotion-classifier<!-- replaceusernamewith your HF username --> - Developed by: Fabian Prasetyo
- Institution: SMKN 21 Jakarta
- Language: Indonesian (
id) - License: Apache 2.0
- Base model: indobenchmark/indobert-base-p1
- Task: Emotion classification from short conversational text
- Number of classes: 5
๐ฏ Use Cases
โ Direct Use
- Emotion recognition for Indonesian chatbot conversations.
- Sentiment/feedback analysis for educational or customer service systems.
- Emotion-aware dialogue systems and virtual assistants.
๐ Downstream Use
- As a module in larger conversational AI systems.
- As a feature extractor for satisfaction prediction or escalation pipelines.
๐ซ Out-of-Scope Use
- โ Clinical or psychological diagnosis.
- โ Text domains unrelated to conversation or short feedback (e.g., news articles, long essays).
โ ๏ธ Bias, Risks, and Limitations
- The dataset consists of student chatbot feedback and may not generalize beyond similar conversational contexts.
- Minority labels (
Frustrasi,Marah) are underrepresented โ this leads to low recall for those classes. - Heavy slang, code-switching (Indonesian-English), typos, and non-standard spelling can reduce model accuracy.
- Use caution before applying in high-risk or safety-critical settings (no clinical/medical decisions, no legal decisions, etc.).
๐ Quick Start
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
model_name = "username/indobert-emotion-classifier" # replace 'username' with your HF username
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
classifier = pipeline("text-classification", model=model, tokenizer=tokenizer, return_all_scores=True)
text = "Apaan sih ini, nggak jelas banget!"
print(classifier(text))
โ
Example Output:
python
[
{'label': 'Frustrasi', 'score': 0.3700},
{'label': 'Bingung', 'score': 0.3357},
{'label': 'Netral', 'score': 0.1256},
{'label': 'Marah', 'score': 0.1058},
{'label': 'Senang', 'score': 0.0629}
]๐ IndoBERT Emotion Classifier
A fine-tuned IndoBERT model for classifying emotions in Indonesian short-chat responses. Developed as part of a student research project at SMKN 21 Jakarta.
๐ Dataset
- Source: 1,896 annotated chatbot responses
- Participants: 237 students
- Label distribution:
- Netral: 1,018
- Bingung: 442
- Senang: 249
- Frustrasi: 98
- Marah: 89
โ ๏ธ Note: The dataset is imbalanced, particularly for Frustrasi and Marah. This strongly affects per-class performance.
โ๏ธ Training Procedure
- Train/Test Split: 80/20
- Epochs: 3
- Optimizer: AdamW
- Loss Function: CrossEntropy with class weights
- Precision: fp32
- Hardware: NVIDIA T4 (~2 min/epoch)
- Framework: ๐ค Transformers + PyTorch
๐ง Model Architecture
- Base Model: IndoBERT (BERT-base, ~110M parameters)
- 12 layers, 768 hidden size, 12 attention heads
- Fine-tuning: All layers (full fine-tune)
๐ Evaluation Results
- Overall Accuracy: ~0.33
- Macro F1: 0.22
Interpretation: The model captures dominant intents (neutral, confused, positive) reasonably well, but struggles with rare classes (Frustrasi, Marah) due to dataset imbalance.
๐งช Example Predictions
def predict(text, classifier):
scores = classifier(text)[0]
return sorted(scores, key=lambda x: x["score"], reverse=True)[0]
print(predict("Apaan sih ini, nggak jelas banget!"))
# โ Frustrasi (0.37)
print(predict("Aku sangat senang jawabannya jelas sekali"))
# โ Senang (0.42)
print(predict("Hah? Maksudnya gimana?"))
# โ Bingung (0.37)๐ง Technical Specifications
Architecture: IndoBERT (BERT-base: 12 layers, 768 hidden, 12 heads, ~110M parameters) Fine-tuning: Full fine-tuning (all layers) Training time: ~2 minutes/epoch on NVIDIA T4 (reported) Framework: ๐ค Transformers + PyTorch
๐ ๏ธ Recommendations (Actionable)
Class imbalance
- Oversample minority classes.
- Apply stronger augmentation (back-translation, synonym replacement).
- Experiment with focal loss or class-balanced loss functions.
Preprocessing
- Normalize slang and common typos.
- Apply light text normalization:
- lowercasing
- repeated-character normalization
- token-level normalization for common chat abbreviations
Data collection
- Collect more labeled samples for Frustrasi and Marah.
- Use active learning to prioritize annotation of high-uncertainty samples.
Evaluation
- Report confidence intervals (e.g., via bootstrap).
- Provide confusion matrix and per-class metrics.
Deployment
- Apply quantization (e.g., 8-bit) for reduced latency on edge devices.
- Define fallback policy: escalate or request human review when Frustrasi or Marah prediction exceeds a threshold.
๐ฌ Contact
Author: Fabian Prasetyo Institution: SMKN 21 Jakarta Email: fabianprasetyo133@gmail.com
๐ Citation
If you use this model, please cite it as:
@misc{prasetyo2025indobert,
title={IndoBERT Emotion Classifier},
author={Fabian Prasetyo},
institution={SMKN 21 Jakarta},
year={2025},
howpublished={\url{https://huggingface.co/username/indobert-emotion-classifier}}
}