File size: 1,989 Bytes
2181dc1
af5e428
 
 
 
 
 
 
 
 
 
 
 
 
 
2181dc1
 
af5e428
2181dc1
af5e428
2181dc1
 
 
af5e428
 
 
 
 
2181dc1
 
 
af5e428
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f0a21d1
 
73858e4
af5e428
 
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
---
license: mit
tags:
- epistemic-stance
- classification
- longformer
- nlp
- social-science
datasets:
- custom
metrics:
- accuracy
- f1
- precision
- recall
---

# Epistemic Stance Classifier

A Longformer-based classifier for detecting epistemic stances (absolutist, evaluativist, multiplist) in text.

## Model Details

- **Model Type**: LongformerForSequenceClassification (Longformer architecture)
- **Base Model**: allenai/longformer-base-4096
- **Max Sequence Length**: 2048
- **Number of Labels**: 3
- **Labels**: absolutist, evaluativist, multiplist

## Training Details

- **Best Validation Metric (f1_macro)**: 0.7081
- **Best Epoch**: 6
- **Training Epochs**: 6
- **Learning Rate**: 2e-05
- **Batch Size**: 4
- **Gradient Accumulation Steps**: 4
- **Focal Loss**: True
- **Class Weights**: True
- **Temperature Scaling**: True

## Test Set Performance

- **Accuracy**: 0.7651
- **F1 Macro**: 0.6272
- **F1 Weighted**: 0.7574
- **Expected Calibration Error**: 0.0943

## Usage

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

model_name = "johnclund/epistemic-stance-longformer"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = LongformerForSequenceClassification.from_pretrained(model_name)

text = "Your text here..."
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=2048)

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

label_map = {0: "absolutist", 1: "evaluativist", 2: "multiplist"}
print(f"Predicted: {label_map[predicted_class]}")
print(f"Confidence: {probs[0][predicted_class]:.4f}")
```

## Citation

If you use this model, please cite:

```bibtex
@misc{epistemic-stance-classifier,
  title={Epistemic Stance Classifier},
  author={John Lund},
  year={2026},
  howpublished={\url{https://huggingface.co/johnclund/epistemic-stance-classifier}}
}
```