## 2 Materials and Methods
### The Inter- and Intra-Patient Paradigm
#### 2.2.2 Reservoir Computing Model  
Reservoir computing presents a powerful and efficient framework for various machine-learning tasks, particularly appealing for its computational efficiency, scalability, and flexibility. Due to these distinctive features, RCs have garnered attention in various fields such as control theory [56], classification schemes [57], modeling complex systems [58], and forecasting and prediction schemes [59; 60]. They are physically implemented through diverse technologies [61; 62]. Consequently, many software frameworks and libraries have been developed and published in the literature [63; 64].  
Three layers constitute conventional RC models, Figure 3. The input layer receives observed data \(X_{in}(n)\in\mathbb{R}^{D}\) at time step \(n\), with \(D=280\) being the feature number of each heartbeat. Before being broadcast to the reservoir nodes, the data undergoes a reshaping process \((c\times h)=(10\times 28)\) and then is projected onto the input weights \(W_{in}\).  
The core of the RC is the reservoir (encoder), which has a pool of N internal nodes or states (\(r(n)\)). In general, nodes are fully or partially interconnected by fixed random weights. In response to input data (input data projected onto the input weights), the nodes act like dynamical systems that evolve into novel high-dimensional space states \(r(n+1)\ \in\mathbb{R}^{c\times N}\), which are used as representative features of the corresponding input data. In other words, the reservoir acts as a feature extractor. Equations (1) and (2) are the differential equations that govern the evolution of the internal states for linear and nonlinear RC, respectively [50]:  
\[r(n+1) =(1-\alpha)r(n)+\alpha(Wr(n)+W_{in}X_{in}(n)+b) \tag{1}\] \[r(n+1) =(1-\alpha)r(n)+\alpha\tanh\left(Wr(n)+W_{in}X_{in}(n)+b\right) \tag{2}\]  
where \(\alpha\) is the decay rate of the node, and \(b\) is the bias vector. The hyperbolic tangent function tanh provides the RC with the required non-linearity. \(W_{in}\) (\(D\times N\)) denotes the input-weight matrix, and \(W\)(\(N\times N\)) represents the forward and recurrent connection weights between the reservoir's internal nodes.  
The \([W,W_{in}]\) (the encoder parameters matrix) are randomly initialized and kept constant during the training process.  
Figure 3: Basic architecture of traditional RC. Three layers, the input layer receives the input data. The reservoir extracts the features. The readout layer maps the extracted features representing the input into the corresponding class. ‘\(X_{in}\)’: input data (280 samples for each heartbeat). ‘\(W_{in}\)’: input weights (initialized randomly and fixed). ‘\(W\)’: reservoir’s internal weights (initialized randomly and fixed). ‘\(W_{out}\)’: output weights (the only trainable parameter). ‘SVM’: support vector machine. ‘MLP’: multilayer perceptron. c = 20, h = 28.  
The output layer (decoder) could be constructed by various readout mechanisms such as linear regression, support vector machine, or multilayer perceptron. Here, two techniques are investigated, namely linear Ridge regression and MLP.  
In the case of linear Ridge readout, the RC states are linearly combined through the output trainable weights (the only trainable parameters of the classifier) to map the input to the desired output (class labels), as outlined in Equation (3):  
\[y(n+1)=W_{out}r(n+1)+b_{out} \tag{3}\]  
where \([W_{out},b_{out}]\) are the decoder weights, and \(y(n)\) is the network output.  
When the readout is an MLP neural network, the weights \(W_{out}\) designs the MLP weights.