# Surface Electromyography-Based Action Recognition and Manipulator Control
## 2 Method and Mathematical Background
### Selection of Classifier
#### 2.5.2 Genetic-Algorithm-Based Support Vector Machine (GA-SVM)  
Support Vector Machine (SVM) is specially applied to process data with limited samples, based on structural risk minimization. The penalty coefficient and kernel parameter are the key factors that affect the learning and generalization ability. The penalty coefficient acts on the ratio of empirical risk and confidence range in a given feature subspace. The kernel parameter affects the complexity of the same type of data in high-dimensional space. In parameter optimization, it is usually difficult to choose the best parameter through empirical or manual calculation, so grid division and Genetic Algorithm (GA) are commonly applied to realize the simultaneous optimization of the training parameters [39; 40].  
The grid division searches and compares all samples in the grid. However, if the number of grids is large, the search takes a long time. Fortunately, the GA runs much faster, as the GA searches in parallel and in a random order, which is different from the grid division. GA aims to create a population through random parameters, in light of [PERSON]'s theory of evolution, and the individuals in the population are encoded in the form of chromosome. First, the individuals are selected through the fitness function. The fittest survives and the unsuitable are eliminated. Second, crossover is executed, i.e., one or a part of the chromosome in two selected individuals is randomly picked to replace each other in corresponding positions. Third, mutation is carried out, namely a bit of the chromosome is changed randomly with a small probability. During the loop of the three operations, the fitness of the individual is constantly improved, until the optimal solution is found. As a result, the individuals of new population have a relatively higher fitness.  
We made the choice of Radial Basis Function (RBF) with penalty coefficient as the kernel function, so that it could map the sample to a higher dimensional space and handle the samples when the class labels had a nonlinear relationship with the eigenvalues as well. The parameters \((C,\gamma)\) (where \(C\) is the penalty coefficient and \(\gamma\) is the kernel parameter) required optimizing. The parameter optimization of SVM through GA are divided into 7 steps, and the complete flow is shown in Figure 2[41; 42; 43; 44]:(i) Input the training samples and preprocess the data via the normalization function and the eigenvalues of the training and test sets [0,1].  
(ii) Set the range of \(C\) and \(\gamma\). Others parameters such as maximum genetic generation, total number of populations, generation gap, encoding length, crossover rate, and mutation rate are also initialized.  
(iii) Encode the \(C\) and \(\gamma\) in binary form. Generate the initial population and the chromosomes that randomly represent the SVM parameters.  
(iv) Train the SVM model by the obtained parameters and through the use of leave-one-out cross-validation to evaluate the fitness. Then select the fitness function to calculate the fitness of the individual.  
(v) Iterate to find the optimal solution. If the fitness calibration is satisfied, the loop ends, or it repeats the selection, crossover, and mutation.  
(vi) Get the optimized SVM model by the best \(C\) and \(\gamma\).  
Figure 2: The complete flow of the GA–SVM. The core of the GA–SVM is using genetic algorithm to simulate the rule of the fittest survives, and the unsuitable are eliminated in nature, so as to search the best penalty coefficient and the kernel parameter. Ultimately, the optimal SVM model is formed.  
(vii) Send the training set to the optimized SVM model and obtain the optimal classification surface, and then input the test set for calculating the classification accuracy.