Downloads · 30 days
0
rmxjck/ltaf-ecg-beats-classifier
ltaf-ecg-beats-classifier is a machine learning model from rmxjck. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as mit.
Frozen Chronos-2 (amazon/chronos-2) multivariate encoder + MLP head, trained on the PhysioNet Long-Term Atrial Fibrillation (LTAF) database for per-beat classification.
Downloads · 30 days
0
Access
Public
Updated Apr 19, 2026
Repo size
1.6 MB
Likes
0
Public
Click a slice to open those files.
.pt1.6 MB · 100%
From the Hugging Face model README
Frozen Chronos-2 (amazon/chronos-2) multivariate encoder + MLP head,
trained on the PhysioNet Long-Term Atrial Fibrillation (LTAF) database
for per-beat classification.
| Code | Expansion |
|---|---|
| N | Normal sinus-origin beat |
| A | Atrial premature contraction (APC / PAC / SVE) |
| V | Ventricular premature contraction (PVC / VE) |
Q (unclassifiable / paced, ~89 / 9 M in the LTAF subset) is dropped.
(B, 2, 256) — 2-lead ECG at 128 Hz, 2-second window centered on the R-peak sampleECG1, ECG2| Field | Value |
|---|---|
num_classes | 3 |
class_names | ["N", "A", "V"] |
window_samples | 256 (2 s @ 128 Hz) |
n_channels | 2 |
chronos_model_id | amazon/chronos-2 |
freeze_encoder | true (only the head's 395,267 params were trained) |
| Head | 2-layer MLP: Linear(1024, 512) → ReLU → Dropout(0.3) → Linear(512, 3) |
import torch
from huggingface_hub import hf_hub_download
from src.models.ts_llm.ecg_classifier import EcgRhythmClassifier
path = hf_hub_download("rmxjck/ltaf-ecg-beats-classifier", "best_classifier.pt")
model = EcgRhythmClassifier.load(path, device="cuda")
# x: (B, 2, 256) float32 at 128 Hz, z-scored, centered on R-peak
logits = model(x)
pred = logits.argmax(-1) # 0=N, 1=A, 2=V
Produced by scripts/train_ecg_classifier.py in
rmxjck/TSLM-Arena on the LTAF-Haystack split
(67 train / 8 val / 9 test records, deterministic seed 42). N beats are
subsampled per epoch to negative_k × n_nonN (default 2.0) to balance
the 97 % N / 1.7 % A / 1.5 % V class distribution.
.venv/bin/python3 scripts/train_ecg_classifier.py \
--label-class beats --epochs 30 --batch-size 128
Research artifact only. Not FDA-cleared. Not suitable for triage, diagnosis, or any patient-facing application.