# MCRCNet: A Bearing Fault Diagnosis Method for Unknown Faults Based on Transfer Learning
## 3 Proposed Method
### Improved Open Set Domain Adaptation Method  
For the open set domain adaptation problem, one of our goals is to correctly classify the known target samples into the corresponding known class, and the second goal is to train the classifier to draw a boundary between the unknown and known target samples. For the first objective, we use LMFLoss as the loss function. In the actual working condition, there are differences in the frequency of each bearing fault, and the amount of different types of fault data that can be collected is not the same when the fault occurs, so there is bound to be data imbalance. In order to better realize the correct classification of imbalanced known samples, we improve the loss function. By setting separate weights for different classes, it strengthens the learning of the minority class samples. We adopt LMFLoss for implementation, which jointly uses two methods: Focal Loss and LDAM Loss. Focal Losssolves the problem of unbalanced class distribution by dynamically adjusting the loss weight of training hard and easy samples. Its core idea is that in classification tasks, most samples can easily be correctly classified, and only a few hard samples need more attention from the model. Therefore, Focal Loss introduces a dynamic adjustment factor to reduce the loss contribution of easy to classify samples and increase the loss contribution of difficult to classify samples, so as to achieve the purpose of the focused training model. The formula is as follows:  
\[Focal_{Loss}=-(1-p_{t})^{\gamma}\log(p_{t}), \tag{4}\]  
where, \(p_{t}\) is the probability that the sample belongs to the true class, and \(\gamma\) is the adjustment factor that controls the loss weight of easy /hard samples  
LDAM Loss sets different decision boundaries for different classes from the perspective of label distribution adaptation. The specific method includes two parts. The first part is to set a label-aware boundary, which sets a different decision boundary margin for each class, using a smaller margin for the minority class and a larger margin for the majority class. In this way, the minority class samples are easier to classify correctly. The second part, adaptive loss scaling, also introduces an adaptive loss scaling factor that is inversely proportional to the frequency of the class to which the sample belongs. In this way, the loss contribution of the minority class samples can be increased, and the model can learn these categories better. The equation is as follows:  
\[L_{LDAM}((x,y),f)=-\log\frac{u}{u+\sum_{j\
eq y}e^{z}y}. \tag{5}\]  
The LMF Loss we used combines the two loss functions and makes full use of the prediction probability information and label distribution information of samples, which enables the model to better mine the valuable information contained in the data, thus improving the overall classification performance. At the same time, these two strategies can also enhance each other and form a synergistic effect. The formula is as follows:  
\[L_{LMF}=-\alpha\log\frac{u}{u+\sum_{j\
eq y}e^{z}y}-\beta(1-p_{t})^{\gamma} \log(p_{t}). \tag{6}\]  
Figure 5: Improved feature extraction network.  
For the second goal, we use the idea of generative adversarial training to achieve the classification of unknown classes. The purpose of this process is to train a classifier to draw a boundary between unknown and known target samples. To achieve this goal, we need to measure the difference between the source domain and the target domain. The objective function based on the Wasserstein distance can well measure the distance between the two distributions when there is no overlap or little overlap between the source domain and the target domain, and effectively prevent the phenomenon of gradient disappearance. Its formula is as follows, where \(P_{s}\) and \(P_{t}\) denote the data distribution in the source and target domains, respectively:  
\[W(P_{s},P_{t})=\sup_{\|f\|_{L\leq 1}}\mathbb{E}_{x\sim P_{s}}[f(x)]-\mathbb{E}_{ x\sim P_{t}}[f(x)]. \tag{7}\]