Characterising Abnormal Heart Rhythms as Syncopation Thomas Kaplan
Abnormal heart rhythms can be likened to musical syncopation - even the etymological relationship between syncopation and syncope (a potential sign of arrhythmia) dates back to the 16th century. This project characterises abnormal heart rhythms through simulated listening; studying the phase response of a rhythm perception model.
Introduction & Background
Syncopation has a long-running relationship with cardiology, in that the musical term (dating back to the late 16th century) stems in etymology from ‘syncope’ - to faint, a term born from pathology in the 15th century. Syncope itself can be caused by 'arrhythmia', irregular and abnormal heart rhythms, which are inherently syncopated. In light of the fatal risks associated with abnormal heart rhythms such as arrhythmia, this work explores how rhythm perception models can assist computational cardiology - deploying models that mimic human perception of complex (syncopated) rhythms.
Figure 0: Ectopic beats alongside a syncopated musical representation of the beats.
Moving from etymology to neuroscience; similar to the evidence that rhythm perception in music has a correlate in entrainment of cortical oscillation [6], there are believed to be numerous oscillatory systems in cerebral hemodynamics. [13] categorises these in six forms: (1) cardiac, ∼1Hz (2) respiratory, ∼0.25Hz (3) low frequency (LF) oscillations relating to muscle tissue of vessels, ∼0.1Hz (4) very low frequency (VLF) oscillations relating to nervous activity of vessels, ∼0.04Hz (5-6) VLF oscillations relating to functions in vascular lining, ∼0.01Hz and ∼0.007Hz. These include the enigmatic ‘Mayer Waves’, ∼0.1Hz oscillations in arterial pressure that are distinguishable from respiration and heartbeat yet correlated. Mayer Waves have been detected in various animals, and are discussed in relation to baroreflex, yet their origins are disputed. [3] suggested nonlinear methods may be required to further understand beat-by-beat oscillations in this kind of cardiovascular regulation, given the seeminly chaotic nature of some heartbeat intervals, which may reduce prominence of oscillations during linear analysis.
Gradient Frequency Neural Networks (GFNNs) are neurodynamic oscillator models, developed in response to the increasing evidence around nonlinearity in the auditory nervous system [5]. Following application of GFNNs to complex rhythm perception problems, such as pulse perception for syncopated stimuli [6], they seem like strong candidates for investigating rhythms in cardiology. These networks are formed of non-linear oscillators (following a canonical model) along some frequency gradient; and as a single layer, could be likened to an array of band-pass filters. Arranged densely for sensitivity, oscillators will entrain according to frequency patterns in the stimulus and their respective natural frequency. When layered (see Figure 1), a secondary gradient can act as a longer memory, excited by a first sensory gradient which acts as a buffer to transient short term changes in frequency. This has been likened to the layers of cognitive faculties involved in predictive coding models of rhythm perception [12].
GFNNs have been used in a variety of tasks, yet this is their first application in cardiology. This work explores their application through the analogies of interbeat syncopation and groove, but exploring the specific benefits of their nonlinear operation and parameterisation is out of the scope of this work.
Figure 1: Two-layer GFNN, where each circle represents a single nonlinear oscillator of a unique natural frequency for each layer. The first layer consumes external stimulus, and arrows represent connections between layers.
Isolated Syncopations - Abnormal Heartbeats
At the most granular level, syncopation manifests itself as an early or late beat (as per Figure 0), which is noticeable to a human listener as it disrupts a rhythm’s phase. Phase of oscillators in a GFNN should intuitively see similar disruptions to abnormal (e.g. premature) beats in a heart rhythm, and may provide a detailed response that characterises these beats in some useful way. To explore this, weighted phase was used, proposed in [4] as a reasonable metric for studying entrainment stability.
In order to explore this, a 1-layer network (see Model 1 in Appendix 1) was created, as these simple networks cannot entrain to highly syncopated rhythms, making them vulnerable to syncopated beats. For stimulus, 20-length R-R intevval (peak-to-peak timings from an ECG) windows from the Physiobank MIT Arrhythmia Database [2, 9] were processed as MIDI pulse-trains. This database is a common benchmark for ECG and R-R related classification problems, with control patients (normal sinus rhythm) and sufferers of various types of arrhythmia. 18 patients were used (commonly adopted training split from [1], excluding paced patients), for a total of ∼9 hours of R-R intervals.
In Figures 2 and 3, a normal and abnormal sample of heart rhythm are shown with their R-R intervals and weighted phase series. To further illustrate the regularity in phase response, linear regression is performed on each of the intervals. For normal rhythms, weighted phase forms a smooth sawtooth, reflecting excitement of the network around R-R impulse before a broadly uniform drift in oscillator amplitude. In the case of atrial premature beats ‘a’ and ‘A’, the previous beat’s interval is compressed (steeper gradient) and the delayed trailing beat reveals a quivering phase (lower R2). There is clear disturbance due to these beats, demonstrated crudely considering R2 means and standard deviations per-beat and across windows in Figure 4 and 5. For abnormal beats (ectopic as opposed to normal), and arrhythmic windows (e.g. atrial fibrillation, “(AFIB"), there is a noticeably lower mean R2 and greater standard deviation.
The world of abnormal heartbeat and rhythm classification is well trodden with high accuracy models, but this interestingly suggests GFNNs are sensitive to isolated syncopations and could be used to explore alternative classification approaches.
Figure 2: Stability in weighted phase for normal heart rhythm, for 20 R-R intervals, producing a sawtooth shape.
Figure 3: Instability in weighted phase for non-normal heart rhythm (contains arrhythmia and tachyarrhythmia) for 20 R-R intervals.
Figure 4: Mean per-beat linear regression for weighted phase response, grouped by AAMI classes (ectopic categories are typical of arrythmic periods).
Figure 5: Mean per-window linear regression statistics, based on rhythm categories observed. Reference available: https://physionet.org/physiobank/annotations.shtml
Groove - HRV and Low Frequency Oscillations
Regular patterns of inter-beat syncopation, be it through micro-timings or larger disruptions, help characterise a ‘groove’ in musical rhythm; often with a fixed underlying tempo. This is more interesting as a proposition for GFNNs in computational cardiology, in light of the low frequency oscillatory processes observed beneath noisy surface-level heartbeat intervals. GFNNs were mentioned in [12] as suitable models of the predictive coding process underpinning groove (metrical uncertainty) perception. Additionally, by virtue of their frequency gradient, seem like reasonable candidates to capture the numerous oscillatory components hidden in some stimulus - similar to some FFT process, but with the underlying nonlinearity.
Exaggerated Oscillations during Meditation
Heart rate variability (HRV) can be likened to groove in that it can occur in a cyclical (oscillatory) pattern, at a low frequency, with heartbeats often not falling on this pulse. In the Physiobank Exaggerated Oscillations database [2, 10], HRV is clearly demonstrated through meditative breathing, which was used here to explore GFNN entrainment to low frequency oscillations. Specifically, the 4 Kundalini Yoga participants were studied, in 300s R-R samples from pre-meditation and during meditation. Again, the R-R samples were converted to a MIDI pulse train. For this experiment, a 2-layer model (see Model 2 in Appendix 1) was used, for a secondary motor layer resilient to the heartbeats not on the HRV pulse.
Figure 6 demonstrates the second layer entrainment before and during meditation, with clear HRV detected during meditation. To illustrate the aforementioned difference of the two layers, Figure 7 shows the difference in amplitudes between the two layers at the end of the study. In all cases, there are evident peaks in the spectrogram reflecting the underlying HRV frequencies. Whereas for Y1 and Y2 this is a stable frequency between 0.05 and 0.1 Hz, Y3 sees a marginal increase in this frequency during the period, and Y4 has a gradual downward shift in frequency. Y3 and Y4 are also interesting in that unlike the others, they have multiple high-amplitude entrained components by the end of the window. Referring to Figure 7, it appears these occur at metric multiples, which would be explained by the harmonic connections in Model 2. In musical contexts this aspect of GFNNs is important, for example a representation of different metrical levels for a rhythm, yet in physiological settings might distort results.
This dataset provided an opportunity to confirm that a 2-layer GFNN is capable of entraining to an underlying pulse (arguably, a groove) in a given stimulus. However, the exaggerated nature of this dataset (through controlled breathing) does not reflect the rhythmic noise of normal ECG samples; and the origins of the low frequency oscillations are not of significant physiological interest.
Figure 6: GFNN entrainment spectrogram for 300s of Kundalini Yoga, left column is prior to meditation and the right column is during.
Figure 7: Final GFNN oscillator amplitudes for 300s of Kundalini Yoga. Note that 1 and 2 refer to the sensory and motor layers respectively.
Non-Exaggerated Oscillations
Unlike before where R-R intervals were converted to MIDI for GFNN stimulus, an ECG itself can be processed as a raw sound wave by a GFNN. In order to openly investigate presence of low frequency oscillations that characterise Mayer Waves, an ∼18 hour recording of a patient using a Holter device (QMUL un-published data) was analysed. The raw ECG was incredibly noisy, so required some pre-processing. First, a baseline was taken using two median filters of 200ms and 600ms (as per [8]). Second, smoothing was performed via a 15-sample median filter, followed by a 261-sample median filter relative to the original samples standard deviation; using 1D linear interpolation for removed samples in both cases (as per [11]). These stages of pre-processing can be seen in Figure 8. Due to difficulty in configuring a 2-layer model (see Model 3 in Appendix 1) to operate stably for windows exceeding 100s, a windowed approach was taken to analysis (100s windows with 75s overlap). Specifically, this was necessary as occasionally some feature in the stimulus would cause oscillators to reach significant amplitudes; rapidly causing the entire network to 'explode' in amplitudes and effectively break.
The windowed approach taken is problematic in that any persistent notion of GFNN entrainment is lost, and requires stitching together the multitude of spectrograms to try and decipher any high-level patterns. The last 25% of each window’s spectrogram was used, to try and mask the early stage in each window before oscillators have entrained. Figure 9 demonstrates a single window (180-280s) where a ∼0.1Hz frequency component is observed, a positive sign that relevant low frequency oscillations are measured. Figure 10 shows the complete stitched spectrogram over the ∼18 hour period.
Figure 10 begs more questions than it provides answers - throughout the recording, the sub 0.2Hz region is noisy, with no evident consistent pulses. Although this could be distorted by the windowed approach, it is also worth asking whether this is actually expected or not - potentially, heightened activity in this region is short-lived and often unecessary. Between ~00:20am and 4:30am, there is however a clear drop-off in LF/VLF activity, with peaks of HF energy emerging exactly around ~0.25Hz. Given the respiratory association with the HF component, it seems plausible that this is related to consistent breathing during sleep. Just before 9:30pm and 11pm, there are short-lived moments of high energy around 0.1Hz, and suggest suitable points of closer examination. Additionally, around 8pm there is a high energy component around 0.1Hz in isolation, following a lull in VLF energy. For example, these may be correlated with abnormal rhythm categories at surface-level, or their onset. Unfortunately it was out of the scope of this work to investigate these further.
This study presented issues in the lack of model stability, yet has potentially shed light on localised cases of high LF energy which may reflet the elusive Mayer Wave if correlated with other features of the ECG signal. Future work must focus on stablising the GFNN response, through adaptive frequency neural networks (AFNNs) [4] which deploy recurrent neural networks to predict tempo changes, or finer control over the beta (amplitude compressing) and epsilon (nonlinearity) parameters of the model. The latter is important in that it could demonstrate the utility of nonlinear models such as GFNNs.
Figure 8: ECG pre-processing illustrated, starting with a raw series before applying a series of median filters to (1) extract ECG baseline without R peaks and (2) smooth further down to underlying oscillations.
Figure 9: Entrainment at 0.1Hz to 100s ECG signal (from 18hr recording), in motor layer of a 2-layer GFNN. Potentially, an example of Mayer Waves.
Figure 10: Stitched spectrograms of motor layer entrainment of 2-layer GFNN, for entire 18hr ECG recording. Each window was 100s, with 75s overlap, and the final 25s of each window was plotted.
Conclusion & Future Work
GFNN have been used to study heart rhythms at two levels: (1) the surface-level of interbeat syncopation, representative of abnormal heart rhythms such as arrhythmia and (2) the underlying groove, representative of low-frequency heart rate and blood pressure changes stemming from potential neural oscillation. First, it was demonstrated that phase disruptions in a simple GFNN reflect syncopated beats, and can characterise abnormal heart rhythms - a potential approach for future classifiers. Second, it was demonstrated that low-frequency oscillations such as HRV can be detected using a multi-layer GFNN, similar to pulse percept in syncopated music. Finally, this concept was expanded to a large sample ECG, presenting numerous points for investigating where interesting LF/VLF oscillations may have been detected. As preliminary work, there is significant room for improving the application of GFNNs to heart rhythms, and most importantly this involves exploring the benefits of their nonlinearity. Other than exploring other stimuli such as blood pressure, it is crucial to produce a stable model for analysing entrainment of low frequency oscillations over time. This could involve more appropriate parameterisation (such as the nonlinear parameter), narrowing of frequency bands for studying specific oscillation types, or the deployment of adaptive frequency neural networks.
References
[1] P. Chazal, M. O’Dwyer, and R. B. Reilly. Automatic classification of heartbeats using ecg morphology and heartbeat interval features. IEEE Transactions on Biomedical Engineering, 51(7):1196–1206, 2004.
[2] A. L. Goldberger, L. A. N. Amaral, L. Glass, J. M. Hausdorff, P. Ch. Ivanov, R. G. Mark, J. E. Mietus, G. B. Moody, C.-K. Peng, and H. E. Stanley. PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals. Circulation, 101(23):e215–e220, 2000 (June 13).
[3] J. W. Hamner, R. J. Morin, J. L. Rudolph, and J.A. Taylor. Inconsistent link between low-frequency oscillations: R-r interval responses to augmented mayer waves. Journal of Applied Physiology, 90(4):1559– 1564, 2001.
[4] A. J. Lambert, T. Weyde, and N. Armstrong. Adaptive frequency neural networks for dynamic pulse and metre perception. In Proceedings of the 17th International Society for Music Information Retrieval Conference, ISMIR 2016, New York City, United States, August 7- 11, 2016, pages 60–66, 2016.
[5] E. W. Large, F. V. Almonte, and M. J. Velasco. A canonical model for gradient frequency neural networks. Physica D: Nonlinear Phenomena, 239(12):905 – 911, 2010.
[6] E. W. Large, J. A. Herrera, and M. J. Velasco. Neural networks for beat perception in musical rhythm. Frontiers in Systems Neuroscience, 9:159, 2015.
[7] E. W. Large, J. C. Kim, K. D. Lerud, and D. Harrell. GrFNN Toolbox: Matlab Tools for Simulating Signal Processing, Plasticity and Pattern Formation in Gradient Frequency Neural Networks. https://github.com/MusicDynamicsLab/GrFNNToolbox, 2014.
[8] V. Mondéjar-Guerra, J. Novo, J. Rouco, M. G. Penedo, and M. Ortega. Heartbeat classification fusing temporal and morphological information of ecgs via ensemble of classifiers. Biomedical Signal Processing and Control, 47:41 – 48, 2019.
[9] G. B. Moody and R. G. Mark. The impact of the mit-bih arrhythmia database. IEEE Engineering in Medicine and Biology Magazine, 20(3):45–50, 2001.
[10] C.-K Peng, J.E. Mietus, Y. Liu, G. Khalsa, P. S. Douglas, H. Benson, and A. L. Goldberger. Exaggerated heart rate oscillations during two meditation techniques. International Journal of Cardiology, 70(2):101 – 107, 1999.
[11] S. Rieger, S. Klee, and D. Baumgarten. Experimental characterization and correlation of mayer waves in retinal vessel diameter and arterial blood pressure. Frontiers in Physiology, 9:892, 2018.
[12] P. Vuust, M. J. Dietzand M. Witek, and M. L. Kringelbach. Now you hear it: a predictive coding model for understanding rhythmic incongruity. Annals of the New York Academy of Sciences, 1423(1):19–29, 2018.
[13] M. A. Yücel, J. Selb, C. M. Aasted, P.-Y. Lin, D. Borsook, L. Becerra, and D. A. Boas. Mayer waves reduce the accuracy of estimated hemodynamic response functions in functional near-infrared spectroscopy. Biomed. Opt. Express, 7(8):3078–3088, 2016.
Appendix 1 - GFNN Parameters
Note that all the networks below have a log-spaced frequency gradient, follow the "critical" oscillatory regime, and are implemented using the GrFNNToolbox [7] according to the models developed in GrFNNRhythm.
Model 1: 1 network with no connections internally, Fs=140Hz
Model 2: 2 networks with local and harmonic afferent/efferent/internal connections, Fs=8Hz
Model 3: 2 networks with local afferent/efferent/internal connections, Fs=8Hz