## 3 Materials and Methods  
This section presents the methodology followed to develop the hand gesture modeling system (HGM) based on surface electromyography signals (sEMG) and partial least squares multiresponse. It has been divided into eight subsections, each of them providing enough information to understand the method and the results section. A complete schematic of the operations followed to achieve HGM can be seen in Figure 1.  
This figure is meant to be a guide to the reader showing the processing and flow of data, and it follows the same notation and subsection names and numbering used in the rest of this paper. In it, each rectangle includes the numerical matrix resulting from applying the operation indicated in the access arrow and describes in detail in the subsection that bears the name and numbering indicated. The second subscript of the matrices indicates the dimension of each of them. For example, the vector of the class labels, \(\mathbf{L}\), and the signals sEMG, \(\mathbf{X}\), are divided according to the procedure described in Section 3.2 into the data to be used for training, \(\mathbf{L}_{TR}\) and \(\mathbf{X}_{TR}\), and for prediction, \(\mathbf{L}_{TS}\) and \(\mathbf{X}_{TS}\), respectively. Applying the coding procedure explained in Section 3.3 returns \(\mathbf{Y}_{TR}\), the matrix of the encoded response, which, together with \(\mathbf{X}_{TR}\), allows the coefficients of the PLS regression, \(\mathbf{\hat{B}}\), to be obtained. With this model, the calculated code matrix, \(\mathbf{\hat{Y}}_{TR}\), is obtained, which is  
Figure 1: Schematic of the hand gesture modelling method based on sEMG and PLS-ECOC. Steps 3.1 to 3.8 are addressed by the subsections of this section. The arrows box indicates iteration of the included steps in it. “\(c\)” stands for the number of binary learners in class codification and changes in each iteration. See the text above for an explanation of the other details. decoded into \(\mathbf{\hat{L}}_{TR}\) to compare it with the vector of the labels \(\mathbf{L}_{TR}\). Afterwards, the matrix of sensitivities and specificities, \(\mathbf{S}_{TR}\), is obtained in training. This process is iterated according to the procedure described in Section 3.7 to obtain the optimal PLS model, \(\mathbf{\hat{B}}_{OP}\). This model is applied to the test set, \(\mathbf{\chi}_{TS}\), and the vector of labels in prediction, \(\mathbf{\hat{L}}_{TS}\), is obtained. More details on the method can be consulted in [32]. The K-class model consists of \(K\) models, one for each class modelled. Class models are built and validated as a whole. Consequently, if a new class was added, the model would need to be built and validated again, obtaining a new (K + 1)-class model. \(I\) sEMG signals were recorded into \(K\) class, \(C_{1}\), \(C_{2}\),..., \(C_{K}\), each of them associated with each gesture type. The number of signals recorded for the \(j\)-th class is denoted by \(I_{j}\), so \(I=\sum_{j=1}^{K}I_{j}\). The result of applying the K-class model is summarized in the confusion matrix \(\mathbf{N}\)  
\[\mathbf{N}= \begin{pmatrix}n_{11}&n_{12}&\cdots&n_{1m}&\cdots&n_{1K}\\ n_{21}&n_{22}&\cdots&n_{2m}&\cdots&n_{2K}\\ \vdots&\vdots&\ddots&\vdots&\ddots&\vdots\\ n_{j1}&n_{j2}&\cdots&n_{jm}&\cdots&n_{JK}\\ \vdots&\vdots&\ddots&\vdots&\ddots&\vdots\\ n_{K1}&n_{K2}&\cdots&n_{Km}&\cdots&n_{KK}\\ \end{pmatrix} , \tag{1}\]  
where usual gesture classification algorithms verify the following: \(n_{jm}\) is the number of gestures belonging to class \(C_{j}\) which are inside the class model built for class \(C_{m}\). * \(I_{j}=\sum_{m=1}^{K}n_{jm}\), which means that the sum of the \(j\)-row elements of matrix \(\mathbf{N}\), Equation (1), is equal to the number of elements in the \(j\)-th class. * \(I=\sum_{j=1,m=1}^{K}n_{jm}\), which means that the sum of all the elements of matrix \(\mathbf{N}\), Equation (1), is equal to the total \(I\) signals recorded. However, when using class modelling, each signal can be assigned to no class or more than one class.