# Unsupervised Method Based on Adversarial Domain Adaptation for Bearing Fault Diagnosis
## 3 Methods  
The feature extractor's original structure includes two residual blocks, each consisting of two convolution layers with a 3 \(\times\) 3 convolution kernel for each. As a result, this structure generates many parameters, significantly reducing the models' computational efficiency and increasing the risk of overfitting. To overcome these two issues, this project improves the structure of the feature extractor. This new structure remains two convolution layers. The first convolution layer contains a 20 \(\times\) 20 filter, a bath normalization layer, a max pooling layer, and a Relu activation layer. The second convolution layer consists of the same layers as the first convolution layer, except for a 10 \(\times\) 10 filter. This project has modified the structure of two residual blocks. Both of them comprise a 1 \(\times\) 1 filter, a 3 \(\times\) 3 filter, a 1 \(\times\) 1 filter, and an identity map with a 1 \(\times\) 1 filter. Finally, the final result is passed to the adaptive average pooling layer after going through a Relu activation layer. Figure 4 represents the detailed structure of the improved feature extractor based on a bottleneck residual block, which consists of two components: residual mapping and identity [40]. The residual mapping is the main component of the structure. It is utilized for learning the transferable and robust features of the input tensor and producing the residual function F(x). This function is added back to the input tensor to produce the output of the block. In this figure, one 1 \(\times\) 1 convolutional layer, one 3 \(\times\) 3 convolutional layer, and one 1 \(\times\) 1 convolutional layer make up the component of residual mapping. Specifically, the first 1 \(\times\) 1 convolutional layer reduces the quantity of input tensor channels. In comparison, the second 1 \(\times\) 1 convolutional layer is utilized to restore the number of channels to the original value. By applying this residual mapping, the whole set of variations in the main convolutional layer will be reduced, resulting in a low computational cost of the block. The 3 \(\times\) 3 convolutional layer plays a critical part in the residual mapping, where it operates on the reduced-channel input tensor and is utilized for learning the input data's underlying features. Figure 3: Process of pseudo-label semi-supervised learning. The identity part in the bottleneck residual block is the shortcut connection, which enables the addition of the block's output to the input tensor. This connection can ensure that the network can learn identity mapping, which is very important for achieving good performance on a wide range of tasks. The identity part of the block involves adding the input tensor to the output of the residual mapping:  
\[y=F(x,W_{i})+x \tag{11}\]  
where the input vector is represented as \(x\), and the output vector is denoted as \(y\) in the bottleneck residual block. If \(x\) and \(F\) have the same dimensions, Equation (11) is utilized. Otherwise, to match the dimensions, a linear projection Ws using shortcut connections is carried out:  
\[y=F(x,W_{i})+W_{s}x \tag{12}\]  
where \(W_{s}\) denotes a square matrix for matching the dimensions between input \(x\) and output \(y\). The residual mapping function is:  
\[F(x,W_{i})=W_{3}\sigma(W_{2}\sigma(W_{1}x)) \tag{13}\]  
where \(F\) denotes residual mapping, \(\sigma\) represents the activation function Relu, and the biases are eliminated to simplify the notations. The pseudocode of this improved feature extractor is shown in Appendix A. In Algorithm A1, a feature extractor based on the bottleneck residual block is defined by the pseudocode. It is made up of two primary parts, a feature extractor module and a residual block. The ResNet building block, which is a well-liked building block in deep learning architectures, forms the foundation for the residual block in the code.