Views
No views yet
| Metric | Value |
|---|---|
| Accuracy | 0.9835 |
| F1-Score | 0.9685 |
| Test Samples | 40,626 |
| Avg Confidence | 0.9938 |
| Model | Accuracy | F1-Score |
|---|---|---|
| Original (HF Trainer) | 0.9820 | 0.9658 |
| PyTorch Manual | 0.9835 | 0.9685 |
1class ShakespeareClassifier(nn.Module):
2 def __init__(self, bert_model, num_classes=2, dropout_rate=0.1):
3 super().__init__()
4 self.bert = bert_model
5 self.dropout = nn.Dropout(dropout_rate)
6 self.classifier = nn.Linear(768, num_classes)
7
8 def forward(self, input_ids, attention_mask):
9 outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)
10 pooled_output = outputs.pooler_output
11 x = self.dropout(pooled_output)
12 logits = self.classifier(x)
13 return logits