# SA-SVM-Based Locomotion Pattern Recognition for Exoskeleton Robot
## 2 Materials and Methods
### Locomotion Pattern Recognition  
#### 2.3.1 Support Vector Machine Classifier  
SVM is an excellent supervised learning method for solving regression analysis and classification problems [18]. SVM is an efficient classifier, which can replace the existing multi-layer perceptron, RBF neural network, polynomial network and other learning algorithms [19]. The basic model of SVM is a linear classifier for binary classification problems. Its principle is to find the hyperplane that maximizes the distance between two kinds of features in the feature space. Binary classifiers can extend multiple classifiers. For the K-class classification problem, these methods design only one objective function to train all K-binary support vector machines simultaneously and maximize the boundary between each class and the rest of the class. In the training of classification model, SVM introduces penalty factor \(C\) to the constraint conditions so that the training model has the fault-tolerant ability. The larger the \(C\), the lower the tolerance to the training sample error and the stronger the model fitting accuracy, but the poorer the generalization ability and the prone to over-fitting phenomenon. The smaller the \(C\) is, the higher the tolerance to the error of training samples. Although the model has a strong generalization ability, the fitting accuracy of samples decreases, which increases the empirical risk and is prone to underfitting. The dimension of the characteristic subspace is related to the kernel function \(\sigma\). The smaller the \(\sigma\), the finer the classification and overfitting is easy to occur. On the contrary, the coarser the category, the less fit is likely to occur. To obtain the optimal SVM classification model, finding the optimal \(C\) and \(\sigma\) is the key. The optimization problem of solving SVM can be expressed as:  
\[ \begin{split}\min\limits_{\omega}J(\omega,\xi)\frac{1}{2}|| \omega||^{2}+C\sum\limits_{i=1}^{m}\xi_{i}\\ s.t.\ y_{i}(\omega\Phi(x_{i})+b)\geq 1-\xi_{i},\xi_{i}\geq 0,i=1,2, \dots\end{split}  \tag{6}\]  
where \(C\) is the penalty factor, \(C>0\) ; \(\xi_{i}\) is the relaxation factor. In order to find the generalized optimal classification plane, it is necessary to consider the maximum classification interval and the minimum misclassification samples. In order to better solve, the KKT optimality condition is used to transform the equation into a duality problem by introducing Lagrange multiplier [20]. \[ \begin{split}\min\limits_{\omega,b,\xi}\max\limits_{\lambda,\mu}L (\omega,b,\xi,\lambda,\mu)=\frac{1}{2}||\omega||^{2}+C\sum\limits_{i=1}^{m} \xi_{i}+\\ \sum\limits_{i=1}^{n}\lambda_{i}\big{[}1-\xi_{i}-y_{i}\big{(} \omega^{T}x_{i}+b\big{)}\big{]}-\sum\limits_{i=1}^{n}\mu_{i}\xi_{i}\end{split}  \tag{7}\]  
where \(\lambda_{i},\mu_{i}\) is the Lagrange multiplier, \(\omega,b,\xi_{i}\) is the main problem parameter. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Order** & **Name** & **Score** \\ \hline
1 & \(F_{H}\) & 0.023 \\
2 & \(F_{B}\) & 0.016 \\
3 & \(\theta_{LK}\) & 0.014 \\
4 & \(\theta_{RH}\) & 0.012 \\
5 & \(\theta_{LA}\) & 0.007 \\
6 & \(\theta_{LH}\) & 0.003 \\
7 & \(\theta_{RK}\) & 0.000 \\
8 & \(\theta_{RA}\) & 0.002 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Comparison of feature selection results of the three locomotion patterns. Take the partial derivatives of the main problem parameters respectively and put them into the Lagrange function to get (8). \[\underset{\omega,b,\xi}{\text{min}}L(\omega,b,\xi,\lambda,\mu)=\sum\limits_{j=1}^ {n}\lambda_{i}-\frac{1}{2}\sum\limits_{i=1}^{n}\sum\limits_{j=1}^{n}\lambda_{i} \lambda_{j}y_{i}y_{j}\big{(}x_{i}\text{:}x_{j}\big{)} \tag{8}\]  
Minimizing results with only \(\lambda\) and no \(\mu\) and results will maximize \(\lambda\). \[