Text Classification
Transformers
Safetensors
English
deberta-v2
deberta-v3
spatial-language
spatial-reasoning
text-embeddings-inference
Instructions to use SamAgnoli/deberta-v3-base-spatial-language-detection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SamAgnoli/deberta-v3-base-spatial-language-detection with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="SamAgnoli/deberta-v3-base-spatial-language-detection")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("SamAgnoli/deberta-v3-base-spatial-language-detection") model = AutoModelForSequenceClassification.from_pretrained("SamAgnoli/deberta-v3-base-spatial-language-detection", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -77,6 +77,7 @@ print(clf({"text": "The cat is sitting on top of the bookshelf.", "text_pair": "
|
|
| 77 |
- **Split:** group-aware 70/15/15 by speaker session (no session spans splits)
|
| 78 |
- **Hyperparameters:** 2 epochs · lr 2e-5 · batch 16 · weight decay 0.01 · warmup 0.1 ·
|
| 79 |
max_length 128 · fp16 · seed 42 · best checkpoint by F1
|
|
|
|
| 80 |
- **Framework:** 🤗 Transformers
|
| 81 |
|
| 82 |
## Evaluation (held-out test set)
|
|
@@ -85,18 +86,17 @@ Reported for two views: **dictionary candidates only** (the meaningful view —
|
|
| 85 |
dictionary flags as plausibly spatial) and **overall** (every word, dominated by trivially
|
| 86 |
non-spatial tokens).
|
| 87 |
|
| 88 |
-
### Candidates only —
|
| 89 |
|
| 90 |
| class | precision | recall | F1 | support |
|
| 91 |
|---|---|---|---|---|
|
| 92 |
-
| not_spatial | 0.
|
| 93 |
| spatial | 0.827 | 0.900 | 0.862 | 229 |
|
| 94 |
|
| 95 |
-
**Overall accuracy: 0.
|
| 96 |
|
| 97 |
Reading it per class: the model catches **90.0%** of truly-spatial words (recall) at **82.7%**
|
| 98 |
-
precision; for non-spatial words it's
|
| 99 |
-
sensitivity 0.900, specificity 0.925, PPV 0.827, NPV 0.958.)
|
| 100 |
|
| 101 |
### Overall — every word, 5,207 tokens
|
| 102 |
|
|
@@ -104,13 +104,13 @@ accuracy **0.987** · spatial-F1 **0.862** · Cohen's κ **0.855**
|
|
| 104 |
|
| 105 |
> The two views share the *same* spatial predictions (229 spatial words, same 206 caught). Only
|
| 106 |
> the non-spatial pool differs, which is why "overall" accuracy looks higher — it's padded with
|
| 107 |
-
> ~4,
|
| 108 |
> **candidates-only** view.
|
| 109 |
|
| 110 |
## Calibration
|
| 111 |
|
| 112 |
Raw probabilities are over-confident, so a post-hoc **temperature scaling** factor
|
| 113 |
-
(**T = 1.
|
| 114 |
you can read literally. Temperature scaling is monotonic, so the hard 0/1 decision is unchanged.
|
| 115 |
See section 7.5 of the repo.
|
| 116 |
|
|
|
|
| 77 |
- **Split:** group-aware 70/15/15 by speaker session (no session spans splits)
|
| 78 |
- **Hyperparameters:** 2 epochs · lr 2e-5 · batch 16 · weight decay 0.01 · warmup 0.1 ·
|
| 79 |
max_length 128 · fp16 · seed 42 · best checkpoint by F1
|
| 80 |
+
- **Class imbalance:** no class weighting or resampling. The dictionary gate already raises the positive rate from ~4% of all words to ~30% of candidates, and checkpoint selection used minority-class F1 rather than accuracy.
|
| 81 |
- **Framework:** 🤗 Transformers
|
| 82 |
|
| 83 |
## Evaluation (held-out test set)
|
|
|
|
| 86 |
dictionary flags as plausibly spatial) and **overall** (every word, dominated by trivially
|
| 87 |
non-spatial tokens).
|
| 88 |
|
| 89 |
+
### Candidates only — 622 words (393 not-spatial, 229 spatial)
|
| 90 |
|
| 91 |
| class | precision | recall | F1 | support |
|
| 92 |
|---|---|---|---|---|
|
| 93 |
+
| not_spatial | 0.938 | 0.891 | 0.914 | 393 |
|
| 94 |
| spatial | 0.827 | 0.900 | 0.862 | 229 |
|
| 95 |
|
| 96 |
+
**Overall accuracy: 0.894** (556 of 622 words correct) · macro-F1 0.888 · Cohen's κ 0.776
|
| 97 |
|
| 98 |
Reading it per class: the model catches **90.0%** of truly-spatial words (recall) at **82.7%**
|
| 99 |
+
precision; for non-spatial words it's 89.1% recall at 93.8% precision. (sensitivity 0.900, specificity 0.891, PPV 0.827, NPV 0.938.)
|
|
|
|
| 100 |
|
| 101 |
### Overall — every word, 5,207 tokens
|
| 102 |
|
|
|
|
| 104 |
|
| 105 |
> The two views share the *same* spatial predictions (229 spatial words, same 206 caught). Only
|
| 106 |
> the non-spatial pool differs, which is why "overall" accuracy looks higher — it's padded with
|
| 107 |
+
> ~4,600 easy non-candidate words the model trivially gets right. Judge the model by the
|
| 108 |
> **candidates-only** view.
|
| 109 |
|
| 110 |
## Calibration
|
| 111 |
|
| 112 |
Raw probabilities are over-confident, so a post-hoc **temperature scaling** factor
|
| 113 |
+
(**T = 1.887**, fit on the validation candidates) rescales them into a calibrated `P(spatial)`
|
| 114 |
you can read literally. Temperature scaling is monotonic, so the hard 0/1 decision is unchanged.
|
| 115 |
See section 7.5 of the repo.
|
| 116 |
|