|
|
--- |
|
|
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}} |
|
|
} |
|
|
``` |
|
|
|