# A Collaborative Domain Adversarial Network for Unlabeled Bearing Fault Diagnosis
## 2 Theoretical Background
### Domain Adversarial Adaptive  
The domain adversarial adaptation [17] trains discriminators to make the distribution of data features consistent between different domains. As shown in Figure 1, the dashed line represents the category boundary, and the domain adaptation method maps features with different distributions to the same space, thereby reducing the distance between the two domains as much as possible. Domain Adversarial Neural Networks (DANNs) and Conditional Domain Adversarial Networks are neural network models used to address domain adaptation problems, leveraging unlabeled target domain data and achieving superior cross-domain fault diagnosis performance, and are widely applied in the fault diagnosis field. DANNs aim to reduce the data distribution difference between the source domain and the target domain by adversarially training the feature extractor and domain discriminator to learn domain-invariant features, thereby minimizing the marginal distribution difference between different domains. It outputs the probability distribution of fault categories through a label classifier and demonstrates good performance in domain adaptation tasks in fault diagnosis. However, this method fails to capture complex multimodal structure, even if the method successfully confuses the domain discriminator in adversarial training.  
In contrast, the conditional domain adversarial networks method can utilize the discriminative information transmitted by the classifier to assist adversarial adaptation, thereby reducing the joint distribution difference in features and labels. The domain adversarial network introduces a Gradient Reversal Layer (GRL) in the network model, forming an adversarial relationship between the conditional domain discriminator and the feature extractor, and considers both marginal distribution and conditional distribution during domain alignment. The conditional adversarial loss \(\mathcal{L}_{adv}\) and the prediction loss \(\mathcal{L}_{pred}\) are defined as follows:  
\[\mathcal{L}_{adv}=\frac{1}{N_{s}+N_{t}}{\sum}_{i=1}^{N_{s}+N_{t}}\mathbb{E}_{( \mathbf{x},y)\sim P_{s+t}}[\log D(G(\mathbf{x}),y)+\log(1-D(G(\mathbf{x}),y))] \tag{1}\]  
\[\mathcal{L}_{pred}=\frac{1}{N_{s}}{\sum}_{i=1}^{N_{s}}\mathbb{E}_{(\mathbf{x},y)\sim P_{s}}[-y\log C(G(\mathbf{x}))] \tag{2}\]  
where \(N_{s}\) represents the number of artificial fault samples (source domain), and \(N_{t}\) represents the number of real industrial samples (target domain). \(P_{s}\) and \(P_{t}\) denote the distributions of the source and target domains, respectively. \(P_{s+t}\) represents the combined distribution of all samples. \(G\) is the feature extractor. \(D\) is the conditional domain discriminator; \(C\) is the classifier. \(x\) represents the input samples. y denotes the labels. The conditional adversarial loss \(\mathcal{L}_{adv}\) ensures that the features extracted by \(G\) are indistinguishable from the source, while the prediction loss \(\mathcal{L}_{\text{pred}}\) ensures that the features extracted by \(G\) are useful for the classification task.