# Reservoir Computing Based Echo State Networks for Ventricular Heart Beat Classification
## 2 Materials and Methods
### ECG Signal Preprocessing
#### 2.2.1 ECG Signal Denoising  
The contaminated signals contain numerous kinds of noises and artifacts, for instance, baseline wanderings and power line interference. There are several reasons for contamination; sometimes it occurs due to respiration or it also occurs when the patient moves while recording the physiological signals. There are two noises that are frequently highlighted in ECG signals baseline wandering and Power line interference [37] which are caused by respiration and the variation of 50% amplitude in peak to peak due to the 50 Hz, respectively. These noises and artifacts can create a problem in the extraction of information of interest (hidden features) from the raw ECG signal. Furthermore, a corrupt ECG signal can lead to the wrong diagnosis and it also has a major effect on the performance of algorithms during classification [37; 38; 39].  
\begin{table}
\begin{tabular}{c c} \hline \hline  & **Acronyms** \\ \hline MIT-BIH-AR & Massachusetts Institute of Technology-Beth Israel arrhythmia \\ MIT-BIH-SVDM & Massachusetts Institute of Technology-Beth Israel Hospital \\ Supraventricular Arrhythmia database \\ AHA & American Heart Association \\ ECG & Electrocardiogram \\ RC & Reservoir computing \\ MIoT & Medical Internet of Things \\ ANDSI/AAMI & American Nation Standards Institute/Association for the \\ Advancement of Medical Instrumentation \\ SVB & Supraventricular Beat \\ VB & Ventricular Beat \\ \hline \hline \end{tabular}
\end{table}
Table 1: List of acronyms used in this study.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Dataset** & **ECG Rec** & **Patients** & **Leads** & **SVB** & **VB** \\ \hline AHA & 155 & - & 2 & 317,612 & 32,403 \\ MIT-BIH-SVDB & 78 & - & 2 & 174,317 & 9953 \\ MIT-BIH-AR & 48 & 47 & 2 & 92,754 & 7803 \\ \hline \hline \end{tabular}
\end{table}
Table 2: The Description of Data sets used in this study.  
In the literature, there are many studies that are dedicated to innovating the algorithm for the filtering of noisy physiological signals for the highest performance of proposed models, for instance [39; 40], this study applies the same filtering technique as used in [8; 41], and these studies also addressed the similar aim of classification. The author believes that this is the major decision that helps to evaluate the performance of the current study with the existing methods. Therefore, to bridge this gap, we used a median filter on the ECG signal (x) which had \(n\)th length. The sliding window is created for the preprocessing of signals, so the length of the ECG signal \(n\) will be represented as the length of the sliding window. For every step, the median value will be calculated by using this equation:  
\[\left\{\begin{array}{c}\boldsymbol{x(i-\frac{n-1}{2}):x(i+\frac{n-1}{2})} \boldsymbol{\ \textit{if the value of $n$ is odd}}\\ \boldsymbol{x(i-\frac{n}{2}),x(i-\left(\frac{n}{2}\right)+1,\ldots,x(i+\left( \frac{n}{2}\right)-1)}\boldsymbol{\ \textit{if the value of $n$ is even}}\end{array}\right. \tag{1}\]  
This study used two median filters, one is for length \(n\) = 600 ms and the second one is for \(n\) = 200 ms. This study used the medfilt1 function of the Matlab [42] which implemented the one-dimensional filtering on the ECG signal. The main benefit of applying the medfilt1 function was that it eliminates the unwanted distortion from the signal.  
After the application of median filters for the baseline wandering outlier's removal, this study applied 12 th order finite impulse response (low pass filter) with the given cut-off frequency \(k\) = 35 Hz for removing the outliers which are related to power line interference by using the fir1 Matlab function [43]. The clear picture based on the results of these filters is reported in Figure 2a,b.  
Figure 1: Schematic representation of ventricular heartbeat classifier.