jimnoneill commited on
Commit
f9ffb1e
·
verified ·
1 Parent(s): fa87009

Stacked head release 1.2.0

Browse files
Files changed (1) hide show
  1. README.md +28 -25
README.md CHANGED
@@ -35,6 +35,7 @@ Developed by the [**FAIR Data Innovations Hub**](https://fairdataihub.org/) at t
35
 
36
  | Version | Date | Notes |
37
  |---------|------|-------|
 
38
  | **1.1.0** | 2026-08-28 | Feature extraction moved off the AGPL-licensed PyMuPDF to pdfplumber (text and structure) and pypdfium2 (page rendering), both permissively licensed, so the whole stack is MIT-compatible. The head was retrained on the re-extracted features; held-out accuracy is 89.2%. |
39
  | **1.0.0** | 2026-08-18 | Head trained on the human-validated corpus: 3,381 documents labeled by a three-reviewer survey (Krippendorff's alpha 0.79) with blinded adjudication of the 439 contested documents. |
40
 
@@ -71,15 +72,15 @@ PDF Input
71
 
72
  ## Architecture
73
 
74
- Three feature channels concatenated into a **542-dimensional** vector, fed to a single LogisticRegression:
75
 
76
  | Channel | Features | Dimension | Signal |
77
  |---------|----------|-----------|--------|
78
- | **Text** | model2vec (potion-base-32M) embedding | 512 | Semantic content |
79
  | **Visual** | Color stats, edge density, FFT spatial complexity, whitespace | 15 | Visual layout |
80
  | **Structural** | Page count, area, font diversity, text blocks, density | 15 | PDF geometry |
81
 
82
- Each classifier head is a single linear layer stored as a numpy `.npz` file (10 KB). Inference is pure numpy, no torch required at prediction time.
83
 
84
  ## PDF backend (speed vs license)
85
 
@@ -100,14 +101,16 @@ Evaluated against human-validated labels (three-reviewer survey with blinded adj
100
 
101
  | Metric | Value |
102
  |--------|-------|
103
- | **Held-out accuracy** (508 documents) | **89.2%** (95% CI 86.2 to 91.6) |
104
- | Macro F1 (held-out) | 0.892 |
105
- | Precision / Recall / F1 (poster) | 0.887 / 0.897 / 0.892 |
106
- | Precision / Recall / F1 (non-poster) | 0.897 / 0.886 / 0.892 |
107
- | Out-of-fold accuracy (all 3,381 documents, 5-fold) | 88.0% |
 
 
108
  | Classifier speed | under one second per file on a CPU (PDF parsing is the bottleneck) |
109
 
110
- Errors concentrate where the human panel itself divided: out-of-fold agreement is 90.3% on documents the panel rated unanimously and 73.2% on documents decided two to one.
111
 
112
  ### Top Features by Importance
113
 
@@ -115,18 +118,18 @@ Standardized logistic regression coefficients of the trained head (positive push
115
 
116
  | Rank | Feature | Coefficient | Signal |
117
  |------|---------|------------|--------|
118
- | 1 | `line_count` | +2.80 | Posters pack many short text lines |
119
- | 2 | `edge_density` | +2.61 | Visually busy layouts |
120
- | 3 | `page_width_pt` | +2.22 | Posters are physically wide |
121
- | 4 | `img_width` | +2.16 | Large rendered width |
122
- | 5 | `size_per_page_kb` | +1.82 | Dense, high-resolution single pages |
123
- | 6 | `color_diversity` | +1.70 | Posters are visually rich |
124
- | 7 | `page_count` | -1.64 | More pages pushes away from poster |
125
- | 8 | `font_count` | +1.52 | Many fonts across poster panels |
126
- | 9 | `is_landscape` | +1.26 | Many posters are landscape |
127
- | 10 | `file_size_kb` | -1.25 | Multi-page documents are bigger overall |
128
-
129
- Structural and visual cues carry most of the decision; three embedding dimensions appear among the fifteen largest coefficients.
130
 
131
  ## Training Data
132
 
@@ -137,7 +140,7 @@ Trained on **3,381 documents with human-validated labels**, zero synthetic data:
137
  | **Poster** | 1,686 | Three-reviewer survey; unanimous panel label or blinded adjudication |
138
  | **Non-poster** | 1,695 | Three-reviewer survey; unanimous panel label or blinded adjudication |
139
 
140
- Three reviewers independently rated all 3,570 candidate documents (inter-rater Krippendorff's alpha 0.79); the 439 documents without a unanimous panel were settled in a blinded adjudication review. After removing 182 near-duplicate documents and 7 with unavailable PDFs, the remaining 3,381 form the training corpus. Applied to the full corpus of 30,145 readable repository PDFs labeled as posters, PosterSentry classifies 76.4% as posters: more than one in five records labeled as posters is something else.
141
 
142
  Training data: [fairdataihub/poster-sentry-training-data](https://huggingface.co/datasets/fairdataihub/poster-sentry-training-data)
143
 
@@ -187,9 +190,9 @@ Training completes in ~40 minutes on CPU (PDF rendering is the bottleneck, not t
187
  | Embedding dimension | 512 |
188
  | Visual features | 15 (color, edge, FFT, whitespace) |
189
  | Structural features | 15 (page geometry, fonts, text blocks) |
190
- | Total input dimension | 542 |
191
- | Classifier | LogisticRegression (sklearn) + StandardScaler |
192
- | Head file size | 10 KB (.npz) |
193
  | Precision | float32 |
194
  | GPU required | No (CPU-only) |
195
  | License | MIT |
 
35
 
36
  | Version | Date | Notes |
37
  |---------|------|-------|
38
+ | **1.2.0** | 2026-09-01 | Stacked head: the 512-d text embedding is scored by a stage-one logistic regression whose poster probability becomes a single text-score feature for the final classifier over [text_score + 15 visual + 15 structural] = 31 features. Held-out accuracy 92.9%. Head weights now store a zero first column so softmax reproduces sklearn's sigmoid exactly; earlier heads doubled the logit, which sharpened reported confidences (decisions at 0.5 were unaffected). Flat heads remain loadable by the package. |
39
  | **1.1.0** | 2026-08-28 | Feature extraction moved off the AGPL-licensed PyMuPDF to pdfplumber (text and structure) and pypdfium2 (page rendering), both permissively licensed, so the whole stack is MIT-compatible. The head was retrained on the re-extracted features; held-out accuracy is 89.2%. |
40
  | **1.0.0** | 2026-08-18 | Head trained on the human-validated corpus: 3,381 documents labeled by a three-reviewer survey (Krippendorff's alpha 0.79) with blinded adjudication of the 439 contested documents. |
41
 
 
72
 
73
  ## Architecture
74
 
75
+ Two-stage (stacked) logistic regression. Stage 1 scores the 512-d text embedding alone; its poster probability becomes the single `text_score` feature of stage 2, which classifies **31 features**:
76
 
77
  | Channel | Features | Dimension | Signal |
78
  |---------|----------|-----------|--------|
79
+ | **Text score** | Stage-1 LogisticRegression over the model2vec (potion-base-32M) embedding | 1 | Semantic content, summarized |
80
  | **Visual** | Color stats, edge density, FFT spatial complexity, whitespace | 15 | Visual layout |
81
  | **Structural** | Page count, area, font diversity, text blocks, density | 15 | PDF geometry |
82
 
83
+ Stage 2 is trained on inner 5-fold out-of-fold text scores so it never sees an in-sample-optimistic text score. Both stages (weights and scalers) live in one numpy `.npz` head (about 20 KB). Inference is pure numpy, no torch required at prediction time. Every stage-2 coefficient is a named, interpretable feature; the raw 542-d concatenation of earlier releases underperformed it by about six points out of fold because the 512 standardized text dimensions crowded out the reliable engineered signal.
84
 
85
  ## PDF backend (speed vs license)
86
 
 
101
 
102
  | Metric | Value |
103
  |--------|-------|
104
+ | **Held-out accuracy** (508 documents) | **92.9%** (95% CI 90.3 to 94.8) |
105
+ | Macro F1 (held-out) | 0.929 |
106
+ | Precision / Recall / F1 (poster) | 0.932 / 0.925 / 0.929 |
107
+ | Precision / Recall / F1 (non-poster) | 0.926 / 0.933 / 0.930 |
108
+ | Nested out-of-fold accuracy (all 3,381 documents, 5-fold) | 94.4% |
109
+ | Panel reliability with the model as a fourth rater | alpha 0.793 -> 0.797 (unchanged) |
110
+ | Calibration (out-of-fold) | Brier 0.045, ECE 0.017 |
111
  | Classifier speed | under one second per file on a CPU (PDF parsing is the bottleneck) |
112
 
113
+ Errors concentrate where the human panel itself divided: out-of-fold agreement is 96.5% on documents the panel rated unanimously and 81.1% on documents decided two to one.
114
 
115
  ### Top Features by Importance
116
 
 
118
 
119
  | Rank | Feature | Coefficient | Signal |
120
  |------|---------|------------|--------|
121
+ | 1 | `page_count` | -3.86 | More pages pushes away from poster |
122
+ | 2 | `size_per_page_kb` | +2.49 | Dense, high-resolution single pages |
123
+ | 3 | `line_count` | +2.02 | Posters pack many short text lines |
124
+ | 4 | `file_size_kb` | -1.74 | Multi-page documents are bigger overall |
125
+ | 5 | `mean_g` | +1.30 | Colorful, non-white pages |
126
+ | 6 | `img_width` | +1.22 | Large rendered width |
127
+ | 7 | `page_width_pt` | +1.16 | Posters are physically wide |
128
+ | 8 | `edge_density` | +0.83 | Visually busy layouts |
129
+ | 9 | `is_landscape` | +0.76 | Many posters are landscape |
130
+ | 10 | `color_diversity` | +0.75 | Posters are visually rich |
131
+
132
+ Every coefficient of the final classifier is a named feature; the whole text channel enters as the single `text_score` (+0.64, rank 12 of 31), whose value concentrates on the documents where geometry misleads.
133
 
134
  ## Training Data
135
 
 
140
  | **Poster** | 1,686 | Three-reviewer survey; unanimous panel label or blinded adjudication |
141
  | **Non-poster** | 1,695 | Three-reviewer survey; unanimous panel label or blinded adjudication |
142
 
143
+ Three reviewers independently rated all 3,570 candidate documents (inter-rater Krippendorff's alpha 0.79); the 439 documents without a unanimous panel were settled in a blinded adjudication review. After removing 182 near-duplicate documents and 7 with unavailable PDFs, the remaining 3,381 form the training corpus. Applied to the full corpus of 30,139 readable repository PDFs labeled as posters, PosterSentry classifies 80.6% as posters: roughly one in five records labeled as posters is something else.
144
 
145
  Training data: [fairdataihub/poster-sentry-training-data](https://huggingface.co/datasets/fairdataihub/poster-sentry-training-data)
146
 
 
190
  | Embedding dimension | 512 |
191
  | Visual features | 15 (color, edge, FFT, whitespace) |
192
  | Structural features | 15 (page geometry, fonts, text blocks) |
193
+ | Final-classifier input dimension | 31 (text score + 15 visual + 15 structural) |
194
+ | Classifier | Two-stage (stacked) LogisticRegression + StandardScaler |
195
+ | Head file size | 20 KB (.npz, both stages) |
196
  | Precision | float32 |
197
  | GPU required | No (CPU-only) |
198
  | License | MIT |