# An Intelligent Diagnosis Method for Machine Fault Based on Federated Learning
## 2 The Shared Fault Diagnosis Model Based on Federated Learning  
### Proposed Methodology  
The architecture of shared fault diagnosis model based on FL is shown in Figure 2. Firstly, a local fault diagnosis model should be established. Because deep learning with good self-feature extraction and classification capabilities has been applied widely in fault diagnosis, the local fault diagnosis models are constructed based on deep convolutional neural networks. In general, a deep convolutional neural network model is constituted by an input layer, a convolution layer, a pooling layer, a fully connected layer, and an output layer [25]. The convolution layer mines the hidden features of the input data by the convolution kernel and expresses it in high-dimensional form. The pooling layer can reduce the output dimensionality of the convolution layer and extract local features, so as to accelerate the convergence and  
Figure 1: Existing fault diagnosis methods. ensure the invariance of space and structure. The fully connected layer and the output layer are used to classify. The structure of the deep convolution neural network used in this paper is shown in Figure 2. The individual local fault diagnosis models established based on the structure can recognize the trained fault types, that is, the models find the classification hyperplane that can recognize the faults, as shown(1),2 and(3)in Figure 2. From(jin Figure 2, no matter which hyperplane cannot accurately and effectively classify all faults. However, the fault diagnosis model based on FL finds a classification hyperplane suitable for recognizing the faults with different types, as shown(5)in Figure 2. The reason is that the model based on FL fuses the weight parameters of each local fault diagnosis model into global weight. Then, the global weight parameters are returned to the local model to update as a global shared federated fault diagnosis model. The specific steps of establishing the federated fault diagnosis model are as follows. Step 1. The local fault diagnosis models are established. A fault data set \(F_{k}\) (\(k\) = 1, 2, 3,..., \(K\)) is constructed from the vibration signals of the monitored key components, and the set is divided into the training set and the testing set according to a certain proportion. \(K\) local models for \(K\) fault data sets are established respectively. Step 2. Initialize the federated learning model parameters and train the model. The model parameters are initialized, such as model weight \(w\), maximum number of iterations \(N\), total number of local fault diagnosis models \(K\), score of nodes used in local fault diagnosis model \(C\), batch size \(B\), and learning rate \(\eta\). During each iteration \(t\) (\(t\) = 1, 2, 3,..., \(N\)), \(m\) (\(m\) = max(\(C\)\(\times\)\(K\), 1)) nodes are selected from the above \(K\) local fault diagnosis models, and a random training sample set \(S_{train}^{FK}\) (\(k\) = 1, 2, 3,..., \(m\)) is constructed. At the same time, local parameters Model Update (\(k\), \(w_{t}^{k}\)) are updated by training the local models. During the training process, the batch size is \(b\), so, \(i\) (\(i\) = 1, 2,..., length(\(S_{train}^{FK}\))/\(b\)) calculations are performed in each iteration. Therefore, the input is \(x_{in}^{0}\) = \(S_{train}^{FK}\) (1 + \(b\)\(\times\) (i\(-\)1):\(b\)\(\times\)\(i\)). In the forward propagation process of training, the input \(x_{in}^{l-1}\) (\(l\) = 1, 2,..., \(L\), \(L\) is the number of convolution layer) are convolved with the convolution kernel \(w_{c}^{l}\) when it passes the \(l\)-th convolution layer. Then, the output \(x_{c}^{l}\) is obtained as:  
\[x_{c}^{l}=f(x_{in}^{l-1}*w_{c}^{l}+bias^{l}) \tag{1}\]  
where * is the convolution operation, \(bias^{l}\) is the bias, and \(f\) () is the activation function.