{'fraction_non_alphanumeric': 0.021403464725081596, 'fraction_numerical': 0.0035149384885764497, 'mean_word_length': 5.243338557993731, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Smart-phone based electrocardiogram wavelet decomposition and neural network classification

This paper discusses ECG classification after parametrizing the ECG waveforms in the wavelet domain. The aim of the work is to develop an accurate classification algorithm that can be used to diagnose cardiac beat abnormalities detected using a mobile platform such as smart-phones. Continuous time recurrent neural network classifiers are considered for this task. Records from the European ST-T Database are decomposed in the wavelet domain using discrete wavelet transform (DWT) filter banks and the resulting DWT coefficients are filtered and used as inputs for training the neural network classifier. Advantages of the proposed methodology are the reduced memory requirement for the signals which is of relevance to mobile applications as well as an improvement in the ability of the neural network in its generalization ability due to the more parsimonious representation of the signal to its inputs.


Introduction
Early diagnosis of heart diseases enables patients to improve their quality of life through more effective treatments [1]. Analysis and classification of ECG signals can be particularly helpful to identify the initiation of heart conditions such as atrial fibrillation or flutter, multifocal atrial tachycardia, palpitations, paroxysmal supraventricular tachycardia, reasons for frequent fainting, slow heart rate (bradycardia) or ventricular tachycardia. Normally patients will be given a Holter monitor and wear the monitoring electrodes over a period of 24-48 hours. The data-logged signals are postprocessed and examined for cardiac beat abnormalities by doctors over the following days. There are restrictions, however, to how often one should perform such measurements. It is not uncommon for patients to complain to their doctors that the arrhythmias they suffered prior to the examination period were not present during the monitoring process, making early diagnosis more difficult. If one is prepared to wear the appropriately placed electrodes more often, it would be possible to use mobile phones as data logging devices directly. Bluetooth emitters such as the RN-42 from Microchip can provide a direct input from a small footprint battery-operated mobile data acquisition card to which the electrodes are interfaced. With the ever-increasing capabilities of smart-phones, portable ECG telemonitoring is likely to become a common feature for these devices, performing data-logging functionality for the ageing population. Beyond their data-logging functionalities, smart -phones can also use Multimedia Messaging Services (MMS) to enable the recorded signals to be sent directly for diagnosis by experts through current mobile networks or perform directly classification tasks. With the number of patients increasing due to current population sedative lifestyles and unhealthy eating habits, an increased expectation by patients for personalized medical treatment, as well as the envisaged wider proliferation of ECG data-logging devices, it is widely anticipated that there will soon be an overwhelming requirement for expert advice in healthcare service systems worldwide. As a consequence, there are pressures for devising automatic classifiers that could quickly and reliably prescreen for abnormalities before a referral to experts is made. A further aim of the proposed algorithms is to encourage the data-logging, analysis and classification of heart-beat patterns of subjects at regular intervals throughout their lifetime. Patterns from the same patient when they were healthy should provide a more accurate input to the classifiers for the early detection of abnormalities, direct comparison of benefits from diet and fitness regimes in the cardio-vascular system, or the identification of potentially harmful side-effects to the cardiovascular system from different treatments associated to specific drugs.
The current work discusses efficient decompositions of the ECG signals in the wavelet domain using Discrete Wavelet Transforms (DWTs) and investigates their further processing using neural network based classifiers. There are additional benefits in terms of memory storage requirements as well as a possible reduction in energy and transmission bandwidth requirements which are important from a smart-phone applications perspective that can also be explored through the proposed signal decomposition process. In the next two sections, identification of the QRS complex and ECG signal wavelet decompositions are discussed in more detail whereas in section 4, candidate neural network classifiers are considered.

Identification of the QRS complex in Electrocardiograms (ECG)
ECGs provide a graphic representation of the electrical activity of the heart muscle. It can be seen that the contraction of any heart muscle is associated with electrical changes (depolarization) and these changes can be detected by electrodes attached to the surface of the body and the ECG monitor [2]. The electrocardiogram (ECG) consists of the measurement of electrical activity on the body surface associated with myocardial contraction with respect to time. The standard ECG consists of 12 different leads that record the same electric events but from different viewpoints. Each cardiac cycle in the ECG is normally characterized by a sequence of deflections that make waveforms that are known as the P wave, the QRS complex, and the T wave. Contraction of the atria is associated with the ECG wave called the P wave and that wave represents the sequential activation (depolarization) of the right and left atria. There is a large deflection of the ECG signal when the ventricles are depolarised, that is commonly known as the QRS complex wave. The muscle mass of the atria is small when compared with that of the ventricles due to the P wave being smaller than the QRS complex. The T wave is associated with the return of the ventricular mass to its resting electrical state, which is called repolarisation. Figure 1 shows the basic shape of the normal ECG wave. The ECG can provide evidence and information that can help doctors to identify abnormalities in heart beat rates, arrhythmias, myocardial infarctions, atrial enlargements, ventricular hypertrophies, and bundle branch blocks. ECG records are essential for diagnosing heart diseases such as abnormal cardiac rhythm, abnormal cardiac conduction, ischemia of myocardium, and cardiac hypertrophy [3]. The diagram below shows typical records of a normal ECG signal taken from the European ST-T Database, depicting the presence of the characteristic QRS complex.

ECG signal decomposition using Discrete Wavelet Transforms (DWTs)
It is convenient to decompose ECG signals into time-frequency representations by using Discrete Wavelet Transforms (DWTs). The main advantage of the DWT is its great time and frequency localization ability, which enables it to reveal the local characteristics of the input signal. Discrete wavelet transforms have already been used by the ECG community because of their multi-resolution capabilities in detecting specific ECG characteristics e.g., the P wave, Q wave, or QRS complex and for cardiac beat analysis [4].
In the signal decomposition using the DWT, both a low pass filter bank (LPF) and a high pass filter bank (HPF) are used to generate time domain responses, these are convolved with the time domain ECG signal. Convolving the response function of the chosen filter (corresponding to a particular mother wavelet) with the signal provides an output which has different energy at different scales. Approximation coefficients relate to the low frequency components of the signal whereas detail coefficients relate to the higher frequency components in the signal. Wavelet decomposition using the DWT provides essentially a multi-resolution representation of the input signal. The user normally retains coefficients up to a particular scale whereas more detailed decompositions become redundant as their incorporation have a negligible effect on the signal. The convolution operation may be conveniently performed in the frequency domain where it is implemented through a simple multiplication process [5].
The ECG signals considered in this study were taken from the European ST-T Database [6]. The features in the ECG signal were extracted using DWTs from the sym3, db4 and db6 wavelet families. Six decomposition levels are more than sufficient to faithfully represent the ECG signals. As shown clearly in figure 2, blocks h[n] and g[n] represent the low-pass and high-pass filter responses (i=1,... 6) respectively, and the 2 operator denotes dyadic down-sampling. Approximation A i and Detail D i coefficients at each decomposition step are also shown. Only perfect reconstruction quadrature mirror filter banks (orthogonal transforms) are considered in this study because they fully preserve the information content in the signal. This is important from an algorithm certification perspective which is normally associated with the introduction of new algorithms for bio-medical software applications. The discrete wavelet transform can be calculated in a fast manner by using finite-impulse-response (FIR) filter banks. denote polyphasic components of ( ) ( ). Further algorithmic details of the proposed filter banks and a discussion of adaptive filter banks for the purpose are discussed in [7]. Results from multi-level decompositions are shown in Figure 3. Of particular interest to the current study is to identify the most parsimonious representation of the ECG signals in the wavelet domain so that a non-linear neural network classifier can perform the classification task directly in the wavelet domain. Further parameterization of the signals using adaptive wavelets using various adaptive filter banks [7] from the wavelet transform literature are considered in this project.

Discussion of candidate neural network classifiers
Classification of arrhythmias is a complex problem because of a strict requirement for avoiding falsepositive or false-negative results. There are many different approaches that can be used to analyze and classify ECG signals. There have been suggestions to use linear discriminant analysis [9], back propagation neural networks [10], self-organizing maps (SOM), learning vector quantization (LVQ) schemes [11], support vector machines (SVM) [12] and fuzzy or neuro-fuzzy algorithms [13]. A Recurrent Neural Network (RNN) was implemented and used as a basis for detection of the variability of ECG signals. RNN can be used to classify different types of ECG beats, such as normal beat, congestive heart failure beat, ventricular tachyarrhythmia beat and atrial fibrillation beat that are obtained from different ECG databases. A particular feature of all neural networks is their multilayered architecture. Multi-layered networks can be classified as feed-forward or feedback networks, according to their connectivity and the direction of information flow. The recurrence allows the network to remember cues from the past without complicating the learning excessively.
An Elman RNN is a network which in principle is set up as a regular feed-forward network. This means that in this type of network, all neurons in one layer are connected with all neurons in the next layer. Figure 4 depicts the architecture of this type of network, it can be seen that the neurons in the context layer (context neurons) hold a copy of the output of the hidden neurons. Moreover, the output of each hidden neuron is copied into a specific neuron in the context layer. RNNs can perform highly nonlinear dynamic mappings and thus, have temporally extended applications; whereas multi-layer feed-forward networks are confined to performing static mappings. This is an important advantage over other topologies for the current application. The strength of all connections between neurons are indicated with a weight, which is similar to a regular feed-forward neural network. At the start point, all weight values are chosen randomly and are then optimized during the training stage. The weights from the hidden layer to the context layer are set to one and are fixed because the values of the context neurons have to be copied exactly in an Elman network. Furthermore, the first output weights of the context neurons are set to be equal to half the output range of the other neurons in the network. Similar to regular feed-forward neural networks, the Elman network can be trained with gradient descent back propagation and optimization methods [14][15][16]. Elman networks are, therefore, good candidates for ECG signal classification. In recent years, there has been a growing interest in Continuous Time Recurrent Neural Networks (CTRNN). The popularity of these networks has been increasing because of their simplicity in simulating non-linear dynamical processes. Gallagher et al., (2005) suggested that CTRNNs should be seen as Hopfield type networks with unconstrained connection weight matrices [17]. The unconstrained connectivity provides an improvement in the generalization ability of the networks in the learning process, thus improving its classification ability. Furthermore, CTRNNs are capable of faithfully emulating neuronal activity, and as such they are a natural platform upon which a classifier can be built for ECG diagnostics. CTRNNs are made up of neurons and each neuron's activity can be described by the following expression: In the above expression, is the internal state of neuron , is a time constant of neuron i, N is the total number of neurons, is the strength of the connection from neuron to neuron , is a threshold/bias term, (x) =1 / (1+ -x ) is the standard non-linear (sigmoid) logistic activation function and ( ) represents a weighted sensory input with strength [17].
The main difference of a CTRNN over other kinds of neural networks is that the neurons could propagate a signal back through the network. Other neural networks considered in ECG are feed forward, which means that neuron signals could only be unidirectional. In addition, CTRNNs are more dynamic in terms of mimicking biological neuronal signal discharge processes. Moreover, CTRNNs are also deemed to be more efficient than other neural networks in terms of computations since they could be used to directly simulate each spike [18]. The CTRNN has additional advantages and computational efficiency over other discrete formulations. For example, using a discrete-time RNNs there is a considerable dependence of the resulting models on the sampling period used in the process, whereas for CTRNNs this can be varied without the need for re-training. Even in the presence of measurements noise the RNNs are capable of providing long-range predictions. Another advantage of CTRNNs is that if they are compared with other NN types such as feed forward neural networks (FFNNs), they have been shown to be more efficient in terms of the number of neurons required to model a dynamic system [19].

Conclusion
The current study proposes the use of smart-phones and a wireless communication network for monitoring patients at home or on the go over a prolonged period of time for the purpose of providing early diagnosis of heart conditions. Different wavelet decomposition schemes of ECG signals assuming different levels of approximation and detail for each wavelet family are considered and their suitability as inputs to neural network classifiers is investigated. The efficiency in parametrizing the wavelet coefficients using adaptive structures from the perspective of improving parsimony in each decomposition step and improving the reliability of the classification task is currently investigated and will be discussed at the conference. The results from different classifiers where the classification process is performed in the wavelet domain are also being considered.