poltextlab
commited on
Commit
•
907432d
1
Parent(s):
65ec0e4
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -10,7 +10,7 @@ metrics:
|
|
10 |
- accuracy
|
11 |
- f1-score
|
12 |
---
|
13 |
-
#
|
14 |
## Model description
|
15 |
An `xlm-roberta-large` model finetuned on training data containing [major topic codes](https://www.comparativeagendas.net/pages/master-codebook) from the [Comparative Agendas Project](https://www.comparativeagendas.net/).
|
16 |
|
@@ -44,7 +44,7 @@ dataset = hg_data.map(tokenize_dataset, batched=True, remove_columns=hg_data.col
|
|
44 |
|
45 |
#### Inference using the Trainer class
|
46 |
```python
|
47 |
-
model = AutoModelForSequenceClassification.from_pretrained('poltextlab/
|
48 |
num_labels=num_labels,
|
49 |
problem_type="multi_label_classification",
|
50 |
ignore_mismatched_sizes=True
|
@@ -52,8 +52,8 @@ model = AutoModelForSequenceClassification.from_pretrained('poltextlab/MODEL_NAM
|
|
52 |
|
53 |
training_args = TrainingArguments(
|
54 |
output_dir='.',
|
55 |
-
per_device_train_batch_size=
|
56 |
-
per_device_eval_batch_size=
|
57 |
)
|
58 |
|
59 |
trainer = Trainer(
|
@@ -68,7 +68,7 @@ predicted = pd.DataFrame(np.argmax(probs, axis=1)).replace({0: CAP_NUM_DICT}).re
|
|
68 |
```
|
69 |
|
70 |
### Fine-tuning procedure
|
71 |
-
`
|
72 |
```
|
73 |
training_args = TrainingArguments(
|
74 |
output_dir=f"../model/{model_dir}/tmp/",
|
@@ -88,9 +88,34 @@ training_args = TrainingArguments(
|
|
88 |
We also incorporated an EarlyStoppingCallback in the process with a patience of 2 epochs.
|
89 |
|
90 |
## Model performance
|
91 |
-
The model was evaluated on a test set of
|
92 |
Model accuracy is **0.83**.
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
## Inference platform
|
96 |
This model is used by the [CAP Babel Machine](https://babel.poltextlab.com), an open-source and free natural language processing tool, designed to simplify and speed up projects for comparative research.
|
|
|
10 |
- accuracy
|
11 |
- f1-score
|
12 |
---
|
13 |
+
# xlm-roberta-large-german-cap
|
14 |
## Model description
|
15 |
An `xlm-roberta-large` model finetuned on training data containing [major topic codes](https://www.comparativeagendas.net/pages/master-codebook) from the [Comparative Agendas Project](https://www.comparativeagendas.net/).
|
16 |
|
|
|
44 |
|
45 |
#### Inference using the Trainer class
|
46 |
```python
|
47 |
+
model = AutoModelForSequenceClassification.from_pretrained('poltextlab/xlm-roberta-large-german-cap',
|
48 |
num_labels=num_labels,
|
49 |
problem_type="multi_label_classification",
|
50 |
ignore_mismatched_sizes=True
|
|
|
52 |
|
53 |
training_args = TrainingArguments(
|
54 |
output_dir='.',
|
55 |
+
per_device_train_batch_size=8,
|
56 |
+
per_device_eval_batch_size=8
|
57 |
)
|
58 |
|
59 |
trainer = Trainer(
|
|
|
68 |
```
|
69 |
|
70 |
### Fine-tuning procedure
|
71 |
+
`xlm-roberta-large-german-cap` was fine-tuned using the Hugging Face Trainer class with the following hyperparameters:
|
72 |
```
|
73 |
training_args = TrainingArguments(
|
74 |
output_dir=f"../model/{model_dir}/tmp/",
|
|
|
88 |
We also incorporated an EarlyStoppingCallback in the process with a patience of 2 epochs.
|
89 |
|
90 |
## Model performance
|
91 |
+
The model was evaluated on a test set of 6309 examples (10% of the available data).
|
92 |
Model accuracy is **0.83**.
|
93 |
+
| label | precision | recall | f1-score | support |
|
94 |
+
|:-------------|------------:|---------:|-----------:|----------:|
|
95 |
+
| 0 | 0.65 | 0.6 | 0.62 | 621 |
|
96 |
+
| 1 | 0.71 | 0.68 | 0.69 | 473 |
|
97 |
+
| 2 | 0.79 | 0.73 | 0.76 | 247 |
|
98 |
+
| 3 | 0.77 | 0.71 | 0.74 | 156 |
|
99 |
+
| 4 | 0.68 | 0.58 | 0.63 | 383 |
|
100 |
+
| 5 | 0.79 | 0.82 | 0.8 | 351 |
|
101 |
+
| 6 | 0.71 | 0.78 | 0.74 | 329 |
|
102 |
+
| 7 | 0.81 | 0.79 | 0.8 | 216 |
|
103 |
+
| 8 | 0.78 | 0.75 | 0.76 | 157 |
|
104 |
+
| 9 | 0.87 | 0.78 | 0.83 | 272 |
|
105 |
+
| 10 | 0.61 | 0.68 | 0.64 | 315 |
|
106 |
+
| 11 | 0.61 | 0.74 | 0.67 | 487 |
|
107 |
+
| 12 | 0.72 | 0.7 | 0.71 | 145 |
|
108 |
+
| 13 | 0.69 | 0.6 | 0.64 | 346 |
|
109 |
+
| 14 | 0.75 | 0.69 | 0.72 | 359 |
|
110 |
+
| 15 | 0.69 | 0.65 | 0.67 | 189 |
|
111 |
+
| 16 | 0.36 | 0.47 | 0.41 | 55 |
|
112 |
+
| 17 | 0.68 | 0.73 | 0.71 | 618 |
|
113 |
+
| 18 | 0.61 | 0.68 | 0.64 | 469 |
|
114 |
+
| 19 | 0 | 0 | 0 | 18 |
|
115 |
+
| 20 | 0.73 | 0.75 | 0.74 | 102 |
|
116 |
+
| 21 | 0 | 0 | 0 | 1 |
|
117 |
+
| macro avg | 0.64 | 0.63 | 0.63 | 6309 |
|
118 |
+
| weighted avg | 0.7 | 0.69 | 0.69 | 6309 |
|
119 |
|
120 |
## Inference platform
|
121 |
This model is used by the [CAP Babel Machine](https://babel.poltextlab.com), an open-source and free natural language processing tool, designed to simplify and speed up projects for comparative research.
|