# Research Method for Ship Engine Fault Diagnosis Based on Multi-Head Graph Attention Feature Fusion
## 3 Case Study
### Network Parameter Setting
#### 3.3.3 Algorithm Performance Comparison  
In order to verify the validity of the proposed model in this paper, GCN, CNN, SVM, and BPNN algorithms are selected in the experiments in this subsection to compare the algorithm performance with the MPGANN model proposed in this paper. The parameters of GCN, such as the neighbor graph construction method, the number of hidden layers, the number of neurons in the hidden layer, and the dropout rate, are all the same as those of MPGANN. CNN has a total of four convolutional layers. The size of the convolution kernel is 5-3-2-2, the stride is 1-1-1-1, and each convolution layer is connected to an average pooling layer after each convolution layer. The window size is 2-2-2-2, padding is 0, and stride is 1. The kernel function of SVM is the Gaussian kernel function; set the penalty factor c = 1.0 and set the gamma to auto. In the BPNN hidden layer, the number of neurons is set to 16, the number of iterations for all algorithms is set to 1000, and the learning rate is set to 0.01. Accuracy is an overall performance indicator; if it is used as a performance evaluation index for diagnostic algorithms, it will likely mask the specific classification of diagnostic algorithms, so in order to solve this type of problem, this paper introduces precision, recall, and the F1 score, calculated as:  
\[R=\frac{TP}{TP+FN}, \tag{20}\]  
\[P=\frac{TP}{TP+FP}, \tag{21}\]  
\[F=\frac{2}{\frac{1}{P}+\frac{1}{R}}=\frac{2 RP}{R+P}, \tag{22}\]  
where \(R\) is the recall rate; \(P\) is the precision rate; \(F\) is the F1 score; \(TP\) is the number of samples that classify positive samples as positive samples; \(FN\) is the number of positive samples classified as negative samples, and \(FP\) is the number of negative samples classified as positive samples. The precision and recall of each algorithm used in this paper are shown in Table 5. From the table, it can be seen that each algorithm can basically correctly classify the normal working conditions, but the complexity of the engine fault data leads to a relatively poor classification effect for the traditional diagnostic algorithms. In this experiment, the precision rate and recall rate of BPNN are lower than other diagnostic algorithms, and  
Figure 10: Heat map of model accuracy at different learning rates and head counts. although the precision rate and recall rate of GCN and CNN diagnosis for each condition are better than those of SVM and BPNN, the diagnostic effect is still unsatisfactory in F1 and F2 conditions. The MPGANN proposed in this paper achieves 100% accuracy and recall in all working conditions except for 0.89 accuracy and 0.88 recall in F2 and F1 working conditions, which is an obvious advantage over other diagnostic algorithms and is more in line with practical industrial needs. From Figure 11, it can be seen that fault F1 is misclassified in all diagnostic algorithms, while after the feature mining of probabilistic graph relationships and rank order graph structure, MPGANN and GCN only have two F1 fault samples misclassified, and the MPGANN proposed in this paper only has two samples misclassified, which shows that the MPGANN model can mine more information between the data to improve the diagnostic algorithm's classification accuracy and stability and is better than other models. Figure 12 shows the average accuracy, average precision, average recall, and F1 score of each diagnostic algorithm. The performance of each diagnostic algorithm can be seen more clearly by comparing the figures. CNN, as a network model for deep learning, is widely used in the field of mechanical fault diagnosis and has achieved excellent results. However, due to the fact that there is no large amount of data for model training in this experiment, the training effect of CNN is not good, and it cannot make correct classification judgments. GCN is limited by its own information propagation rules, and even though it adopts the same topology structure for fault diagnosis, the diagnostic effect is still not good.