A Two-Stage Time-Aware Transformer for Short-Horizon AECOPD Risk Prediction

arXiv cs.LG Papers

Summary

This paper presents a two-stage transformer framework for predicting the risk and timing of acute exacerbations of COPD using raw waveform data from home ventilators, demonstrating improved performance over baseline models.

arXiv:2608.19578v1 Announce Type: new Abstract: Acute exacerbation of chronic obstructive pulmonary disease (AECOPD) can worsen rapidly, making timely prediction a clinical priority. Most existing machine learning approaches rely on episodically collected clinical variables, introducing delays that limit their practical utility in home monitoring settings. Home ventilators offer a lower-latency alternative, producing a near-continuous record of respiratory status during daily use. However existing ventilator-based approaches either compress the waveform into handcrafted features or focus primarily on binary risk classification, leaving the timing of an impending event unresolved. In this paper, we present a two-stage framework that operates directly on raw pressure and flow waveforms from the most recent seven days of home ventilator use. The first-stage classification model identifies patients at high risk of a severe exacerbation. The second-stage regression model then estimates how many days remain before the event occurs. Our experimental results demonstrate that the two-stage model outperforms traditional baseline models on both risk classification and time-to-event estimation, with our selected Stage 1 classifier achieving F1 = 0.91 and our Stage 2 regression model achieving RMSE = 1.00 days and R^2 = 0.76, giving clinicians both an early warning and actionable lead time before a severe exacerbation occurs.
Original Article
View Cached Full Text

Cached at: 08/21/26, 10:25 AM

