# Food Risk Entropy Model Based on Federated Learning
## 1 Introduction
In terms of the pass rate, pesticide residues are inevitable even if they pass the check. The accumulation of pesticides can also lead to risks. In terms of the residue rate, it can only qualitatively indicate the presence or absence of pesticide residues in a sample, not quantitatively indicate the level of specific residues. To solve those problems, we have developed a risk entropy tool for food safety based on federated learning. Figure 2 shows the principle of federated learning in our method, which convert the sampling data into the quantitative analysis of pesticide residues, and  
Figure 1: The data silos. our tool can protect the data between different local situations, and maximize the use of data information to build the risk entropy model. The privacy data used in our method is the pesticide detection data for agricultural products from provincial departments. It includes 51 products and is divided into 11 categories. Each product has 58 detection indicators, and each indicator corresponds to one pesticide. Specifically, the food safety risk entropy base on federated learning in five steps as follows:  
1. The federated learning server sends the calculation method, parameters, and data format of risk entropy to the clients in each department. The data format is shown in Section 4.1 in Table 1.
2. According to the standard data format, privacy data is statistically grouped by year, quarter, province, category, and product to represent the features. 3. Selecting features of different dimensions to form the privacy data within the group (e.g., year is 2019 and quarters are 1 and 2). 4. Risk entropy is calculated for the data within the group. The privacy data is calculated in the clients of each department, and the risk entropy is uploaded to the server for aggregation and macroscopic evaluation. 5. Transferring the summarized risk entropy data to the clients of each department. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Years** & **Quarters** & **Provines** & **Categories** & **Products** & **DR1** & **...** & **DR58** \\ \hline
2022 & 4 & Hubei & leafy vegetables & Chinese cabbage & 0.005 &... & 0.001 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Standard data format. Figure 2: Federated learning model. The above five steps describe the process of our method, which can calculate each department risk entropy and aggregate the risk entropy in whole departments. The advantage of our method is that it can protect the privacy of original data and represent the quantitatively level of pesticide residues in agricultural products. The experimental results prove that compared with traditional risk evaluation metrics, the risk entropy of agricultural safety can quantitatively represent the risk situation of agricultural products and protect private data. In summary, the contributions to this paper are as follows:  
1. We have designed a federated learning model to solve the data gap of various departments, which can maximize the use of data to optimize the model. 2. We have designed a model for calculating the risk entropy of pesticide residues in fruits and vegetables, which can quantitatively to analyze the sampling data. 3. We have developed a multi-dimensional data analyzing tool to calculate the risk entropy by selecting different dimensions and categories of data automatically. 4. Our approach pioneers the latest models and provides novel insights. Notably, this paper can provide policymakers, environmental engineers, and agricultural technicians with important insights on soil pollution control and management strategies and technologies.