# FSN: Feature Shift Network for Load-Domain (LD) Domain Generalization
## 4 Experiment
### Evaluation in CWRU Bearing Dataset  
**Setup. ** This study utilizes the Case Western Reserve University (CWRU) bearing dataset, commonly known as the CWRU bearing dataset. This dataset is an open-source collection, developed and released by Case Western Reserve University, and it has been widely applied in fault diagnosis and analysis. For more information, refer to Appendix A. In the CWRU experiment, we consider the bearing load as the domain criterion. The model is trained in multiple source domains to classify nine fault modes, and then the model is applied to the target domain data for a generalization test. The number of samples is still about 600 samples for each fault mode, and each domain contains data for 9 fault modes. Data corresponding to loads of 0 HP, 1 HP, and 2 HP are designated as the three  
Figure 7: FSN structure. source domains, labeled with domain numbers 0, 1, and 2, respectively. Data with a load of 3 HP, labeled as domain number 3, serves as the target domain, which acts as the test set for evaluation. The Epoch is set to 20, and 1200 iterations are carried out in each Epoch. Every 50 iterations, the model will be tested on the test set to obtain the real-time effect of generalization. In order to reduce the randomness of the final results, a list is used to store the accuracy of the last 30 tests, and the average of the last 30 tests is given. **Training Details. ** Before the experiment, we first describe the training process of the FSN. The complete training process of the FSN is shown in Figure 8. The FSN model is trained in stages to achieve better performance (i.e., relational classifier \(\rightarrow\) fully connected classifier \(\rightarrow\) FSN), and the training process of each stage is shown in Algorithms 1-3. ```
1:\(x_{0},x_{1},\dots,x_{9}\) //\(x_{1},\dots,x_{9}\) are grayscale image with labels 0-8 from the source domain
2:\(\theta_{f}\), \(\theta_{r}\) // are the parameters of feature extractor and relation module respectively
3:\(x_{0}\), \(x_{1}\), \(\dots\), \(x_{9}\) = get()
4:\(feature_{0}=G_{f}(x_{0})\)
5:for\(i=1\to 9\)do
6:\(feature_{i}=G_{f}(x_{i})\)
7:\(feature_{i,0}=concatenate(feature_{i},feature_{0})\)
8:\(relation\_score=G_{r}(feature_{i,0})\) //\(G_{r}\)represents relation module
9:if\(label(x_{0})!=label(x_{i})\)then
10:\(loss+=loss\_func(relation\_score,0)\)
11:else
12:\(loss+=loss\_func(relation\_score,1)\)
13:endif
14:endfor
```  
**Algorithm 1** Trains the feature extractor and the relation classifier. In the first stage of training the FSN, Algorithm 1 employs a relational classifier to perform classification training. This step is crucial for acquiring the initial parameters of both the feature extractor and the relation module. By using a relational classifier, the network learns to distinguish between different fault modes based on their relational scores. Algorithm 2 represents the second stage of FSN training. At this stage, a fully connected classifier is integrated into the model. The training process now involves updating  
Figure 8: The training process of FSN. the parameters of the entire model, including the feature extractor, the relation module, and the newly added fully connected classifier. This integration allows the model to refine its feature representations and improve classification accuracy. ```
0:\(x_{0},x_{1},\dots,\ x_{9},\theta_{f},\theta_{r}\), \(\theta_{f},\theta_{r}\)
0:\(\theta_{f},\theta_{r},\theta_{c}\) // \(\theta_{c}\)is the parameters of the fully connected classifier
1:\(x_{0},\ x_{1},\ \dots,\ x_{9}=\text{get()}\)
2:\(feature_{0}=G_{f}(x_{0})\)
3:\(loss+=loss\_func(G_{c}(feature_{0}),label(x_{0}))\)
4:for\(i=1\to 9\)do
5:\(feature_{i}=G_{f}(x_{i})\)
6:\(feature_{i,0}=concatenate(feature_{i},feature_{0})\)
7:\(relation\_score=G_{r}(feature_{i0})\)
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
```  
**Algorithm 2** Trains fully connected classifier.