Open, tested implementation of a selective (abstaining) questionnaire-based labeller for severe vs no periodontitis, with an external check on NHANES 2009-2014.
Research and education use only. selectperio is not a medical device and must not be used to diagnose, screen or treat any person. Labels are CPITN-based proxy categories for research cohorts.
Stamatelou, Nijland, Su, Loos and Angelakis (Sci Rep 2026, doi:10.1038/s41598-026-43934-6) proposed a two-stage machine-learning pipeline that labels a person "severe periodontitis" (SP) or "no periodontitis" (NP) from eight self-reported oral health (SROH) questions, age and sex, but only when it is very sure, and abstains otherwise. The aim is case-control selection in cohorts that have questionnaires but no periodontal exam. Their code and data are not public.
This repository:
- Re-implements the pipeline from the published description: Q1 adjustment, removal of non-similar label duplicates (nSLDs), Separator-A (CatBoost, confidence >= 0.85), rule-based subset, Separator-Z, and the [0.80, 0.94] probability interval. This is an independent implementation, not the authors' code.
- Packages it as a typed Python library and CLI with 48 tests and CI on Python 3.10-3.12.
- Runs the external check the paper asks for: a temporal check on public NHANES data (development 2009-2012, hold-out 2013-2014), with nSLD and rule ablations, intervals re-derived on training data only, a simple baseline, risk-coverage curves and 20 repeated splits.
pip install "selectperio[catboost] @ git+https://github.com/Decadentry/selectperio"
selectperio demo # synthetic data, prints metrics
selectperio label --train my_labelled.csv --input my_cohort.csv --out labelled.csvInput columns: q1-q8, age, sex (coding in src/selectperio/features.py);
the training file also needs category (NP / MP / SP from CPITN). Each output row gets label
(NP, SP or abstain), reason, and the probabilities of both separators.
from selectperio import SelectiveLabeler
model = SelectiveLabeler().fit(train_df, train_df["category"]) # paper settings by default
out = model.predict(new_df)
# Re-derive the interval on your own training data with explicit targets (recommended):
model = SelectiveLabeler(nsld_mode="none", use_rules=False, consistency_gate=False,
z_interval="derive", max_risk=0.05, max_mp_leak=0.10).fit(train_df, train_df["category"])Reproduce every number below (a few minutes on 2 CPU cores):
pip install -e ".[dev,catboost,figures]"
python scripts/download_nhanes.py # public-domain NHANES files from CDC/NCHS
python experiments/run_nhanes.py # writes results/*.json and docs/figures/*.pngData. NHANES 2009-2010, 2011-2012 and 2013-2014 adults aged 30+ with a complete full-mouth
periodontal exam and all eight SROH items (the CDC/AAP items OHQ835-OHQ875 are the same eight
questions as in the paper): n = 10,336 (development 6,805; hold-out 3,531). Reference: a CPITN-like
proxy from the deepest probing depth (< 4 mm NP, 4-5 mm MP, >= 6 mm SP). Source: results/cohort.json.
Hold-out 2013-2014, NP vs SP (2,526 NP/SP people; 1,005 MP). Accuracy, coverage and the share of
MP people given a label ("MP leak") from results/main.json, seed 0:
| Configuration | Labelled (NP / SP) | Coverage | Accuracy among labelled (95% CI) | MP leak |
|---|---|---|---|---|
| Paper settings (fixed rules and thresholds) | 158 (14 / 144) | 0.063 | 0.108 (0.068-0.166) | 0.063 |
| Paper settings without the consistency gate | 216 (72 / 144) | 0.086 | 0.319 (0.261-0.384) | 0.087 |
| Paper settings, no nSLD removal | 19 (0 / 19) | 0.008 | 0.211 (0.085-0.433) | 0.014 |
| Paper settings, nSLD "minority" variant | 390 (0 / 390) | 0.154 | 0.082 (0.059-0.114) | 0.141 |
| Paper settings, no rules, no gate | 290 (287 / 3) | 0.115 | 0.931 (0.896-0.955) | 0.121 |
| Re-derived on training, zero-error target | 9 (9 / 0) | 0.004 | 1.000 (0.701-1.000) | 0.002 |
| Re-derived on training, 5% risk / 10% MP targets | 272 (272 / 0) | 0.108 | 0.971 (0.943-0.985) | 0.041 |
| Baseline: one CatBoost model, 5% risk threshold | 491 (491 / 0) | 0.194 | 0.974 (0.955-0.984) | 0.093 |
| Paper settings, evaluated with the paper's label-aware filtering of the evaluation set* | 5 (4 / 1) | 0.025* | 1.000 (0.566-1.000) | 0.076 |
* Label-aware filtering (nSLD removal and the q1/q3 rules applied with the reference labels) leaves 371 of 3,531 hold-out people (201 NP/SP, 170 MP); coverage and MP leak for this row use those denominators. All other rows use 2,526 NP/SP and 1,005 MP.
Over 20 repeated development splits (results/repeats.json) the paper
settings reached a mean hold-out accuracy of 0.133 (range 0.052-0.337); the 5% baseline 0.972
(range 0.964-0.978) with mean coverage 0.257.
What we found
- The (q1, q3) rules do not hold in NHANES. Among NP/SP people, the SP share is 0.18 for (q1 = 0, q3 = 1) and 0.34 for (q1 = 1, q3 = 1), yet the paper's rules treat both patterns as SP (figure). Many NHANES respondents report past gum treatment but have no pocket of 6 mm or more at the exam.
- nSLD removal does not scale. In 6,805 development rows almost every answer pattern occurs with more than one label, so removing all of them discards 89% of development rows (87% of the training split: 4,931 of 5,648).
- With the paper's fixed settings, labels on the hold-out are mostly wrong (accuracy 0.108; SP precision 0.028, below the 0.106 SP share among NP/SP). Applying the paper's label-aware filtering to the evaluation set makes the same model look perfect (5 of 5), which illustrates the optimism the authors themselves describe. The label-free consistency gate (our addition) is not the cause: without it, accuracy is 0.319 and SP precision is still 0.028.
- Re-derived selective labelling works for NP, not for SP. With thresholds fixed on training data,
about 97% of labels are correct, but nearly all labels are NP. No configuration gave reliable SP
labels: Separator-A's hold-out AUROC is 0.73-0.75, and the 100 people with the highest predicted SP
probability are 29% SP versus a 7.6% base rate (
results/sp_enrichment_holdout.json), which is enrichment, not labelling. (7.6% is the SP share among all hold-out people, MP included; 0.106 is the SP share among hold-out NP/SP people.) - A single model with a training-fixed threshold matches the re-derived two-stage pipeline: 491 labels at 0.974 accuracy versus 272 at 0.971, so in NHANES the second stage adds no benefit.
How this compares with the paper. The paper reports complete separation on 12 retained cases (4.31% of its NP/SP pool) in Dutch data with clinical CPITN. We do not reproduce that result in NHANES, and these results do not show the original analysis is wrong: the population, the question wording (US English vs Dutch), the reference standard (probing-depth proxy vs CPITN) and the prevalence differ. They support the authors' own advice that rules and thresholds must be re-derived for each population, and they show which parts transfer (the abstaining framework, NP labelling) and which do not (the rules, fixed thresholds, SP labelling from questionnaire answers alone).
See docs/SPEC.md. Where the paper's text leaves a choice open, selectperio uses:
confidence = max(p, 1 - p); out-of-fold Separator-A probabilities to choose Separator-Z's training rows;
nSLDs defined over all three labels (NP, MP, SP) and removed from training data only; and, because the
rules use the reference label, a label-free consistency gate at labelling time (a label is given only
if Separator-Z agrees with the label implied by the person's own q1/q3 answers). Separator-Z's
hyperparameters are not reported in the paper; the Separator-A values (13 iterations, learning rate
0.70, depth 5) are used for both.
- NHANES survey weights and design are not used: figures describe this sample, not the US population.
- The reference is a proxy from probing depth only (deepest site, six sites per tooth, third molars excluded), not CPITN index-tooth scoring and not clinical attachment loss; one deep site makes SP.
- The 2013-2014 hold-out differs from 2009-2012 (SP share among NP/SP 0.106 vs about 0.21), which lowers SP precision and raises NP accuracy on the hold-out.
- Repeated splits vary the development split and seed only; the hold-out set is fixed.
- The re-derived interval with zero-error target is chosen on nSLD-cleaned training rows (optimistic); the 5%-target configuration changes several settings at once and was not pre-registered.
- The authors' original data were not available, so the paper's own numbers could not be re-run.
Reporting checklist: docs/TRIPOD_AI_checklist.md; model card:
MODEL_CARD.md; technical note: docs/technical_note.pdf
(Zenodo: 10.5281/zenodo.24569329).
A separate project by the same author, Hezarani/periorisk, screens periodontitis risk (CDC/AAP case definition) from self-reported questions on NHANES. selectperio is different: it re-implements and tests a selective NP/SP labeller with a CPITN-like reference.
Please cite the original paper and this software (see CITATION.cff):
- Stamatelou E, Nijland N, Su N, Loos BG, Angelakis A. A selective machine learning algorithm for severe periodontitis labeling from questionnaire data. Sci Rep. 2026;16:13422. doi:10.1038/s41598-026-43934-6
- Boustani Hezarani H. selectperio (v1.0.0). Decadentry; 2026. doi:10.5281/zenodo.24569302 (all versions: 10.5281/zenodo.24569301)
NHANES data: Centers for Disease Control and Prevention, National Center for Health Statistics. National Health and Nutrition Examination Survey data, 2009-2014. Public domain.
The method is from Stamatelou et al. (2026). The authors are not involved in this repository and do not endorse it; corrections and comments are welcome as GitHub issues.
MIT © 2026 Hossein Boustani Hezarani / Decadentry. NHANES data are downloaded by script and never redistributed here.
