CoolFace
Modelpublic

ZenyxS/indobert-emotion-emotionclf

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes8downloads
Model Card

๐Ÿค– 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 <!-- replace username with 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

python
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

LabelPrecisionRecallF1
Senang0.210.380.27
Netral0.540.260.35
Bingung0.350.560.43
Frustrasi0.040.040.04
Marah0.000.000.00
  • โ€”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

python
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:

bibtex
@misc{prasetyo2025indobert,
  title={IndoBERT Emotion Classifier},
  author={Fabian Prasetyo},
  institution={SMKN 21 Jakarta},
  year={2025},
  howpublished={\url{https://huggingface.co/username/indobert-emotion-classifier}}
}