Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,54 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
# Model Card for BERT hate offensive tweets
|
| 6 |
+
|
| 7 |
+
BERT base uncased trained on the data that can be found here: MartynaKopyta/hate_offensive_tweets (https://huggingface.co/datasets/MartynaKopyta/hate_offensive_tweets) to classify tweets as 0 - hate, 1 - offensive or 2 - neither.
|
| 8 |
+
|
| 9 |
+
You can find the notebook used for training in my GitHub repo: MartynaKopyta/BERT_FINE-TUNING (https://github.com/MartynaKopyta/BERT_FINE-TUNING/blob/main/BERT_hate_offensive_speech.ipynb).
|
| 10 |
+
|
| 11 |
+
## Model Details
|
| 12 |
+
|
| 13 |
+
- **Finetuned from model bert-base-uncased:https://huggingface.co/bert-base-uncased**
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
## Bias, Risks, and Limitations
|
| 17 |
+
|
| 18 |
+
The dataset was not big enough for BERT to learn to classify 3 classes accurately, it is right 3/4 times.
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
## How to Get Started with the Model
|
| 22 |
+
|
| 23 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 24 |
+
|
| 25 |
+
model = AutoModelForSequenceClassification.from_pretrained('MartynaKopyta/BERT_hate_offensive_tweets')
|
| 26 |
+
tokenizer = AutoTokenizer.from_pretrained('MartynaKopyta/BERT_hate_offensive_tweets')
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
#### Training Hyperparameters
|
| 30 |
+
|
| 31 |
+
- **batch size:16**
|
| 32 |
+
- **learning rate:2e-5**
|
| 33 |
+
- **epochs:3**
|
| 34 |
+
|
| 35 |
+
## Evaluation
|
| 36 |
+
|
| 37 |
+
Accuracy: 0.779373368146214
|
| 38 |
+
Classification Report:
|
| 39 |
+
precision recall f1-score support
|
| 40 |
+
|
| 41 |
+
0 0.74 0.68 0.71 1532
|
| 42 |
+
1 0.85 0.88 0.87 1532
|
| 43 |
+
2 0.74 0.78 0.76 1532
|
| 44 |
+
|
| 45 |
+
accuracy 0.78 4596
|
| 46 |
+
macro avg 0.78 0.78 0.78 4596
|
| 47 |
+
weighted avg 0.78 0.78 0.78 4596
|
| 48 |
+
|
| 49 |
+
Confusion Matrix:
|
| 50 |
+
[[1043 96 393]
|
| 51 |
+
[ 169 1343 20]
|
| 52 |
+
[ 204 132 1196]]
|
| 53 |
+
|
| 54 |
+
MCC: 0.670
|