# FSN: Feature Shift Network for Load-Domain (LD) Domain Generalization
## 4 Experiment
### Evaluation in CWRU Bearing Dataset
```
0:\(x_{0},x_{1},\dots,\ x_{9},\theta_{f},\theta_{r},\theta_{c}\)
0:\(\theta_{f},\theta_{r},\theta_{c},\theta_{s}\) // \(\theta_{s}\)is the parameter of FSN
1:\(x_{0},\ x_{1},\ \dots,\ x_{9}=get\_different\_domain()\) // \(x_{0}\)from domain n, \(x_{1},\ \dots,\ x_{9}\) domain n-1
2:\(feature_{0}=G_{f}(x_{0})\)
3:\(feature_{shift}=G_{s}(feature_{0})\) // \(G_{s}\) is FSN
4:for\(i=1\to 9\)do
5:\(feature_{i}=G_{f}(x_{i})\)
6:\(feature_{i,shift}=concatenate(feature_{i},feature_{shift})\)
7:\(relation\_score=G_{r}\big{(}feature_{i,shift}\big{)}\)
8:if\(label(x_{0})!=label(x_{i})\)then
9:\(loss+=loss\_func(relation\_score,0)\)
10:else
11:\(loss+=loss\_func(relation\_score,1)\)
12:endif
13:endfor
14:\(loss+=loss\_func(G_{c}\big{(}feature_{i,shift}\big{)},label(x_{0}))\)
```  
**Algorithm 3** Trains fully connected classifier. In the third stage, outlined by Algorithm 3, the training primarily focuses on the FSN. A key aspect to note in this stage is the relationship between the data samples: \(x_{1},\dots,\ x_{9}\) not only correspond to labels 0 to 8 but also have domain numbers that are always one less than that of \(x_{0}\). This configuration encourages the alignment of features from higher domains with those from lower domains that share the same label. This alignment is critical for enhancing the model's ability to generalize across domains with different load conditions. In general, FSN hopes to achieve better results through the above-staged training process. In the training process, the network parameters trained in the previous stages will be used as the input for the subsequent stages, indicating that the network used in the subsequent stages is trained by the previous stages. By learning the shift of domain features\(1\overset{shift}{\rightarrow}0\) and \(2\overset{shift}{\rightarrow}1\) on the source domain, we expect to learn a feature shift network that can achieve the shift of target domain 3 features to source domain 2 features \(3\overset{shift}{\rightarrow}2\), thereby achieving the purpose of generalization. **Result of Relational classifier. ** A Domain Adversarial Neural Network (DANN) is a classical domain generalization model based on a domain adversarial [29]. In this paper, a relational classifier is introduced into DANN, which has two different classification methods. We call this new model a Mixed Classifier Domain Adversarial Neural Network, or MCDANN for short. To establish the mixed classifier of our experiment, we integrate the relation network, applied in few-shot learning, into DANN. The novel deep learning model is called the Mixed Classifier Domain Adversarial Neural Network (MCDANN). As a result, MCDANN improves the generalization ability of the model. We compare the MCDANN to several classic models. The comparative experiment is conducted using the CWRU dataset. For domain division, the load serves as the basis, and loads 0 HP, 1 HP, 2 HP, and 3 HP are divided into domains 0, 1, 2 and 3. The model is trained using domains 0, 1 and 2 as the source domains, while domain 3 is reserved as the target domain, which is used to test the model's ability to generalize to unseen data. The classical models employed in the comparison primarily fall into two categories: models trained using one-dimensional signals, and models trained using images. For the former, we have selected the classical models SVM and 1 DCNN, whereas for the latter, we mainly compare them with methods based on 2 DCNNs. In our experiments, ResNet is used as the underlying model for all 2 DCNN implementations. To facilitate representation, we use the following notations in Table 1: FC to signify the fully connected classifier, relation for the relational classifier, and DA for the domain adversarial method implemented by the classifier and Gradient Reversal Layer (GRL) [30,31] for the source domain. In case a model comprises two classifiers, the generalization accuracy on the target domain will be calculated separately using these two classifiers during testing.