Prediction and Visual Analysis of Food Safety Risk Based on TabNet-GRA

Food safety risk prediction is crucial for timely hazard detection and effective control. This study proposes a novel risk prediction method for food safety called TabNet-GRA, which combines a specialized deep learning architecture for tabular data (TabNet) with a grey relational analysis (GRA) to predict food safety risk. Initially, this study employed a GRA to derive comprehensive risk values from fused detection data. Subsequently, a food safety risk prediction model was constructed based on TabNet, and training was performed using the detection data as inputs and the comprehensive risk values calculated via the GRA as the expected outputs. Comparative experiments with six typical models demonstrated the superior fitting ability of the TabNet-based prediction model. Moreover, a food safety risk prediction and visualization system (FSRvis system) was designed and implemented based on TabNet-GRA to facilitate risk prediction and visual analysis. A case study in which our method was applied to a dataset of cooked meat products from a Chinese province further validated the effectiveness of the TabNet-GRA method and the FSRvis system. The method can be applied to targeted risk assessment, hazard identification, and early warning systems to strengthen decision making and safeguard public health by proactively addressing food safety risks.


Introduction
Food safety has emerged as a significant global public health concern in recent years, impacting people's health and wellbeing [1]. Within the food supply chain, food products are susceptible to contamination due to various safety hazards, including biological, chemical, and physical risks [2]. These hazards can give rise to over 200 different diseases, ranging from mild conditions such as diarrhea to more severe outcomes such as cancer. Alarming data from the World Health Organization in 2023 indicate that over 600 million cases of foodborne illnesses and 420,000 deaths may result from consuming contaminated food annually [3]. This pressing situation underscores the urgent need to strengthen food safety supervision and thereby prevent incidents and safeguard public health. Monitoring potential hazards in food, conducting food safety risk predictions, and issuing early warnings have proven to be effective tools in the supervision and control of food safety. Food safety prediction involves utilizing models to predict future food safety events or outcomes by analyzing patterns from historical food-safety-related data to provide a basis for risk warnings. Such risk prediction is highly valuable in developing food safety surveillance programs, especially in identifying products and hazards that warrant close monitoring [4]. Consequently, the establishments of robust food safety risk prediction models hold crucial significance for both risk monitoring and early warning in the context of food safety.
Machine learning (ML), the process through which computers learn from substantial historical data via statistical algorithms, generate empirical models, and make predictions

The TabNet-GRA Method
TabNet-GRA is considered a food safety risk prediction method that utilizes the combination of TabNet and GRA, which can predict the risk of food products by employing food safety detection data. In this section, the principles and construction process of Tab-Net-GRA will be introduced.

The TabNet-GRA Method
TabNet-GRA is considered a food safety risk prediction method that utilizes the combination of TabNet and GRA, which can predict the risk of food products by employing food safety detection data. In this section, the principles and construction process of TabNet-GRA will be introduced.

The Pipeline of TabNet-GRA Method
The Pipeline of the TabNet-GRA method is illustrated in Figure 1A, encompassing the subsequent steps.
Step 1: Data processing. The food safety detection data are processed for deleting useless attributes, data format conversion, deleting redundant data and "undetected" result filling, etc., and the data are processed into a data matrix X suitable for modeling.
Step 2: Using GRA to calculate the comprehensive risk value of each food sample in a detection dataset. Firstly, GRA is used to calculate the weight vector W of each indicator's contribution to the risk of the sample; secondly, the hazard level matrix for pollutants D is obtained using the detection value of the risk indicator compared with its corresponding limit value; and, finally, D is multiplied with W to obtain the risk vector of the food sample R.
Step 3: Construction and training of a TabNet-based food safety risk prediction model. The predictive model was constructed based on the TabNet. During the training process of the model, the food safety detection data matrix X is used as the input, and the risk vector of the food sample R is used as the expected output; the relevant parameters of the model are set and adjusted to obtain the TabNet-based food safety risk prediction model. The performance of the model is evaluated eventually.

