|
|
--- |
|
|
datasets: |
|
|
- CausalNewsCorpus |
|
|
language: en |
|
|
library_name: transformers |
|
|
license: mit |
|
|
metrics: |
|
|
- accuracy |
|
|
- f1 |
|
|
- precision |
|
|
- recall |
|
|
tags: |
|
|
- text-classification |
|
|
- roberta |
|
|
- causal-narrative |
|
|
- sequence-classification |
|
|
--- |
|
|
|
|
|
# RoBERTa Causal Narrative Classifier |
|
|
|
|
|
This model is a fine-tuned version of `roberta-base` for causal narrative sentence classification. |
|
|
|
|
|
## Model Description |
|
|
|
|
|
- **Base Model**: roberta-base |
|
|
- **Task**: Binary classification (causal vs non-causal sentences) |
|
|
- **Training Data**: CausalNewsCorpus V2 |
|
|
|
|
|
## Training Results |
|
|
|
|
|
- **Accuracy**: 83.82% |
|
|
- **Precision**: 84.31% |
|
|
- **Recall**: 83.20% |
|
|
- **F1 Score**: 83.48% |
|
|
|
|
|
## Usage |
|
|
|
|
|
```python |
|
|
from transformers import RobertaTokenizer, RobertaForSequenceClassification |
|
|
import torch |
|
|
|
|
|
# Load model and tokenizer |
|
|
model_name = "causal-narrative/roberta-causal-narrative-classifier" |
|
|
tokenizer = RobertaTokenizer.from_pretrained(model_name) |
|
|
model = RobertaForSequenceClassification.from_pretrained(model_name) |
|
|
|
|
|
# Predict |
|
|
text = "The heavy rain caused flooding in the city." |
|
|
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True) |
|
|
|
|
|
with torch.no_grad(): |
|
|
outputs = model(**inputs) |
|
|
prediction = torch.argmax(outputs.logits, dim=-1).item() |
|
|
|
|
|
print(f"Is causal: {prediction == 1}") |
|
|
``` |
|
|
|
|
|
## Labels |
|
|
|
|
|
- **0**: Non-causal sentence |
|
|
- **1**: Causal narrative sentence |
|
|
|