🚀 roberta-base-frenk-hate
這是一個基於文本分類的模型,它以roberta-base
為基礎,並在FRENK數據集上進行了微調。該數據集包含針對LGBT群體和移民的仇恨言論。微調僅使用了數據集中的英文子集,並且對數據集進行了重新標註,以進行二元分類(冒犯性或可接受)。
🚀 快速開始
本模型基於roberta-base
,在特定數據集上微調後可用於文本分類任務,能判斷文本是否具有冒犯性。
✨ 主要特性
- 基於
roberta-base
模型,在特定的仇恨言論數據集上進行微調。
- 僅使用英文子集數據進行微調,並重新標註為二元分類任務。
📦 安裝指南
文檔未提供安裝步驟,故跳過此章節。
💻 使用示例
基礎用法
from simpletransformers.classification import ClassificationModel
model_args = {
"num_train_epochs": 6,
"learning_rate": 3e-6,
"train_batch_size": 69}
model = ClassificationModel(
"roberta", "5roop/roberta-base-frenk-hate", use_cuda=True,
args=model_args
)
predictions, logit_output = model.predict(["Build the wall",
"Build the wall of trust"]
)
predictions
📚 詳細文檔
微調超參數
使用simpletransformers
進行微調。事先進行了簡要的超參數優化,推測的最優超參數如下:
model_args = {
"num_train_epochs": 6,
"learning_rate": 3e-6,
"train_batch_size": 69}
性能表現
為了進行比較,使用相同的管道對另外兩個Transformer模型和fasttext
進行了運行。記錄了6次微調會話中每個模型的準確率和宏F1分數,並進行了事後分析。
模型 |
平均準確率 |
平均宏F1分數 |
roberta-base-frenk-hate |
0.7915 |
0.7785 |
xlm-roberta-large |
0.7904 |
0.77876 |
xlm-roberta-base |
0.7577 |
0.7402 |
fasttext |
0.725 |
0.707 |
根據記錄的準確率和宏F1分數,還計算了p值:
與xlm-roberta-base
的比較:
測試方法 |
準確率p值 |
宏F1分數p值 |
Wilcoxon |
0.00781 |
0.00781 |
Mann Whithney U-test |
0.00108 |
0.00108 |
Student t-test |
1.35e - 08 |
1.05e - 07 |
與xlm-roberta-large
的比較結果不明確。roberta-base
的平均準確率為0.7915,而xlm-roberta-large
的平均準確率為0.7904。如果比較宏F1分數,roberta-base
實際上比xlm-roberta-large
的平均值低:分別為0.77852和0.77876。在假設roberta-base
具有更好指標的前提下進行了相同的統計測試,結果如下:
測試方法 |
準確率p值 |
宏F1分數p值 |
Wilcoxon |
0.188 |
0.406 |
Mann Whithey |
0.375 |
0.649 |
Student t-test |
0.681 |
0.934 |
在相反的假設下(即xlm-roberta-large
具有更好的統計指標),這種情況下宏F1分數的Wilcoxon p值達到0.656,Mann - Whithey p值為0.399,當然Student p值保持不變。因此得出結論,這兩個模型的性能在統計上沒有顯著差異。
🔧 技術細節
文檔中關於技術細節的描述主要圍繞微調超參數和性能比較,已在詳細文檔中體現。
📄 許可證
本項目採用CC BY-SA 4.0許可證。
📖 引用
如果您使用該模型,請引用以下論文,該論文是原始模型的基礎:
@article{DBLP:journals/corr/abs-1907-11692,
author = {Yinhan Liu and
Myle Ott and
Naman Goyal and
Jingfei Du and
Mandar Joshi and
Danqi Chen and
Omer Levy and
Mike Lewis and
Luke Zettlemoyer and
Veselin Stoyanov},
title = {RoBERTa: {A} Robustly Optimized {BERT} Pretraining Approach},
journal = {CoRR},
volume = {abs/1907.11692},
year = {2019},
url = {http://arxiv.org/abs/1907.11692},
archivePrefix = {arXiv},
eprint = {1907.11692},
timestamp = {Thu, 01 Aug 2019 08:59:33 +0200},
biburl = {https://dblp.org/rec/journals/corr/abs-1907-11692.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
以及用於微調的數據集:
@misc{ljubešić2019frenk,
title={The FRENK Datasets of Socially Unacceptable Discourse in Slovene and English},
author={Nikola Ljubešić and Darja Fišer and Tomaž Erjavec},
year={2019},
eprint={1906.02045},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/1906.02045}
}