Sleep apnea is usually diagnosed with polysomnography, an overnight lab study that wires the patient with brain, eye, muscle, breathing and oxygen sensors. It is expensive, it has long waitlists, it disturbs the very sleep it measures, and it is close to impossible to run in places like acute stroke units. The cheap substitutes are single wearable or bedside signals such as one ECG lead or a fingertip pulse sensor. These work well on the dataset they were trained on and then break when the hardware, the hospital or the patient population changes. Social-media researchers know this failure under the name platform evolution bias: a model fit to one version of a platform decays when the interface or the user base changes. That literature has a useful habit. It asks what kind of drift happened before deciding how to fix it. Did the words simply become more or less common, or did they change meaning?
We propose to bring that question, and the oldest tool for answering it, to wearable sleep screening. Each minute of heartbeat signal is turned into a "document" of discrete beat-pattern "words." Minutes are classified with TF-IDF, a term weighting scheme that scores a word by how often it appears in this document times the log of how rare it is across the whole corpus, followed by a linear classifier. Because the rarity statistic needs no labels, it can be recomputed on a new device or cohort from unlabeled nights alone. The core claim is that this gives two things at once. It is a label-free adaptation step, and it is a diagnostic that splits the accuracy lost under a shift into the part caused by changed pattern frequencies, which re-weighting recovers, and the part caused by changed pattern-to-apnea relationships, which only new polysomnography-labeled nights can fix. That diagnostic tells a clinic whether a new device needs a labeling study.
Grounding in prior work
The physiological side motivates the problem. A CNN with a recurrent layer and temporal attention, trained on single-lead ECG, reaches 91.22% per-minute accuracy (F1 88.30%) on PhysioNet Apnea-ECG. The same work reports that accuracy "dropped significantly" when it was applied to UCDDB without fine-tuning, and that it recovered to 92.3% only after fine-tuning on target labels (Chen et al.). An ECG sleep-staging network applied directly to wrist photoplethysmography (PPG, an optical pulse signal) fell from kappa 0.60 to 0.56 (van Gilst et al.). Neither paper says why the model degraded, and both treat recovery as a labeling problem.
The OSASUD stroke-unit dataset is what makes a clean test possible. It records synchronized multi-lead ECG, PPG, SpO2 and Class-III polysomnography on 30 unselected patients (OSASUD). It therefore lets us change only the sensor while holding the patients fixed. AIOSA reached 0.958 per-patient OSA accuracy on this dataset using ECG together with SpO2 (AIOSA).
The platform-drift literature supplies the lens. Lin and Mishne measured term-distribution churn in search and tweets. Singer et al. showed Reddit's structure changed so that link-based models broke. Both distinguish frequency churn from structural change, and neither touches physiology.
TF-IDF supplies the method. N-gram TF-IDF with a linear model is a strong, interpretable baseline on noisy short text: 81.82% F1 on Arabic OffensEval (NAYEL). Character and skip-gram variants handle variation in surface form (LTG-ST). TF-IDF has also been carried over to non-text acoustic units (TF-IDF acoustic model), which is the precedent for tokenizing a signal.
The closest bridge across directions is Cohen Zion et al.. They screened for sleep disorders from Bing search logs (AUC 0.62–0.69), but with keyword presence features and no drift model. Their data is also not public. We take their motivation, which is to avoid polysomnography, and move it to signals where public benchmarks exist.
Core Claim
Under a shift from source domain $S$ to target domain $T$, part of the degradation of a bag-of-patterns apnea classifier comes from changed document frequencies. That part can be removed by recomputing
$$\mathrm{IDF}_T(w) = \log \frac{N_T}{1 + \mathrm{df}_T(w)},$$
where $N_T$ is the number of unlabeled target minutes and $\mathrm{df}_T(w)$ is the number of those minutes containing pattern $w$. The classifier weights stay as they were. We measure how much of the shift this recovers with the recoverable fraction
$$\rho = \frac{A_{\text{IDF}_T} - A_{\text{direct}}}{A_{\text{fine-tuned}} - A_{\text{direct}}},$$
where $A$ is target per-minute accuracy for the direct-transfer, IDF-re-estimated and label-fine-tuned versions of the same model. A value of $\rho$ near 1 means the shift was mostly frequency churn and no new polysomnography is needed. A value near 0 means the patterns changed meaning. We predict two outcomes. Sensor shift on OSASUD, from ECG beat intervals to PPG pulse intervals in the same patients, should have high $\rho$. This follows because pulse transit delays smear the interval patterns but preserve the cyclical heart-rate swings that accompany apneas. Cohort shift, from Apnea-ECG to UCDDB or to the stroke unit, should have lower $\rho$, because comorbidities and arrhythmias change what patterns mean.
Research Program
We first build a tokenizer. Beat-to-beat intervals are extracted from ECG R-peaks or PPG pulse peaks. Successive interval differences and local amplitude are quantized into a small alphabet, and short symbol n-grams over windows of a few beats become "words." This is the signal analogue of character n-grams. The tokenizer is fixed before any target data is seen, and its alphabet size and n-gram range are tuned on source validation folds only. Each labeled minute is a document. A logistic regression or linear SVM is trained on source TF-IDF vectors.
Second, we define three shifts with increasing severity. The first is sensor-only, using OSASUD ECG to OSASUD PPG with patient-disjoint splits. The second is cohort-and-hardware, using Apnea-ECG to UCDDB. The third is setting, using Apnea-ECG to the OSASUD stroke-unit ECG. For each shift we compute $\rho$ and its bootstrap confidence interval over target patients.
Third, we attribute drift to individual patterns. Because the model is linear and sparse, we can rank patterns by how much their target document frequency moved and by how much their weight changes when the model is fit on target labels. The second ranking is the "meaning changed" set. We will check whether those patterns concentrate in patients with atrial fibrillation or very low heart-rate variability, which are common among stroke patients.
Baselines
The naive reference is direct transfer. The source-trained model, including the TF-IDF model with source IDF, is applied unchanged to the target. It defines $A_{\text{direct}}$.
The strongest existing method is the CNN with recurrent layer and attention of Chen et al.. Its reported numbers are 91.22% per-minute accuracy and 88.30% F1 on Apnea-ECG, and 92.3% on UCDDB after fine-tuning. No reported direct-transfer UCDDB number was found on Lacuna; the paper says only that accuracy "dropped significantly." We reimplement it on the same patient splits. We run it three ways: direct transfer; with label-free adaptation that recomputes its batch-normalization statistics on unlabeled target minutes, the dense counterpart of IDF re-estimation; and fine-tuned on the same labeled target subsets given to our model. Hyperparameter search uses the same number of trials and source-only validation for every method.
For stroke-unit OSA detection, the reference point is AIOSA's 0.958 per-patient accuracy with ECG plus SpO2 (AIOSA). No reported result was found on Lacuna for PPG-only or ECG-only apnea detection on OSASUD, so we will establish that number ourselves.
A hand-crafted baseline is the multi-band spectral entropy features with an SVM of Shao et al., which reports 95.94% severe-OSA-versus-control accuracy on Apnea-ECG. We run it with and without per-domain feature standardization.
The key ablation isolates IDF re-estimation from simpler normalizations. It uses the same tokens and classifier with four weightings: raw counts, source IDF, per-domain z-scored counts, and target IDF.
Beating the field means one of two things. Either target-IDF matches or exceeds the batch-norm-adapted CNN on target per-minute accuracy and recording-level AHI-class agreement without labels, or it reaches the fine-tuned CNN's accuracy with fewer labeled target nights. The diagnostic contribution stands if $\rho$ computed from unlabeled data predicts the labeled-recovery gap across shifts.
Why not just…?
Why not just fine-tune the deep model on target polysomnography? This is the upper bound, and we report it. But it needs labels, which means polysomnography, which is the very cost being avoided. Chen et al. needed target fine-tuning to recover on UCDDB. Our label-budget curves show how many labeled target nights fine-tuning needs before it overtakes label-free re-weighting. If the answer is one or two nights, our adaptation claim is weak, and we will say so.
Why not just adapt batch-normalization statistics or z-score features per domain? This is the real threat. It is also a label-free correction of first-order statistics, and it may match target-IDF on accuracy. The ablation and the batch-norm-adapted CNN settle this directly. If either one ties, the accuracy claim reduces to "any per-domain normalization helps." The remaining contribution is then the decomposition, $\rho$ together with the per-pattern attribution. Dense normalization cannot provide that, because it does not say which signal patterns changed meaning.
Why not just use hand-crafted heart-rate-variability spectra with an SVM? Shao et al. are strong on matched data and equally cheap. However, spectral band powers over 5-minute windows average away the beat-level patterns whose frequency shifts we want to track. They also give no natural unlabeled correction beyond standardization. Running them under all three shifts will show whether they are simply more robust to begin with. If they are, that would undercut the need for tokenization.
Proposed Experiments
The decisive check is OSASUD sensor shift, because the patients are identical and any loss is purely due to the sensor. The prediction is $\rho \geq 0.6$ for ECG to PPG. A second check runs across the three shifts: label-free $\rho$ should rank-order the observed fine-tuning gains, with sensor shift recovering most and stroke-unit setting shift least. If $\rho$ is uniformly small, frequency churn is not the dominant drift in wearable apnea screening. That would be a useful negative result, because it would argue that every new deployment needs labels.
Metrics are per-minute accuracy and F1, recording-level AHI-class agreement and correlation, and $\rho$ with bootstrap intervals over patients. Secondary measures are inference cost per night and the stability of the top-weighted patterns across folds.
References
- A spatio-temporal learning-based model for sleep apnea detection using single-lead ECG signals
- Direct application of an ECG-based sleep staging algorithm on reflective photoplethysmography data decreases performance
- OSASUD: A dataset of stroke unit recordings for the detection of Obstructive Sleep Apnea Syndrome
- AIOSA: An approach to the automatic identification of obstructive sleep apnea events based on deep learning
- A Study of "Churn" in Tweets and Real-Time Search Queries
- Evolution of reddit: from the front page of the internet to a self-referential community?
- NAYEL at SemEval-2020 Task 12: TF/IDF-Based Approach for Automatic Offensive Language Detection in Arabic Tweets
- LTG-ST at NADI Shared Task 1: Arabic Dialect Identification using a Stacking Classifier
- Continuous speech recognition with a TF-IDF acoustic model
- Identifying Sleep Disorders From Search Engine Activity: Combining User-Generated Data With a Clinically Validated Questionnaire
- Obstructive Sleep Apnea Recognition Based on Multi-Bands Spectral Entropy Analysis of Short-Time Heart Rate Variability