File size: 3,495 Bytes
a02c36c
abe7f5f
 
 
a02c36c
abe7f5f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a02c36c
 
abe7f5f
a02c36c
abe7f5f
a02c36c
abe7f5f
a02c36c
abe7f5f
 
 
 
a02c36c
abe7f5f
a02c36c
abe7f5f
a02c36c
abe7f5f
 
 
 
 
 
 
 
a02c36c
abe7f5f
a02c36c
abe7f5f
 
 
 
a02c36c
abe7f5f
a02c36c
abe7f5f
 
a02c36c
abe7f5f
 
a02c36c
abe7f5f
 
 
a02c36c
abe7f5f
a02c36c
abe7f5f
a02c36c
abe7f5f
 
 
a02c36c
abe7f5f
 
 
a02c36c
abe7f5f
 
 
a02c36c
abe7f5f
 
 
 
a02c36c
abe7f5f
 
 
a02c36c
abe7f5f
a02c36c
abe7f5f
a02c36c
abe7f5f
 
 
 
 
 
 
a02c36c
abe7f5f
a02c36c
abe7f5f
 
 
a02c36c
abe7f5f
a02c36c
abe7f5f
a02c36c
abe7f5f
a02c36c
abe7f5f
 
 
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
---
license: mit
language:
- pt
library_name: transformers
tags:
- text-classification
- binary-classification
- modernbert
- pytorch
- transformers
datasets:
- tcepi/mbp_pas_dataset
metrics:
- accuracy
- f1
- precision
- recall
- roc_auc
base_model: answerdotai/ModernBERT-base
pipeline_tag: text-classification
model-index:
- name: mbp_pas_model
  results:
  - task:
      type: text-classification
      name: Binary Text Classification
    dataset:
      name: tcepi/mbp_pas_dataset
      type: tcepi/mbp_pas_dataset
      split: test
    metrics:
    - name: Accuracy
      type: accuracy
      value: 0.9861
    - name: F1
      type: f1
      value: 0.9863
    - name: Precision
      type: precision
      value: 0.9796
    - name: Recall
      type: recall
      value: 0.9931
    - name: ROC-AUC
      type: roc_auc
      value: 0.9988
---

# MBP PAS Classification Model

Este modelo é um fine-tune do [ModernBERT-base](https://huggingface.co/answerdotai/ModernBERT-base) para classificação binária, treinado no dataset [tcepi/mbp_pas_dataset](https://huggingface.co/datasets/tcepi/mbp_pas_dataset).

## Descrição do Modelo

- **Modelo Base:** answerdotai/ModernBERT-base
- **Tarefa:** Classificação Binária de Texto
- **Linguagem:** Português (pt)
- **Framework:** PyTorch + Transformers

## Métricas de Performance

### Conjunto de Teste

| Métrica | Valor |
|---------|-------|
| **Accuracy** | 0.9861 |
| **F1-Score** | 0.9863 |
| **Precision** | 0.9796 |
| **Recall** | 0.9931 |
| **ROC-AUC** | 0.9988 |
| **Specificity** | 0.9789 |

### Matriz de Confusão

|  | Predito Negativo | Predito Positivo |
|--|-----------------|-----------------|
| **Real Negativo** | 139 (TN) | 3 (FP) |
| **Real Positivo** | 1 (FN) | 144 (TP) |

### Relatório de Classificação

```
              precision    recall  f1-score   support

    Negativo     0.9929    0.9789    0.9858       142
    Positivo     0.9796    0.9931    0.9863       145

    accuracy                         0.9861       287
   macro avg     0.9862    0.9860    0.9861       287
weighted avg     0.9862    0.9861    0.9861       287

```

## Uso

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

# Carregar modelo e tokenizer
tokenizer = AutoTokenizer.from_pretrained("tcepi/mbp_pas_model")
model = AutoModelForSequenceClassification.from_pretrained("tcepi/mbp_pas_model")

# Classificar texto
text = "Seu texto aqui"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)

with torch.no_grad():
    outputs = model(**inputs)
    predictions = torch.softmax(outputs.logits, dim=-1)
    predicted_class = torch.argmax(predictions, dim=-1).item()

print(f"Classe predita: {model.config.id2label[predicted_class]}")
print(f"Probabilidades: {predictions.tolist()}")
```

## Treinamento

### Hiperparâmetros

- **Épocas:** 5
- **Learning Rate:** 2e-5
- **Batch Size:** 8
- **Weight Decay:** 0.01
- **Warmup Ratio:** 0.1
- **Mixed Precision:** FP16
- **Optimizer:** AdamW

### Informações de Treinamento

- **Tempo Total:** 186.64 segundos
- **Samples/segundo:** 55.19
- **Loss Final:** 0.1391

## Dataset

O modelo foi treinado usando o dataset [tcepi/mbp_pas_dataset](https://huggingface.co/datasets/tcepi/mbp_pas_dataset).

## Limitações

- O modelo foi treinado especificamente para o domínio do dataset MBP/PAS
- Performance pode variar em textos de outros domínios
- Recomenda-se avaliar o modelo antes de usar em produção