# A Multi-Source Consistency Domain Adaptation Neural Network MCDANN for Fault Diagnosis
## 2 Proposed Model
### Multi-Source Prediction Consistency  
When using a single labeled source domain to align with the target domain, the fine-grained information that can be obtained is limited, and only the source domain label can help the subdomain alignment. Using data from multiple source domains with different distributions and allowing them to participate in domain adaptation training at the same time can obtain more label information. This richer label information can be used to correct the alignment of sub-domains, which can improve pseudo-label prediction accuracy. The difference between single-source domain adaptation and multi-source domain adaptation is shown in Figure 5.  
Figure 4: Schematic diagram of Domain Adaptation. Use two or more working conditions as the source domain and the remaining one as the target domain. Weighting the adversarial loss and distance loss between several source and target domains before optimizing them yields higher accuracy than using only a single working condition as the source domain. In addition, using data from multiple source domains can also improve the accuracy of pseudo-labels prediction in the target domain. When matching different source domains and target domains, if the model transfer is successful, it means that when the label classifiers from different source domains are applied to predict the same data in the target domain, the obtained pseudo labels should be consistent. The difference between several pseudo-labels can also be added to training as a loss function. In this way, the accuracy of the pseudo-label can be greatly improved. When using multiple source domains for training, the training of the model is divided into two stages. In the first stage, the model is trained on multiple source domains, respectively. We can obtain the label classification loss and adversarial loss from the domain discriminator on each source domain, and take out their feature output on the feature layer for subsequent calculations. At the same time, for training on each source domain, the obtained label classifier is used to predict the target domain data, and then the pseudo-label of the target domain is determined by majority voting. In the second stage, train on the target domain data to obtain the adversarial loss of the domain discriminator, and combine the adversarial loss calculated by multiple source domain data to obtain the overall domain adversarial loss. After obtaining the feature output on the target domain, the LMMD distances are calculated with the output feature of other source domains separately according to the pseudo-label, which are then summed as the distance loss. The difference between the pseudo-labels predicted in the first stage is also calculated with cross-entropy and then taken into consideration as the consistency regularization loss. The loss function of multi-source domain adaptation is shown in Equation (10):  
\[E=\sum_{i=1,\ldots N}\left(L_{y}(s_{i})+L_{d}(s_{i},t)+L_{l}(s_{i},t)\right)+ \sum_{i,j=1,\ldots,N}L_{ce}\left(G_{y}(s_{i}),G_{y}(s_{j})\right) \tag{10}\]  
where \(L_{y}\) is the loss function of the label classifier, \(L_{d}\) represents the domain loss function of the source domain and the target domain, \(L_{l}\) represents the distance loss between the source domain and the target domain (using LMMD distance), and \(L_{ce}\) is the cross entropy loss function. The difference between the pseudo-labels predicted by the classifiers trained on the different source domains is taken as the consistency regularization loss. This model combining multiple domain losses and constraining pseudo-labels with consistency regularization is called Multi-Source Consistency Domain Adaptation Neural  
Figure 5: Single-source domain adaptation and multi-source domain adaptation. Network (MCDANN). MCDANN consists of three network components, which are a feature extractor, a domain classifier, and a label classifier.