| The establishment of food safety early warning system is a necessary means to prevent food safety problems,strengthen food safety management and implement food safety strategy.As an important link in food safety supervision,agricultural product quality and safety early warning needs more attention.In recent years,with the popularization and wide application of information technology,data-driven anomaly detection technology has made some important achievements in the research and exploration of food safety.Therefore,it is particularly necessary to study how to use anomaly detection technology to process and analyze the data of agricultural products in the market,and to assist the government regulatory authorities to carry on the scientific and efficient management,so as to reduce the irreparable losses caused by the quality and safety problems of agricultural products.In the existing data of agricultural products,due to the large amount of information,complicated data,rapid information change,wide coverage and other characteristics,When using the traditional Isolation Forest(iForest)algorithm for anomaly detection,its random selection of features reduces the quality of isolated trees and ignores the difference in anomaly detection ability among isolated trees,resulting in low accuracy of anomaly detection.Thus,it is difficult to extract useful information from existing data.This paper proposes an improved isolated forest algorithm named DW-iForest(Double Weight iForest)to solve the above problems.In this algorithm,entropy weight method is adopted to change random feature selection in the traditional isolated forest algorithm to feature weighted selection,so as to reduce the impact of random selection of features.Secondly,for the difference of anomaly detection ability among isolated trees in the traditional isolated forest algorithm,Dw-iForest adopts the normalized weighting of standard deviation of path length to calculate outliers.Finally,the DW-iForest algorithm is compared with 7 representative anomaly detection algorithms in 11 public data sets and real agricultural product data sets.The experimental results show that DW-iForest algorithm has great improvement in accuracy and AUC value,and significantly reduces the computational cost of the algorithm while effectively improving the accuracy of anomaly detection.Thus,the effectiveness and stability of the improved algorithm in this paper are verified.This paper also uses DW-iForest anomaly detection method to focus on the realtime online data of agricultural products,and based on this designs and implements an agricultural product quality and safety early warning system based on unsupervised anomaly detection method.According to the actual demand of the market,the system can accurately detect the abnormal state of the real-time data of agricultural products and make a comprehensive statistical analysis of the abnormal detection results,so as to realize the hierarchical security warning of abnormal agricultural products. |