# Reservoir Computing Based Echo State Networks for Ventricular Heart Beat Classification
## 2 Materials and Methods
### Temporal Feature Extraction  
The aim of this study is to design a reliable and optimal classifier for ventricular heartbeat classification which can be useful for Medical IoT based on a single ECG lead. The other main focus of this study is to extract those features which should not contain more computational cost and should be easy to implement in the real time environment. Therefore, this study does not consider those signals for the feature extraction phase which has contamination in their parts. The characterization of normal heart beats (N + SVB) and abnormal heartbeats (A + VB) are well known and are also suggested by the medical specialists in the literature [45, 46]. (N + SVB) were distinguished by regular RR intervals, the presence of P-wave, and has a narrow QRS complex, whereas (A + VB) has shorter RR interval, the p-wave is not present, and it also has a wider QRS complex. Moreover, in this part of feature extraction, this study follows two types of methods; one is based on temporal feature extraction which is less expensive and easy to implement, however these features are lead independent yet useful for real-time implementation, therefore to overcome this inter-patient variability issue, this study used a second method by the name template matching. It is a patient adaptable and simple approach which measures the similarity between the input signal beat and template beat [47]. In the first method, the author computed the relevant attributes for the study's classifier; the six temporal features were computed from each segmented beat. 1. **The Previous R-R interval** is defined as the time duration between the current beat and previous beat. 2. **The Subsequent R-R Interval** is explained as the time duration between the current beat and subsequent beat. 3. **The Standard deviation of Successive Difference (SDSD)** is defined as the standard feature of physiological signals for arrhythmia classification. It is the difference between 10 consequent RR intervals [48]. 4. **The Average of RR-Interval**\(|\overline{\mathbf{beat}}|\) is defined as the average ratio of 10 consecutive RR intervals. Figure 4: Representation of QRS segmented area in the ECG signal. The Average Derivate of RR interval \(\left|\overline{\mathbf{Beat}}^{\prime}\right|\) is defined as the average ratio of the derivate of the RR interval, where the derivation of the segmented beat is calculated by using this central difference Equation (2). \[\left(\mathbf{f}(\mathbf{z})\approx\frac{\mathbf{f}(\mathbf{z}+\mathbf{h})-\mathbf{f}(\mathbf{z}-\mathbf{h})}{ \mathbf{2h}}\right) \tag{2}\]  
Based on clinical specialist advice, ventricular abnormal beat has a wider area of QRS complex and it also tends to rise and fall more than a normal beat. Therefore, the derivative area should have the lowest value. In contrast, in the second method, template matching was used to avoid the lead independency and inter-patient variability issues. The approach was quite simple and patient adaptable; the study used this approach to compare the ECG signal heart beats with the same class specific template in order to define the Pearson's correlation coefficients (PCC) between the input ECG signal and template beat. However, template beat was calculated by taking an average ratio of at least 50% beats in which 25% belongs to the normal beat and 25% belongs to the abnormal beats. After calculating the specific template beats for normal and abnormal, this method compared the current heartbeat with the template beat example which is shown in Figure 5.  
To this end, for the comparison of heartbeats in real time scenarios, we updated and calculated the template based on a real-time adaptation of the system. Assuming that doctors are using 10 s ECG strips which have around 15 heartbeats in every 10 s ECG strips, the new template is estimated and updated and also replaces the old beats from the template.