|
# bcms-bertic-frenk-hate |
|
|
|
Text classification model based on `classla/bcms-bertic` and fine-tuned on the [FRANK dataset](https://www.clarin.si/repository/xmlui/handle/11356/1433) comprising of LGBT and migrant hatespeech. Only the Croatian subset of the data was used for fine-tuning and the dataset has been relabeled for binary classification (offensive or acceptable). |
|
|
|
## Fine-tuning hyperparameters |
|
|
|
Fine-tuning was performed with `simpletransformers`. Beforehand a brief hyperparameter optimisation was performed and the presumed optimal hyperparameters are: |
|
|
|
```python |
|
|
|
model_args = { |
|
"num_train_epochs": 12, |
|
"learning_rate": 1e-5, |
|
"train_batch_size": 74} |
|
``` |
|
|
|
## Performance |
|
|
|
The same pipeline was run with two other models and with the same dataset. Accuracy and macro F1 score were recorded for each of the 6 fine-tuning sessions and post festum analyzed. |
|
|
|
| model | average accuracy | average macro F1| |
|
|---|---|---| |
|
|bcms-bertic-frenk-hate|0.8313|0.8219| |
|
|EMBEDDIA/crosloengual-bert |0.8054|0.796| |
|
|xlm-roberta-base |0.7175|0.7049| |
|
|
|
|
|
|
|
From recorded accuracies and macro F1 scores p-values were also calculated: |
|
|
|
Comparison with `crosloengual-bert`: |
|
|
|
| test | accuracy p-value | macro F1 p-value| |
|
| --- | --- | --- | |
|
|Wilcoxon|0.00781|0.00781| |
|
|Mann Whithney|0.00108|0.00108| |
|
|Student t-test |2.43e-10 |1.27e-10| |
|
|
|
Comparison with `xlm-roberta-base`: |
|
|
|
| test | accuracy p-value | macro F1 p-value| |
|
| --- | --- | --- | |
|
|Wilcoxon|0.00781|0.00781| |
|
|Mann Whithney|0.00107|0.00108| |
|
|Student t-test |4.83e-11 | 5.61e-11 | |
|
|
|
## Use examples |
|
|
|
```python |
|
from simpletransformers.classification import ClassificationModel |
|
model_args = { |
|
"num_train_epochs": 12, |
|
"learning_rate": 1e-5, |
|
"train_batch_size": 74} |
|
|
|
model = ClassificationModel( |
|
"bert", "5roop/bcms-bertic-frenk-hate", use_cuda=True, |
|
args=model_args |
|
|
|
) |
|
|
|
predictions, logit_output = model.predict(['Ne odbacujem da će RH primiti još migranata iz Afganistana, no neće biti novog vala', |
|
"Potpredsjednik Vlade i ministar branitelja Tomo Medved komentirao je Vladine planove za zakonsku zabranu pozdrava 'za dom spremni' "]) |
|
predictions |
|
### Output: |
|
### array([0, 0]) |
|
``` |