File size: 2,555 Bytes
4308771 b792806 4308771 7f9c6bd 4308771 7f9c6bd 4308771 7f9c6bd 4308771 7f9c6bd 4308771 7f9c6bd 4308771 7f9c6bd 4308771 7f9c6bd 4308771 7f9c6bd 4308771 7f9c6bd 4308771 7f9c6bd 4308771 |
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 |
---
language:
- es
base_model: cardiffnlp/twitter-roberta-base-sentiment-latest
pipeline_tag: text-classification
tags:
- text-classification
---
# BERT Bregman - Modelo de Análisis de Sentimientos en Español
Este modelo está basado en XLM-RoBERTa y ha sido fine-tuned para realizar análisis de sentimientos en textos en español.
## Rendimiento del Modelo
• *Accuracy*: 0.7432
• *F1 Score*: 0.7331
• *Precision*: 0.7483
• *Recall*: 0.7432
### Métricas por Clase
| Clase | Precision | Recall | F1-Score | Support |
|----------|-----------|--------|----------|---------|
| Negativo | 0.8718 | 0.7234 | 0.7907 | 47 |
| Neutro | 0.0000 | 0.0000 | 0.0000 | 3 |
| Positivo | 0.6000 | 0.8750 | 0.7119 | 24 |
## Uso del Modelo
Este modelo puede ser utilizado para clasificar el sentimiento de textos en español en tres categorías: negativo, neutro y positivo.
python
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
model_name = "nmarinnn/bert-bregman"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
def predict(text):
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)
with torch.no_grad():
outputs = model(**inputs)
probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(probabilities, dim=-1).item()
class_labels = {0: "negativo", 1: "neutro", 2: "positivo"}
return class_labels[predicted_class]
# Ejemplo de uso
texto = "Me encanta este producto, es excelente!"
sentimiento = predict(texto)
print(f"El sentimiento del texto es: {sentimiento}")
## Limitaciones
• El modelo muestra un rendimiento bajo en la clase "neutro", posiblemente debido a un desbalance en el dataset de entrenamiento.
• Se recomienda precaución al interpretar resultados para textos muy cortos o ambiguos.
## Información de Entrenamiento
• *Épocas*: 2
• *Pasos de entrenamiento*: 148
• *Pérdida de entrenamiento*: 0.6209
## Cita
Si utilizas este modelo en tu investigación, por favor cita:
@misc{marinnn2023bertbregman,
author = {Marin, Natalia},
title = {BERT Bregman - Modelo de Análisis de Sentimientos en Español},
year = {2023},
publisher = {HuggingFace},
journal = {HuggingFace Model Hub},
howpublished = {\url{https://huggingface.co/nmarinnn/bert-bregman}}
} |