CoolFace
Modelpublic

Rendika/Trained-DistilBERT-Indonesia-Presidential-Election-Balanced-Dataset

sourceHugging Facemitupdated 2y agoView on Hugging Face
0likes6downloads
Model Card

Berikut adalah README.txt yang menarik dan informatif untuk model yang telah Anda unggah ke Kaggle Model Hub:


Fine-tuned DistilBERT Model for Indonesian Text Classification

Overview

This repository contains a fine-tuned version of the DistilBERT model (based on cahya/distilbert-base-indonesian) for Indonesian text classification. The model is trained to classify text into eight distinct categories, including politics, socio-cultural, defense and security, ideology, economy, natural resources, demography, and geography.

Dataset

The dataset used for training the model underwent significant augmentation and balancing to address class imbalance issues. Below are the details of the dataset before and after augmentation:

Before Augmentation

CategoryCount
Politik2972
Sosial Budaya587
Pertahanan dan Keamanan400
Ideologi400
Ekonomi367
Sumber Daya Alam192
Demografi62
Geografi20

After Augmentation

CategoryCount
Politik2969
Demografi427
Sosial Budaya422
Ideologi343
Pertahanan dan Keamanan331
Ekonomi309
Sumber Daya Alam156
Geografi133

Label Encoding

EncodedLabel
0Demografi
1Ekonomi
2Geografi
3Ideologi
4Pertahanan dan Keamanan
5Politik
6Sosial Budaya
7Sumber Daya Alam

Data Split

The dataset was split into training and testing sets with an 85:15 ratio.

  • Train Size: 4326 samples
  • Test Size: 764 samples

Model Training

The model was trained for 4 epochs, achieving the following results:

EpochTrain LossTrain Accuracy
11.02400.6766
20.56150.8220
30.32700.9014
40.17590.9481

Training Completion

  • Test Loss: 0.7948
  • Test Accuracy: 0.7687
  • Test Balanced Accuracy: 0.7001

Model Evaluation

The model was evaluated using precision, recall, and F1 scores, with the following results:

  • Precision Score: 0.7714
  • Recall Score: 0.7696
  • F1 Score: 0.7697

Classification Report

CategoryPrecisionRecallF1-ScoreSupport
Demografi0.940.910.9264
Ekonomi0.670.720.6946
Geografi0.950.950.9520
Ideologi0.710.560.6252
Pertahanan dan Keamanan0.690.660.6750
Politik0.840.850.84446
Sosial Budaya0.380.400.3963
Sumber Daya Alam0.500.570.5323
  • Accuracy: 0.7696
  • Balanced Accuracy: 0.7001
  • Macro Avg Precision: 0.71
  • Macro Avg Recall: 0.70
  • Macro Avg F1-Score: 0.70
  • Weighted Avg Precision: 0.77
  • Weighted Avg Recall: 0.77
  • Weighted Avg F1-Score: 0.77

Usage

To use this model, you can load it using the Hugging Face Transformers library:

python
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-classification", model="Rendika/Trained-DistilBERT-Indonesia-Presidential-Election-Balanced-Dataset")

# Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("Rendika/Trained-DistilBERT-Indonesia-Presidential-Election-Balanced-Dataset")
model = AutoModelForSequenceClassification.from_pretrained("Rendika/Trained-DistilBERT-Indonesia-Presidential-Election-Balanced-Dataset")

Conclusion

This fine-tuned DistilBERT model for Indonesian text classification demonstrates robust performance across various categories. The augmentation and balancing of the dataset have contributed significantly to the model's ability to generalize well on the test set.

Feel free to use this model for your Indonesian text classification tasks, and don't hesitate to reach out if you have any questions or feedback.