Spaces:
Running on Zero
Download GLOSSARY.md from wqerer/ctg-escalate: direct link, hf CLI and curl.
- Browser
- Download file 14.2 kB
-
https://huggingface.co/spaces/wqerer/ctg-escalate/resolve/main/GLOSSARY.md
- Command line
-
hf download hf://spaces/wqerer/ctg-escalate/GLOSSARY.md
-
curl -L -o GLOSSARY.md https://huggingface.co/spaces/wqerer/ctg-escalate/resolve/main/GLOSSARY.md
A newer version of the Gradio SDK is available: 6.33.0
Glossary
Plain-language definitions of the terms used in this project. Where it helps, each entry gives the project's own number or file as an example. Sections run from the clinical background, through the signal and data, to the machine-learning and statistics terms, then terms specific to this project.
The project in one sentence: CTG-Escalate reads the last hour of a baby's heart-rate trace during labour and says escalate, continue or check the transducer. It is tested on whether it flags the babies born with too much acid in their blood.
1. Clinical background
CTG (cardiotocography) The monitor strapped to a mother's belly in labour. It draws two lines on a strip: the baby's heart rate and the mother's contractions. "Cardio" = heart, "toco" = contractions. Staff read it by eye to decide whether the baby is coping.
Intrapartum / antepartum Intrapartum means during labour; antepartum means before labour starts. CTU-UHB traces are intrapartum. Most JNU-CTG traces are antepartum, recorded 1–2 weeks before birth, which is why they couldn't predict problems at birth.
FHR (fetal heart rate) The baby's heartbeats per minute (bpm). Normal is roughly 110–160 bpm.
UC (uterine contractions) The second CTG line: how hard the womb is squeezing. It matters because how the heart rate reacts to contractions is a key warning sign.
Baseline The baby's "resting" heart rate over about 10 minutes, ignoring brief rises and dips. A falling baseline (record 2011 dropped to about 71 bpm) is a danger sign.
Tachycardia / bradycardia A baseline above 160 bpm (too fast) or below 110 bpm (too slow).
Variability How much the heart rate wiggles from second to second. Healthy babies wiggle about 5–25 bpm. Too little variability (reduced) can mean the baby's nervous system is stressed; too much (increased) can also be a warning.
Acceleration A brief rise of more than 15 bpm above baseline, lasting more than 15 seconds. Usually reassuring.
Deceleration ("decel") A brief drop of more than 15 bpm below baseline, lasting more than 15 seconds. The most important warning sign. Types:
- Late deceleration: the lowest point (nadir) comes well after the contraction peak (more than 20 s here) and the drop is gradual. It suggests the baby is short of oxygen.
- Prolonged deceleration: lasts more than 3 minutes.
- Variable / early: other shapes, usually less worrying.
Nadir The lowest point of a deceleration.
FIGO guideline (2015) The international obstetric guideline for reading CTGs. It classes a trace as normal, suspicious or pathological using the baseline, variability and decelerations. Baseline B0 is a computer version of it.
Cord pH / umbilical artery pH Blood taken from the umbilical cord right after birth and tested for acidity. Low pH means the baby went short of oxygen during labour. It's the "ground truth" this project predicts.
Acidemia / acidemic Too much acid in the blood. Here: pH < 7.15 (primary label), or pH < 7.05 for severe acidemia (secondary label).
Asphyxia Oxygen starvation at birth, diagnosed clinically. It's the JNU-CTG outcome (27 cases in its held-out set).
Surrogate outcome Something measured instead of what you really care about. Cord pH is a surrogate for the real harms, brain injury (HIE) or death, which this database doesn't record.
Caesarean (C-section) Surgical delivery. Over-reading CTGs raises caesarean rates, which carry their own risks to the mother.
Escalate / senior review Calling a more senior doctor to look at the trace and decide whether to act.
Transducer The sensor on the belly. When it slips, the trace goes blank; "check transducer" means fix it before trusting the trace.
2. Signal processing
4 Hz 4 samples per second. Each CTU-UHB recording is up to 90 minutes, so about 21,600 samples per line.
Signal loss / FHR loss The fraction of the hour with no usable heart-rate reading (blank, or removed as an artefact). Median about 17% in this data.
Artefact / spike A false reading, for example the monitor picking up the mother's pulse. Samples more than 25 bpm from the 15-second running median are thrown out.
Interpolation Filling a short gap by drawing a straight line across it. Gaps of 15 s or less are filled; longer gaps stay missing.
Trailing gap Missing signal at the end of the trace, right before birth, when it matters most. Record 2009's last 17 minutes were blank. The v1 gate only looked at total loss, so it didn't catch this.
STV (short-term variability) A finer variability measure on 3.75-second chunks (Dawes-style), used in computerized CTG systems.
3. The data
CTU-UHB The main dataset: 552 labours from the University Hospital in Brno, Czech Republic, 2010–2012. Free on PhysioNet. Every recording has cord pH.
PhysioNet A free online library of medical signal datasets.
JNU-CTG A Chinese dataset of 12,606 pregnancies (Jinan University), used as a "scaling test".
FHRMA 135 French recordings with no outcomes, used only for pretraining.
Merged corpus
All three datasets converted to one format in data/ctg_corpus/: 21,456 recordings, 11,301 hours. Labels are kept separate because each dataset measures a different outcome.
Record / record ID
One labour's recording, named by a number like 2011.
Positive / negative A positive is an acidemic baby (the thing we try to catch). The held-out set has 32 positives out of 166.
4. Machine learning
Feature
A number computed from the trace that the model uses, such as "decelerations per hour". CTG-Escalate uses 29 features (ctg/features.py).
Model / classifier The formula that turns features into a risk score.
Logistic regression (LR) A simple, interpretable model: it multiplies each feature by a weight, adds them up, and squashes the result into a 0–1 probability. CTG-Escalate v1 is one of these.
Regularization (L1, L2, elastic net, C) A penalty that stops a model from over-trusting the training data. C sets its strength: smaller C means a stronger penalty and a simpler model. v1 uses L2 with C = 0.1. L1 can switch features off entirely; elastic net mixes L1 and L2.
Spline A way to let a feature have a curved effect, for example "both very high and very low baseline are bad", while keeping a logistic regression.
Gradient boosting (GBM) Many small decision trees added together. Often more accurate, but less interpretable and easier to overfit on small data. This is baseline B2.
Overfitting When a model memorizes quirks of its training data and does worse on new data. It's the main risk with only 386 training labours.
Hyperparameter / tuning Settings chosen before training (C, tree depth and so on). Tuning means trying several and picking the best, which must be done without peeking at the test data.
Deep learning / neural network Models that learn their own features straight from the raw signal. Four were tried in the benchmark:
- CNN (convolutional neural network) scans the trace with small sliding filters. MCNN is the multimodal CNN, with separate branches for FHR and UC.
- ResNet (1-D) is a deeper CNN with "skip" connections.
- PatchTST is a transformer that cuts the trace into short patches, like words in a sentence.
Transformer The architecture behind modern language models, applied here to time series.
Pretraining / self-supervised / masked pretraining Training a model first on lots of unlabelled data by hiding parts of the trace and asking it to fill them in, then fine-tuning it on the small labelled task. M4 did this on about 8,000 hours, and it added only +0.03 AUROC.
Foundation model A large pretrained model meant to be reused for many tasks. The 2026 PatchTST preprint called itself one.
Epoch / early stopping / patience An epoch is one pass over the training data. Early stopping halts training when validation performance stops improving; patience (8 here) is how many epochs to wait first.
Calibration / Platt scaling Adjusting scores so that "30% risk" really means about 30% of such babies are acidemic. Platt scaling is a small logistic regression fitted on top of the scores.
Ensemble / rank-average Combining several models' outputs. A rank-average averages each model's ordering of the cases rather than their raw scores.
LLM (large language model) / Unsloth Text models like Llama or Claude. Unsloth is a tool that speeds up fine-tuning them. It doesn't apply to this project's core model, which reads numbers from a heart trace, not text.
5. Evaluation and statistics
Development set (dev) / held-out set The 552 labours were split once, before any modelling. 386 development labours are for every design choice. 166 held-out labours were locked away and used once, at the end, to measure honest performance.
Data leakage When information from the test data sneaks into training or design choices, making results look better than they really are. Most of the project's rules exist to prevent it.
SHA-256 hash
A fingerprint of a file. Recording the held-out list's hash (144842a8…) proves it never changed afterwards.
Pre-registration
Writing down the method and hypotheses before seeing results (benchmark/README.md), so you can't move the goalposts later.
Cross-validation (CV), 5-fold, repeated 5×5 Split the dev set into 5 parts, train on 4 and test on the 5th, rotating until each part has been the test once. Doing this 5 times with different shuffles (5×5) gives a steadier estimate.
Out-of-fold (OOF) predictions Each dev record's score from the model that didn't train on it. The pieces are pooled to measure dev performance.
Nested CV
CV inside CV: the inner loop tunes hyperparameters, the outer loop measures the whole recipe. It prevents tuning from inflating the score. improve/explore_dev.py uses it.
Stratified Splitting so each part keeps the same share of positives.
Seed (20261204) A fixed random-number starting point, so every shuffle can be reproduced exactly.
AUROC (area under the ROC curve) The chance that the model gives a randomly chosen acidemic baby a higher score than a randomly chosen healthy one. 0.5 is a coin flip and 1.0 is perfect. CTG-Escalate scores 0.739 on held-out data; the FIGO rule scores 0.639.
AUPRC (area under the precision–recall curve) Like AUROC, but focused on how clean the positive calls are. It's useful when positives are rare.
Sensitivity / specificity Sensitivity is the share of acidemic babies that get flagged. Specificity is the share of healthy babies correctly left alone. Raising one usually lowers the other.
PPV (positive predictive value) Of the babies flagged, how many really were acidemic. 57% of CTG-Escalate's escalations were false alarms, so its PPV is about 43%.
False negative / false positive A false negative is a missed acidemic baby, the worst error here. A false positive is an unnecessary alarm.
Threshold / operating point The risk cut-off above which the system says "escalate" (0.286). It was chosen to match the FIGO rule's false-alarm rate, for a fair comparison.
Confidence interval (95% CI) The plausible range for a result given the small sample. "0.739 (0.628–0.834)" means the true AUROC could reasonably be anywhere in that range. With 32 positives, the intervals are wide.
Bootstrap Estimating a CI by re-sampling the 166 records with replacement 1,000 times and recomputing the result each time.
Paired difference Comparing two models on the same records, which cancels out luck in which records were drawn. If its CI excludes zero, the difference is real. CTG-Escalate vs FIGO: +0.099 (+0.018 to +0.182), which is real. Vs every deep model, the CI spans zero, so it's inconclusive.
Noise (in results) Differences small enough to come from chance. On this data, AUROC gaps under about 0.02–0.05 are noise.
6. Project-specific terms
CTG-Escalate (v1)
The frozen model: 29 features → L2 logistic regression (C = 0.1) → Platt calibration → signal-loss gate. Stored in models/models.pkl with its settings in config.yaml.
Second reader The intended role: a prompt for the midwife, never the decision-maker.
The three outputs 🔴 Escalate (risk > 0.286) · 🟢 Continue (never meaning "safe") · ⚠️ Check transducer (signal loss > 45%, so no score is given).
Abstention / gate Refusing to score when the signal is too poor. It's an honest "I don't know". On held-out data the v1 gate set aside 7.8% of traces but didn't improve accuracy.
Baselines B0, B1, B2 Reference methods to beat:
- B0: the computerized FIGO rule.
- B1: logistic regression on 7 FIGO features.
- B2: gradient boosting on all 29 features.
Benchmark M1–M4 The four re-implemented published deep models: M1 MCNN, M2 ResNet1D, M3 PatchTST from scratch, M4 PatchTST pretrained.
Frozen
Locked: the model file and config can't change after the held-out run, and the hash check in evaluate.py enforces it.
v2 candidate
A possible improved model, judged on development CV only, because the held-out set has already been used once. That work lives in improve/.
7. Where things live
| Path | What it is |
|---|---|
README.md |
Full write-up and results |
config.yaml |
Frozen decision rules and dev CV numbers |
ctg/ |
Core code: signal cleaning, features, models, metrics |
develop.py |
Every design choice, on dev data only |
evaluate.py |
Scores the frozen model on the held-out set |
splits/ |
Which labours are dev vs held-out (+ hash) |
results/holdout/ |
Held-out results, predictions, error cases |
benchmark/ |
Pre-registered head-to-head vs published deep models |
results/benchmark/ |
Benchmark results (scored once) |
improve/ |
v2 search on dev data only |
app.py |
Demo app replaying held-out cases |
video/ |
Script that renders the narrated demo video |