Interpretable Pre-Trained Transformers for Heart Time-Series Data (2407.20775v2)
Abstract: Decoder-only transformers are the backbone of the popular generative pre-trained transformer (GPT) series of LLMs. In this work, we employ this framework to the analysis of clinical heart time-series data, to create two pre-trained general purpose cardiac models, termed PPG-PT and ECG-PT. We place a special emphasis on making both such pre-trained models fully interpretable. This is achieved firstly through aggregate attention maps which show that, in order to make predictions, the model focuses on similar points in previous cardiac cycles and gradually broadens its attention in deeper layers. Next, we show that tokens with the same value, which occur at different distinct points in the electrocardiography (ECG) and photoplethysmography (PPG) cycle, form separate clusters in high dimensional space. The clusters form according to phase, as the tokens propagate through the transformer blocks. Finally, we highlight that individual attention heads respond to specific physiologically relevent features, such as the dicrotic notch in PPG and the P-wave in ECG. It is also demonstrated that these pre-trained models are straightforward to fine-tune for tasks such as classification of atrial fibrillation (AF), and beat detection in photoplethysmography. For the example of AF, the fine-tuning took 11 minutes of computer time, and achieved the respective leave-one-subject-out AUCs of 0.99 and 0.93 for ECG and PPG within the MIMIC Perform AF dataset. In addition, the fine-tuned beat detector achieved a state-of-the-art F1 score of 98%, as well as uniquely providing a beat confidence level which acts as a signal quality estimator. Importantly, the fine-tuned models for AF screening are also fully explainable, with attention shifting to regions in the context that are strongly indicative of atrial fibrillation.
- A. Radford and K. Narasimhan, “Improving Language Understanding by Generative Pre-Training,” 2018.
- T. B. Brown et al., “Language Models are Few-Shot Learners,” arXiv: 2005.14165, 2020.
- OpenAI, “GPT-4 Technical Report,” arXiv: 2303.08774, 2024.
- A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin, “Attention is All you Need,” Advances in Neural Information Processing Systems, 2017.
- N. Arora and B. Mishra, “Origins of ECG and Evolution of Automated DSP Techniques: A Review,” IEEE Access, vol. 9, pp. 140 853–140 880, 2021.
- H. J. Davies, G. Hammour, M. Zylinski, A. Nassibi, L. Stanković, and D. P. Mandic, “The Deep-Match Framework: R-Peak Detection in Ear-ECG,” IEEE Transactions on Biomedical Engineering, vol. 71, no. 7, pp. 2014–2021, 2024.
- P. H. Charlton et al., “The 2023 Wearable Photoplethysmography Roadmap,” Physiological Measurement, vol. 44, no. 11, p. 111001, Nov 2023.
- H. J. Davies, P. Bachtiger, I. Williams, P. L. Molyneaux, N. S. Peters, and D. Mandic, “Wearable In-Ear PPG: Detailed Respiratory Variations Enable Classification of COPD,” IEEE Transactions on Biomedical Engineering, vol. 69, no. 7, pp. 2390–2400, 2022.
- H. Zhao, H. Chen, F. Yang, N. Liu, H. Deng, H. Cai, S. Wang, D. Yin, and M. Du, “Explainability for Large Language Models: A Survey,” arXiv: 2309.01029, 2023.
- S. Jain and B. C. Wallace, “Attention is not Explanation,” arXiv: 1902.10186, 2019.
- A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, A. Desmaison, A. Kopf, E. Yang, Z. DeVito, M. Raison, A. Tejani, S. Chilamkurthy, B. Steiner, L. Fang, J. Bai, and S. Chintala, “Pytorch: An imperative style, high-performance deep learning library,” in Advances in Neural Information Processing Systems 32. Curran Associates, Inc., 2019, pp. 8024–8035.
- A. Karpathy, “nanogpt video lecture,” https://github.com/karpathy/ng-video-lecture, 2023.
- W. Karlen et al., “Multiparameter Respiratory Rate Estimation From the Photoplethysmogram,” IEEE Transactions on Biomedical Engineering, vol. 60, no. 7, pp. 1946–1953, 2013.
- M. A. F. Pimentel et al., “Toward a Robust Estimation of Respiratory Rate From Pulse Oximeters,” IEEE Transactions on Biomedical Engineering, vol. 64, no. 8, pp. 1914–1923, 2016.
- M. Kachuee, M. M. Kiani, H. Mohammadzade, and M. Shabany, “Cuff-less High-Accuracy Calibration-Free Blood Pressure Estimation Using Pulse Transit Time,” in Proceedings of the 2015 IEEE International Symposium on Circuits and Systems (ISCAS), 2015, pp. 1006–1009.
- A. L. Goldberger, L. A. N. Amaral, L. Glass, J. M. Hausdorff, P. C. Ivanov, R. G. Mark, J. E. Mietus, G. B. Moody, C.-K. Peng, and H. E. Stanley, “PhysioBank, PhysioToolkit, and PhysioNet ,” Circulation, vol. 101, no. 23, pp. e215–e220, 2000.
- E. A. P. Alday, A. Gu, A. J. Shah, C. Robichaux, A.-K. I. Wong, C. Liu, F. Liu, A. B. Rad, A. Elola, S. Seyedi, Q. Li, A. Sharma, G. D. Clifford, and M. A. Reyna, “Classification of 12-Lead ECGs: the PhysioNet/Computing in Cardiology Challenge 2020,” Physiological Measurement, vol. 41, no. 12, p. 124003, Dec 2020.
- P. H. Charlton, K. Kotzen, E. Mejía-Mejía, P. J. Aston, K. Budidha, J. Mant, C. Pettit, J. A. Behar, and P. A. Kyriacou, “Detecting Beats in the Photoplethysmogram: Benchmarking Open-Source Algorithms,” Physiological Measurement, vol. 43, no. 8, p. 085007, Aug 2022.
- A. E. Johnson, T. J. Pollard, L. Shen, L.-w. H. Lehman, M. Feng, M. Ghassemi, B. Moody, P. Szolovits, L. Anthony Celi, and R. G. Mark, “MIMIC-III: A Freely Accessible Critical Care Database,” Scientific Data, vol. 3, no. 1, p. 160035, May 2016.
- A. Das, W. Kong, R. Sen, and Y. Zhou, “A Decoder-Only Foundation Model for Time-Series Forecasting,” arXiv: 2310.10688, 2024.
- C. Carlson et al., “Bed-based ballistocardiography dataset,” IEEE Dataport, 2020.
- C. Carlson, V.-R. Turpin, A. Suliman, C. Ade, S. Warren, and D. E. Thompson, “Bed-Based Ballistocardiography: Dataset and Ability to Track Cardiovascular Parameters,” Sensors, vol. 21, no. 1, 2021.
- H. J. Davies, Y. Miao, A. Nassibi, M. Khaleghimeybodi, and D. P. Mandic, “Segmented Error Minimisation (SEMI) for Robust Training of Deep Learning Models with Non-Linear Shifts in Reference Data,” in Proceedings of the 2024 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2024, pp. 5215–5219.
- R. S. Wijesurendra and B. Casadei, “Mechanisms of Atrial Fibrillation,” Heart, vol. 105, no. 24, pp. 1860–1867, 2019.
Paper Prompts
Sign up for free to create and run prompts on this paper using GPT-5.
Top Community Prompts
Collections
Sign up for free to add this paper to one or more collections.