With the growth in the living standard of people, food safety and quality risk assessment has gradually become the focus. Therefore, this article realizes the dynamic risk assessment of food safety based on an improved hidden Markov model (HMM) integrating the cuckoo search algorithm (CS) (CS‐HMM). The CS is used to conduct global search to obtain the initial value of HMM, and then the Baum–Welch algorithm is used for modifying the initial value to obtain a trained risk assessment model. Finally, in terms of several benchmark functions, the accuracy of the CS algorithm is better than the PSO and the GA algorithms for seeking global optimal solution. Moreover, the presented method is applied to evaluate the safety risk of the sterilized milk production. Combined with the characteristics of time and temperature, the deterioration reasons of sterilized milk are analyzed. Moreover, the proposed method has certain theoretical significance and practical value for improving the ability of food quality risk assessment and formulating control measures in advance.
Practical applications
The presented method is applied to evaluate the safety risk of the sterilized milk production, which are supplied by the food inspection agency of Guizhou province in China. Combined with the characteristics of time and temperature, the deterioration reasons of sterilized milk are analyzed. Furthermore, the improved model breaks out of the local optimal limit, so as to better realize the risk prediction of food and obtain better evaluation results. Based on the analysis of dynamic risk assessment result with the temperature characteristics, the future risk trend can be predicted. Meanwhile, the causes affecting the deterioration of the sterilized milk and the direction to improve the quality of the sterilized milk can be obtained. In this way, risk control measures can be taken more precisely and risks can be reduced more effectively, which is helpful to the production and storage of food products.