# Edge Computing Based on Federated Learning for Machine Monitoring
## 2 The Background
### Federated Learning  
Traditional machine learning algorithms need large computing power such that they usually use a centralized data processing method in the cloud. However, algorithms will fail to meet the requirements of data specifications, such as data privacy and data protection issues. With the development of 5G IoT technology, the performance requirements of distributed computing for transmission bandwidth between devices and the application requirements for fog computing are also increasing. Most factory managers are concerned about leaking confidential information about the production process. The traditional centralized machine learning techniques had to upload all local datasets to the server. Since the cloud of the proposed IoT system is outside the factory, federated learning helped the system hold local data samples without exchanging them while training models. Since federated learning trained the decision model across multiple decentralized system of factories holding local data samples without exchanging them, it could keep data privacy for the real production of the factory. Federated Learning (FL) is a decentralized deep learning framework that enables privacy-preserving training of models to work with a wide variety of clients in an actual cellular network [25]. The FL protocol iteratively asks random clients to download a trainable model from the server, updates the model with their own data parameters, and then uploads the locally updated model to the server. After receiving different models from clients, the server aggregates multiple client updates to further improve the model. Currently, federated learning helps fog computing in playing a positive role in performance improvement and transmission efficiency of distributed processing [26]. Although clients in this protocol do not need to open their own private data, the overall training process becomes inefficient when some clients require long update times or long upload times because of computation or communication problems. Recently, some modifications of the FL algorithm were proposed to solve the problems. It is believed that more achievements for the solution in the IoT will appear in the future. The first step is the formulate topology. We have to decide how to centralize or decentralize, which includes the order and rules of communication, the direction of information flow, and model convergence. Next, each node will first perform gradient calculation based on saved local data set of its own. The method of gradient calculation will be very different based on topology and algorithm, and may also require specific data processing first. This is an important research topic for federated learning. After the parameter update step iscompleted, the gradient is transmitted based on topology. For a centralized model, the gradient is first aggregated in the parameter server and then distributed to each node. In the proposed paper, the parameter server will be the fog node. For the decentralized models, gradients are transmitted to adjacent nodes or designated nodes, and gradients are encrypted before exchanging to ensure that gradients do not lead to privacy problem. After model parameters are sent to the server, a weight is given according to the number of samples contained in the selected local node. Multiply the model for each local node by the weights and sum up the results. The summed model parameters are the new server model. These processes are repeated until the entire federated learning system is trained. When the two models are aggregated and averaged, they have the opportunity to readjust their positions, leaving the local minimum and approaching closer to the global minimum, because they update parameter by following similar paths or directions [27]. Fog computing based on FL deep learning includes both end devices and the cloud server. Because the factory environment is complex and the production line changes frequently, the noise of the captured images increased. IoT in factory environments require dynamic learning to update models.