Risk early warning method and system based on food safety comprehensive index

Through the comprehensive food safety index method based on the LASSO regression algorithm, the problem that traditional food safety management methods are difficult to deal with complex risk factors is solved, and a comprehensive prediction and early warning of food safety risks is achieved, providing strong decision-making support for food safety management.

CN119990736APending Publication Date: 2025-05-13SHANGHAI MUNICIPAL ADMINISTRATION FOR MARKET REGULATION INFORMATION APPL RES CENT (SHANGHAI FOOD SAFETY TECH APPL CENT SHANGHAI MUNICIPAL ADMINISTRATION FOR MARKET REGULATION ARCHIVES)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411891149.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

Traditional food safety management methods are difficult to deal with complex and changeable risk factors, and cannot accurately predict food safety risks. This is mainly due to the limitations of data collection and analysis. Traditional methods focus on factors in single dimensions and cannot comprehensively consider factors in multiple dimensions.

Method used

The food safety comprehensive index method based on the LASSO regression algorithm is used to collect food safety index data through different source databases, preprocess and model training, and determine the LASSO regression model to predict the food safety comprehensive index and conduct risk warning based on the predicted results.

Benefits of technology

By constructing a food safety index based on the LASSO algorithm, complex multi-dimensional food safety data can be converted into specific indexes, providing strong decision-making support for food safety management, and achieving more comprehensive prediction and early warning of food safety risks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119990736A_ABST
    Figure CN119990736A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of food safety prediction, in particular to a risk early warning method based on a food safety comprehensive index, and the method comprises the steps: collecting independent variable and dependent variable data of a food safety index through different source databases, carrying out the preprocessing, forming a food safety index data set, and dividing the data set into a training set and a verification set according to a certain proportion; a food safety index data set is used for training, an LASSO regression regularization coefficient is determined, then an LASSO regression model is determined based on the regularization coefficient, the food safety comprehensive index can be predicted, and a prediction result is obtained. According to the method, the advantages of big data and machine learning can be utilized, complex and multi-dimensional food safety data can be converted into specific and operable indexes, powerful decision support is provided for food safety management, and in the face of new food safety problems, related variables can be quickly brought into an index model and the model is updated. New risks are reflected in time, and adjustment of countermeasures is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of food safety prediction, and in particular to a risk early warning method and system based on a comprehensive food safety index. Background Art

[0002] Food safety is an important issue in the field of public health and concerns the health and well-being of the general public. The food safety index is a relatively comprehensive indicator that covers all areas of food safety. Traditional food safety management methods mainly rely on qualitative analysis or simple analysis based on historical data, which is difficult to cope with increasingly complex and changing risk factors. Due to the limitations of data collection and analysis, traditional food safety management can only identify risks at a relatively general level, but food safety risks are often the result of multiple factors, involving food production, circulation, catering and other links. Traditional risk assessment methods often focus on factors of a single dimension and cannot accurately predict food safety risks. Summary of the invention

[0003] In view of this, the purpose of the present invention is to propose a risk warning method and system based on a comprehensive food safety index to solve the problems of existing methods.

[0004] Based on the above purpose, the present invention provides a risk warning method based on a comprehensive food safety index, comprising the following steps:

[0005] S1. Collect independent and dependent variable data of food safety indicators through different source databases;

[0006] S2. Preprocess the collected food safety index data to form a food safety index data set, and divide the data set into a training set and a validation set according to a certain ratio;

[0007] S3, use the food safety index data set for training and determine the LASSO regression regularization coefficient;

[0008] S4, determining a LASSO regression model based on the determined LASSO regression regularization coefficient;

[0009] S5, inputting the pre-processed food safety index data before the target date into the LASSO regression model, predicting the food safety comprehensive index, and obtaining the prediction result;

[0010] S6. Based on the prediction results of the model, risk warnings are issued for areas where the total score of the subsequent food safety index is below the critical value.

[0011] Preferably, in step S1, the independent variables of the food safety indicators include information traceability-production, information traceability-sales, information traceability-catering, law enforcement inspection-production, law enforcement inspection-sales, law enforcement inspection-catering, complaints and reports-production, complaints and reports-sales, complaints and reports-catering, administrative penalties-production, administrative penalties-sales, administrative penalties-catering, random inspections and assessments-special foods, random inspections and assessments-network platforms, random inspections and assessments-food production, random inspections and assessments-food sales, random inspections and assessments-catering services, random inspection and monitoring-random inspection coverage, random inspection and monitoring-supervisory random inspections, comprehensive indicators-enterprise management system certification rate, comprehensive indicators-citizen satisfaction, comprehensive indicators-citizen awareness, and comprehensive indicators-food poisoning incidence rate.

