robertou2 commited on
Commit
d306a4d
·
1 Parent(s): 2147135

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +147 -0
README.md ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ -
5
+ datasets:
6
+ - EXIST Dataset
7
+ - MeTwo Machismo and Sexism Twitter Identification dataset
8
+
9
+ widget:
10
+ - text: "manejas muy bien para ser mujer"
11
+ - text: "En temas políticos hombres y mujeres son iguales"
12
+ - text: "Los ipad son unos equipos electrónicos"
13
+
14
+ metrics:
15
+ - accuracy
16
+ model-index:
17
+ - name: twitter_sexismo-finetuned-exist2021
18
+ results:
19
+ - task:
20
+ name: Text Classification
21
+ type: text-classification
22
+ dataset:
23
+ name: EXIST Dataset
24
+ type: EXIST Dataset
25
+ args: es
26
+ metrics:
27
+ - name: Accuracy
28
+ type: accuracy
29
+ value: 0.83
30
+ ---
31
+
32
+ # twitter_sexismo-finetuned-exist2021
33
+
34
+ This model is a fine-tuned version of [pysentimiento/robertuito-base-uncased](https://huggingface.co/pysentimiento/robertuito-base-uncased) on the EXIST dataset
35
+
36
+ It achieves the following results on the evaluation set:
37
+ - Loss: 0.47
38
+ - Accuracy: 0.80
39
+ - F1: 0.83
40
+ - F2: 0.89
41
+
42
+ ## Model description
43
+ Model for the 'Somos NLP' Hackathon for detecting sexism in twitters in Spanish. Created by:
44
+ - **medardodt**
45
+ - **MariaIsabel**
46
+ - **ManRo**
47
+ - **lucel172**
48
+ - **robertou2**
49
+
50
+ ## Intended uses & limitations
51
+
52
+ More information needed
53
+
54
+ ## Training and evaluation data
55
+
56
+ More information needed
57
+
58
+ ## Training procedure
59
+ The model has been trained to get the best F2 score.The F-measure is calculated as the harmonic mean of precision and recall, giving each the same weighting. It allows a model to be evaluated taking both the precision and recall into account using a single score, which is helpful when describing the performance of the model and in comparing models. The Fbeta-measure is a generalization of the F-measure that adds a configuration parameter called beta. A default beta value is 1.0, which is the same as the F-measure. A smaller beta value, such as 0.5, gives more weight to precision and less to recall, whereas a larger beta value, such as 2.0, gives less weight to precision and more weight to recall in the calculation of the score. It is a useful metric to use when both precision and recall are important but slightly more attention is needed on one or the other, such as when false negatives are more important than false positives, or the reverse.F2-measure puts more attention on minimizing false negatives. We want to detect the sexist comments.
60
+
61
+
62
+ ### Training hyperparameters
63
+
64
+ The following hyperparameters were used during training:
65
+ - my_learning_rate = 5E-5
66
+ - my_adam_epsilon = 1E-8
67
+ - my_number_of_epochs = 8
68
+ - my_warmup = 3
69
+ - my_mini_batch_size = 32
70
+ - optimizer: AdamW with betas=(0.9,0.999) and epsilon=1e-08
71
+ - lr_scheduler_type: linear
72
+ - num_epochs: 8
73
+
74
+ ### Training results
75
+
76
+ Epoch T. Loss V. Loss Accuracy F1 Precision Recall F2
77
+
78
+ 1 0.478700 0.443148 0.804386 0.830160 0.750689 0.928450 0.886467
79
+
80
+ 2 0.298000 0.460549 0.823684 0.841107 0.784661 0.906303 0.879048
81
+
82
+ 3 0.063600 0.706177 0.817544 0.829508 0.799368 0.862010 0.848708
83
+
84
+ 4 0.078700 1.060862 0.816667 0.836078 0.774709 0.908007 0.877800
85
+
86
+ 5 0.005900 1.069239 0.808772 0.821604 0.790551 0.855196 0.841435
87
+
88
+ 6 0.008300 1.184729 0.808772 0.821604 0.790551 0.855196 0.841435
89
+
90
+ 7 0.001400 1.238865 0.816667 0.829388 0.796238 0.865417 0.850636
91
+
92
+ 8 0.000100 1.267197 0.815789 0.827303 0.799682 0.856899 0.844810
93
+
94
+ 9 0.000100 1.267815 0.808772 0.818937 0.799028 0.839864 0.831366
95
+
96
+ 10 0.000300 1.275827 0.807895 0.818257 0.797735 0.839864 0.831086
97
+
98
+
99
+ ### Framework versions
100
+
101
+ - Transformers 4.17.0
102
+ - Pytorch 1.10.0+cu111
103
+ - Tokenizers 0.11.6
104
+
105
+
106
+ ## Model in Action
107
+ Fast usage with pipelines:
108
+ ``` python
109
+ ###libraries required
110
+ !pip install transformers
111
+ from transformers import pipeline
112
+
113
+ ### usage pipelines
114
+ model_checkpoint = "robertou2/twitter_sexismo-finetuned-robertuito-exist2021"
115
+ pipeline_nlp = pipeline("text-classification", model=model_checkpoint)
116
+ pipeline_nlp("mujer al volante peligro!")
117
+ #pipeline_nlp("¡me encanta el ipad!")
118
+ #pipeline_nlp (["mujer al volante peligro!", "Los hombre tienen más manias que las mujeres", "me encanta el ipad!"] )
119
+
120
+ # OUTPUT MODEL #
121
+ # LABEL_0: "NON SEXISM"or LABEL_1: "SEXISM" and score: probability of accuracy per model.
122
+
123
+ # [{'label': 'LABEL_1', 'score': 0.9967633485794067}]
124
+ # [{'label': 'LABEL_0', 'score': 0.9934417009353638}]
125
+
126
+ #[{‘label': 'LABEL_1', 'score': 0.9967633485794067},
127
+ # {'label': 'LABEL_1', 'score': 0.9755664467811584},
128
+ # {'label': 'LABEL_0', 'score': 0.9955045580863953}]
129
+ ```
130
+
131
+ ## More Information Process
132
+ ### Retos
133
+ Uno de los principales retos que se encontró en este proceso ha sido disponer de un dataset en español. Se ha logrado conseguir (previa solicitud) el dataset utilizado en [EXIST:sEXism Identification in Social neTworks](http://nlp.uned.es/exist2021/), el cual fue un gran punto de partida para comenzar con el modelo. Lamentablemente este un dataset presenta limitaciones debido a licencias y políticas para ser compartido libremente.
134
+ Este dataset incorpora cualquier tipo de expresión sexista o fenómenos relacionados, incluidas las afirmaciones descriptivas o informadas donde el mensaje sexista es un informe o una descripción de un comportamiento sexista. se han utilizado los 3,541 tweets etiquetados en español. Luego se logró disponer de otro dataset en español [MeTwo: Machismo and Sexism Twitter Identification dataset](https://github.com/franciscorodriguez92/MeTwo). Este dataset contiene los id de cada tweet con su etiqueta respectiva, lo que nos permitió obtener el texto del tweet e incrementar el dataset original.
135
+ Un desafío ha sido iniciar los procesos de finetuned en las prueba, esto pues se dispone de diversas variables para validar y testear (desde modelos como: BETO o Roberta, hasta hiperparámetros: como learning rate), y solo se disponede un plazo acotado de dos semanas, además de la curva de aprendizaje. Para este desafío, se han basado las primeras pruebas en los parámetros presentados por de Paula et al. (2021), lo cual brindó un punto de partida y un reto a vencer, el **_0.790 de accuracy_** obtenidos por el trabajo previo en la identificación de tweets sexistas en español.
136
+ En este ámbito se realizaron diversas pruebas en paralelo para encontrar el mejor modelo. Luego de un proceso colaborativo de finetuned se ha logrado obtener un **83% de accuracy**.
137
+
138
+ ### Trabajos Futuros
139
+ Se propone incrementar el dataset desarrollado. Para esto es posible descargar cantidades superiores de tweets en español y aplicar técnicas de active learning para obtener un grupo reducido de tweets a etiquetar vía crowdsourcing, y en donde estos datos etiquetados puedan servir para etiquetar el resto. También se pueden utilizar técnicas de Data Augmentation, para duplicar y extender el dataset. Realizar más pruebas con otros modelos y mejorar el modelo es otro reto que se propone como trabajos futuros.
140
+
141
+ ### Posibles Aplicaciones
142
+ Primero es sumamente importante dar mayor visibilidad al problema de _sexismo en redes sociales_, principalmente en español. El proceso de Transfer Learning logra reutilizar y aprovechar modelos previamente entrenados, y lo que se desea es que nuevos grupos de investigación, estudiantes, etc. utilicen la base del actual modelo para desarrollar los propios y crear un mejor modelo. De esta manera, se podría construir una herramienta que pueda identificar en tiempo real los tweets sexistas y eliminarlos antes de su propagación.
143
+
144
+ ### Referencias
145
+ 1 de Paula, A. F. M., da Silva, R. F., & Schlicht, I. B. (2021). Sexism Prediction in Spanish and English Tweets Using Monolingual and Multilingual BERT and Ensemble Models. arXiv preprint arXiv:2111.04551.
146
+
147
+ Rodríguez-Sánchez, F., Carrillo-de-Albornoz, J., Plaza, L., Gonzalo, J., Rosso, P., Comet, M., & Donoso, T. (2021). Overview of exist 2021: sexism identification in social networks. Procesamiento del Lenguaje Natural, 67, 195-207.