# Research on a PSO-H-SVM-Based Intrusion Detection Method for Industrial Robotic Arms
## 3 Intrusion Detection Method and Response Mechanism
### Hierarchical Support Vector Machine Based on PSO Algorithm  
Support vector machines (SVM) started out by solving binary classification problems, and later, as the problems became more complex, SVM needed to be extended to multi-classification problems [43]. There are generally two classification methods for multi-classification problems: one is to combine multiple binary classifiers to complete a multi-classification task, the other is to modify the objective function directly by combiningthe parameter solutions of multiple classification surfaces into one optimization problem. A one-time solution is performed, but this latter method has too many parameters in the optimization process and the training speed is slow, so it is generally not used. Combinatorial binary classifier methods include one-versus-rest SVM (1-v-r SVM), one-versus-one SVM (1-v-1 SVM) and hierarchical SVM (h-SVM). In this paper, the h-SVM approach is used, and assuming that there are k categories to be classified, then the h-SVM will construct \(\mathbf{k}-1\) classifiers to complete the classification task. First, all k categories are divided into two categories, and then subcategories are divided step by step until each individual category is divided [44]. In this paper, the operating states of a robotic arm are classified into five categories using the joint angle, velocity, acceleration and the closing angle of the end gripper as the feature vectors. Those five categories are: operating to the grasping point, performing grasping action, operating to the placing point, performing placing action and resetting the arm, and the corresponding state labels are state 1, state 2, state 3, state 4 and state 5. Then, 4 classifiers need to be constructed to classify the 5 types of operation states. Since all categories are firstly divided into two categories and then divided in turn, the problem faced is that there are many ways to build h-SVM. For example, it is possible to divide state 1 and state 2 into a category separate from state 3, state 4 and state 5, and also state 2 and state 4 into a category separate from state 1, state 3 and state 5, and the same principle applies to the next level of classification. Different construction methods will have different classification effects, so it is crucial to construct a reasonable h-SVM model. Think of the configuration of the classifier of the h-SVM as a tree. Starting at the top level of the tree, if the number of categories in the left and right subtrees of each tree node is not balanced, then it is called a \"skewed tree\"; if the number of categories in the left and right subtrees of a tree node is equal, then it is called a \"normal tree\"; the rest of the structure is somewhere in between. The more the tree shape is oriented like a \"normal tree\", the better the classification effect will be. Secondly, starting from the top level of the tree, it is necessary to make the accuracy of the classifier at the upper level as high as possible, that is, the two subclasses are as distinguishable as possible [45]. Following the above two principles, the structure of the h-SVM shown in Figure 2 was constructed, and the tree type is more inclined towards being a \"normal tree\". Classifier 1 classifies state 2 and state 4 and state 1, state 3 and state 5 into two classes, with state 2 and state 4 indicating that the grabbing and placing actions are more separable from the other three states. Similarly, classifier 2 classifies state 2 with state 4, classifier 3 classifies state 3 with state 1 and state 5 and classifier 4 classifies state 1 with state 5. The core of SVM lies in the kernel function, which maps the low-dimensional data into a high-dimensional space. The performance of a classification mainly depends on the choice of kernel function and the setting of hyperparameters. The universal Gaussian radial basis  
Figure 2: Schematic diagram of the structure of the h-SVM classifier.