[0012] Preferably, in step S1, the dependent variable of the food safety index is a comprehensive food safety index.

[0013] Preferably, preprocessing the collected food safety index data includes:

[0014] All independent variables are standardized, that is, the mean of each independent variable is adjusted to 0 and the variance is adjusted to 1.

[0015] Preferably, step S3 specifically includes:

[0016] The regularization coefficient is selected by the cross-validation method, and the cv.glmnet function is used for cross-validation to evaluate the prediction effect of the model corresponding to each value on the validation set to determine the optimal parameters.

[0017] Preferably, the goal of the LASSO regression model is to minimize the following objective function:

[0018]

[0019] Among them, Y represents the dependent variable, X represents the independent variable, B represents the regression coefficient, a represents the adjustment term, j represents the jth independent variable, p represents the number of independent variables, and B represents the number of independent variables. LASSO represents the target regression coefficient.

[0020] The present invention also provides a risk warning system based on a comprehensive food safety index, which is used to execute the above-mentioned risk warning method based on a comprehensive food safety index.

[0021] Beneficial effects of the present invention:

[0022] 1. By constructing a food safety index based on the LASSO algorithm, the present invention can take advantage of big data and machine learning to transform complex, multi-dimensional food safety data into a specific, actionable index, and provide strong decision-making support for food safety management. The LASSO algorithm comprehensively considers factors in multiple dimensions and integrates risk factors into a single index value, thereby providing a more comprehensive risk overview.

[0023] 2. The present invention can trigger an early warning in time when the index value declines through dynamic monitoring of the food safety index, provide real-time risk warnings, take rapid intervention measures, and reduce potential food safety accidents. In particular, when the food safety risk increases significantly, it can predict and take measures in advance to reduce the hazards of the corresponding period.

[0024] 3. The food safety index model based on LASSO of the present invention can adjust the model structure relatively quickly because it can perform feature selection. When facing new food safety issues, relevant variables can be quickly incorporated into the index model, and important features related to new risks can be automatically selected through LASSO to update the model. In this way, new risks can be reflected in a timely manner, which helps to adjust countermeasures. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0026] Figure 1 A flowchart of a risk warning method based on a comprehensive food safety index according to an embodiment of the present invention;

[0027] Figure 2 This is a comparison chart of the predicted values ​​and measured values ​​of the food safety comprehensive index scores of 16 districts in Shanghai according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.

[0029] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0030] like Figure 1 As shown, the embodiment of this specification provides a risk warning method based on the comprehensive index of food safety, and the comprehensive index of food safety is predicted using the LASSO algorithm. LASSO is a regression analysis method used in statistics and machine learning. The core is to control the complexity of the model by introducing a regularization term, and then select appropriate independent variables, and reduce the impact of redundant variables on the model. Unlike ordinary linear regression, LASSO can adjust the independent variable coefficients so that some coefficients are directly 0, thereby realizing the automatic selection of variables. Therefore, the LASSO algorithm is particularly suitable for high-dimensional data sets and situations where the number of variables is much larger than the observed data points.

[0031] Specifically, the method comprises the following steps:

[0032] S1. Collect independent and dependent variable data of food safety indicators through different source databases;

[0033] The first step of model construction is to collect relevant independent variables and dependent variable data. According to the demand, the present embodiment extracts food safety related indicators within a specific time period from the data source. The independent variable is the average of multiple food related indicators within a period of time, and the dependent variable is the target variable to be predicted (the comprehensive index of food safety in a certain month in the future, i.e., the total score). In the secondary index, the independent variable indicators to be collected include information tracing-production, information tracing-sales, information tracing-catering, law enforcement inspection-production, law enforcement inspection-sales, law enforcement inspection-catering, complaints and reports-production, complaints and reports-sales, complaints and reports-catering, administrative penalties-production, administrative penalties-sales, administrative penalties-catering, random inspection and assessment-special food, random inspection and assessment-network platform, random inspection and assessment-food production, random inspection and assessment-food sales, random inspection and assessment-catering service, random inspection and monitoring-random inspection coverage, random inspection and monitoring-supervision random inspection, comprehensive indicators-enterprise management system certification rate, comprehensive indicators-citizen satisfaction, comprehensive indicators-citizen awareness, comprehensive indicators-food poisoning incidence, and these independent variables are all numerical data. The covariate to be collected is the data update time. The dependent variable that needs to be collected is the total score of the food safety index.

