## 4 Proposition of Signal Classification Algorithms
### Presentation of the Classification System Based on the Neural Network  
In this part, an advanced approach containing a neural network algorithm will be analyzed. Two neural networks of the same number of nonlinear hidden layers were suggested. The first one was a Jordan recurrent neural network, and the other one was a feed-forward neural network. The choice of the number of layers, activation functions and the number of neurons in each layer was selected based on trials and errors using the expert approach. In order to carry out the procedure of the neural network training, a training data set consisting of input and output data had to be prepared. In the process of training input training set \(\mathbf{P}\) was used, which used a matrix of patterns \(p\) of the number of rows \(i\) = 32. The input values were integrated one-second EEG signal periods. The number of rows depends on the number of electrodes in the set. Output set \(\mathbf{T}\) was also necessary in the process of the neural network training. It consisted of the matrix of input patterns \(t\) of the number of rows \(j\) = 5. Value \(j\) results from five types of recognized signals, i.e., at rest, move forward, backward, to the right and to the left. Input and output training patterns included the same number of elements \(n\) = 250. The form of the data presented may be supported by the formulae [37]:\[\mathbf{P}=\begin{bmatrix}\mathbf{P}^{(1)}\\ \vdots\\ \mathbf{P}^{(1)}\end{bmatrix}=\begin{bmatrix}p_{1}^{(1)}&p_{2}^{(1)}&\ldots&p_{n}^ {(1)}\\ p_{1}^{(2)}&p_{2}^{(2)}&\ldots&p_{n}^{(2)}\\ \vdots&\vdots&\vdots&\vdots\\ p_{1}^{(31)}&p_{2}^{(31)}&\ldots&p_{n}^{(31)}\\ p_{1}^{(32)}&p_{2}^{(32)}&\ldots&p_{n}^{(32)}\end{bmatrix}. \tag{3}\]  
The matrix of output patterns used looks as follows:  
\[\mathbf{T}=\begin{bmatrix}\mathbf{t}^{(1)}\\ \vdots\\ \mathbf{t}^{(j)}\end{bmatrix}=\begin{bmatrix}t_{1}^{(1)}&t_{2}^{(1)}&\ldots&t_ {n}^{(1)}\\ t_{1}^{(2)}&t_{2}^{(2)}&\ldots&t_{n}^{(2)}\\ t_{1}^{(3)}&t_{2}^{(3)}&\ldots&t_{n}^{(3)}\\ t_{1}^{(4)}&t_{2}^{(4)}&\ldots&t_{n}^{(4)}\\ t_{1}^{(5)}&t_{2}^{(5)}&\ldots&t_{n}^{(5)}\end{bmatrix}. \tag{4}\]  
It was decided to choose a network consisting of four hidden layers of the neural network. In the first of them, tangensoidal function \((tansig(.))\) with 35 neurons was used. The second layer is the activation function \(logsig(.)\) consisting of 30 neurons. Radial basis function \((radbas(.))\) with 20 neurons constitutes the third layer. The last hidden layer is again the function \(tansig(.)\) with 15 neurons. The last part, the feed-forward neural network consists of a single layer containing five neurons with linear activation function \(purelin(.)\). In such a structure of the designed neural network, the linear part gives the effect of adding up nonlinear neuron activation functions. They can be found in the front layers. An output signal of the designed neural network classifying a signal will be according to formulae [37; 38; 39]:  
\[\begin{split} y=\mathbf{W}^{(5)}f^{(4)}\bigg{[}(\mathbf{W}^{(4)} \mathbf{f}^{(3)}+b^{(4)})(\mathbf{W}^{(3)}\mathbf{f}^{(2)}+b^{(3)})\\ (\mathbf{W}^{(2)}\mathbf{f}^{(1)}+b^{(2)})(\mathbf{W}^{(1)} \mathbf{u}+b^{(1)})\bigg{]}+b^{(5)}.\end{split} \tag{5}\]  
Figure 9 shows a reference diagram of the designed feed-forward neural network. Graphic interpretation of Equation (5) is shown in the same figure.  
Figure 9: The structure of the feed-forward neural network.  
According to Formula (5), on the reference graphics of network Figure 9, the vector of output data is marked with \(y\), and the network inputs, which are integrated values of the EEG signal from 32 electrodes, are marked with \(u\).  
The suggested neural network structure from diagram Figure 9 proved to be better than the other Jordan neural network tested. This fact is confirmed by the learning procedure results shown on characteristics Figure 10.  
The following section will present the classification results of integrated EEG signal periods as well as the results of robot control.