Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: id
|
3 |
+
tags:
|
4 |
+
- indonesian-roberta-base-sentiment-classifier
|
5 |
+
license: mit
|
6 |
+
datasets:
|
7 |
+
- indonlu
|
8 |
+
widget:
|
9 |
+
- text: "Jangan sampai saya telpon bos saya ya!"
|
10 |
+
---
|
11 |
+
|
12 |
+
## Indonesian RoBERTa Base Sentiment Classifier
|
13 |
+
|
14 |
+
Indonesian RoBERTa Base Sentiment Classifier is a sentiment-text-classification model based on the [RoBERTa](https://arxiv.org/abs/1907.11692) model. The model was originally the pre-trained [Indonesian RoBERTa Base](https://hf.co/flax-community/indonesian-roberta-base) model, which is then fine-tuned on [`indonlu`](https://hf.co/datasets/indonlu)'s `SmSA` dataset consisting of Indonesian comments and reviews.
|
15 |
+
|
16 |
+
After training, the model achieved an evaluation accuracy of 93.88% and F1-macro of 91.57%. On the benchmark test set, the model achieved an accuracy of 90.00% and F1-macro of 85.97%.
|
17 |
+
|
18 |
+
Hugging Face's `Trainer` class from the [Transformers](https://huggingface.co/transformers) library was used to train the model. PyTorch was used as the backend framework during training, but the model remains compatible with other frameworks nonetheless.
|
19 |
+
|
20 |
+
## Model
|
21 |
+
|
22 |
+
| Model | #params | Arch. | Training/Validation data (text) |
|
23 |
+
| ---------------------------------------------- | ------- | ------------ | ------------------------------- |
|
24 |
+
| `indonesian-roberta-base-sentiment-classifier` | 124M | RoBERTa Base | `SmSA` |
|
25 |
+
|
26 |
+
## Evaluation Results
|
27 |
+
|
28 |
+
The model was trained for 5 epochs and the best model was loaded at the end.
|
29 |
+
|
30 |
+
| Epoch | Training Loss | Validation Loss | Accuracy | F1 | Precision | Recall |
|
31 |
+
| ----- | ------------- | --------------- | -------- | -------- | --------- | -------- |
|
32 |
+
| 1 | 0.346100 | 0.263456 | 0.915079 | 0.888680 | 0.877023 | 0.903502 |
|
33 |
+
| 2 | 0.175200 | 0.215166 | 0.930952 | 0.908246 | 0.918557 | 0.898842 |
|
34 |
+
| 3 | 0.111700 | 0.227525 | 0.932540 | 0.901823 | 0.916049 | 0.891263 |
|
35 |
+
| 4 | 0.071800 | 0.244867 | 0.938889 | 0.915714 | 0.923105 | 0.909921 |
|
36 |
+
| 5 | 0.055000 | 0.262004 | 0.935714 | 0.906755 | 0.918607 | 0.898044 |
|
37 |
+
|
38 |
+
## How to Use
|
39 |
+
|
40 |
+
### As Text Classifier
|
41 |
+
|
42 |
+
```python
|
43 |
+
from transformers import pipeline
|
44 |
+
|
45 |
+
pretrained_name = "w11wo/indonesian-roberta-base-sentiment-classifier"
|
46 |
+
|
47 |
+
nlp = pipeline(
|
48 |
+
"sentiment-analysis",
|
49 |
+
model=pretrained_name,
|
50 |
+
tokenizer=pretrained_name
|
51 |
+
)
|
52 |
+
|
53 |
+
nlp("Jangan sampai saya telpon bos saya ya!")
|
54 |
+
```
|
55 |
+
|
56 |
+
## Disclaimer
|
57 |
+
|
58 |
+
Do consider the biases which come from both the pre-trained RoBERTa model and the `SmSA` dataset that may be carried over into the results of this model.
|
59 |
+
|
60 |
+
## Author
|
61 |
+
|
62 |
+
Indonesian RoBERTa Base Sentiment Classifier was trained and evaluated by [Wilson Wongso](https://w11wo.github.io/). All computation and development are done on Google Colaboratory using their free GPU access.
|