Khaos ECG Anomaly
A transformer for single-lead ECG windows of 2,048 samples. It returns an embedding and an abnormality score: the probability that the window contains abnormal beats or morphology, trained on labelled MIT-BIH and PTB-XL windows.
tele_bio_ecg v1, from Khaos (a local-first library of pre-trained models for domain-specific tasks). This is the first release of the artifact.
Model
- Architecture: SensorTransformer with a score head: patch embedding (32 samples), 4-layer transformer (dim 128, 4 heads), mean pooling and a linear abnormal-probability head
- Parameters: 814,257
- Format: ONNX (
model.onnx) plus PyTorch weights (model.pt) andmanifest.json - Training data: fletxcher/khaos-tele_bio_ecg
Results
Measured on the held-out test split of the training dataset.
| Metric | Value |
|---|---|
| test_auroc | 0.8564 |
| test_ap | 0.8096 |
| test_f1_at_val_threshold | 0.6719 |
| score_threshold | 0.3893 |
| n_test | 8706 |
| baseline_rms_auroc | 0.4153 |
| baseline_kurtosis_auroc | 0.3969 |
| positive_rate | 0.3518 |
| test_auroc_mit_bih | 0.8894 |
| test_auroc_ptb_xl | 0.7810 |
Test AUROC by source
| Source | Windows | AUROC |
|---|---|---|
| mit_bih | 6,974 | 0.8894 |
| ptb_xl | 1,732 | 0.7810 |
Training
{
"epochs": 40,
"batch": 64,
"lr": 0.0003,
"kind": "supervised",
"architecture": "SensorTransformer"
}
Best epoch 10, trained in 2.0 minutes on a single consumer GPU (RTX 3050 8 GB).
Intended use
Screening and prioritizing ECG recordings by their abnormality score. Not a diagnostic device.
Limitations
- Not validated for clinical use.
- MIT-BIH (360 Hz) and PTB-XL (500 Hz) windows cover different durations; other sampling rates are untested.
- A reconstruction-based autoencoder scored at chance on this data, so the first release uses supervised labels: it detects the abnormalities in the training labels, not arbitrary novelty.
- Flags unusual morphology, which includes noise and artifacts as well as pathology.
Usage
pip install khaos
khaos serve ./tele_bio_ecg
License
Trained on data released under CC BY 4.0 or generated by Khaos; released under CC BY 4.0.