[0034] S2. Preprocess the collected food safety index data to form a food safety index data set, and divide the data set into a training set and a validation set according to a certain ratio;

[0035] In this embodiment, data standardization is required before LASSO modeling. Since LASSO is sensitive to data of different scales, all independent variables need to be standardized before modeling, that is, the mean value of each independent variable is adjusted to 0 and the variance is adjusted to 1 to avoid certain features of larger magnitude from having too great an impact on the model results.

[0036] S3, use the food safety index data set for training and determine the LASSO regression regularization coefficient;

[0037] The core goal of LASSO regression is to minimize the residual sum of squares with regularization terms. In this embodiment, the regularization coefficient is selected by cross-validation. The cv.glmnet function is used for cross-validation, and the data set is divided into a training set and a validation set. The prediction effect of the model corresponding to each value on the validation set is evaluated to determine the optimal parameters. For example, the division ratio of the training set and the validation set can be 7:3 or 8:2.

[0038] S4, determining a LASSO regression model based on the determined LASSO regression regularization coefficient;

[0039] After the optimal regularization coefficient is determined, the final model needs to be determined based on this parameter. The independent variable and the dependent variable are modeled through LASSO regression to obtain the regression coefficient of the independent variable. The regularization coefficient determined above can enable the model to automatically reduce the coefficients of those variables that are weakly correlated with the dependent variable to 0, thereby achieving variable selection. The model form is as follows:

[0040] Taking the LASSO equation for predicting data one month later in the secondary indicator model as an example (using data before May 2023 to predict data in June 2023), the equation is:

[0041] Y=0.0236X 信息追溯-餐饮 -0.0808X 执法检查-餐饮 -0.0647X 行政处罚-餐饮 +0.6141X 抽查考核-特殊食品

[0042] +0.2382X 抽查考核-网络平台 +0.04327X 抽查考核-食品生产 +0.3402X 抽查考核-食品销售 +0.6575X 抽查考核-餐饮服务 +0.04263X 抽检监测-抽检覆盖 +0.0893X 综合性指标-市民知晓度 .

[0043] S5. Input the pre-processed food safety index data before the target date into the LASSO regression model, predict the comprehensive food safety index, and obtain the prediction result.

[0044] In this embodiment, the R-square value of the LASSO model is generally above 0.8 or 0.9, indicating that the model has a good fitting effect. This study also provides a graphical description of the actual value and the predicted value. The results show that the data points are very close to the straight line y=x, indicating that the model has good accuracy. The specific image is as follows Figure 2 As shown, the horizontal axis is the true value and the vertical axis is the predicted value.

[0045] The risk warning method based on the food safety comprehensive index provided in this embodiment can be applied in the following aspects:

[0046] (1) Risk warning

[0047] By establishing a food safety index model, we can use variables to predict the index scores of different districts in Shanghai in three months and six months. This index can reflect the overall situation and trend of food safety in the region, and provide a basis for food safety sampling monitoring and supervision. For areas where food safety is below the critical value, risk warnings will be issued, indicating that food safety in the area may have problems after the corresponding period of time, so as to strengthen monitoring of the area.

[0048] (2) Targeted intervention

[0049] When the comprehensive food safety index of a certain area continues to decline, or even triggers an early warning mechanism, targeted intervention measures can be formulated based on the specific information provided by the index. For example, check which variable has the greatest impact. Unlike traditional extensive inspections, intervention measures based on the food safety index can be more accurate and effective, reducing the waste of ineffective resources.

[0050] (3) Partition prediction

[0051] Since Shanghai has 16 districts, the food consumption patterns and risk points of each district may be different. When applied, the model can evaluate and predict the unique situation of each district and accurately monitor the food safety trends of each district. Therefore, regional processing can improve the effectiveness of early warning and optimize resource allocation. The uniqueness of the LASSO algorithm in the food field:

[0052] This method is the first application of the LASSO algorithm to the early warning field of food safety index scores. The traditional method may be ordinary regression, which rarely makes trade-offs in the selection of independent variables. A major feature of indicators in the field of food safety is that there are many indicators. For example, the number of indicators in the data of the third-level indicators is as high as 172. Traditional methods are difficult to handle data with many variables and high dimensions, and the LASSO algorithm provides a solution to this problem. Specifically:

[0053] (1) Feature selection:

