# Research on a PSO-H-SVM-Based Intrusion Detection Method for Industrial Robotic Arms
## 4 Experiments and Evaluation of Results
### Analysis of Results  
In this subsection, we analyze the results of the hyperparameter optimization and the classification effect of the proposed machine learning model PSO-H-SVM, and simulate the intrusion behavior of the attacker on a physical experimental platform, testing the effectiveness of the physical process logic intrusion detection method based on state classification and the role of the response mechanism. In this experiment, for the training dataset on robotic arm state classification, the experimentally completed dataset in Section 4.2 is used. To improve the accuracy of the classification model algorithm, the PSO-H-SVM classification model is proposed, multiple hierarchical classifiers are constructed, and the penalty parameter C and the kernel function parameter gamma are optimized by the PSO algorithm. The dataset is trained using the traditional SVM, PSO-SVM and PSO-H-SVM algorithms. Finally, we evaluate the merit of each machine learning model in terms of its classification accuracy [49], the accuracy being the ratio of the number of correctly predicted samples to the number of all samples; in order to calculate the accuracy, we need to know the true positives (TP), true negatives (TN), false positives (FP) and false negatives (FN) for each category, calculated as follows:  
\[\text{Accuracy}=\frac{\text{TP}+\text{TN}}{\text{TP}+\text{FP}+\text{TN}+ \text{FN}} \tag{11}\]  
When training with the traditional SVM algorithm, default values are used for the hyperparameters such that C = 1.0 and gamma = 'auto' ; for training with the PSO-SVM algorithm, we use the SVC class from the scikit-learn library to perform multi-categorization directly, set the attribute value of decision_function_shape to 'ovo', build  
Figure 6: (**a**) Joint angle data under normal condition. (**b**) Joint angle data under PPL attack. a classifier between each two categories, and finally, predict the categories by the \"vote method\". The initialization parameters for the PSO algorithm are set as follows: the number of individuals in the particle swarm is set to 120, the number of iterations is set to 20, the learning factors C\({}_{1}\) and C\({}_{2}\) are set to 2.0, the inertia weight is linearly decreasing, the search range of C is set to [0.001, 15], the search range of gamma is set to [0.01, 1]. For the PSO-H-SVM algorithm, four classifiers are constructed in order to classify five classes of operational states, and the four classifiers are optimized separately using the PSO algorithm. The classifiers are combined to construct a hierarchical support vector machine after parameter optimization is completed, and the initialization parameters in this algorithm are set as above for the PSO algorithm. The values of the hyperparameters and the classification accuracy of the traditional SVM, PSO-SVM and PSO-H-SVM algorithms are shown in Table 2. The classification accuracy of the traditional SVM algorithm reached 93.87%, the classification accuracy of the PSO-SVM improved significantly to 95.04%, and finally, the accuracy of the PSO-H-SVM algorithm improved further compared to PSO-SVM, to 96.02%. To further analyze the performance of the PSO-H-SVM algorithm, we use the confusion matrix to evaluate the classification effect of the algorithm. The confusion matrix obtained from the result of classifying the operating state of the robotic arm using the PSO-H-SVM algorithm is shown in Figure 7. It can be observed from the confusion matrix that state 1 and state 5 have the highest classification accuracy at over 97%, and the rest of the states have an accuracy of over 95%. By analyzing the accuracy rate, we can verify that the proposed PSO-H-SVM model has a good classification effect.