File size: 4,974 Bytes
205c6c2
 
b146b6c
205c6c2
024a7dd
205c6c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
024a7dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b146b6c
024a7dd
 
 
205c6c2
 
b146b6c
205c6c2
 
 
 
 
 
b146b6c
205c6c2
b146b6c
205c6c2
b146b6c
 
205c6c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b146b6c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205c6c2
 
 
 
 
 
 
b146b6c
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
---
license: apache-2.0
language: es
tags:
- spanish
datasets:
- catalonia_independence
metrics:
- accuracy
model-index:
- name: roberta-base-bne-finetuned-mnli
  results:
  - task:
      name: Text Classification
      type: text-classification
    dataset:
      name: catalonia_independence
      type: catalonia_independence
      args: spanish
    metrics:
    - name: Accuracy
      type: accuracy
      value: 0.7880893300248138
  - task:
      type: text-classification
      name: Text Classification
    dataset:
      name: catalonia_independence
      type: catalonia_independence
      config: catalan
      split: test
    metrics:
    - name: Accuracy
      type: accuracy
      value: 0.4592039800995025
      verified: true
    - name: Precision Macro
      type: precision
      value: 0.6104489964825159
      verified: true
    - name: Precision Micro
      type: precision
      value: 0.4592039800995025
      verified: true
    - name: Precision Weighted
      type: precision
      value: 0.6167123723406555
      verified: true
    - name: Recall Macro
      type: recall
      value: 0.4146479268294389
      verified: true
    - name: Recall Micro
      type: recall
      value: 0.4592039800995025
      verified: true
    - name: Recall Weighted
      type: recall
      value: 0.4592039800995025
      verified: true
    - name: F1 Macro
      type: f1
      value: 0.33416407167650636
      verified: true
    - name: F1 Micro
      type: f1
      value: 0.4592039800995025
      verified: true
    - name: F1 Weighted
      type: f1
      value: 0.34549318538357193
      verified: true
    - name: loss
      type: loss
      value: 3.393402099609375
      verified: true
widget:
- text: "Junqueras, sobre la decisi\xF3n judicial sobre Puigdemont: La justicia que\
    \ falta en el Estado llega y llegar\xE1 de Europa"
- text: "Desconvocada la manifestaci\xF3n del domingo en Barcelona en apoyo a Puigdemont"
---

# roberta-base-bne-finetuned-catalonia-independence-detector

This model is a fine-tuned version of [BSC-TeMU/roberta-base-bne](https://huggingface.co/BSC-TeMU/roberta-base-bne) on the catalonia_independence dataset.
It achieves the following results on the evaluation set:
- Loss: 0.9415
- Accuracy: 0.7881

<details>

## Model description

The data was collected over 12 days during February and March of 2019 from tweets posted in Barcelona, and during September of 2018 from tweets posted in the town of Terrassa, Catalonia.
Each corpus is annotated with three classes: AGAINST, FAVOR and NEUTRAL, which express the stance towards the target - independence of Catalonia.

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 2e-05
- train_batch_size: 16
- eval_batch_size: 16
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 5

### Training results

| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|:-------------:|:-----:|:----:|:---------------:|:--------:|
| No log        | 1.0   | 378  | 0.5534          | 0.7558   |
| 0.6089        | 2.0   | 756  | 0.5315          | 0.7643   |
| 0.2678        | 3.0   | 1134 | 0.7336          | 0.7816   |
| 0.0605        | 4.0   | 1512 | 0.8809          | 0.7866   |
| 0.0605        | 5.0   | 1890 | 0.9415          | 0.7881   |

</details>

### Model in action 🚀

Fast usage with **pipelines**:

```python

from transformers import pipeline

model_path = "JonatanGk/roberta-base-bne-finetuned-catalonia-independence-detector"
independence_analysis = pipeline("text-classification", model=model_path, tokenizer=model_path)

independence_analysis(
    "Junqueras, sobre la decisión judicial sobre Puigdemont: La justicia que falta en el Estado llega y llegará de Europa"
    )

# Output:
[{'label': 'FAVOR', 'score': 0.9936726093292236}]

independence_analysis(
    "El desafío independentista queda adormecido, y eso que el Gobierno ha sido muy claro en que su propuesta para Cataluña es una agenda de reencuentro, centrada en inversiones e infraestructuras")

# Output:
[{'label': 'AGAINST', 'score': 0.7508948445320129}]

independence_analysis(
    "Desconvocada la manifestación del domingo en Barcelona en apoyo a Puigdemont"
    )

# Output:
[{'label': 'NEUTRAL', 'score': 0.9966907501220703}]

```

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/JonatanGk/Shared-Colab/blob/master/Catalonia_independence_Detector_(SPANISH).ipynb#scrollTo=uNMOXJz38W6U)

### Framework versions

- Transformers 4.11.3
- Pytorch 1.9.0+cu111
- Datasets 1.12.1
- Tokenizers 0.10.3

## Citation
Thx to HF.co & [@lewtun](https://github.com/lewtun) for Dataset ;)


> Special thx to [Manuel Romero/@mrm8488](https://huggingface.co/mrm8488) as my mentor & R.C.

> Created by [Jonatan Luna](https://JonatanGk.github.io) | [LinkedIn](https://www.linkedin.com/in/JonatanGk/)