[0054] Food safety data contains many influencing factors, such as information traceability, administrative penalties, and some comprehensive indicators. Some of these factors have a greater impact on the total score, while others have a smaller impact or are even irrelevant. The regularization term of LASSO will reduce the coefficients of irrelevant or less influential features to 0, thereby automatically screening out key features, which can make the food safety prediction model more focused on the core influencing factors and make the model more concise.

[0055] (2) Processing high-dimensional data:

[0056] Since food safety data contains a large number of variables, especially for the third-level indicators, traditional regression methods are prone to overfitting when dealing with high-dimensional data, while LASSO effectively controls the complexity of the model by introducing penalty terms, thereby reducing the risk of overfitting and ensuring the robustness of the model.

[0057] Compared with the LASSO method provided in this specification, the performance of traditional regression methods in food safety prediction is relatively inferior. For example, traditional methods such as linear regression do not have the function of automatically selecting features, and it is difficult to handle high-dimensional data and a large number of irrelevant variables. Moreover, traditional methods usually lead to overfitting when there are many variables, or require manual screening of variables, resulting in low efficiency. Since data in the field of food safety often contain multi-level and strongly correlated variables, traditional regression methods have limited applicability in accurate prediction and risk analysis, and are more suitable for dealing with situations with fewer variables and simple structures.

[0058] Neural network methods are suitable for dealing with more complex nonlinear relationships. In the prediction of food safety data, methods such as deep neural networks (DNNs) can learn highly complex variable relationships. However, neural network models usually require a large amount of data and computing resources, and food safety data does not always have sufficient sample size. In addition, the "black box" characteristics of neural networks make them less interpretable than LASSO, and it is difficult to clearly show the specific impact of each variable on food safety risks, which may affect the credibility of decision-making.

[0059] Those skilled in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the present invention is limited to these examples; under the concept of the present invention, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity. Any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A risk warning method based on a comprehensive food safety index, characterized in that: The following steps are involved: S1. Collect independent and dependent variable data of food safety indicators through different source databases; S2. Preprocess the collected food safety index data to form a food safety index data set, and divide the data set into a training set and a validation set according to a certain ratio; S3, use the food safety index data set for training and determine the LASSO regression regularization coefficient; S4, determining a LASSO regression model based on the determined LASSO regression regularization coefficient; S5, inputting the pre-processed food safety index data before the target date into the LASSO regression model, predicting the food safety comprehensive index, and obtaining the prediction result; S6. Based on the prediction results of the model, risk warnings are issued for areas where the total score of the subsequent food safety index is below the critical value.

2. The risk warning method based on the food safety comprehensive index according to claim 1 is characterized in that: In step S1, the independent variables of food safety indicators include information traceability-production, information traceability-sales, information traceability-catering, law enforcement inspection-production, law enforcement inspection-sales, law enforcement inspection-catering, complaints and reports-production, complaints and reports-sales, complaints and reports-catering, administrative penalties-production, administrative penalties-sales, administrative penalties-catering, random inspection and assessment-special foods, random inspection and assessment-network platform, random inspection and assessment-food production, random inspection and assessment-food sales, random inspection and assessment-catering services, random inspection and monitoring-random inspection coverage, random inspection and monitoring-supervisory random inspection, comprehensive indicators-enterprise management system certification rate, comprehensive indicators-citizen satisfaction, comprehensive indicators-citizen awareness, and comprehensive indicators-food poisoning incidence.

3. The risk warning method based on the food safety comprehensive index according to claim 1 is characterized in that: In step S1, the dependent variable of the food safety index is the total score of the food safety index.

4. The risk warning method based on the food safety comprehensive index according to claim 1 is characterized in that: The preprocessing of the collected food safety index data includes: All independent variables are standardized, that is, the mean of each independent variable is adjusted to 0 and the variance is adjusted to 1.

5. The risk warning method based on the food safety comprehensive index according to claim 1 is characterized in that: Step S3 specifically includes: The regularization coefficient is selected by cross-validation method, and the cv.glmnet function is used for cross-validation to evaluate the prediction effect of the model corresponding to each value on the validation set to determine the optimal parameters.

6. The risk warning method based on the food safety comprehensive index according to claim 1 is characterized in that: The goal of the LASSO regression model is to minimize the following objective function: Among them, Y represents the dependent variable, X represents the independent variable, B represents the regression coefficient, a represents the adjustment term, j represents the jth independent variable, p represents p independent variables, and B LASSO represents the target regression coefficient.

7. A risk warning system based on a comprehensive food safety index, used to execute the risk warning method based on a comprehensive food safety index as described in any one of claims 1-6.