Views
No views yet
bert-base-uncased| Metric | Score |
|---|---|
| Accuracy | 0.91 |
| Precision | 0.90 |
| Recall | 0.93 |
| F1-Score | 0.91 |
| ROC-AUC | 0.92 |
| Model | Accuracy | Precision | Recall | F1-Score | ROC-AUC |
|---|---|---|---|---|---|
| Fine-tuned BERT (This Model) | 0.910 | 0.900 | 0.930 | 0.910 | 0.920 |
| BERT Zero-shot | 0.657 | 0.599 | 1.000 | 0.749 | 0.914 |
| Enhanced Keyword Baseline | 0.857 | 0.894 | 0.818 | 0.854 | 0.864 |
| Scientific Embedding Model | 0.697 | 0.909 | 0.455 | 0.606 | 0.843 |
| Keyword Matching Baseline | 0.730 | 0.670 | 0.620 | 0.640 | 0.710 |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4# Load model and tokenizer
5tokenizer = AutoTokenizer.from_pretrained("mgroenendyk/bert-gov-canada-data-citation-classifier")
6model = AutoModelForSequenceClassification.from_pretrained("mgroenendyk/bert-gov-canada-data-citation-classifier")
7
8# Example text
9text = "Data for this study was taken from Statistics Canada."
10
11# Tokenize and predict
12inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True, max_length=128)
13with torch.no_grad():
14 outputs = model(**inputs)
15 predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
16
17# Get prediction
18citation_probability = predictions[0][1].item()
19is_citation = citation_probability > 0.5
20
21print(f"Citation probability: {citation_probability:.3f}")
22print(f"Is citation: {is_citation}")1from transformers import pipeline
2
3classifier = pipeline("text-classification",
4 model="mgroenendyk/bert-gov-canada-data-citation-classifier",
5 tokenizer="mgroenendyk/bert-gov-canada-data-citation-classifier")
6
7result = classifier("Data for this study was taken from Statistics Canada.")
8print(result)
9# [{'label': 'CITATION', 'score': 0.89}]1@article{groenendyk2025bert,
2 title={The Effectiveness of Fine-Tuning BERT to Identify Citations of Government of Canada Open Data},
3 author={Groenendyk, Michael},
4 journal={[Pre-Publication]},
5 year={2025},
6 note={Model available at: https://huggingface.co/mgroenendyk/bert-gov-canada-data-citation-classifier}
7}