# Bearing Fault Diagnosis Grounded in the Multi-Modal Fusion and Attention Mechanism
## 4 Experimental Design and Results
### Experimental Results  
In this study, cross-entropy function (12) was employed, and after multiple iterations using the training set, the algorithm's performance was evaluated, resulting in the confusion matrix shown in Figure 6. Additionally, data visualization using the t-SNE (t-distributed stochastic neighbor embedding) algorithm (Figure 7) confirmed an accuracy of 97.5% for the algorithm. \[L=-\frac{1}{N}\sum_{i=1}^{N}[y_{i}\log(\hat{y_{i}})+(1-y_{i})\log(1-\hat{y_{i} })] \tag{12}\]  
To further validate the feasibility of the proposed algorithm, comparisons were made with mainstream algorithms, including CBMA-ViT, ViT, Swin Transformer, and ConvNeXt. Four evaluation metrics were employed in this study: accuracy, precision, recall, and F1 score Table 3 [21]. Figure 5: Current signals under normal, ball fault, inner-race fault, and outer-race fault states. (1) Accuracy: represents the proportion of correctly classified samples in the total samples  
\[Accuracy=\frac{TP+TN}{TP+FN+FP+TN} \tag{13}\]  
(2) Precision: represents the proportion of actual class i samples among samples predicted as class i  
\[Precision_{i}=\frac{TP_{i}}{TP_{i}+FP_{i}} \tag{14}\]  
(3) Recall: represents the proportion of correctly predicted class i samples among actual class i samples  
\[Recall_{i}=\frac{TP_{i}}{TP_{i}+FN_{i}} \tag{15}\]  
Figure 6: Confusion matrix diagram. Figure 7: FAN-BD Classification results diagram. \begin{table}
\begin{tabular}{c c c c} \hline \hline \multirow{2}{*}{**Evaluation Indicators**} & \multicolumn{2}{c}{**Prediction**} \\ \cline{2-4}  & & **Positive** & **Negative** \\ \hline \multirow{2}{*}{Actual} & Positive & True Positive (TP) & False Negative (FN) \\ \cline{2-4}  & Negative & False Positive (FP) & Ture Negative (TN) \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Evaluation indicators. (4) F1-score is a metric used to evaluate the performance of the classification models. It is the harmonic mean of the precision and recall. The formula is as follows:  
\[F1-score_{i}=\frac{Precision\times Recall}{Precision+Recall} \tag{16}\]  
To demonstrate each parameter, confusion matrices were created, as shown in Figure 8, based on the results of the five algorithms used in the testing sets. The accuracy derived from the confusion matrices for the four algorithms is as follows: CBMA-ViT (Accuracy = 0.929), ViT (Accuracy = 0.907), Swin Transformer (Accuracy = 0.931), and ConvNeXt (Accuracy = 0.915). These results highlight the superior performance of the proposed FAN-BD algorithm compared to the other models. As seen in Table 4, the FAN-BD excels in terms of precision, recall, and F1 score, demonstrating the algorithm's ability to effectively balance both the detection and classification of faults, ensuring high accuracy and reliability. To verify the feasibility of the proposed FAN-BD algorithm, we compared it with mainstream algorithms, including CBMA-ViT, ViT, Swin Transformer, and ConvNeXt. The cross-entropy loss function was used to optimize the classification accuracy, chosen for its ability to effectively measure the difference between predicted probabilities and actual labels. A comparative analysis of accuracy and loss across multiple iterations highlights the superior performance of FAN-BD, as illustrated in Figure 9.  
The changes in loss functions during the training process for FAN-BD, CBMA-ViT, ViT Model, Swin Transformer, and ConvNeXt algorithms are shown through line graphs. From this figure, we can see that the FAN-BD algorithm demonstrated the fastest convergence speed and the lowest loss value throughout the training cycle, indicating its superior performance in this experiment. While other algorithms also showed a downward trend in loss values, their final loss values were all higher than those of FAN-BD, with ConvNeXt and CBMA-ViT following closely behind, while ViT Model and Swin Transformer performed relatively worse. FAN-BD is an improved version of CBMA-ViT, which performs classification tasks by extracting all feature information.