# Neural Network-Enhanced Fault Diagnosis of Robot Joints
## 4 Computational Experiments
### Experimental Evaluation of Single Size of Fault  
Because of the different tasks of each joint of the robotic arm, the neural network has different classification effects for databases built with different features, which means different fault diagnosis precision and accuracy, as shown in the table below (Table 9). As can be seen from the table, when meeting the requirement of a 95% accuracy rate under other conditions being the same, the three-feature fusion establishes the smallest data size, and only needs to sample each segment of the trajectory 600 times to obtain an \begin{table}
\begin{tabular}{l c c c c} \hline \hline
**Sampling Number** & **Number of Epochs** & **Layers** & **Accuracy (\%)** & **Cross-Entropy Loss** \\ \hline
300 & 500 & 9-13-13-7 & 91.21 & 0.8119 \\
600 & 400 & 9-13-13-7 & 95.92 & 0.7325 \\
1000 & 400 & 9-13-13-7 & 96.72 & 0.6964 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Network training results of joint diagnosis for robots. Size of joint angle error = 0.1\({}^{\circ}\) (three features). \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Configuration of Features** & **Size of Database** & **Size of Fault (\({}^{\circ}\))** & **Accuracy (\%)** \\ \hline Single Position & 70,000 \(\times\) 3 & 0.5 & 95.97 \\ Single Attitude & 35,000 \(\times\) 3 & 1.0 & 64.53 \\ Position and Attitude & 7000 \(\times\) 6 & 0.5 & 97.29 \\ Position, Attitude and Acceleration & 4200 \(\times\) 9 & 0.5 & 98.34 \\ \hline \hline \end{tabular}
\end{table} 
Table 9: Overview of neural network training results for different configurations of features. accuracy rate of 98.34%. And, although the neural network classification corresponding to the two-feature data is not as effective as that of the three-feature data, the accuracy also reaches 97.29%, which meets the previously proposed requirement of more than 95%. At the same time, the arithmetic power required to calculate the acceleration is larger, and it is necessary to find the derivatives of the rate of change of the neighbouring samples of each segment in the three directions, which is the second-order derivative, and this will increase the load of calculation considerably. So, the classification effect of the corresponding neural network with dual features will be evaluated. As an example, in the experiment corresponding to Table 7, when the number of samples is 1500, the group of experiments achieved a very high accuracy of 99.62%, but at the same time, the cross-entropy loss is also 0.1708, which can be noticed that the cross-entropy loss of each group of experiments is on the high side compared to the accuracy, and the network will be continuously evaluated below in conjunction with metrics such as the ROC curves and the confusion matrices, which is shown in Figures 10 and 11. The confusion matrix is usually presented for the results of a test set, to give an idea of how the model actually performs on unseen data. It shows the relationship between the individual categories predicted by the model and the actual categories, and the confusion matrix provides a clear view of how accurately the model predicts each category and when it misclassifies one category as another. When the number of samples per trajectory (category) is 1500, the corresponding 20% as a training set is 300. The 99.6% in the bottom right corner indicates the classification accuracy of the neural network, which means that there is a 99% probability that each classification is correct. The horizontal and vertical axes of the confusion matrix are the true and predicted labels, respectively. For data with label 0 (no faulty trajectory), the red box in the upper left corner indicates that the actual value is the same as the predicted value, i.e., true positive (TP), which is 297. The blue box on the left side indicates that the actual value is positive (False Positive, FP); in our example, three data with label 0 are predicted to have label 6, and the TN value is the sum of the values in the corresponding columns, except for the TP value, which is 3.