# Unsupervised Method Based on Adversarial Domain Adaptation for Bearing Fault Diagnosis
## 2 Preliminary Knowledge
### Model 2: Maximum Classifier Discrepancy (MCD)  
The second network is an adversarial learning-based unsupervised model with domain adaptation using a distinct training technique [41]. For various objectives, model 1 is commonly utilized as the central network for domain adaptation models based on classifiers. Contrary to DANN, MCD concentrates on the decision boundary of distinct domains. Through aligning two distinct domains' distributions, this model can utilize the outcomes of two different classifiers for adversarial training and then successfully conduct binary classification on two domains with distinct data distributions. The basic ideas of MCD are to train a classifier using labeled source data and then use it to conduct predictions for the target data. These predictions are then used to align the difference between the classifier predictions on two domains. Once the distributions are aligned, a final classifier is trained through the aligned distributions. This classifier can then be used to conduct predictions for the target data. By aligning the distributions of the two domains, MCD can help increase the performance of the final classifier for the classification of target data, even though a significant domain shift happens in the source domain and target domains.  
Figure 2 illustrates the working process of the improved MCD. It contains a feature generator that generates extracted feature vectors after receiving the source data and target, and two different classifiers that classify input data into different classes according to the extracted feature vectors. It aims to look for target data far from the source data by utilizing two different classifiers, F1 and F2, to align features drawn from the source and target data. To represent the differences between the predictions conducted by these two classifiers, MCD introduces the discrepancy. During the training phase, the two classifiers are utilized to maximize this difference to identify data beyond the boundary of the source domain. The feature generator is trained by reducing the discrepancy between these two classifiers for good feature performance. These training stages based on adversarial learning are repeated until a satisfactory outcome is obtained. The whole model can be treated as an adversarial-based min-max issue because, during the training phase, these two classifiers aim to maximize the discrepancy of target data. At the same time, the feature generator aims to minimize this discrepancy.  
Figure 2: The general process of MCD.  
The discrepancy between the anticipations conducted by two distinct classifiers is identified as the discrepancy loss.  
\[d(p1,p2)=\frac{1}{K}*\sum_{K=1}^{K}|p_{1k}-p_{2k}| \tag{5}\]  
where the probability outputs of \(f_{1}\) and \(f_{2}\) for class k are denoted as \(p_{1k}\) and \(p_{2k}\), respectively.  
There are three stages in the training phase, as mentioned before. The first stage involves training the entire model to categorize source data accurately and to reduce softmax cross entropy.  
\[\min_{G,F_{1},F_{2}}\zeta(X_{s},Y_{s}) \tag{6}\]  
\[\zeta(X_{s},Y_{s})=-E(x_{s},y_{s})\sim(X_{s},Y_{s})\,\sum_{K=1}^{K}l_{[k=y_{s} ]}logp(y|x_{s}) \tag{7}\]  
Stage 2 fixes the feature extractor's settings and utilizes two classifiers to increase discrepancy loss. The loss of classification is combined with discrepancy loss.  
\[\min_{F_{1},F_{2}}\zeta(X_{s},Y_{s})-\zeta_{adv}(X_{t}) \tag{8}\]  
\[\zeta_{adv}(X_{t})=E_{x_{t}\sim X_{t}}[d(p1(y|x_{t}),p2(y|x_{t}))] \tag{9}\]  
Stage 3 fixes the classifier and trains the feature extractor to reduce discrepancy loss.  
\[\min_{G}\zeta_{adv}(X_{t}) \tag{10}\]  
If the model can accurately predict the labels of source data, these three stages will continue with adversarial repetition until achieving this goal.