nmarinnn commited on
Commit
37673d3
1 Parent(s): 1b25d81

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +119 -0
README.md ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: es
3
+ tags:
4
+ - sentiment-analysis
5
+ - text-classification
6
+ - spanish
7
+ - xlm-roberta
8
+ license: mit
9
+ datasets:
10
+ - custom
11
+ metrics:
12
+ - accuracy
13
+ - f1
14
+ library_name: transformers
15
+ pipeline_tag: text-classification
16
+ widget:
17
+ - text: "Vamos pato!"
18
+ example_title: "Ejemplo positivo"
19
+ - text: "el otro día pensaba eso"
20
+ example_title: "Ejemplo neutro"
21
+ - text: "No puede ser presidente"
22
+ example_title: "Ejemplo negativo"
23
+ model-index:
24
+ - name: bert-bullruch
25
+ results:
26
+ - task:
27
+ type: text-classification
28
+ name: Sentiment Analysis
29
+ dataset:
30
+ name: Custom Spanish Sentiment Dataset
31
+ type: custom
32
+ metrics:
33
+ - type: accuracy
34
+ value: 0.677
35
+ - type: f1
36
+ value: 0.664
37
+ architectures:
38
+ - XLMRobertaForSequenceClassification
39
+ transformers_version: "4.41.2"
40
+ base_model: cardiffnlp/twitter-xlm-roberta-base-sentiment
41
+ inference:
42
+ parameters:
43
+ temperature: 1.0
44
+ max_length: 512
45
+ num_return_sequences: 1
46
+ ---
47
+
48
+ # BERT- Bullrich - Modelo de Análisis de Sentimientos en Español
49
+
50
+ Este modelo está basado en XLM-RoBERTa y ha sido fine-tuned para realizar análisis de sentimientos en textos en español en comentarios sobre la candidata en redes sociales durante el primer debate presidencial de Argentina en 2023.
51
+
52
+ ## Rendimiento del Modelo
53
+
54
+ •⁠ ⁠*Accuracy*: 0.677
55
+ •⁠ ⁠*F1 Score*: 0.664
56
+ •⁠ ⁠*Precision*: 0.652
57
+ •⁠ ⁠*Recall*: 0.677
58
+
59
+ ### Métricas por Clase
60
+
61
+ | Clase | Precision | Recall | F1-Score | Support |
62
+ |----------|-----------|--------|----------|---------|
63
+ | Negativo | 0.8718 | 0.7234 | 0.7907 | 47 |
64
+ | Neutro | 0.0000 | 0.0000 | 0.0000 | 3 |
65
+ | Positivo | 0.6000 | 0.8750 | 0.7119 | 24 |
66
+
67
+ ## Uso del Modelo
68
+
69
+ Este modelo puede ser utilizado para clasificar el sentimiento de textos en español en tres categorías: negativo, neutro y positivo.
70
+
71
+ ⁠ python
72
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
73
+ import torch
74
+
75
+ model_name = "nmarinnn/bert-bullrich"
76
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
77
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
78
+
79
+ def predict(text):
80
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)
81
+ with torch.no_grad():
82
+ outputs = model(**inputs)
83
+
84
+ probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
85
+ predicted_class = torch.argmax(probabilities, dim=-1).item()
86
+
87
+ class_labels = {0: "negativo", 1: "neutro", 2: "positivo"}
88
+ return class_labels[predicted_class]
89
+
90
+ # Ejemplo de uso
91
+ texto = "Vamos pato!"
92
+ sentimiento = predict(texto)
93
+ print(f"El sentimiento del texto es: {sentimiento}")
94
+  ⁠
95
+
96
+ ## Limitaciones
97
+
98
+ •⁠ ⁠El modelo muestra un rendimiento bajo en la clase "neutro", posiblemente debido a un desbalance en el dataset de entrenamiento.
99
+ •⁠ ⁠Se recomienda precaución al interpretar resultados para textos muy cortos o ambiguos.
100
+
101
+ ## Información de Entrenamiento
102
+
103
+ •⁠ ⁠*Épocas*: 2
104
+ •⁠ ⁠*Pasos de entrenamiento*: 148
105
+ •⁠ ⁠*Pérdida de entrenamiento*: 0.6209
106
+
107
+ ## Cita
108
+
109
+ Si utilizas este modelo en tu investigación, por favor cita:
110
+
111
+
112
+ @misc{marinnn2023bertbullrich,
113
+ author = {Marin, Natalia},
114
+ title = {BERT Bregman - Modelo de Análisis de Sentimientos en Español},
115
+ year = {2023},
116
+ publisher = {HuggingFace},
117
+ journal = {HuggingFace Model Hub},
118
+ howpublished = {\url{https://huggingface.co/nmarinnn/bert-bregman}}
119
+ }