The GRA-Based Food Risk Quantitative Assessment
Grey relational analysis (GRA) is a multi-indicator decision-making evaluation method developed from the gray system theory. Its fundamental concept involves quantifying the geometric similarity between reference data sequences and multiple comparative data sequences to establish their level of association. This analytical approach enables the assessment and evaluation of correlations and influences among multiple indicators, facilitating comprehensive decision-making progress [19]. In the second step of the TabNet-GRA method, GRA is utilized to determine the contribution weight of each indicator to the sample's risk, and then the comprehensive risk value for each sample is calculated.
In order to clearly describe the process of calculating the sample's comprehensive risk value, the definitions of the symbols used in it are first stated. Let X be the food detection data matrix, containing m indicators and n samples. xi(k) is the detection result of the ith indicator of the kth sample, where i = 1, 2, . . . , m; k = 1, 2, . . . , n, n is the length of the data sequence (the number of food samples), and m is the number of indicators. The reference sequence is In the actual calculation, each indicator sequence is used as a reference sequence once, and the rest of the indicator sequences are used as a comparison sequence.
The process of calculating the comprehensive risk value of food samples using GRA is as follows: (1) Dimensionless data. The difference in the physical significance of each indicator results in data that are not always of similar magnitude, which does not facilitate comparisons or makes it difficult to obtain correct conclusions when making comparisons. Dimensionless data processing is required for grey relational analysis. Equation (1) is used for dimensionless processing.
(2) The grey correlation coefficients of y 1 (k) and y i (k) at sample k are calculated as Equation (2).
where ξ i (k) is the grey correlation coefficient and ρ is called the adjustment parameter, which is used to adjust the difference between correlation coefficients (ρ ∈ (0, 1)); the smaller the ρ, the greater the difference and the stronger the distinction, which is usually ρ = 0.5.
(3) The correlation coefficient between the two sequences y 1 and y i is calculated as Equation (3): (4) Each indicator acts as a reference sequence once, and the correlation coefficient matrix γ of all indicators can be obtained using Equation (3). In matrix γ, γ iq denotes the correlation between the ith and qth indicator.
Determining indicator weights. According to the correlation coefficient matrix γ, γ i can reflect the weight of the ith indicator among all indicators, as calculated by Equation (4).
(6) Calculation of risk values for food samples. The ratio of the detection value of the risk indicator to its limit value is used to express the risk of individual indicators on the sample, calculated by the equation d ik = x ik /l i (i = 1, 2, . . . , m; k = 1, 2, . . . , n), where x ik is the detection value of the kth sample corresponding to the ith indicator and l i is the maximum limit standard value of the ith indicator. Finally, the hazard level matrix for pollutants D obtained after the above calculation is multiplied by the indicator weight vector W to obtain the risk series of food samples, as shown in Equation (6).
where R = [r 1 , r 2 , . . . , r n ] is the risk value matrix for n samples, D is the hazard level matrix for pollutants, and W = [w 1 , w 2 , . . . , w m ] is the weight vector.

The TabNet-Based Food Safety Risk Prediction Model
TabNet is a novel high-performance standard deep learning architecture designed for tabular data; it has demonstrated remarkable performance in tasks such as the classification and regression of tabular-type data. TabNet is applied to predict food safety in this work. The architecture of the TabNet-based food safety risk prediction model is shown in Figure 2, which consists of N steps sequential decision steps, each consisting of the Attentive transformer (At) module, Mask module, Feature transformer (Ft) module, Split module, and ReLU activation function to realize, respectively, feature selection and feature processing. The normalization and initialization module contain two parts: the batch normalization (BN) layer and variable initialization. First, the sampling data were processed into a risk feature matrix through the BN layer, and the initialization of variables was performed. In addition, TabNet was encoded with the input of the ith step by the output of the (i − 1)th step through the module to decide which feature was used, and the Mask-filtered features were then input into the Ft module for feature processing to obtain the processed risk features. When put into the Split module for division, the input of the next decision step a[i] and the output of the current decision step d[i] can be obtained in two parts. For the next At module for feature selection and the overall output to use, after N steps decision steps, the multi-step output vector d[i] is aggregated by the ReLU function to obtain the d out , and then the Fully connected layer (FC) can be used for a transformation to take place. Finally the composite risk value of the sample was obtained. Specifically:

The TabNet-Based Food Safety Risk Prediction Model
TabNet is a novel high-performance standard deep learning architecture designed for tabular data; it has demonstrated remarkable performance in tasks such as the classification and regression of tabular-type data. TabNet is applied to predict food safety in this work. The architecture of the TabNet-based food safety risk prediction model is shown in Figure 2, which consists of sequential decision steps, each consisting of the Attentive transformer (At) module, Mask module, Feature transformer (Ft) module, Split module, and ReLU activation function to realize, respectively, feature selection and feature processing. The normalization and initialization module contain two parts: the batch normalization (BN) layer and variable initialization. First, the sampling data were processed into a risk feature matrix through the BN layer, and the initialization of variables was performed. In addition, TabNet was encoded with the input of the th i step by the output of the ( 1)th i − step through the module to decide which feature was used, and the Mask-filtered features were then input into the Ft module for feature processing to obtain the processed risk features. When put into the Split module for division, the input of the next decision step [ ] a i and the output of the current decision step [ ] d i can be obtained in two parts. For the next At module for feature selection and the overall output to use, after decision steps, the multi-step output vector [ ] d i is aggregated by the ReLU function to obtain the , and then the Fully connected layer (FC) can be used for a transformation to take place. Finally the composite risk value of the sample was obtained. Specifically: Step 1: Normalization and initialization.
The BN layer processes the sampling data matrix X into a risk feature matrix c as an input to each decision step, as shown in Equation (7).   Step 1: Normalization and initialization. The BN layer processes the sampling data matrix X into a risk feature matrix c as an input to each decision step, as shown in Equation (7).
where c ∈ B×D , B denotes the batch size (number of food samples used at a time during training), and D denotes the number of dimensions of the features (risk indicators). Initialize the related variables of TabNet: Step 2: Let i = i + 1, execute the decision step, and input a[i − 1] into the At module to learn to obtain the Mask matrix M[i].
The Mask module implements the selection of significant features, which made the model focus on the risk indicators that mainly contribute to the risk when learning, thus improving the learning efficiency of the model. The importance of the features was realized by the At module, which implements feature selection for the current decision step by learning a Mask matrix as in Equation (8).
where a[i − 1] was the input information at the current decision step obtained by the Split module at (i − 1)th step, and h i denoted a Fully connected (FC) layer and a BN layer operation, which served to achieve a linear combination of features so as to extract higher dimensional and abstracted features. hi(a[i − 1]) and P[i − 1] were multiplied and then the desired M[i] was generated by the sparsemax algorithm. M[i] and feature elements were multiplied to achieve feature selection for the current decision step. P[i] denotes the use of features in the past decision step, which is updated by Equation (9).
where γ is a relaxation parameter. When γ = 1, a feature is forced to be used in only one decision step. In addition, the sparsemax algorithm was employed to assign weights to individual features of each sample, ensuring that the total sum of weights for all features in a sample equaled 1, i.e., where D denotes the dimensionality of the features, thus realizing instance-wise feature selection.
Step 3: The risk feature matrix c and M[i] were passed through the Mask module to select the significant features of food safety risks.
The feature selection for the current decision step was achieved by multiplying M[i] and the risk feature matrix c to obtain the food safety risk significant feature M[i]•c.
Step 4: The significant feature M[i]•c was input into the Ft module for processing to obtain the risk feature y[i] as in Equation (10): where f i is the Ft module operation and c is the risk feature matrix.
Step 5: The processed risk features y[i] were put into the Split module for segmentation. The processed risk features y[i] were divided into two parts by the Split module; one part was used for the output of the current decision step (d[i]) and the other part was used as the input information for the next decision step (a Nd is the number of features in the total decision output, and Na is the number of features input to the At module for the next step.
Step 6: Determine whether i is less than N steps , then go to Step 2 to perform the next decision step, or otherwise go to Step 7. Step 7: TabNet draws on the idea of tree model aggregation to aggregate the output , and then finally a FC layer is mapped to the final output, which was the predicted fused risk value.
After the above steps, a food safety risk prediction model based on TabNet was constructed, with the detection data matrix X as the input, and the comprehensive risk vector R as the expected output. The relevant hyperparameters of TabNet were set and adjusted to train the risk prediction model.

Case Study and Model Evaluation
This work presents an analysis using the safety detection data of cooked meat products provided by the food detection department of a Chinese province in 2018 and 2019. Firstly, the raw data were processed, adhering to the principles of the comprehensiveness, scientific state, and operability of the risk evaluation indicator system [18]. Moreover, nine risk indicators were selected for food additives (nitrite, sorbic acid, and benzoic acid), heavy metal elements (lead, cadmium, chromium, and total arsenic), and microorganism (coliform and total bacterial count) categories, which have an important impact on the risk of meat products. Secondly, the GRA method was employed to calculate the weights of each indicator, and the risk value of meat samples was obtained by fusing the results with the weights; then, the food safety risk prediction model was constructed based on TabNet, the detection content data of each hazard in the meat product sample were used as the input of the model, and the comprehensive risk value calculated via the GRA was used as the expected output to perform the model training process.

Data Preprocessing
The detection data used in this work comprised 87,260 raw data records, a part of the raw data is shown in Table 1. The data included over 50 attributes (e.g., sample number, sampling time, product name, detection items, detection results, etc.) and contained detection items other than the nine indicators to be used in this experiment. Each detection item possessed a unique discrete domain, while the format of the detection result data primarily utilized in model construction lacked standardization and contained many superfluous attributes, redundant data, etc. Therefore, preprocessing the detection results is essential prior to modeling. To address the issues with the data, the following processing steps were undertaken: (1) Useless attributes were eliminated, retaining only twelve relevant attributes, including nine risk indicators, sample number, limit standards, and standard detection limits.
(2) Data formats were converted, and the redundant non-numerical symbols in the data were removed, e.g., "<0.005" to "0.005". (3) Redundant data were removed, for example, if there were multiple numbers in the detection result; the maximum value was taken as its detection result. (4) "Undetected" results were addressed by filling them with half of the standard detection limit rather than assigning a value of zero. (5) Outlier detection was performed on the data to identify and exclude abnormal samples. The processed data are presented in Table 2, consisting of a total of 7933 samples. Among these samples, 7885 samples from 2018 to November 2019 were utilized for model construction (7835 for model training and 50 for model test), while 48 samples were retained from December 2019 to be applied in the risk early warning and visualization system.

Calculating the Comprehensive Risk Value
Based on the processed cooked meat products detection data, correlation analysis was performed using the GRA method on 7885 sample data from January 2018 to November 2019 to obtain the weights of nine evaluation indicators, and the comprehensive risk values of the samples were obtained by fusing the data on the detected contents of hazards in cooked meat product samples with the indicator weights. The correlation coefficient between each risk indicator was obtained using Equations (1)-(3), and the correlation coefficient represented the correlation degree between the indicators; the larger the correlation coefficient, the greater the correlation degree between the two indicators. The correlation degree and heat map matrix between the evaluation indicators are shown in Figure 3. Then, based on the correlation coefficient matrix, the weights of each risk evaluation indicator were calculated using Equations (4) and (5), and the results are shown in Table 3. Finally, the risk value of each food sample was calculated using Equation (6) as the expected output of the model. The results of the risk assessment are shown in Table 4.

Model Construction and Evaluation
In constructing the food safety risk prediction model using the pytorch-tabnet package, 7835 samples were used as the training set for TabNet model training, and the remaining 50 samples were used as the test set; Table 5 shows the parameter settings of the risk prediction model this study proposed. To verify the predictive power of this model,

Model Construction and Evaluation
In constructing the food safety risk prediction model using the pytorch-tabnet package, 7835 samples were used as the training set for TabNet model training, and the remaining 50 samples were used as the test set; Table 5 shows the parameter settings of the risk prediction model this study proposed. To verify the predictive power of this model, comparison experiments were performed between the TabNet-based model and six typical predictive models on the same detection dataset. The comparison models included three tree models, RF, GBDT, and XGBoost, and three neural networks: BP, ELM, and RBF. Among them, RF is an integrated learning model with a decision tree as the base learner, which integrates the results of multiple decision trees to obtain the final training results; the GBDT model mainly achieves the purpose of data learning by the linear combination of base learners and continuously reducing the residuals generated by the training process. XGBoost has more efficient and accurate prediction capabilities by adding a regular term to the loss function as well as supporting parallel computation; BP is a multi-layer feedforward neural network trained according to the error back propagation algorithm, which is one of the more widely used neural network models; and ELM and RBF are kinds of single hidden layer feedforward neural networks-ELM has the advantages of few training parameters and fast learning speed and RBF uses radial basis function as the activation function of hidden layer neurons, which is a kind of local approximation network with a strong generalization ability. The root mean squared error (RMSE) and mean absolute error (MSE) are used to judge the performance of each model on the test set, and the smaller the values, the better the risk prediction ability of the model, which are calculated by Equations (11) and (12), respectively. The experimental results are shown in Table 6. The RMSE value and MAE value of the TabNet-based model are the smallest among the seven models, which are 0.0710 and 0.0532, respectively, indicating that TabNet can predict the risk value of meat samples more accurately. The risk prediction error curves of the seven models are shown in Figure 4. The error is obtained by subtracting the true value from the model prediction and taking the absolute value, and it can be seen that the error curve of TabNet fluctuates the least. Meanwhile, from Figure 5, it can be found that the curves of the predicted values of TabNet almost overlap with the curves of the true values, while the curves of the predicted values of the other models have a larger gap with the curves of the true values, indicating that its fitting ability is stronger than that of the other comparison models. Therefore, it can be concluded that the TabNet-based food safety risk prediction model is better than the other comparison models in terms of risk prediction accuracy, stability, and generalization ability.
where n is the number of samples, y i is the true risk value of the i th sample, andŷ i is the predicted risk value of the i th sample.

FSRvis System
The framework of the FSRvis system developed in this work is shown in Figure 1B. It comprised several views, including the detection data view; risk indicator detection content view; risk prediction results view; sample details view; risk value distribution view; sample risk composition view; and the portion view of samples for each risk level, which can realize the prediction and visual analysis of food safety risk based on sampling data. Figure 6 shows the interface of the system obtained by uploading the detection results of 48 samples of cooked meat products in December 2019. Due to space limitations, please refer to the Supplementary Material for a detailed description of the interaction of each view of the system.

FSRvis System
The framework of the FSRvis system developed in this work is shown in Figure 1B. It comprised several views, including the detection data view; risk indicator detection content view; risk prediction results view; sample details view; risk value distribution view; sample risk composition view; and the portion view of samples for each risk level, which can realize the prediction and visual analysis of food safety risk based on sampling data. Figure 6 shows the interface of the system obtained by uploading the detection results of 48 samples of cooked meat products in December 2019. Due to space limitations, please refer to the Supplementary Material for a detailed description of the interaction of each view of the system.  In the detection data view ( Figure 6A) in the FSRvis system, analysts uploading food detection results in the tabular form receive the content presented in the other views, and sliders are used to adjust the warning thresholds. The uploaded data sample size as well as the risk indicators are also shown to facilitate a better understanding of the content of the other views. The detection content of the risk indicator view ( Figure 6B) presents the detection content of nine risk indicators in the form of a bar chart, which allows you to clearly see the distribution of the detection content of each evaluation indicator, as well as the comparison of the content of each sample in the same indicator. The risk prediction results view ( Figure 6C) presents the risk prediction results by the risk prediction model for the uploaded samples, with the horizontal axis indicating the sample number and the vertical axis indicating the predicted risk value. The prediction results are visualized using three markers, point, line, and surface, respectively, and two visual channels, position and color, to present the prediction results. According to the risk calculation in this work, when the sample risk is greater than one, it means that there is at least one risk indicator in the sample with a detection content greater than the maximum limit, so the risk level is coded by color in the three sub-views: red denotes that the risk value is greater than the warning threshold (high risk), yellow denotes that the sample risk value is between one-half of the warning threshold and the warning threshold (medium risk), and green denotes that the sample risk is less than one-half of the warning threshold (low risk), and the analyst can slide the slider in view ( Figure 6A) to adjust the warning threshold according to the actual situation. In this way, the high-risk food samples (redmarked samples in view ( Figure 6C)) can be found visually and effectively. The subview ( Figure 6C 1 ) can effectively discover the distribution of different sample risks in the form of a scatter plot; the subview ( Figure 6C 2 ) can visually compare the risk level of adjacent or different samples in the form of a bar chart; and the subview ( Figure 6C 3 ) can obviously observe the trend of sample risks in the form of a line graph. For problems such as graphical overlap caused by a large number of samples, a brush tool is designed to enable the swiping of samples, which can increase the distance between markers in the view, and this tool is also applicable to views ( Figure 6C 2 ) and ( Figure 6C 3 ). For further analysis, a function for downloading risk results was designed in each subview of view ( Figure 6C).
The sample details information view ( Figure 6D) uses a hierarchical tree to explore the details of a single sample. By selecting a sample in view ( Figure 6C) by clicking on it, you can display information about the detection time, food category, food name, and sampling results of each risk indicator for that sample in view ( Figure 6D). The root node in the tree diagram denotes the sample, the color is synchronized with the view (Figure 6C), the second layer denotes the attribute name, and the third layer denotes the attribute value. The distribution information of the predicted risk results for the data samples is presented in the distribution of the risk values view ( Figure 6E), through which the overall situation of the sample risk can be understood, e.g., the third quartile is 0.937, indicating that three-quarters of the sample risk is below 0.937.
In the risk composition of the samples view ( Figure 6F), the relative risk of each indicator is presented using parallel coordinates, which is the hazard level matrix for pollutants D in Equation (6), where each vertical axis represents an indicator and each line through each indicator represents a sample, which passes through each axis, from which the impact of each indicator on the risk of the sample can be analyzed. As in view ( Figure 6C), here the color channels are used to indicate the level of risk. The proportion of the samples by the risk-level view ( Figure 6G) mainly presents the percentage of samples with different risk levels obtained from the uploaded data samples, as predicted by the TabNet-based model.

Discussion
First, the proposed GRA-based quantitative risk assessment method can calculate fine-grained risk values of food products in detection data, enabling a more accurate identification of food safety risks. This method calculated the correlation between each risk indicator by using the GRA approach and obtained the weight of each indicator, subsequently calculating the risk value based on the weighted sum of all indicator detections. In comparison with qualitative risk assessment methods, this quantitative approach allowed for a more precise evaluation of food risks, overcoming the limitations of subjectivity and difficulties in quantifying risks to a certain extent.
Second, the proposed food safety risk prediction method, TabNet-GRA, provided a rapid and direct comprehensive risk value for food based on detection data, exhibiting a superior predictive ability when compared with typical prediction models. The TabNet-GRA method first derives the comprehensive risk value of fused detection data using GRA. It then constructs a risk prediction model based on TabNet, trained using the detection data as the input and the comprehensive risk value calculated via the GRA as the expected output. Subsequently, users can employ this trained model to directly predict the comprehensive risk value of food based on new detection data, eliminating the need for previous complex calculation processes. As a result, food safety risks can be promptly identified. Comparative experimental results demonstrated that the TabNet-based prediction model exhibits lower error rates than the current typical models, including RF, GBDT, XGBoost, BP, ELM, and RBF, showcasing its superior fitting ability and ability to predict food safety risk more accurately and efficiently.
Third, the developed FSRvis system offers support for food safety risk assessment, prediction, and visual analysis in a more intuitive and effective manner. The system integrated the risk prediction model constructed based on the TabNet-GRA method and employed multi-view collaborations, providing multiple views of detection data, detection content for each risk indicator, risk prediction results, risk composition, sample detail information, etc. This approach enabled risk prediction and multi-faceted interactive visual analysis of new detection data, thereby enhancing the efficiency and accuracy of risk analysis. Food safety supervision departments can utilize this system to conduct in-depth analysis of detection data and subsequently implement targeted food safety monitoring, early warning, and control measures based on risk analysis outcomes. For example, the FSRvis system can be employed to focus on monitoring and controlling high-risk food products and safety hazards, ultimately improving the cost-efficiency of supervision efforts.

Conclusions and Future Work
In conclusion, this work addressed the critical aspect of data-driven food safety risk early warning, which was a pivotal method for ensuring effective food safety supervision. This study proposed an innovative risk prediction method for food safety, namely TabNet-GRA, which harnessed the advantages of TabNet and GRA to empower accurate and expeditious fine-grained risk prediction based on detection data. To substantiate its efficacy, this study conducted a comprehensive case study and method evaluation using a dataset comprising 87,260 original records of cooked meat products detection from a Chinese province. The comparative evaluation unequivocally demonstrated the superiority of the TabNet-based prediction model over six typical models (RF, GBDT, XGBoost, BP, ELM, and RBF) under equivalent conditions. Additionally, this study has implemented an intelligent visualization system named the FSRvis system which is built upon the TabNet-GRA method. This advanced system facilitated food safety risk prediction and multi-dimensional interactive visual analysis, elevating the efficiency and scope of food safety risk analysis to new heights.
In future work, the intention is to explore two pivotal research directions. Firstly, the goal involves parameter optimization of the risk prediction model by employing particle swarm optimization (PSO) and Bayesian optimization techniques, aiming to further elevate the prediction accuracy. Secondly, attention will be directed towards devising an automated warning report generation method, which is capable of generating comprehensive analysis reports for users following risk analysis and prediction of detection data. These improvements will substantially amplify the practicality and real-world applicability of the TabNet-GRA method.
Supplementary Materials: The following supporting information can be downloaded at: https:// www.mdpi.com/article/10.3390/foods12163113/s1, Food safety risk prediction and visualization system decomposition diagram and description.