# A Two-Stage Time-Aware Transformer for Short-Horizon AECOPD Risk Prediction
Source: [https://arxiv.org/html/2608.19578](https://arxiv.org/html/2608.19578)
Weihao QuLing ZhengHaowen PanThanks:D\. Wang, W\. Qu, and L\. Zheng are with the Department of Computer Science and Software Engineering, Monmouth University, West Long Branch, NJ, USA\. E\-mail: \{s1382037, wqu, lzheng\}@monmouth\.eduThanks:H\. Pan is with Changzhou Yaoyuanxing Electronic Technology Co\., Ltd\., China\. E\-mail: hpan2414@gmail\.com

Acute exacerbation of chronic obstructive pulmonary disease \(AECOPD\) can worsen rapidly, making timely prediction a clinical priority\. Most existing machine learning approaches rely on episodically collected clinical variables, introducing delays that limit their practical utility in home monitoring settings\. Home ventilators offer a lower\-latency alternative, producing a near\-continuous record of respiratory status during daily use\. However existing ventilator\-based approaches either compress the waveform into handcrafted features or focus primarily on binary risk classification, leaving the timing of an impending event unresolved\. In this paper, we present a two\-stage framework that operates directly on raw pressure and flow waveforms from the most recent seven days of home ventilator use\. The first\-stage classification model identifies patients at high risk of a severe exacerbation\. The second\-stage regression model then estimates how many days remain before the event occurs\. Our experimental results demonstrate that the two\-stage model outperforms traditional baseline models on both risk classification and time\-to\-event estimation, with our selected Stage 1 classifier achieving F1 = 0\.91 and our Stage 2 regression model achieving RMSE = 1\.00 days andR2R^\{2\}= 0\.76, giving clinicians both an early warning and actionable lead time before a severe exacerbation occurs\.

## IIntroduction

Acute exacerbation of chronic obstructive pulmonary disease \(AECOPD\) refers to a sudden worsening of respiratory symptoms beyond normal day\-to\-day variation\[[15](https://arxiv.org/html/2608.19578#bib.bib1)\]\. AECOPD substantially worsens quality of life and is associated with increased hospitalization and mortality\[[10](https://arxiv.org/html/2608.19578#bib.bib2)\]\. We therefore view early detection as a clinical priority, but most existing machine learning models rely on clinical and laboratory inputs such as electronic health records, spirometry, blood gas analyses, and symptom questionnaires\[[9](https://arxiv.org/html/2608.19578#bib.bib3)\]\. Because these signals are collected episodically, they introduce a delay between physiological deterioration and risk detection that is especially problematic for a condition that can worsen rapidly\.

Home ventilator waveforms provide a lower\-latency alternative\. Patients with severe COPD often use home non\-invasive ventilators for several hours per day, and the resultingpressureandflowsignals offer a near\-continuous record of respiratory status in the home environment\. Unlike clinic\-derived measurements, these waveforms are available during routine daily use and can therefore support short\-horizon monitoring without waiting for the next hospital visit or test\.

Recent machine learning studies have shown that respiratory and clinical time\-series data carry predictive value, including explainable COPD risk models\[[9](https://arxiv.org/html/2608.19578#bib.bib3)\], data\-driven COPD flare\-up detection\[[15](https://arxiv.org/html/2608.19578#bib.bib1)\], and modern transformer models for multivariate time\-series representation learning\[[4](https://arxiv.org/html/2608.19578#bib.bib12),[17](https://arxiv.org/html/2608.19578#bib.bib15)\]\. However, an important gap remains: many existing AECOPD approaches still aggregate the waveform into handcrafted summary features or otherwise weaken the temporal structure of the raw signal, making it harder to capture the short\-horizon dynamics that precede severe exacerbation\.

In this paper we address two clinical questions\. First, given a rolling window of home ventilator recordings, can a model identify patients at high risk of an imminent severe AECOPD event? Second, for patients already identified as high risk, how many days remain before that severe exacerbation event? We view the first question as supporting early warning, whereas the second provides actionable lead time for intervention\.

To answer these questions, we use a two\-stage model inspired by recent transformer\-based time\-series modeling work with temporal representation learning\[[4](https://arxiv.org/html/2608.19578#bib.bib12),[17](https://arxiv.org/html/2608.19578#bib.bib15)\]\. At a high level, the approach operates directly on rawpressureandflowwaveforms over a 7\-day window, first producing a binary high\-risk decision and then estimating time to event only for the patients identified as high risk\. We design the pipeline to preserve the temporal structure of the raw waveform signal and to mirror the natural clinical workflow: screen for risk first, then estimate urgency\.

Our main contributions are as follows:

1. \(i\)Instead of extracting all ventilator variables into handcrafted features, we keep the two primary waveform channels,pressureandflow, over a 7\-day window\. These channels directly reflect patients’ respiratory mechanics, triggering, cycling, and air trapping\. This method preserves the breath\-level temporal dynamics, which are indispensable for short\-horizon deterioration prediction\.
2. \(ii\)Time\-Aware Transformer encoder adapted for raw respiratory time\-series data, learning patient representations frompressureandflowwaveforms that can be reused by downstream classifiers and regression models\.
3. \(iii\)A two\-stage prediction pipeline in which Stage 1 combines the learned representations with downstream classifiers for high\-risk classification, and Stage 2 applies a separately trained time\-aware regression model for time\-to\-event estimation in patients identified as high risk\.
4. \(iv\)An empirical evaluation in which our selected 32\-dimensional time\-aware Stage 1 configuration uses logistic regression as the primary classifier \(F1 = 0\.91 for label 1\) and XGBoost as a secondary classifier for stability verification, while our selected 64\-dimensional Stage 2 model achieves RMSE = 1\.00 days, MAE = 0\.87 days, andR2R^\{2\}= 0\.76 on the held\-out test set\.

The remainder of the paper is structured as follows\. Section[III](https://arxiv.org/html/2608.19578#S3)describes the dataset and preprocessing pipeline\. Section[IV](https://arxiv.org/html/2608.19578#S4)presents the architecture of the two\-stage model\. Section[V](https://arxiv.org/html/2608.19578#S5)reports experimental results\. Section[VI](https://arxiv.org/html/2608.19578#S6)discusses clinical implications, limitations, and future directions\.

## IIRelated Work

Prior work on AECOPD prediction has largely relied on structured clinical variables, telemonitoring summaries, or hand\-crafted features rather than raw ventilator waveforms\. Recent COPD\-focused studies have used explainable clinical risk models, data\-driven flare\-up detection, and day\-to\-day home noninvasive ventilation parameters to predict or characterize exacerbation risk\[[9](https://arxiv.org/html/2608.19578#bib.bib3),[15](https://arxiv.org/html/2608.19578#bib.bib1),[7](https://arxiv.org/html/2608.19578#bib.bib9),[18](https://arxiv.org/html/2608.19578#bib.bib10)\]\. These studies support the feasibility of early AECOPD prediction, but they generally depend on engineered features, intermittent measurements, or multimodal summaries that may still introduce latency or discard part of the original temporal waveform structure\. In addition, most AECOPD prediction studies formulate the task mainly as binary classification, which can indicate whether risk is elevated but not how soon an event is likely to occur\.

More recently, transformer\-based time\-series models have advanced rapidly, including improved positional encoding for multivariate time\-series classification, general\-purpose time\-series representation learning, and new architectures for long\-horizon temporal modeling\[[4](https://arxiv.org/html/2608.19578#bib.bib12),[17](https://arxiv.org/html/2608.19578#bib.bib15)\]\. Recent studies have also emphasized scalable explainable AI and behavior\-guided learning in intelligent systems\[[16](https://arxiv.org/html/2608.19578#bib.bib18),[11](https://arxiv.org/html/2608.19578#bib.bib19),[14](https://arxiv.org/html/2608.19578#bib.bib20)\]\.

At the same time, prior long\-horizon forecasting work has questioned whether transformer architectures consistently outperform simpler linear baselines for time\-series forecasting\[[20](https://arxiv.org/html/2608.19578#bib.bib14)\]\. A related jump\-point time\-aware transformer for AECOPD prediction compressed the respiratory waveform into sparse event representations before classification\[[13](https://arxiv.org/html/2608.19578#bib.bib13)\]\. In contrast, our work keeps the rawpressureandflowwaveforms, uses explicit temporal encoding over the last seven days, and extends beyond binary classification to a two\-stage pipeline that also estimates time to event\. This design is intended to preserve continuous respiratory deterioration patterns that are especially important for downstream regression and alert timing\. Prior COPD exacerbation prediction studies have commonly used XGBoost as a strong machine\-learning baseline for remote\-monitoring and near\-future AECOPD prediction\[[19](https://arxiv.org/html/2608.19578#bib.bib16),[12](https://arxiv.org/html/2608.19578#bib.bib17)\]\. Therefore, we include XGBoost as a non\-transformer comparator and stability\-check model\.

## IIIData and Preprocessing

### III\-ADataset

The dataset initially comprised continuous one\-month respiratory time\-series recordings from 87 COPD patients collected via daily\-use home non\-invasive ventilators between 2023 and 2025 \(42 patients from 2023, 10 from 2024, and 35 from 2025\)\. Of these, 57 patients were assigned to label 0 \(no acute exacerbation\), whereas 30 patients were assigned to label 1 \(severe AECOPD requiring emergency or intensive\-care\-level treatment\)\. 2 patients were excluded before model development because their recordings did not provide sufficient temporal coverage for the required analysis windows\. The final analysis contained 85 patients\. Daily usage ranged from 4 to 12 hours, producing between 72,000 and 220,000 rows per day at a sampling rate of five readings per second\. Each row contains eight columns: timestamp, flow, pressure, peripheral oxygen saturation \(SpO2\), respiratory rate, tidal volume, minute ventilation, and system leak\. Timestamp records the exact date and time of the measurement\. Flow, minute ventilation, and leak are recorded in liters per minute\. Pressure is recorded as circuit air pressure in centimeters of water \(cmH2O\)\. SpO2records peripheral oxygen saturation\. Respiratory rate is measured in breaths per minute\. Tidal volume is the exhaled volume per breath cycle in mL\.

The cohort was split into 48 training, 15 validation, and 22 test patients\. Training and validation sets were stratified to preserve the natural 2:1 negative\-to\-positive ratio \(training: 32 label\-0, 16 label\-1; validation: 10 label\-0, 5 label\-1\), reflecting true clinical prevalence and avoiding artificial resampling\. The test set comprises 17 label\-0 and 5 label\-1 patients\.

These ventilator waveform data were obtained from a collaborating hospital, deidentified before analysis, and used under institutional ethics approval and consent procedures to be confirmed in the final manuscript\.

### III\-BPreprocessing

We use a targeted preprocessing strategy that retains only thepressureandflowcolumns from the last 7 days before the prediction reference point\.

Rather than using all seven physiological ventilator variables, we retain only the two most clinically representative input channels:pressureandflow\. No handcrafted feature extraction or waveform compression is applied\. We selected these two channels because they are the primary ventilator scalar waveforms routinely used to assess airway resistance, respiratory mechanics, patient effort, triggering, cycling, and air trapping\[[6](https://arxiv.org/html/2608.19578#bib.bib4),[3](https://arxiv.org/html/2608.19578#bib.bib5),[5](https://arxiv.org/html/2608.19578#bib.bib6)\]\. In addition, flow\-derived measures such as peak expiratory flow have shown clinical value for detecting COPD exacerbation and assessing hospitalization\-level deterioration\[[1](https://arxiv.org/html/2608.19578#bib.bib7),[2](https://arxiv.org/html/2608.19578#bib.bib8)\]\.

Figure[1](https://arxiv.org/html/2608.19578#S3.F1)shows a representative short segment of the raw ventilator waveform used in this study\. Because the device records five entries per second, the data preserve fine\-grained breath\-by\-breath temporal variation inflowandpressure, including rapid within\-breath changes and cycle\-to\-cycle transitions\. Figure[1](https://arxiv.org/html/2608.19578#S3.F1)also compares this 5 Hz segment with the same signal reduced to 1 reading per second, showing that much of the waveform shape is lost even before any additional compression is applied\. In contrast, jump\-point data retain only timestamps where the absolute difference between the current value and the previous retained value exceeds a threshold\. This sparse encoding cannot fully preserve the continuous 5 Hz waveform structure used by our model\.

![Refer to caption](https://arxiv.org/html/2608.19578v1/Figures/sample_pressure_flow_waveform.png)Fig\. 1:Representative raw ventilator waveform segment comparing the original 5 Hz recording with the same segment reduced to 1 reading per second\.We further restrict the input to the most recent seven days before the prediction reference point\. This short\-horizon window is motivated by both clinical and practical considerations\. Clinically, ventilator\-based changes associated with impending exacerbation can emerge during the week before hospitalization, and prior studies have explicitly examined abnormal respiratory patterns within a 7\-day pre\-AECOPD period and developed models for predicting AECOPD in the upcoming 7 days\[[7](https://arxiv.org/html/2608.19578#bib.bib9),[18](https://arxiv.org/html/2608.19578#bib.bib10)\]\. Practically, using the last seven days keeps the raw\-sequence length manageable for transformer processing and keeps the model focusing on the period most relevant to short\-horizon deterioration assessment\.

## IVMethodology

Figure[2](https://arxiv.org/html/2608.19578#S4.F2)illustrates the architecture of the Two\-Stage AECOPD Time\-Aware Transformer Model\. The pipeline first preprocesses 30\-day raw ventilator data by selecting only the last seven days ofpressureandflow\. It then applies two*separate*Time\-Aware Transformers: Transformer A for binary classification and Transformer B for time\-to\-event \(TTE\) regression\.

![Refer to caption](https://arxiv.org/html/2608.19578v1/Figures/figure2_AECOPD_framework.png)Fig\. 2:Architecture of the Two\-Stage AECOPD Time\-Aware Transformer Model\.### IV\-ASeparate Time\-Aware Transformers

Although Transformer A and Transformer B share the same Time\-Aware Transformer architecture family, they are trained independently rather than through transfer learning\. This design choice reflects the fact that the two stages solve different learning problems under different data distributions\. Transformer A is trained on all 85 patients to separate high\-risk from low\-risk ventilator patterns, so its parameters are shaped by a binary discrimination objective and by exposure to both label 0 and label 1 examples\. Transformer B, by contrast, is trained only on the 29 label 1 patients and optimized for a continuous time\-to\-event regression target\. The countdown target used in Stage 2 \(from day 6 to day 0 before exacerbation\) has no analogue in Stage 1, so initialising Transformer B from Transformer A would introduce a classification\-oriented inductive bias without a clear task\-level benefit\. Keeping the two transformers separate therefore allows each model to be optimized for its own objective without cross\-task interference\.

Let a patient’s preprocessed raw sequence be denoted𝒮=\{\(e1,v1,τ1\),\(e2,v2,τ2\),…,\(eN,vN,τN\)\}\\mathcal\{S\}=\\\{\(e\_\{1\},v\_\{1\},\\tau\_\{1\}\),\(e\_\{2\},v\_\{2\},\\tau\_\{2\}\),\\ldots,\(e\_\{N\},v\_\{N\},\\tau\_\{N\}\)\\\}, whereeie\_\{i\}is the channel type,viv\_\{i\}is the scalar sample value, andτi\\tau\_\{i\}is the elapsed time from the start of the first recording\. We use elapsed time because prior transformer time\-series work has shown that absolute or elapsed position encoding preserves sequential order\. Time2Vec\-style temporal representations can also improve temporal modeling performance\[[4](https://arxiv.org/html/2608.19578#bib.bib12),[8](https://arxiv.org/html/2608.19578#bib.bib11)\]\.

#### Input Embeddings\.

Each token is represented as the sum of three embeddings:

𝐱i=𝐄type​\(ei\)\+𝐄value​\(vi\)\+𝐄time​\(τi\)\\mathbf\{x\}\_\{i\}=\\mathbf\{E\}\_\{\\text\{type\}\}\(e\_\{i\}\)\+\\mathbf\{E\}\_\{\\text\{value\}\}\(v\_\{i\}\)\+\\mathbf\{E\}\_\{\\text\{time\}\}\(\\tau\_\{i\}\)\(1\)
where𝐄type∈ℝ\|𝒱\|×d\\mathbf\{E\}\_\{\\text\{type\}\}\\in\\mathbb\{R\}^\{\|\\mathcal\{V\}\|\\times d\}is a learned type embedding matrix,𝐄value\\mathbf\{E\}\_\{\\text\{value\}\}is a linear projection from scalar todd\-dimensional space, and𝐄time\\mathbf\{E\}\_\{\\text\{time\}\}is a Time2Vec\-style temporal encoding\[[8](https://arxiv.org/html/2608.19578#bib.bib11)\]applied to the elapsed\-time index:

\[𝐄time​\(τi\)\]j=\{w0​τi\+b0j=0sin⁡\(wj​τi\+bj\)j≥1\[\\mathbf\{E\}\_\{\\text\{time\}\}\(\\tau\_\{i\}\)\]\_\{j\}=\\begin\{cases\}w\_\{0\}\\,\\tau\_\{i\}\+b\_\{0\}&j=0\\\\ \\sin\(w\_\{j\}\\,\\tau\_\{i\}\+b\_\{j\}\)&j\\geq 1\\end\{cases\}\(2\)
Using elapsed time from the start provides a stable, monotonic temporal reference within every sample window\. This is particularly useful for downstream TTE regression because it aligns within\-window progression across patients without introducing irrelevant absolute clock times\. A learnable positional encoding is added prior to the transformer encoder layers\. Each transformer hasL=2L=2layers of multi\-head self\-attention followed by feed\-forward networks, withH=4H=4attention heads and embedding dimensiond∈\{32,64,128\}d\\in\\\{32,64,128\\\}\.

### IV\-BStage 1: Binary Classification

Stage 1 uses Time\-Aware Transformer A with classification head and is trained on all 85 patients\. The raw sequence is segmented into day\-level segments over the last seven days\. Each day is encoded independently, and the resulting seven day\-level embeddings are concatenated into a patient feature vector𝐟∈ℝ7​d\\mathbf\{f\}\\in\\mathbb\{R\}^\{7d\}\. This vector is then passed to five standard classifiers: Logistic Regression \(LR\), Support Vector Machine \(SVM\), Decision Tree \(DT\), Random Forest \(RF\), and XGBoost \(XGB\), as shown in the left branch of Figure[2](https://arxiv.org/html/2608.19578#S4.F2)\.

Transformer A is trained end\-to\-end with binary cross\-entropy \(BCE\) loss with positive class weighting:

ℒcls=−1N∑i=1N\[w\+yilogp^i\+\(1−yi\)log\(1−p^i\)\]\\mathcal\{L\}\_\{\\text\{cls\}\}=\-\\frac\{1\}\{N\}\\sum\_\{i=1\}^\{N\}\\left\[w\_\{\+\}\\,y\_\{i\}\\log\\hat\{p\}\_\{i\}\+\(1\-y\_\{i\}\)\\log\(1\-\\hat\{p\}\_\{i\}\)\\right\]\(3\)
wherew\+=N0/N1w\_\{\+\}=N\_\{0\}/N\_\{1\}is the ratio of negative to positive samples\. The output of Stage 1 is a binary risk label\.

### IV\-CStage 2: Time\-to\-Event Regression

Stage 2 uses Time\-Aware Transformer B with regression head, which is trained separately and is not weight\-shared with Transformer A\. This stage uses only the 29 label 1 patients remaining after cohort filtering\. Unlike the classification pipeline, the regression pipeline does not reuse saved day\-level embeddings from Stage 1\. Instead, Transformer B operates directly on raw preprocessed chunks and predicts the time to event, defined here as the time to ICU\-level exacerbation, which we refer to here as days until exacerbation \(stored in the code ascountdown\_days\_target\)\.

Following the right branch of Figure[2](https://arxiv.org/html/2608.19578#S4.F2), the regression branch converts raw sequences into chunk\-level embeddings using approximately 10\-minute windows\. The regression head then maps each chunk representation to a scalar TTE target:

y^reg=g⁡\(𝐳chunk\)\\hat\{y\}\_\{\\text\{reg\}\}=g\(\\mathbf\{z\}\_\{\\text\{chunk\}\}\)\(4\)
whereggis a regression head\. Targets are transformed bylog⁡\(1\+days\)\\log\(1\+\\text\{days\}\)and min\-max scaled to\[0,1\]\[0,1\]\. The regression model is trained with mean squared error \(MSE\) loss on the scaled targets:

ℒreg=1N​∑i=1N\(y^i−yi\)2\\mathcal\{L\}\_\{\\text\{reg\}\}=\\frac\{1\}\{N\}\\sum\_\{i=1\}^\{N\}\(\\hat\{y\}\_\{i\}\-y\_\{i\}\)^\{2\}\(5\)
At inference, the inverse transforms recover predicted days until AECOPD\. The deployment logic follows the two\-stage workflow shown in Figure[2](https://arxiv.org/html/2608.19578#S4.F2): each rolling seven\-day window is first processed by Stage 1\. If Stage 1 predicts label 1, the patient is passed to Stage 2, which outputs the TTE estimate; an alert is triggered when the predicted TTE is less than 3 days\. If Stage 1 predicts label 0, no TTE regression is performed for that window, and the system continues monitoring the patient with the next rolling seven\-day window\.

### IV\-DTraining Details

Transformer A and Transformer B use the same Time\-Aware Transformer architecture family but are trained as two fully separate models with different data splits, objectives, and checkpoints\. Transformer A is trained for classification on all 85 patients, whereas Transformer B is trained only on the 29 label 1 patients used for TTE regression\. For example, the 32\-dimensional transformer uses 4 attention heads, a feed\-forward hidden dimension of 128, and 2 encoder layers\. The Adam optimizer is used with learning rate10−310^\{\-3\}and weight decay10−510^\{\-5\}\. The 6,000\-row chunk size was selected to fit GPU memory and preserve roughly 10 minutes of continuous waveform context\. The embedding dimensionsd∈\{32,64,128\}d\\in\\\{32,64,128\\\}were evaluated to balance model capacity and computational cost\. AReduceLROnPlateauscheduler halves the learning rate after 10 epochs without improvement on the validation metric\. Training proceeds for a maximum of 100 epochs with early stopping \(patience = 10\)\. Mixed\-precision \(float16\) training viatorch\.cuda\.ampis used throughout\.

## VExperiments and Results

TABLE I:Stage 1 classification: test\-set F1 \(label 1\) with 95% bootstrap CIs for the raw ventilator dataTABLE II:Stage 1 classification: test\-set F1 \(label 1\) with 95% bootstrap CIs for the jump\-point baseline### V\-AExperimental Setup

All experiments use the cohort described in Section[III](https://arxiv.org/html/2608.19578#S3)\. We report the two stages of the proposed pipeline separately and then summarise the final combined configuration\. For Stage 1 classification, the 85\-patient cohort is divided into stratified training, validation, and test sets\. Hyperparameters are selected by stratified 5\-fold cross\-validation on the combined train \+ validation subset, using F1 score on the positive class \(label 1\) as the primary selection metric\. We compare three embedding dimensions \(d∈\{32,64,128\}d\\in\\\{32,64,128\\\}\) under two input settings:withtime, in which Time2Vec elapsed\-time encoding is included in the transformer input, andnotime, in which that explicit temporal encoding is removed\.

For Stage 2 regression, training is restricted to the 29 label 1 patients because only these patients have a defined time\-to\-event \(TTE\) target\. The regression branch uses a 19/5/5 train/validation/test split\. Performance is reported on the held\-out test set after all model choices are fixed\.

### V\-BStage 1 Classification Results

Table[I](https://arxiv.org/html/2608.19578#S5.T1)summarises the Stage 1 classification results\. We observe a clear and consistent pattern: explicit temporal encoding substantially improves classification performance across all model configurations\. Across all three embedding dimensions, thewithtimemodels outperform their correspondingnotimeversions, often by a wide margin\. At 32 dimensions, the bestwithtimemodel is logistic regression with F1 = 0\.91 and a 95% CI of 0\.67,1\.00, whereas the bestnotimemodel at the same dimension reaches only F1 = 0\.57\. At 64 and 128 dimensions, severalwithtimemodels achieve perfect scores on the fixed test split\. We interpret this pattern as likely overfitting within the small held\-out cohort, and we expect a larger patient sample to provide a more reliable basis for model selection\.

For comparison, we evaluate the jump\-point baseline from a prior study by members of the current author team\[[13](https://arxiv.org/html/2608.19578#bib.bib13)\], in which raw waveform segments are compressed into 3\-dimensional jump\-point representations before being passed to a time\-aware transformer classifier\. Table[II](https://arxiv.org/html/2608.19578#S5.T2)shows that the jump\-point baseline reaches best F1 values up to 0\.89, whereas our best raw\-waveformwithtimeStage 1 models in Table[I](https://arxiv.org/html/2608.19578#S5.T1)perform better on the fixed test split\. More importantly, the jump\-point representation is inherently limited to classification and cannot directly support the continuous time\-to\-event estimation required in Stage 2, whereas our approach handles both stages within a unified raw\-waveform framework\.

To test whether the classifiers behave sensibly away from the final 7\-day pre\-event window, we apply the same Stage 1 models to the first 7 days of each patient’s 30\-day recording window, defined as the initial 7 days starting from the first recorded time when the patient used the home ventilator, and treat those earlier windows as expected label 0 inputs\. Table[III](https://arxiv.org/html/2608.19578#S5.T3)summarises strong and weak models at each embedding dimension\.

The contrast between Tables[I](https://arxiv.org/html/2608.19578#S5.T1)and[II](https://arxiv.org/html/2608.19578#S5.T2)also informs our final Stage 1 choice\. Within the 32\-dimensional setting, logistic regression gives the strongest non\-degenerate result in Table[I](https://arxiv.org/html/2608.19578#S5.T1), with F1 = 0\.91 and 95% CI 0\.67,1\.00\. XGBoost is the next\-strongest 32\-dimensionalwithtimealternative at F1 = 0\.80 and remains stable in the first\-7\-day check\. Although logistic regression gives the best positive\-class F1 on the final\-window test set, its weak behavior on the early\-window stability check motivates retaining XGBoost as a complementary secondary classifier\. We therefore use the 32\-dimensionalwithtimesetting with logistic regression as the primary Stage 1 classifier and XGBoost as a secondary classifier for stability verification\.

TABLE III:Cross\-window stability check on the first 7 days of each patient’s 30\-day recording window
### V\-CStage 2 Regression Results

TABLE IV:Stage 2 regression: test\-set RMSE\(Days\), MAE\(Days\), and R2with 95% bootstrap CIs for the raw ventilator dataModelRMSEMAER2Time\-Aware Transformer32dim1\.16 \[0\.97,1\.34\]1\.04 \[0\.86,1\.21\]0\.68 \[0\.51,0\.76\]64dim1\.00 \[0\.85,1\.14\]0\.87 \[0\.70,1\.03\]0\.76 \[0\.62,0\.84\]128dim1\.04 \[0\.87,1\.19\]0\.91 \[0\.74,1\.07\]0\.74 \[0\.58,0\.83\]Baselines \(all embedding dimensions\)Mean2\.05 \[1\.75,2\.34\]1\.80 \[1\.45,2\.13\]0\.00 \[−\-0\.16,0\.00\]Median2\.05 \[1\.74,2\.33\]1\.79 \[1\.42,2\.15\]0\.00 \[−\-0\.16,0\.00\]Ridge2\.25 \[1\.87,2\.59\]1\.96 \[1\.57,2\.33\]−\-0\.20 \[−\-0\.63,−\-0\.01\]XGBoost2\.12 \[1\.65,2\.55\]1\.76 \[1\.37,2\.17\]−\-0\.06 \[−\-0\.49,0\.21\]

Table[IV](https://arxiv.org/html/2608.19578#S5.T4)reports the Stage 2 regression results on the label 1 patients\. These test\-set results are derived from the leave\-one\-patient\-out cross\-validation \(LOPO\-CV\) style evaluation\. We first compare the three Time\-Aware Transformer regression models and then report non\-transformer baselines built from per\-day waveform statistics\. Among the transformer settings, we select the 64\-dimensional model because it achieves the lowest RMSE and MAE and the highestR2R^\{2\}with bootstrap confidence intervals reported in the table\. All transformer variants also outperform the summary\-statistic baselines, whoseR2R^\{2\}values are near zero or negative\. The mean and median baselines produce RMSE values near 2\.05 days andR2R^\{2\}values close to zero, indicating that simple central\-tendency predictors explain little patient\-specific TTE variation\. Ridge regression performs worse, with RMSE = 2\.25 days and negativeR2R^\{2\}, suggesting that the summary features do not support a reliable linear mapping to TTE in this cohort\. XGBoost is the strongest non\-transformer baseline but still remains well below the 64\-dimensional transformer, which supports using the raw\-waveform temporal model rather than only aggregated waveform statistics\.

Based on these results, we use the 64\-dimensional model as our Stage 2 regression model\. It achieves RMSE = 1\.00 days \(95% CI 0\.85,1\.14\), MAE = 0\.87 days \(95% CI 0\.70,1\.03\), andR2R^\{2\}= 0\.76 \(95% CI 0\.62,0\.84\)\. The 128\-dimensional model remains close but does not improve on the 64\-dimensional setting\.

To translate the regression output into a clinically usable alert, we evaluate thresholds from 1 to 5 days on all 29 label 1 patients\. Table[V](https://arxiv.org/html/2608.19578#S5.T5)suggests that a threshold of<3<3days provides the most balanced trade\-off among early warning sensitivity, alert precision, and specificity in this cohort\. At this threshold, sensitivity is 0\.96, specificity is 0\.70, PPV is 0\.72, and NPV is 0\.96\. Stricter thresholds reduce PPV, whereas more relaxed thresholds increase sensitivity at the cost of a much heavier false\-alert burden\.

TABLE V:Stage 2 alert threshold: sensitivity, specificity, PPV, and NPV on the 29 label\-1 patients \(embed\_dim=64\)This threshold analysis is consistent with the patient\-level example in Figure[3](https://arxiv.org/html/2608.19578#S5.F3)\. This figure is shown as an illustrative prediction for one label 1 patient\. For the illustrated test patient, the prediction error narrows as the event approaches, with the most accurate estimates in the final 3 days before exacerbation\.

![Refer to caption](https://arxiv.org/html/2608.19578v1/Figures/tte_examples_32_64.png)Fig\. 3:Illustrative time\-to\-event prediction example for one representative test patient, not an averaged trajectory\. The same patient is evaluated with the 32\-, 64\-, and 128\-dimensional time\-aware regression models\. The x\-axis is shown in reverse order from 6 to 0 days before event\.
### V\-DCombined Pipeline Performance

The final two\-stage configuration combines what we view as the most defensible Stage 1 setting with the strongest Stage 2 regression model\. Specifically, Stage 1 uses the 32\-dimensional withtime transformer embedding, with logistic regression as the primary classifier and XGBoost as a secondary classifier for stability verification, and Stage 2 uses the 64\-dimensional time\-aware regression model\. In deployment, a patient is first assigned to label 0 or label 1 from the last 7 days of raw pressure and flow waveforms\. Patients predicted as label 0 receive no alert\. Patients predicted as label 1 are passed to Stage 2, which outputs the estimated remaining time to event and raises an alert when predicted TTE is below 3 days\.

This final combination reflects the different requirements of the two stages\. For Stage 1, we prioritise a conservative and interpretable operating point rather than the most optimistic fixed\-split score, which leads us to the 32\-dimensional logistic regression model while retaining XGBoost as a secondary stability check\. For Stage 2, the 64\-dimensional transformer gives the best held\-out TTE accuracy and supports a practical 3\-day alert threshold\. Overall, we believe the pipeline suggests that 7 days of raw home\-ventilator waveforms can support both high\-risk screening and short\-horizon event\-timing estimation in a single clinically oriented framework\.

## VIDiscussion

### VI\-AClinical Implications

We design this framework to transform raw home ventilator data into two clinically actionable outputs: \(1\) a binary risk flag indicating whether a patient is trending towards a severe event, and \(2\) a time\-to\-event estimate of days remaining before the predicted event\. In our experiments, the average lead time is approximately three days\. We believe this window allows clinicians to intensify therapy, arrange a clinic visit, or prepare for potential hospital transfer\. Such actions have been shown to reduce exacerbation severity and length of stay\[[15](https://arxiv.org/html/2608.19578#bib.bib1)\]\.

A key practical contribution of this study is the design of the two\-stage model, which first applies column selection to rawpressureandflow, then performs classification, and finally time\-to\-event regression\. Low latency means that the framework relies on continuously available home ventilator waveforms instead of delayed clinical or laboratory measurements\.

This pressure–flow focus is clinically motivated\. Pressure and flow are the two ventilator waveforms most routinely inspected at the bedside, and they directly reflect respiratory mechanics, patient effort, triggering/cycling behavior, and air trapping\[[6](https://arxiv.org/html/2608.19578#bib.bib4),[3](https://arxiv.org/html/2608.19578#bib.bib5),[5](https://arxiv.org/html/2608.19578#bib.bib6)\]\. In COPD specifically, flow\-based measures such as peak expiratory flow have also been associated with exacerbation detection and hospitalization assessment\[[1](https://arxiv.org/html/2608.19578#bib.bib7),[2](https://arxiv.org/html/2608.19578#bib.bib8)\]\. Transformer inference over a 6,000\-row chunk requires only a few seconds on GPU\. From a Human\-Machine Systems perspective, our two\-stage model can reduce reliance on delayed laboratory measurements and serve as a decision\-support tool for prioritizing high\-risk patients, while leaving final clinical judgment to the clinicians\.

### VI\-BLimitations

Several limitations must be acknowledged\. The cohort contains 87 patients with an approximately 2:1 class imbalance, which is small by deep learning standards\. Hyperparameter optimization was performed with 5\-fold cross\-validation on the combined training and validation set to reduce overfitting risk, but the 22\-patient test set still provides limited statistical power\. Baseline demographic characteristics were not available because of privacy restrictions\.

The current model uses only two input columns,flowandpressure\. This restriction is intentional rather than arbitrary, because these are the primary ventilator scalars used in routine waveform interpretation and capture much of the information most relevant to obstruction, resistance, and patient–ventilator interaction\[[6](https://arxiv.org/html/2608.19578#bib.bib4),[3](https://arxiv.org/html/2608.19578#bib.bib5),[5](https://arxiv.org/html/2608.19578#bib.bib6)\]\. Using only two channels also improves GPU efficiency and keeps training and inference computationally manageable on long raw waveform sequences\.

External validation is also challenging in this setting\. As illustrated by the waveform example in Figure[1](https://arxiv.org/html/2608.19578#S3.F1), our ventilator recordings are sampled at 5 readings per second, which preserves within\-breath shape and rapid cycle\-to\-cycle variation inflowandpressure\. Many public datasets either use very different devices, different waveform definitions, or much lower and incompatible sampling schemes\. Hospitals and device manufacturers should standardize ventilator waveform formats and collect higher\-frequency data to support more reliable external validation\.

Finally, due to the structure of the time\-aware transformers, model interpretability remains limited, and its predictions should be used only as decision support while clinicians make the final clinical decisions\.

## VIIConclusion

This paper presented the Two\-Stage AECOPD Time\-Aware Transformer Model for prediction from home ventilator data over a 7\-day pipeline\. The final system uses rawpressureandflowwaveforms as input\. Our selected configuration combines a 32\-dimensional time\-aware embedding with logistic regression as the primary Stage 1 classifier and XGBoost as a secondary classifier for stability verification, together with a 64\-dimensional time\-aware transformer regression model for Stage 2 time\-to\-event estimation\. On the held\-out test set, the selected Stage 1 classifier achieves F1 = 0\.91 for the high\-risk group \(label 1\), and the selected Stage 2 regression model achieves RMSE = 1\.00 days, MAE = 0\.87 days, andR2R^\{2\}= 0\.76\.

In our view, these results suggest that the framework can distinguish high\-risk patients and provide short\-horizon timing information once a patient is flagged as high risk\. Compared with the jump\-point baseline, we find that the raw\-waveform approach gives stronger classification performance while preserving the temporal continuity required for regression\. Overall, we believe the model supports clinically actionable home monitoring over the most recent 7\-day window, although larger cohorts are still needed to confirm its generalizability\. By combining two\-stage prediction with continuous home ventilator monitoring, this framework may support more efficient early identification and intervention for telemedicine and aging\-in\-place care\.

## References

- \[1\]J\. Cen, H\. Ma, Z\. Chen, L\. Weng, and Z\. Deng\(2019\)Monitoring peak expiratory flow could predict COPD exacerbations: a prospective observational study\.Respiratory Medicine148,pp\. 43–48\.External Links:[Document](https://dx.doi.org/10.1016/j.rmed.2019.01.010)Cited by:[§III\-B](https://arxiv.org/html/2608.19578#S3.SS2.p2.1),[§VI\-A](https://arxiv.org/html/2608.19578#S6.SS1.p3.1)\.
- \[2\]J\. Cen and L\. Weng\(2022\)Comparison of peak expiratory flow \(PEF\) and COPD assessment test \(CAT\) to assess COPD exacerbation requiring hospitalization: a prospective observational study\.Chronic Respiratory Disease19,pp\. 14799731221081859\.External Links:[Document](https://dx.doi.org/10.1177/14799731221081859)Cited by:[§III\-B](https://arxiv.org/html/2608.19578#S3.SS2.p2.1),[§VI\-A](https://arxiv.org/html/2608.19578#S6.SS1.p3.1)\.
- \[3\]E\. R\. Fernandez\-Pérez and R\. D\. Hubmayr\(2006\)Interpretation of airway pressure waveforms\.Intensive Care Medicine32\(5\),pp\. 658–659\.External Links:[Document](https://dx.doi.org/10.1007/s00134-006-0108-7)Cited by:[§III\-B](https://arxiv.org/html/2608.19578#S3.SS2.p2.1),[§VI\-A](https://arxiv.org/html/2608.19578#S6.SS1.p3.1),[§VI\-B](https://arxiv.org/html/2608.19578#S6.SS2.p2.1)\.
- \[4\]N\. M\. Foumani, C\. W\. Tan, G\. I\. Webb, and M\. Salehi\(2024\)Improving position encoding of transformers for multivariate time series classification\.Data Mining and Knowledge Discovery38,pp\. 22–48\.External Links:[Document](https://dx.doi.org/10.1007/s10618-023-00948-2)Cited by:[§I](https://arxiv.org/html/2608.19578#S1.p3.1),[§I](https://arxiv.org/html/2608.19578#S1.p5.1),[§II](https://arxiv.org/html/2608.19578#S2.p2.1),[§IV\-A](https://arxiv.org/html/2608.19578#S4.SS1.p2.1)\.
- \[5\]N\. T\. Hamahata, R\. Sato, and E\. G\. Daoud\(2020\)Go with the flow—clinical importance of flow curves during mechanical ventilation: a narrative review\.Canadian Journal of Respiratory Therapy56,pp\. 11–20\.External Links:[Document](https://dx.doi.org/10.29390/cjrt-2020-002)Cited by:[§III\-B](https://arxiv.org/html/2608.19578#S3.SS2.p2.1),[§VI\-A](https://arxiv.org/html/2608.19578#S6.SS1.p3.1),[§VI\-B](https://arxiv.org/html/2608.19578#S6.SS2.p2.1)\.
- \[6\]D\. R\. Hess\(2005\)Ventilator waveforms and the physiology of pressure support ventilation\.Respiratory Care50\(2\),pp\. 166–186\.External Links:[Document](https://dx.doi.org/10.4187/respcare.05500166)Cited by:[§III\-B](https://arxiv.org/html/2608.19578#S3.SS2.p2.1),[§VI\-A](https://arxiv.org/html/2608.19578#S6.SS1.p3.1),[§VI\-B](https://arxiv.org/html/2608.19578#S6.SS2.p2.1)\.
- \[7\]W\. Jiang, Y\. Chao, X\. Wang, C\. Chen, J\. Zhou, and Y\. Song\(2021\)Day\-to\-day variability of parameters recorded by home noninvasive positive pressure ventilation for detection of severe acute exacerbations in COPD\.International Journal of Chronic Obstructive Pulmonary Disease16,pp\. 727–737\.External Links:[Document](https://dx.doi.org/10.2147/COPD.S299819)Cited by:[§II](https://arxiv.org/html/2608.19578#S2.p1.1),[§III\-B](https://arxiv.org/html/2608.19578#S3.SS2.p4.1)\.
- \[8\]S\. M\. Kazemi, R\. Goel, S\. Eghbali, J\. Ramanan, J\. Sahota, S\. Thakur,et al\.\(2019\)Time2Vec: learning a vector representation of time\.arXiv preprint arXiv:1907\.05321\.External Links:[Document](https://dx.doi.org/10.48550/arXiv.1907.05321)Cited by:[§IV\-A](https://arxiv.org/html/2608.19578#S4.SS1.SSS0.Px1.p3.1),[§IV\-A](https://arxiv.org/html/2608.19578#S4.SS1.p2.1)\.
- \[9\]C\. T\. Kor, Y\. R\. Li, P\. R\. Lin, S\. H\. Lin, B\. Y\. Wang, and C\. H\. Lin\(2022\)Explainable machine learning model for predicting first\-time acute exacerbation in patients with chronic obstructive pulmonary disease\.Journal of Personalized Medicine12\(2\),pp\. 228\.External Links:[Document](https://dx.doi.org/10.3390/jpm12020228)Cited by:[§I](https://arxiv.org/html/2608.19578#S1.p1.1),[§I](https://arxiv.org/html/2608.19578#S1.p3.1),[§II](https://arxiv.org/html/2608.19578#S2.p1.1)\.
- \[10\]A\. Lenoir, H\. Whittaker, A\. Gayle, D\. Jarvis, and J\. K\. Quint\(2023\)Mortality in non\-exacerbating COPD: a longitudinal analysis of UK primary care data\.Thorax78\(9\),pp\. 904–911\.External Links:[Document](https://dx.doi.org/10.1136/thorax-2022-218724)Cited by:[§I](https://arxiv.org/html/2608.19578#S1.p1.1)\.
- \[11\]Y\. Li, Y\. Zhou, S\. Dai, J\. Wang, and X\. Wu\(2026\)Behavior\-guided identity learning for multiagent cooperation\.IEEE Systems, Man, and Cybernetics Letters\.External Links:[Document](https://dx.doi.org/10.1109/LSMC.2026.3696310)Cited by:[§II](https://arxiv.org/html/2608.19578#S2.p2.1)\.
- \[12\]K\. Liao, K\. Cheng, M\. Sung, Y\. Shen, C\. Chiu, C\. Liu, and S\. Ko\(2024\)Machine learning approaches for practical predicting outpatient near\-future AECOPD based on nationwide electronic medical records\.iScience27\(4\),pp\. 109542\.External Links:[Document](https://dx.doi.org/10.1016/j.isci.2024.109542)Cited by:[§II](https://arxiv.org/html/2608.19578#S2.p3.1)\.
- \[13\]W\. Qu, L\. Zheng, D\. Wang, J\. Wang, and H\. Pan\(2025\)Time\-aware transformer\-based prediction model for AECOPD\.Studies in Health Technology and Informatics329,pp\. 1089–1093\.External Links:[Document](https://dx.doi.org/10.3233/SHTI251007)Cited by:[§II](https://arxiv.org/html/2608.19578#S2.p3.1),[§V\-B](https://arxiv.org/html/2608.19578#S5.SS2.p2.1)\.
- \[14\]W\. Qu, D\. Wang, L\. Zheng, F\. E\. Alvarez, S\. Polasa, and J\. Wang\(2026\)Multimodal injury risk and performance prediction in tennis using weighted ensemble learning\.IEEE Systems, Man, and Cybernetics Magazine,pp\. 1–7\.Note:Early AccessExternal Links:[Document](https://dx.doi.org/10.1109/MSMC.2026.3685426)Cited by:[§II](https://arxiv.org/html/2608.19578#S2.p2.1)\.
- \[15\]R\. Rueda, E\. Fabello, T\. Silva, S\. Genzor, J\. Mizera, and L\. Stanke\(2024\)Machine learning approach to flare\-up detection and clustering in chronic obstructive pulmonary disease \(COPD\) patients\.Health Information Science and Systems12\(1\),pp\. 50\.External Links:[Document](https://dx.doi.org/10.1007/S13755-024-00308-4)Cited by:[§I](https://arxiv.org/html/2608.19578#S1.p1.1),[§I](https://arxiv.org/html/2608.19578#S1.p3.1),[§II](https://arxiv.org/html/2608.19578#S2.p1.1),[§VI\-A](https://arxiv.org/html/2608.19578#S6.SS1.p1.1)\.
- \[16\]M\. Tyrovolas, N\. D\. Kallimanis, and C\. Stylios\(2026\)Efficient total causal effect computation in fuzzy cognitive maps for scalable explainable artificial intelligence\.IEEE Systems, Man, and Cybernetics Letters\.External Links:[Document](https://dx.doi.org/10.1109/LSMC.2026.3692435)Cited by:[§II](https://arxiv.org/html/2608.19578#S2.p2.1)\.
- \[17\]S\. Wang, J\. Li, X\. Shi, Z\. Ye, B\. Mo, W\. Lin, S\. Ju, Z\. Chu, and M\. Jin\(2025\)TimeMixer\+\+: a general time series pattern machine for universal predictive analysis\.InInternational Conference on Learning Representations,Vol\.2025,pp\. 16980–17016\.Cited by:[§I](https://arxiv.org/html/2608.19578#S1.p3.1),[§I](https://arxiv.org/html/2608.19578#S1.p5.1),[§II](https://arxiv.org/html/2608.19578#S2.p2.1)\.
- \[18\]C\. Wu, G\. Li, C\. Huang, Y\. Cheng, C\. Chen, J\. Chien, P\. Kuo, L\. Kuo, and F\. Lai\(2021\)Acute exacerbation of a chronic obstructive pulmonary disease prediction system using wearable device data, machine learning, and deep learning: development and cohort study\.JMIR mHealth and uHealth9\(5\)\.External Links:[Document](https://dx.doi.org/10.2196/22591)Cited by:[§II](https://arxiv.org/html/2608.19578#S2.p1.1),[§III\-B](https://arxiv.org/html/2608.19578#S3.SS2.p4.1)\.
- \[19\]H\. Yin, K\. Wang, R\. Yang, Y\. Tan, Q\. Li, W\. Zhu, and S\. Sung\(2024\)A machine learning model for predicting acute exacerbation of in\-home chronic obstructive pulmonary disease patients\.Computer Methods and Programs in Biomedicine246,pp\. 108005\.External Links:[Document](https://dx.doi.org/10.1016/j.cmpb.2023.108005)Cited by:[§II](https://arxiv.org/html/2608.19578#S2.p3.1)\.
- \[20\]A\. Zeng, M\. Chen, L\. Zhang, and Q\. Xu\(2023\)Are transformers effective for time series forecasting?\.InAAAI Conference on Artificial Intelligence,Vol\.37,pp\. 11121–11128\.External Links:[Document](https://dx.doi.org/10.1609/aaai.v37i9.26317)Cited by:[§II](https://arxiv.org/html/2608.19578#S2.p3.1)\.

Similar Articles

Uncertainty-Aware Longitudinal Forecasting of Alzheimer's Disease Progression Using Deep Learning

arXiv cs.AI

This paper proposes a probabilistic framework for Alzheimer's disease progression forecasting that combines ordinal diagnosis prediction, multi-horizon trajectory generation, and decomposed uncertainty estimation using a Temporal Fusion Transformer encoder and an autoregressive Mixture Density Network. The model outperforms baselines on ADNI data, achieving near-nominal 90% credible interval coverage with clinically meaningful uncertainty signals.

EVOTS: Evolutionary Transformer Search for Time Series Forecasting

arXiv cs.LG

Introduces an evolutionary neural architecture search framework (EvoTS) for discovering task-adaptive Transformer-like models for multivariate time-series forecasting. The approach uses a modular genome representation and achieves competitive performance on ETT benchmark datasets.