Time Series Forecasting of ECG using Transfer Learning & Heart Arrhythmia Detection

ECG signals are the first level of diagnosis for any heart-related complications. They provide a quick and effective way to monitor the health of the cardiovascular system and detect any abnormalities. With the rise of portable ECG devices in the form of wearables and implantations, an overwhelming amount of data is being generated that needs to be appropriately analysed to tap into its full potential. Currently, this is primarily done manually by physicians, and hence there is a growing need for ECG predictive and abnormality detection models to assist physicians. We propose a transfer learning approach for time series forecasting of ECG signals. First, we pre-train an LSTM on the largest publicly available ECG dataset. Next, we finetune the model on a smaller MIT dataset. The model is further trained by a novel approach where drift in the prediction error is observed, and if it is greater than a threshold, the model is fitted on that sample. Further, the predicted signals are fed into another neural network that detects any heart abnormalities. The predictive analysis will help both the patient and physician as they will be better equipped to handle the crisis. The accompanying code can be found here.