Agricultural product price fluctuation early warning method and system based on model prediction
By obtaining the historical price data of the agricultural product belonging points and combining multiple prediction models for combined operations, the problem of ignoring natural factors and changes in market supply and demand in the existing technology is solved, and more accurate agricultural product price prediction and early warning is achieved.
Patent Information
- Application Number
- CN202510629329.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-06-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art tends to ignore natural factors and market supply and demand changes in agricultural product price prediction, resulting in inaccurate predictions and difficult to effectively integrate multidimensional data for more accurate predictions.
By obtaining the historical price data of the agricultural product attribution points, dividing multiple target years, obtaining the weekly price curve and fluctuation curve, combining multiple prediction models for combination operations, importing the data to be predicted to obtain the predicted prices of multiple models, and correcting them when there are extreme influencing factors.
The agricultural product price prediction is achieved through the fusion of multi-dimensional data, which eliminates the error of prediction of a single model, improves the accuracy of prediction, and corrects when there are extreme influencing factors, enhancing the reliability of early warning.
Smart Images

Figure CN120146901A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of agricultural product price early warning, and particularly relates to a method and system for predicting agricultural product price fluctuations based on model prediction. Background Art
[0002] As important materials for human survival and development, fluctuations in the prices of agricultural products will have many impacts on agricultural producers, operators, and consumers.
[0003] In the prior art, the prediction of agricultural product prices is often achieved through methods such as the moving average method, exponential smoothing method, ARIMA model, and causal analysis method. Time series analysis methods have also laid a foundation for the prediction of agricultural product prices.
[0004] Although the above methods can achieve the prediction and early warning of agricultural product prices, predicting only through one dimension is likely to lead to inaccurate predictions and easily overlook the influence of external factors such as natural factors and changes in market supply and demand on agricultural product prices. Therefore, a method is needed that can achieve the estimation of the initial predicted price through the integration of multi-dimensional data and correct the initial predicted price when there are adjacent extreme influencing factors, so as to obtain a more accurate agricultural product price. Summary of the Invention
[0005] The present invention provides a method for predicting agricultural product price fluctuations based on model prediction and a computer-readable storage medium. Its main purpose is to estimate the initial predicted price through the integration of multi-dimensional data and correct the initial predicted price when there are adjacent extreme influencing factors, so as to obtain a more accurate agricultural product price.
[0006] To achieve the above object, a method for predicting agricultural product price fluctuations based on model prediction provided by the present invention includes:
[0007] Obtain the attribution point of the agricultural product, obtain the historical price data set based on the attribution point of the agricultural product, divide the historical price data set to obtain multiple target years, and obtain the marked weekly price curve and marked fluctuation curve corresponding to each target year in the multiple target years to obtain preprocessed historical data;
[0008] Obtain a set of prediction models, perform a combination operation on the set of prediction models to obtain multiple combined models, where the set of prediction models includes multiple prediction models;
[0009] Obtain the data of the attribution point of the agricultural product to be predicted, where the data of the attribution point of the agricultural product to be predicted includes: the agricultural product to be predicted, the supply port to be predicted, the port area to be predicted, and the time to be predicted;
[0010] Obtain adjacent day data based on the data of the attribution points of agricultural products to be predicted and the preprocessed historical data, import the adjacent day data and the preprocessed historical data into multiple combined models to obtain multiple model predicted prices, calculate the historical predicted prices based on the preprocessed historical data, and calculate the adjacent predicted prices based on the adjacent day data;
[0011] Obtain the initial predicted price of the data of the attribution points of agricultural products to be predicted based on the multiple model predicted prices, the historical predicted prices and the adjacent predicted prices, and obtain the adjacent extreme influencing factor set of the adjacent day data;
[0012] If the adjacent extreme influencing factor set is not an empty set, then obtain the corrected agricultural product price based on the adjacent extreme influencing factor set, and generate a price warning based on the adjacent extreme influencing factor set;
[0013] Otherwise, complete the early warning of the price fluctuation of agricultural products based on the model prediction based on the initial predicted price.
[0014] Optionally, the obtaining of the attribution points of agricultural products includes:
[0015] Obtain a set of agricultural products, and perform the following operations on each agricultural product in the set of agricultural products:
[0016] Obtain the set of supply ports corresponding to the agricultural product, sequentially extract the supply ports from the set of supply ports, and obtain the set of port regions corresponding to the supply port, sequentially extract the port regions from the set of port regions, and merge the agricultural product, the port region and the supply port to obtain the initial attribution point of the agricultural product, where the supply port includes: the production end and the sales end, and the initial attribution point of the agricultural product includes: one agricultural product, one supply port and one port region;
[0017] Summarize the initial attribution points of agricultural products, and extract the attribution points of agricultural products from the summarized initial attribution points of agricultural products.
[0018] Optionally, the obtaining of the identification weekly price curve and the identification fluctuation curve corresponding to each target year in the multiple target years to obtain the preprocessed historical data includes:
[0019] Sequentially extract the target years from the multiple target years, and perform the following operations on the extracted target years:
[0020] Divide the extracted target year based on the preset weekly time sequence to obtain multiple weekly price time sequences, and fill the multiple weekly price time sequences with the historical price data set to obtain multiple weekly price data sets;
[0021] Perform the following operations on each of the weekly price data sets in the multiple weekly price data sets:
[0022] Statistically count the agricultural product price set and the number of samples in the weekly price dataset, calculate the weekly price average based on the agricultural product price set and the number of samples, and obtain the set of extreme influencing factors of the weekly price average within the weekly price time series, where the set of extreme influencing factors includes zero, one, or more extreme influencing factors;
[0023] Summarize the weekly price averages in chronological order from earliest to latest to obtain multiple sequential weekly prices;
[0024] Calculate multiple sequential weekly volatility ratios based on the multiple sequential weekly prices, obtain the weekly price curve and volatility curve corresponding to the target year according to the multiple sequential weekly prices and the multiple sequential weekly volatility ratios, and perform a marking operation on the weekly price curve and volatility curve based on the set of extreme influencing factors to obtain a marked weekly price curve and a marked volatility curve;
[0025] Summarize the marked weekly price curve and the marked volatility curve to obtain preprocessed historical data.
[0026] Optionally, the calculating the weekly price average based on the agricultural product price set and the number of samples includes:
[0027] If the number of samples is greater than a preset sample quantity threshold, calculate the average of the agricultural product prices in the agricultural product price set to obtain the weekly price average;
[0028] If the number of samples is less than or equal to the sample quantity threshold, then obtain multiple adjacent weekly price time series and multiple agricultural product classification attribution points of the weekly price dataset, confirm the adjacent weekly price average corresponding to each adjacent weekly price time series among the multiple adjacent weekly price time series to obtain multiple adjacent weekly price averages, query the classification weekly price average of each agricultural product classification attribution point in the weekly price time series to obtain multiple classification weekly price averages, and calculate the average of the multiple adjacent weekly price averages and the multiple classification weekly price averages to obtain the weekly price average.
[0029] Optionally, the calculating multiple sequential weekly volatility ratios based on the multiple sequential weekly prices, obtaining the weekly price curve and volatility curve corresponding to the target year according to the multiple sequential weekly prices and the multiple sequential weekly volatility ratios, and performing a marking operation on the weekly price curve and volatility curve based on the set of extreme influencing factors to obtain a marked weekly price curve and a marked volatility curve includes:
[0030] Successively extract sequential weekly prices from the multiple sequential weekly prices, and extract the next sequential weekly price adjacent to the sequential weekly price to obtain an adjacent sequential weekly price, calculate the sequential volatility ratio based on the sequential weekly price and the adjacent sequential weekly price, and summarize the sequential volatility ratios to obtain multiple sequential volatility ratios, where the sequential volatility ratios correspond one-to-one with the sequential weekly prices, and the calculation formula of the sequential volatility ratio is as follows:
[0031]
[0032] Where, Indicates the sequential fluctuation ratio, Indicates the adjacent sequential weekly price, Indicates the sequential weekly price;
[0033] Based on the multiple weekly price time series, construct multiple weekly time abscissas. Use the multiple weekly time abscissas as the abscissa of the weekly price curve, and use the multiple sequential weekly prices corresponding to the multiple weekly time abscissas as the ordinate of the weekly price curve. Use a pre-constructed curve fitting method to construct the weekly price curve;
[0034] Use the multiple weekly time abscissas as the abscissa of the fluctuation curve, and use the multiple sequential fluctuation ratios corresponding to the multiple weekly time abscissas as the ordinate to construct the fluctuation curve;
[0035] Extract the sequential weekly prices in the weekly price curve in sequence to obtain the target identification points. Extract the weekly price time series, the extreme influencing factor set, and the sequential fluctuation ratio corresponding to the target identification points to obtain the sequential weekly price identification. Use the sequential weekly price identification to perform an identification operation on the target identification points. After confirming that the identification operation has been performed on all the target identification points in the weekly price curve, obtain the identified weekly price curve;
[0036] Use the extreme influencing factor set and the multiple sequential fluctuation ratios to obtain the identified fluctuation curve.
[0037] Optionally, the importing the adjacent day data and the preprocessed historical data into multiple combined models to obtain multiple model predicted prices includes:
[0038] Extract the combined models from the multiple combined models in sequence, and perform the following operations on all the combined models:
[0039] Identify the first model and the second model. Divide the preprocessed historical data into a historical training set and a historical test set. Use the historical training set to train both the first model and the second model, and use the historical test set to test both the trained first model and the trained second model to obtain the first mean square error and the second mean square error. Calculate the first weight and the second weight based on the first mean square error and the second mean square error;
[0040] Import the adjacent day data and the preprocessed historical data into the trained first model and the trained second model to obtain the initial first model and the initial second model. Predict the first predicted price and the second predicted price of the data of the agricultural product to be predicted belonging point based on the initial first model and the initial second model. Calculate the model predicted price based on the first predicted price, the second predicted price, the first weight, and the second weight;
[0041] Summarize the model predicted prices to obtain multiple model predicted prices.
[0042] Optionally, the calculation formula of the model predicted price is as follows:
[0043]
[0044] Among them, represents the model predicted price, represents the total number of historical test prices in the historical test set, represents the first model after training for the historical test price in the historical test set to obtain the first model's predicted price, represents the first model's first model's predicted price corresponding to the historical test price in the historical test set, represents the first predicted price, represents the second model after training for the historical test price in the historical test set to obtain the second model's predicted price, represents the second model's second model's predicted price corresponding to the historical test price in the historical test set, represents the second predicted price.
[0045] Optionally, calculating the historical predicted price based on the preprocessed historical data and calculating the adjacent predicted price based on the adjacent day data includes:
[0046] Extracting multiple weekly price averages corresponding to the time to be predicted in multiple target years from the preprocessed historical data to obtain multiple initial historical weekly prices, removing the initial historical weekly prices corresponding to non-empty extreme influence factor sets among the multiple initial historical weekly prices to obtain multiple cleaned historical weekly prices, and calculating the average of the multiple cleaned historical weekly prices to obtain the historical predicted price;
[0047] Drawing an adjacent day price curve based on the adjacent day data and calculating the slope corresponding to the preset adjacent time to be predicted in the adjacent day price curve to obtain the adjacent day trend, constructing a trend line based on the adjacent day trend, and calculating the ordinate of the time to be predicted in the trend line to obtain the first adjacent predicted price;
[0048] Extracting multiple identification fluctuation curves corresponding to multiple target years from the preprocessed historical data to obtain multiple historical fluctuation curves, and extracting multiple historical fluctuation data groups corresponding to the time to be predicted in multiple target years from the multiple historical fluctuation curves, where the historical fluctuation data groups correspond one-to-one with the historical fluctuation curves, each historical fluctuation data group includes multiple historical fluctuation data, and the historical fluctuation data is the sequential fluctuation ratio adjacent to the time to be predicted in the target year;
[0049] Calculate the historical volatility mean of multiple historical volatility data sets, extract adjacent price values from the adjacent daily price curve, calculate the second adjacent predicted price based on the adjacent price values and the historical volatility mean, and calculate the adjacent predicted price based on the first adjacent predicted price and the second adjacent predicted price.
[0050] Optionally, the obtaining the initial predicted price of the data of the agricultural product to be predicted belonging point based on multiple model predicted prices, historical predicted prices and adjacent predicted prices includes:
[0051] Summarize multiple model predicted prices, historical predicted prices and adjacent predicted prices to obtain a predicted price set;
[0052] Calculate the predicted price variance of the predicted price set. If the predicted price variance is less than a preset variance threshold, calculate the mean of the predicted price set to obtain the initial predicted price;
[0053] Otherwise, use a pre-constructed outlier removal method to screen the predicted price set to obtain an optimized predicted price set, and calculate the mean of the optimized predicted price set to obtain the initial predicted price.
[0054] To achieve the above object, the present invention also provides an early warning system for agricultural product price fluctuations based on model prediction, including:
[0055] A preprocessing historical data module for obtaining the belonging point of the agricultural product, obtaining a historical price data set based on the belonging point of the agricultural product, dividing the historical price data set to obtain multiple target years, and obtaining the corresponding identification weekly price curve and identification volatility curve for each target year in the multiple target years to obtain preprocessed historical data;
[0056] A data module of the belonging point of the agricultural product to be predicted for obtaining a set of prediction models, performing a combination operation on the set of prediction models to obtain multiple combined models, where the set of prediction models includes multiple prediction models, and obtaining the data of the belonging point of the agricultural product to be predicted, where the data of the belonging point of the agricultural product to be predicted includes: the agricultural product to be predicted, the supply port to be predicted, the port area to be predicted, and the time to be predicted;
[0057] An initial predicted price module for obtaining adjacent day data based on the data of the belonging point of the agricultural product to be predicted and the preprocessed historical data, importing the adjacent day data and the preprocessed historical data into multiple combined models to obtain multiple model predicted prices, calculating historical predicted prices based on the preprocessed historical data, calculating adjacent predicted prices based on the adjacent day data, obtaining the initial predicted price of the data of the belonging point of the agricultural product to be predicted based on multiple model predicted prices, historical predicted prices and adjacent predicted prices, and obtaining an adjacent extreme influencing factor set of the adjacent day data;
[0058] An early warning module, which is used to, if the adjacent extreme influencing factor set is not an empty set, obtain a corrected agricultural product price based on the adjacent extreme influencing factor set and generate a price early warning based on the adjacent extreme influencing factor set; otherwise, complete the early warning of the price fluctuation of the agricultural product predicted based on the model based on the initial predicted price.
[0059] To solve the above problems, the present invention also provides an electronic device, which includes:
[0060] A memory that stores at least one instruction; and a processor that executes the instruction stored in the memory to implement the above-mentioned method for predicting the price fluctuation of agricultural products based on a model.
[0061] To solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one instruction is stored, and the at least one instruction is executed by a processor in an electronic device to implement the above-mentioned method for predicting the price fluctuation of agricultural products based on a model.
[0062] To solve the problems described in the background art, data on the attribution points of agricultural products to be predicted is obtained. Based on the data on the attribution points of agricultural products to be predicted and the preprocessed historical data, data for adjacent days is obtained. The data for adjacent days and the preprocessed historical data are imported into multiple combined models to obtain multiple model prediction prices. The present invention performs predictions through multiple models, aiming to eliminate the errors when a single model is used for prediction. Moreover, in the same combined model, since the first mean square error and the second mean square error are calculated based on the accumulation of errors, in the present invention, the smaller the mean square error in the first mean square error and the second mean square error, the greater the corresponding weight, so as to calculate the model prediction price more accurately through the calculation formula of the model prediction price. Based on the preprocessed historical data, the historical prediction price is calculated. The present invention also combines historical data to provide a reference for the prediction of agricultural product prices. Based on the data for adjacent days, the adjacent prediction price is calculated. It can be seen that the present invention also combines the latest agricultural product prices in time to provide a reference for the prediction of agricultural product prices. Based on the multiple model prediction prices, the historical prediction price, the adjacent prediction price, and the adjacent extreme influencing factor set, the initial prediction price is obtained, and the early warning of agricultural product price fluctuations based on model prediction is completed. The present invention estimates the initial prediction price through the fusion of multi-dimensional data. However, in each step of the above calculations in the present invention, the price fluctuations caused by extreme influencing factors are excluded. The initial prediction price calculated here cannot reflect the price corresponding to the attribution point of the agricultural product to be predicted when the adjacent extreme influencing factor set is not an empty set. Therefore, if the adjacent extreme influencing factor set is not an empty set, it indicates that it is necessary to use the adjacent extreme influencing factor set to correct the initial prediction price to obtain the corrected agricultural product price and issue an alarm, so that the price prediction and early warning of agricultural products are more accurate. Therefore, the present invention can estimate the initial prediction price through the fusion of multi-dimensional data and correct the initial prediction price when there are adjacent extreme influencing factors, so as to obtain a more accurate agricultural product price. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 FIG. is a schematic flowchart of a method for early warning of agricultural product price fluctuations based on model prediction provided by an embodiment of the present invention;
[0064] Figure 2 FIG. is a functional module diagram of a system for early warning of agricultural product price fluctuations based on model prediction provided by an embodiment of the present invention;
[0065] Figure 3 FIG. is a schematic structural diagram of an electronic device for implementing the method for early warning of agricultural product price fluctuations based on model prediction provided by an embodiment of the present invention.
[0066] DESCRIPTION OF REFERENCE NUMERALS:
[0067] 1. Electronic device; 10. Processor; 11. Memory; 12. Bus.
[0068] The implementation, functional features and advantages of the present invention will be further described in conjunction with embodiments with reference to the accompanying drawings. Detailed implementation manners
[0069] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0070] The embodiments of the present application provide a method for predicting and warning the price fluctuation of agricultural products based on model prediction. The execution subject of the method for predicting and warning the price fluctuation of agricultural products based on model prediction includes, but is not limited to, at least one of electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiments of the present application. In other words, the method for predicting and warning the price fluctuation of agricultural products based on model prediction can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes, but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0071] Refer to Figure 1 As shown, it is a schematic flowchart of a method for predicting and warning the price fluctuation of agricultural products based on model prediction provided by an embodiment of the present invention. In this embodiment, the method for predicting and warning the price fluctuation of agricultural products based on model prediction includes:
[0072] S1. Obtain the attribution points of agricultural products, obtain a historical price data set based on the attribution points of agricultural products, divide the historical price data set to obtain multiple target years, obtain the corresponding weekly price curve and fluctuation curve for each target year in the multiple target years, and obtain preprocessed historical data.
[0073] It should be noted that the dividing the historical price data set to obtain multiple target years includes: sequentially extracting historical price data from the historical price data set, identifying the years corresponding to the historical price data, summarizing the years corresponding to the historical price data to obtain multiple years, and removing duplicates from the multiple years to obtain multiple target years.
[0074] Exemplarily, if the multiple years are [2018, 2018, 2019] respectively, then there are two [2018, 2018]. The de-duplication operation is to delete the duplicate years in the multiple years so that each year in the multiple years appears once and each year is not repeated. Therefore, the multiple target years are [2018, 2019].
[0075] It can be understood that the obtaining the attribution points of agricultural products includes:
[0076] Obtain a set of agricultural products, and perform the following operations on each agricultural product in the set of agricultural products:
[0077] Obtain the set of supply ports corresponding to the agricultural products, sequentially extract the supply ports from the set of supply ports, and obtain the set of port regions corresponding to the supply ports. Sequentially extract the port regions from the set of port regions, and merge the agricultural products, port regions, and supply ports to obtain the initial agricultural product attribution points. Among them, the supply ports include: the production end and the sales end, and the initial agricultural product attribution points include: one agricultural product, one supply port, and one port region;
[0078] Summarize the initial agricultural product attribution points, and extract the agricultural product attribution points from the summarized initial agricultural product attribution points.
[0079] It should be noted that the set of agricultural products is a set composed of multiple agricultural products, such as various agricultural products like eggs, bean sprouts, Chinese cabbages, etc. The production end represents the starting point of the supply chain for directly producing agricultural products such as planting and breeding of agricultural products, such as farms, agricultural cooperatives, etc. The sales end represents the supply chain nodes for selling agricultural products to consumers, such as channels like retail, e-commerce, community group buying, etc. The port region is the region where the supply port corresponding to the agricultural product is located, such as Province A, Province B, etc. The initial agricultural product attribution point is the smallest unit for early warning of agricultural product price fluctuations for model prediction. The agricultural product attribution point is an initial agricultural product attribution point extracted from the summarized initial agricultural product attribution points, and in the embodiments of the present invention, the same operations are performed on each initial agricultural product attribution point in the summarized initial agricultural product attribution points.
[0080] It can be understood that for different agricultural products, in different port regions and different supply ports, the corresponding prices may be different. Therefore, in order to provide early warnings of agricultural product price fluctuations for more target populations and realize the prediction of agricultural product prices, the present invention uses agricultural product attribution points as the unit to realize early warnings of agricultural product price fluctuations based on model prediction.
[0081] It can be understood that obtaining the identified weekly price curve and identified fluctuation curve corresponding to each target year in multiple target years to obtain the preprocessed historical data includes:
[0082] Sequentially extract the target years from multiple target years, and perform the following operations on the extracted target years:
[0083] Based on the preset weekly time series, divide the extracted target year to obtain multiple weekly price time series, and use the historical price data set to fill the multiple weekly price time series to obtain multiple weekly price data sets;
[0084] Perform the following operations on each of the weekly price data sets in the multiple weekly price data sets:
[0085] Statistically count the agricultural product price set and the number of samples in the weekly price dataset, calculate the weekly price average based on the agricultural product price set and the number of samples, and obtain the set of extreme influencing factors of the weekly price average within the weekly price time series, where the set of extreme influencing factors includes zero, one, or more extreme influencing factors;
[0086] Summarize the weekly price averages in the order of time from earliest to latest to obtain multiple sequential weekly prices;
[0087] Calculate multiple sequential weekly volatility ratios based on the multiple sequential weekly prices, obtain the weekly price curve and the volatility curve corresponding to the target year according to the multiple sequential weekly prices and the multiple sequential weekly volatility ratios, and perform a marking operation on the weekly price curve and the volatility curve based on the set of extreme influencing factors to obtain a marked weekly price curve and a marked volatility curve;
[0088] Summarize the marked weekly price curve and the marked volatility curve to obtain preprocessed historical data.
[0089] It can be understood that the method of obtaining multiple weekly price time series based on the target year extracted according to the preset weekly time series division and dividing the historical price dataset to obtain multiple target years is similar and can achieve the same effect. Here, the weekly time series is one week, so the weekly price time series is one week after division (for example: February 3, 2020 - February 9, 2020 is a weekly price time series), which will not be elaborated here. The historical price dataset is multiple historical price data of the agricultural product attribution point obtained through the database, and the historical data includes but is not limited to: the agricultural product attribution point, the price of the agricultural product in the agricultural product attribution point, and the date corresponding to the price of the agricultural product in the agricultural product attribution point.
[0090] Further, filling the multiple weekly price time series with the historical price dataset to obtain multiple weekly price datasets includes: sequentially extracting the weekly price time series from the multiple weekly price time series, and sequentially extracting the historical price data from the historical price dataset. If the time corresponding to the historical price data is within the extracted weekly price time series, then store the historical price data and the extracted weekly price time series in the same data to obtain a weekly price dataset, and summarize the weekly price datasets to obtain multiple weekly price datasets.
[0091] It should be noted that the agricultural product price is the price of the agricultural product in the agricultural product attribution point within the weekly price time series, the number of samples is the number of agricultural product prices in the weekly price dataset. The agricultural product price set is the set composed of all agricultural product prices of the agricultural product in the agricultural product attribution point within the weekly price time series.
[0092] It is understandable that extreme influencing factors do not distinguish between human factors or natural factors. Extreme influencing factors particularly refer to human factors or natural factors that cause unreasonable fluctuations in agricultural product prices. For example, the attribution point of the agricultural product is: green vegetables, Province A, production end. In the weekly price time series corresponding to the weekly price dataset, a major flood occurred in Province A, resulting in the inability to harvest the green vegetables planted in Province A. As a result, the average weekly price in the weekly price dataset corresponding to the weekly price time series tripled compared to the average weekly price of the previous week in the weekly price time series. The present invention records influencing factors similar to "a major flood occurred in Province A, resulting in the inability to harvest the green vegetables planted in Province A" as extreme influencing factors. If the extreme influencing factor set includes zero extreme influencing factors, then the extreme influencing factor set is an empty set, indicating that there are no extreme influencing factors in the weekly price time series corresponding to the weekly price dataset.
[0093] Further, calculating the average weekly price based on the agricultural product price set and the number of samples includes:
[0094] If the number of samples is greater than the preset sample quantity threshold, calculate the average of the agricultural product prices in the agricultural product price set to obtain the average weekly price;
[0095] If the number of samples is less than or equal to the sample quantity threshold, then obtain multiple adjacent weekly price time series and multiple types of agricultural product attribution points of the weekly price dataset, confirm the adjacent weekly price averages corresponding to each adjacent weekly price time series in the multiple adjacent weekly price time series to obtain multiple adjacent weekly price averages, query the class weekly price averages of each type of agricultural product attribution point in the weekly price time series among the multiple types of agricultural product attribution points to obtain multiple class weekly price averages, and calculate the average of the multiple adjacent weekly price averages and the multiple class weekly price averages to obtain the average weekly price.
[0096] It should be noted that the sample quantity threshold is a constant set by humans. When the number of samples is greater than the preset sample quantity threshold, the present invention believes that the average of the agricultural product price set can represent the price of the agricultural product at the agricultural product attribution point in the weekly price time series. Otherwise, the present invention believes that the average of the agricultural product price set cannot represent the price of the agricultural product at the agricultural product attribution point in the weekly price time series.
[0097] Exemplarily, if the weekly price time series is from February 3, 2020 to February 9, 2020, and the number of samples is 1, and the sample volume threshold is 2, then the mean of the agricultural product price set cannot represent the price of the agricultural products at the agricultural product attribution point within the weekly price time series. Therefore, multiple adjacent weekly price time series are obtained. For the convenience of illustration, only two adjacent weekly price time series are taken here, and both of the two adjacent weekly price time series satisfy that the number of samples is greater than the preset sample volume threshold. The adjacent weekly price time series are confirmed as the first adjacent weekly price time series from January 27, 2020 to February 2, 2020, and the second adjacent weekly price time series from February 10, 2020 to February 16, 2020, and the adjacent weekly price means of the first adjacent weekly price time series and the second adjacent weekly price time series are obtained respectively, resulting in multiple adjacent weekly price means.
[0098] Specifically, the similar agricultural product attribution point is an agricultural product attribution point similar to the agricultural product attribution point. For example, the agricultural product attribution point is: green vegetables, Province A, production end. After being screened by professionals, it is considered that the agricultural product price set corresponding to the similar agricultural product attribution point (for example, the similar agricultural product attribution point: green vegetables, Province B, production end) in the weekly price time series can provide a reference for the agricultural product price set of the agricultural product attribution point in the weekly price time series. Therefore, the agricultural product price set corresponding to the similar agricultural product attribution point in the weekly price time series (the agricultural product price set of the similar agricultural product attribution point satisfies that the number of samples is greater than the preset sample volume threshold) is obtained, and the mean of the agricultural product price set corresponding to the similar agricultural product attribution point in the weekly price time series is calculated to obtain the similar weekly price mean.
[0099] It can be understood that by calculating the mean of multiple adjacent weekly price means and multiple similar weekly price means, the weekly price mean is obtained to represent the weekly price mean corresponding to the weekly price data set when the number of samples is less than or equal to the sample volume threshold. The query can be performed through a database storing agricultural product prices or obtained through big data. The present invention does not limit this.
[0100] Further, calculating multiple sequential weekly fluctuation ratios based on multiple sequential weekly prices, obtaining the weekly price curve and the fluctuation curve corresponding to the target year according to the multiple sequential weekly prices and the multiple sequential weekly fluctuation ratios, and performing a marking operation on the weekly price curve and the fluctuation curve based on the extreme influence factor set to obtain the marked weekly price curve and the marked fluctuation curve, including:
[0101] Sequentially extract the sequential weekly prices from the multiple sequential weekly prices, and extract the next sequential weekly price adjacent to the sequential weekly price from the multiple sequential weekly prices to obtain the adjacent sequential weekly price. Calculate the sequential fluctuation ratio based on the sequential weekly price and the adjacent sequential weekly price, and summarize the sequential fluctuation ratios to obtain multiple sequential fluctuation ratios. Among them, the sequential fluctuation ratios correspond to the sequential weekly prices one by one, and the calculation formula of the sequential fluctuation ratio is as follows:
[0102]
[0103] Among them, represents the sequential fluctuation ratio, represents the adjacent sequential weekly price, represents the sequential weekly price;
[0104] Based on the multiple weekly price time series, multiple weekly time abscissas are constructed. Taking the multiple weekly time abscissas as the abscissa of the weekly price curve, and taking the multiple sequential weekly prices corresponding to the multiple weekly time abscissas as the ordinate of the weekly price curve, a weekly price curve is constructed by using a pre-constructed curve fitting method;
[0105] Taking the multiple weekly time abscissas as the abscissa of the fluctuation curve, and taking the multiple sequential fluctuation ratios corresponding to the multiple weekly time abscissas as the ordinate, a fluctuation curve is constructed;
[0106] Sequentially extract the sequential weekly prices in the weekly price curve to obtain target identification points, extract the weekly price time series, extreme influencing factor set and sequential fluctuation ratio corresponding to the target identification points to obtain sequential weekly price identifications, and perform identification operations on the target identification points by using the sequential weekly price identifications. After confirming that all target identification points in the weekly price curve have been subjected to identification operations, an identified weekly price curve is obtained;
[0107] An identified fluctuation curve is obtained by using the extreme influencing factor set and the multiple sequential fluctuation ratios.
[0108] Exemplarily, if the multiple sequential weekly prices are arranged in sequence as:
P 8 、P 9 、P 10
[0109] It can be understood that the weekly time abscissa corresponds one-to-one with the weekly price time series. The weekly time abscissa is the abscissa of the weekly price time series on the weekly price curve and is used to distinguish different weekly price means. For example, if the weekly price time series is from January 27, 2020 to February 2, 2020, which is the 5th week of 2020, then 5 - 2020 (or set the weekly time abscissa to 5) can be used as a weekly time abscissa. The weekly price time series from February 3, 2020 to February 9, 2020 is the 6th week of 2020, then 6 - 2020 (or set the weekly time abscissa to 6) can be used as a weekly time abscissa. Optionally, the curve fitting method can be the least squares method, polynomial fitting method, etc. There are multiple existing technologies that can achieve the effect of constructing a weekly price curve by using a pre-constructed curve fitting method, and the present invention does not limit this.
[0110] Specifically, the process of constructing the fluctuation curve with multiple weekly time abscissas as the abscissa of the fluctuation curve and multiple sequential fluctuation ratios corresponding to the multiple weekly time abscissas as the ordinate is similar to the process of constructing the weekly price curve and can achieve the same effect. The difference lies in the different ordinates in the weekly price curve and the fluctuation curve.
[0111] It should be noted that the sequential weekly price identifier is a text identifier obtained by storing the weekly price time sequence, the extreme influencing factor set, and the sequential fluctuation ratio corresponding to the target identifier point. The use of the sequential weekly price identifier to perform the identification operation on the target identifier point can be implemented in forms such as pointers, text identifiers, key-value pairs, etc. The present invention does not limit this.
[0112] Furthermore, the steps of obtaining the identified fluctuation curve using the extreme influencing factor set and multiple sequential fluctuation ratios are similar to the steps of obtaining the identified weekly price curve and can achieve the same effect. The difference lies in that one sequential fluctuation identifier in the fluctuation curve is composed of the corresponding weekly price time sequence, the extreme influencing factor set, and the weekly price average value.
[0113] S2. Obtain a set of prediction models, perform a combination operation on the set of prediction models to obtain multiple combined models, where the set of prediction models includes multiple prediction models.
[0114] It can be understood that the prediction model is a model in the prior art that can be used to predict the price of agricultural products. The combined model includes two prediction models.
[0115] Exemplarily, assume that the set of prediction models includes [Variational Mode Decomposition Model, Linear Regression Model, Long Short-Term Memory Network Model, Extreme Learning Machine Model]. Combining the set of prediction models, then [Variational Mode Decomposition Model, Linear Regression Model] constitutes a combined model, [Variational Mode Decomposition Model, Long Short-Term Memory Network Model] constitutes a combined model, [Variational Mode Decomposition Model, Extreme Learning Machine Model] constitutes a combined model, [Linear Regression Model, Long Short-Term Memory Network Model] constitutes a combined model, and so on. A total of 6 combined models can be obtained. The Variational Mode Decomposition Model, Linear Regression Model, Long Short-Term Memory Network Model, and Extreme Learning Machine Model are models constructed using variational mode decomposition, linear regression, long short-term memory network, and extreme learning machine respectively for predicting the price of agricultural products, and can all be implemented through the prior art, so details are not described here.
[0116] S3. Obtain the data of the attribution point of the agricultural product to be predicted, where the data of the attribution point of the agricultural product to be predicted includes: the agricultural product to be predicted, the supply port to be predicted, the port area to be predicted, and the time to be predicted.
[0117] It is understandable that the data of the agricultural product attribution point to be predicted is the agricultural product attribution point that is expected to be predicted in this embodiment, the agricultural product to be predicted is the agricultural product that is expected to be predicted, for example, green vegetables. The supply port to be predicted is the supply port in the data of the agricultural product attribution point to be predicted, the port area to be predicted is the port area in the data of the agricultural product attribution point to be predicted, and the time to be predicted is the time when it is expected to predict the price of the agricultural product in the data of the agricultural product attribution point to be predicted.
[0118] S4. Obtain adjacent day data based on the data of the agricultural product attribution point to be predicted and the preprocessed historical data, import the adjacent day data and the preprocessed historical data into multiple combined models to obtain multiple model predicted prices, calculate the historical predicted price based on the preprocessed historical data, and calculate the adjacent predicted price based on the adjacent day data.
[0119] Further, the step of importing the adjacent day data and the preprocessed historical data into multiple combined models to obtain multiple model predicted prices includes:
[0120] Sequentially extract combined models from multiple combined models, and perform the following operations on each combined model:
[0121] Identify the first model and the second model, divide the preprocessed historical data into a historical training set and a historical test set, use the historical training set to train both the first model and the second model, and use the historical test set to test both the trained first model and the trained second model to obtain the first mean square error and the second mean square error, and calculate the first weight and the second weight based on the first mean square error and the second mean square error;
[0122] Import the adjacent day data and the preprocessed historical data into the trained first model and the trained second model to obtain the initial first model and the initial second model, predict the first predicted price and the second predicted price of the data of the agricultural product attribution point to be predicted based on the initial first model and the initial second model, and calculate the model predicted price based on the first predicted price, the second predicted price, the first weight and the second weight;
[0123] Summarize the model predicted prices to obtain multiple model predicted prices.
[0124] It is understandable that the first model and the second model are respectively two prediction models in a combined model, and the "first" and "second" are only used to distinguish the two prediction models in the combined model. It is understandable that the historical training set is a set composed of data used for training the first model and the second model in the preprocessed historical data, and the historical test set is a set composed of data extracted from the preprocessed historical data for testing the first model and the second model. For example, if the preprocessed historical data includes four target years, all data of any three target years in the preprocessed historical data can be taken as the historical training set, and all data of the target year other than the three target years in the four target years in the preprocessed historical data can be taken as the historical test set.
[0125] It should be noted that in the process of training the first model and the second model using the historical training set and testing the trained first model and the trained second model using the historical test set, for different combined models, the training methods and the testing methods are different, but they can all be achieved through existing technologies, so they will not be elaborated here.
[0126] Furthermore, the calculation formula for the predicted price of the model is as follows:
[0127]
[0128] where, represents the predicted price of the model, represents the total number of historical test prices in the historical test set, represents the first predicted price obtained by the trained first model for predicting the historical test price in the historical test set, predicted price of the first model, represents the corresponding historical test price in the historical test set for the first predicted price of the first model, historical test price, represents the first predicted price, represents the second predicted price obtained by the trained second model for predicting the historical test price in the historical test set, predicted price of the second model, represents the corresponding historical test price in the historical test set for the second predicted price of the second model, historical test price, represents the second predicted price.
[0129] It is understandable that the calculation formulas for the first mean square error, the second mean square error, the first weight, and the second weight are as follows:
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136] Among them, represents the reciprocal of the first mean square error, represents the reciprocal of the second mean square error, represents the first weight, represents the second weight, represents the first mean square error, represents the second mean square error.
[0137] It should be noted that the first predicted price is the price of the agricultural product to be predicted at the time to be predicted under the condition that the initial first model is used to predict the data of the attribution point of the agricultural product to be predicted. Similarly, the second predicted price will not be elaborated here. The contribution ratios of the first predicted price and the second predicted price to the model predicted price are determined according to the first weight and the second weight. When the first weight and the second weight are determined, since the first mean square error and the second mean square error are calculated based on the accumulation of errors, the smaller the mean square error in the first mean square error and the second mean square error, the greater the corresponding weight. Finally, the model predicted price is calculated through the calculation formula of the model predicted price.
[0138] It can be understood that calculating the historical predicted price based on the preprocessed historical data and calculating the adjacent predicted price based on the adjacent day data includes:
[0139] Extracting the average weekly prices corresponding to the time to be predicted in multiple target years from the preprocessed historical data to obtain multiple initial historical weekly prices, removing the initial historical weekly prices corresponding to the non-empty set of extreme influencing factor sets among the multiple initial historical weekly prices to obtain multiple cleaned historical weekly prices, and calculating the average value of the multiple cleaned historical weekly prices to obtain the historical predicted price;
[0140] Drawing an adjacent day price curve based on the adjacent day data, calculating the slope corresponding to the preset adjacent time to be predicted in the adjacent day price curve to obtain the adjacent day trend, constructing a trend line based on the adjacent day trend, and calculating the ordinate of the time to be predicted in the trend line to obtain the first adjacent predicted price;
[0141] Extract the identification fluctuation curves corresponding to multiple target years from the preprocessed historical data to obtain multiple historical fluctuation curves. Extract multiple historical fluctuation data groups corresponding to the time to be predicted in the multiple target years from the multiple historical fluctuation curves. Among them, the historical fluctuation data groups correspond one-to-one with the historical fluctuation curves. Each historical fluctuation data group includes multiple historical fluctuation data, and the historical fluctuation data is the sequential fluctuation ratio adjacent to the time to be predicted in the target year.
[0142] Calculate the historical fluctuation mean of the multiple historical fluctuation data groups, and extract the adjacent price values from the adjacent day price curves. Calculate the second adjacent predicted price based on the adjacent price values and the historical fluctuation mean, and calculate the adjacent predicted price based on the first adjacent predicted price and the second adjacent predicted price.
[0143] Exemplarily, if the time to be predicted is February 9, 2024, the weekly price means corresponding to February 9 in multiple target years such as 2023, 2022, and 2021 can be obtained to get 3 initial historical weekly prices. If the extreme influence factor set corresponding to the weekly price time series on February 9, 2022 is not an empty set, the embodiments of the present invention consider that the weekly price mean corresponding to February 9, 2022 has no reference value for the historical predicted price, so it needs to be excluded. The cleaned historical weekly price is the initial historical weekly price retained after excluding the initial historical weekly price for which the extreme influence factor set is not an empty set.
[0144] Further, the adjacent day data is a set composed of the prices of each day under the conditions of the agricultural product to be predicted at the supply port to be predicted and the port area to be predicted within a preset time range before the time to be predicted. For example, the preset time range is 7 days, the time to be predicted is February 3, 2020, and under the conditions of the agricultural product to be predicted at the supply port to be predicted and the port area to be predicted, the set composed of the prices of each day from January 27, 2020 to February 2, 2020 is denoted as the adjacent day data. The adjacent day price curve is a curve constructed by using the curve fitting method with each day within the preset time range as the abscissa (each day within the preset time range is arranged in the order of time from the earliest to the latest) and the price of each day as the ordinate.
[0145] Specifically, the time adjacent to the time to be predicted is the time with the shortest time interval from the time to be predicted among the preset time ranges corresponding to the adjacent daily price curves. For example, if the time to be predicted is February 3, 2020, and the preset time range corresponding to the adjacent daily price curve is from January 27, 2020 to February 2, 2020, then the time interval between February 2, 2020 and the time to be predicted, February 3, 2020, is the shortest. Therefore, the time adjacent to the time to be predicted is February 2, 2020. Thus, the slope of February 2, 2020 in the adjacent daily price curve is calculated to obtain the adjacent daily trend, and a tangent line of the time adjacent to the time to be predicted is constructed based on the adjacent daily trend, the ordinate of the time adjacent to the time to be predicted in the adjacent daily price curve, and the time adjacent to the time to be predicted, resulting in a trend line. Constructing the trend line is a prior art and will not be elaborated here. The ordinate corresponding to the abscissa of the time to be predicted is found in the trend line, and the ordinate corresponding to the abscissa of the time to be predicted is used as the first adjacent predicted price.
[0146] Further, the process of extracting multiple historical volatility data groups corresponding to the time to be predicted in multiple target years from multiple historical volatility curves is similar to the process of extracting multiple weekly price averages corresponding to the time to be predicted in multiple target years from the preprocessed historical data to obtain multiple initial historical weekly prices, and the same effect can be achieved. For example, if the time to be predicted is February 3, 2024, then the sequential volatility ratio corresponding to February 9, 2023 can be obtained, the sequential volatility ratio corresponding to the week before February 9, 2023 (from January 30, 2023 to February 5, 2023), the sequential volatility ratio corresponding to the week after February 9, 2023 (from February 13, 2023 to February 19, 2023), the sequential volatility ratio corresponding to the week before February 9, 2022, the sequential volatility ratio corresponding to the week after February 9, 2022, the sequential volatility ratio corresponding to February 9, 2022, and so on. By analogy, multiple sequential volatility ratios are obtained within the artificially preset range to obtain multiple historical volatility data groups. Therefore, the historical volatility average is the average of the multiple sequential volatility ratios corresponding to the multiple historical volatility data groups.
[0147] It can be understood that the adjacent price value is the ordinate in the adjacent daily price curve of the time adjacent to the time to be predicted. The process of calculating the second adjacent predicted price based on the adjacent price value and the historical volatility average is as follows: calculate the product of the ordinate in the adjacent daily price curve and the historical volatility average, and the resulting calculation result is the second adjacent predicted price.
[0148] Further, in the process of calculating the neighboring predicted price based on the first neighboring predicted price and the second neighboring predicted price, the first neighboring weight and the second neighboring weight can be respectively assigned to the first neighboring predicted price and the second neighboring predicted price. Then, the first neighboring weight multiplied by the first neighboring predicted price, plus the second neighboring weight multiplied by the second neighboring predicted price, is equal to the neighboring predicted price. The present invention does not limit the specific values of the first neighboring weight and the second neighboring weight, which can be set artificially.
[0149] S5. Obtain the initial predicted price of the data of the agricultural product to be predicted at the attribution point based on multiple model predicted prices, historical predicted prices and neighboring predicted prices, and obtain the neighboring extreme influence factor set of the neighboring day data.
[0150] Specifically, the neighboring extreme influence factor set is the extreme influence factor set corresponding to the neighboring day data.
[0151] It can be understood that obtaining the initial predicted price of the data of the agricultural product to be predicted at the attribution point based on multiple model predicted prices, historical predicted prices and neighboring predicted prices includes:
[0152] Summarize multiple model predicted prices, historical predicted prices and neighboring predicted prices to obtain a predicted price set;
[0153] Calculate the variance of the predicted prices in the predicted price set. If the variance of the predicted prices is less than a preset variance threshold, calculate the mean of the predicted price set to obtain the initial predicted price;
[0154] Otherwise, use a pre-constructed outlier removal method to screen the predicted price set to obtain an optimized predicted price set, and calculate the mean of the optimized predicted price set to obtain the initial predicted price.
[0155] Further, the variance of the predicted prices is the variance of the predicted price set. Calculating the variance is a prior art and will not be elaborated here. The variance threshold is a constant set artificially. When the variance of the predicted prices is less than the preset variance threshold, it is considered that the differences between multiple model predicted prices, historical predicted prices and neighboring predicted prices in the predicted price set are small. Therefore, the initial predicted price can be obtained by calculating the mean of the predicted price set.
[0156] Further, the outlier removal method can be implemented by prior art. Optionally, the K-nearest neighbor method, the interquartile range method, etc. can be used to screen the predicted price set. The present invention does not limit this. The optimized predicted price set is the set composed of all the remaining data after removing the outliers in the predicted price set by using the outlier removal method.
[0157] S6. If the neighboring extreme influence factor set is not an empty set, obtain the corrected agricultural product price based on the neighboring extreme influence factor set, and generate a price warning based on the neighboring extreme influence factor set.
[0158] Specifically, the price warning is a warning composed of text, and the specific content is designed by professionals, including but not limited to the adjacent extreme influence factor set, corrected agricultural product prices, etc.
[0159] Furthermore, the present invention realizes the estimation of the initial predicted price through the fusion of multi-dimensional data (including multiple model predicted prices, historical predicted prices, and adjacent predicted prices). However, in each step of the above calculations in the present invention, the price fluctuations caused by extreme influence factors are excluded. Therefore, the initial predicted price calculated here cannot reflect the price corresponding to the attribution point of the agricultural product to be predicted when the adjacent extreme influence factor set is not an empty set. Therefore, if the adjacent extreme influence factor set is not an empty set, it indicates that for the time to be predicted, there is one or more adjacent extreme influence factors that cause the initial predicted price to be unable to reflect the true price corresponding to the time to be predicted. Thus, it is necessary to use the adjacent extreme influence factor set to correct the initial predicted price to obtain the corrected agricultural product price. The method for the adjacent extreme influence factor set to correct the predicted agricultural product price can be to query all the sequential fluctuation ratios when all the extreme influence factor sets are not empty sets to obtain multiple extreme fluctuation ratios, calculate the average value of the multiple extreme fluctuation ratios to obtain the extreme correction average value, and use the extreme correction average value to describe the influence of the adjacent extreme influence factor set on the initial predicted price. Therefore, the calculation formula for the corrected agricultural product price is as follows:
[0160]
[0161] Among them, represents the corrected agricultural product price, represents the initial predicted price, represents the extreme correction average value.
[0162] S7. Otherwise, complete the warning of the price fluctuation of the agricultural product based on the model prediction based on the initial predicted price.
[0163] Furthermore, if the adjacent extreme influence factor set is an empty set, the initial predicted price can represent the price corresponding to the attribution point of the agricultural product to be predicted.
[0164] To solve the problems described in the background art, data on the attribution points of agricultural products to be predicted is obtained. Based on the data on the attribution points of agricultural products to be predicted and the preprocessed historical data, data for adjacent days is obtained. The data for adjacent days and the preprocessed historical data are imported into multiple combined models to obtain multiple model prediction prices. The present invention predicts through multiple models, aiming to eliminate the errors when using a single model for prediction. Moreover, in the same combined model, since the first mean squared error and the second mean squared error are calculated based on the accumulation of errors, in the present invention, the smaller the mean squared error in the first mean squared error and the second mean squared error, the greater the corresponding weight, so as to calculate the model prediction price more accurately through the formula for calculating the model prediction price. Based on the preprocessed historical data, the historical prediction price is calculated. The present invention also combines historical data to provide a reference for the prediction of agricultural product prices. Based on the data for adjacent days, the adjacent prediction price is calculated. It can be seen that the present invention also combines the latest agricultural product prices in terms of time to provide a reference for the prediction of agricultural product prices. Based on the multiple model prediction prices, the historical prediction price, the adjacent prediction price, and the adjacent extreme influence factor set, the initial prediction price is obtained, and the early warning of agricultural product price fluctuations based on model prediction is completed. The present invention estimates the initial prediction price through the fusion of multi-dimensional data. However, in each step of the above calculations in the present invention, the price fluctuations caused by extreme influence factors are excluded. The initial prediction price calculated here cannot reflect the price corresponding to the attribution point of the agricultural product to be predicted when the adjacent extreme influence factor set is not an empty set. Therefore, if the adjacent extreme influence factor set is not an empty set, it indicates that the initial prediction price needs to be corrected using the adjacent extreme influence factor set to obtain the corrected agricultural product price and an alarm is issued, making the price prediction and early warning of agricultural products more accurate. Therefore, the present invention can estimate the initial prediction price through the fusion of multi-dimensional data and correct the initial prediction price when there are adjacent extreme influence factors, so as to obtain a more accurate agricultural product price.
[0165] As Figure 2 shown, it is a functional module diagram of an early warning system for agricultural product price fluctuations based on model prediction provided by an embodiment of the present invention.
[0166] The early warning system 100 for agricultural product price fluctuations based on model prediction described in the present invention can be installed in an electronic device. According to the functions to be realized, the early warning system 100 for agricultural product price fluctuations based on model prediction can include a preprocessed historical data module 101, a data module 102 for the attribution points of agricultural products to be predicted, an initial prediction price module 103, and an early warning module 104. The modules described in the present invention can also be referred to as units, which refer to a series of computer program segments that can be executed by the processor of an electronic device and can complete fixed functions, and are stored in the memory of the electronic device.
[0167] The preprocessed historical data module 101 is used to obtain the attribution points of agricultural products, obtain a historical price data set based on the attribution points of agricultural products, divide the historical price data set to obtain multiple target years, obtain the corresponding weekly price curves and volatility curves for each target year in the multiple target years, and obtain the preprocessed historical data;
[0168] The data module 102 for agricultural products to be predicted and their attribution points is used to obtain a set of prediction models, perform a combination operation on the set of prediction models to obtain multiple combined models, where the set of prediction models includes multiple prediction models, and obtain the data of the agricultural products to be predicted and their attribution points, where the data of the agricultural products to be predicted and their attribution points includes: the agricultural products to be predicted, the supply ports to be predicted, the port regions to be predicted, and the time to be predicted;
[0169] The initial predicted price module 103 is used to obtain adjacent day data based on the data of the agricultural products to be predicted and their attribution points and the preprocessed historical data, import the adjacent day data and the preprocessed historical data into multiple combined models to obtain multiple model predicted prices, calculate the historical predicted price based on the preprocessed historical data, calculate the adjacent predicted price based on the adjacent day data, obtain the initial predicted price of the data of the agricultural products to be predicted and their attribution points based on the multiple model predicted prices, the historical predicted price, and the adjacent predicted price, and obtain the set of adjacent extreme influencing factors of the adjacent day data;
[0170] The early warning module 104 is used to, if the set of adjacent extreme influencing factors is not an empty set, obtain the corrected agricultural product price based on the set of adjacent extreme influencing factors and generate a price warning based on the set of adjacent extreme influencing factors; otherwise, complete the early warning of the price fluctuation of agricultural products based on the model prediction based on the initial predicted price.
[0171] Specifically, each module in the agricultural product price fluctuation early warning system 100 based on model prediction in the embodiments of the present invention adopts the same technical means as those in the above Figure 1 and can produce the same technical effects, which will not be elaborated here.
[0172] As Figure 3 shown, it is a schematic structural diagram of an electronic device for implementing the agricultural product price fluctuation early warning method based on model prediction provided by an embodiment of the present invention.
[0173] The electronic device 1 may include a processor 10, a memory 11, and a bus 12, and may further include a computer program stored in the memory 11 and executable on the processor 10, such as a program for the agricultural product price fluctuation early warning method based on model prediction.
[0174] Among them, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), magnetic memory, magnetic disk, optical disc, etc. The memory 11 can be an internal storage unit of the electronic device 1 in some embodiments, such as the mobile hard disk of the electronic device 1. The memory 11 can also be an external storage device of the electronic device 1 in other embodiments, such as a plug-in mobile hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. equipped on the electronic device 1. Further, the memory 11 also includes the internal storage unit of the electronic device 1 and also includes an external storage device. The memory 11 can be used not only to store application software installed in the electronic device 1 and various types of data, such as the code of the method program for early warning of agricultural product price fluctuations based on model prediction, etc., but also to temporarily store data that has been output or will be output.
[0175] The processor 10 can be composed of integrated circuits in some embodiments. For example, it can be composed of a single packaged integrated circuit, or can also be composed of multiple integrated circuits with the same or different functions packaged, including a combination of one or more Central Processing Units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, connecting various components of the entire electronic device through various interfaces and lines, and by running or executing programs or modules stored in the memory 11 (such as the method program for early warning of agricultural product price fluctuations based on model prediction, etc.), and calling data stored in the memory 11, to execute various functions of the electronic device 1 and process data.
[0176] The bus 12 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus 12 can be divided into an address bus, a data bus, a control bus, etc. The bus 12 is set to realize the connection and communication between the memory 11 and at least one processor 10, etc.
[0177] Figure 3 Only the electronic device with components is shown. Those skilled in the art can understand that Figure 3The structure shown does not constitute a limitation on the electronic device 1, and it may include fewer or more components than those shown, or combine certain components, or have different component arrangements.
[0178] For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for powering each component. Preferably, the power source can be logically connected to the at least one processor 10 through a power management system, so as to implement functions such as charge management, discharge management, and power consumption management through the power management system. The power source may also include any components such as one or more DC or AC power sources, a recharge system, a power failure detection circuit, a power converter or inverter, a power status indicator, etc. The electronic device 1 may also include a variety of sensors, a Bluetooth module, a Wi-Fi module, etc., which will not be elaborated here.
[0179] Furthermore, the electronic device 1 may further include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices.
[0180] Optionally, the electronic device 1 may further include a user interface. The user interface may be a display, an input unit (such as a keyboard), and optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) toucher, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display the information processed in the electronic device 1 and to display a visual user interface.
[0181] The program of the method for predicting agricultural product price fluctuations based on model prediction stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can implement:
[0182] Obtain the attribution point of the agricultural product, obtain the historical price data set based on the attribution point of the agricultural product, divide the historical price data set to obtain multiple target years, obtain the corresponding weekly price curve and fluctuation curve for each target year in the multiple target years, and obtain the preprocessed historical data;
[0183] Obtain a set of prediction models, perform a combination operation on the set of prediction models to obtain multiple combined models, where the set of prediction models includes multiple prediction models;
[0184] Obtain the data of the attribution point of the agricultural product to be predicted, where the data of the attribution point of the agricultural product to be predicted includes: the agricultural product to be predicted, the supply port to be predicted, the port area to be predicted, and the time to be predicted;
[0185] Obtain the adjacent day data based on the data of the attribution point of the agricultural product to be predicted and the preprocessed historical data, import the adjacent day data and the preprocessed historical data into multiple combined models to obtain multiple model prediction prices, calculate the historical prediction price based on the preprocessed historical data, and calculate the adjacent prediction price based on the adjacent day data;
[0186] Obtain the initial prediction price of the data of the attribution point of the agricultural product to be predicted based on multiple model prediction prices, historical prediction prices, and adjacent prediction prices, and obtain the set of adjacent extreme influencing factors of the adjacent day data;
[0187] If the set of adjacent extreme influencing factors is not an empty set, then obtain the corrected agricultural product price based on the set of adjacent extreme influencing factors, and generate a price warning based on the set of adjacent extreme influencing factors;
[0188] Otherwise, complete the early warning of the price fluctuation of the agricultural product based on the model prediction based on the initial prediction price.
[0189] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to Figures 1 to 3 the description of the relevant steps in the corresponding embodiment, which will not be elaborated here.
[0190] Further, if the modules / units integrated in the electronic device 1 are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or system capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory).
[0191] The present invention also provides a computer-readable storage medium, where the readable storage medium stores a computer program, and when the computer program is executed by the processor of the electronic device, it can implement:
[0192] Obtain the attribution point of the agricultural product, obtain the historical price data set based on the attribution point of the agricultural product, divide the historical price data set to obtain multiple target years, obtain the identification weekly price curve and the identification fluctuation curve corresponding to each target year in the multiple target years, and obtain the preprocessed historical data;
[0193] Obtain a set of prediction models, perform a combination operation on the set of prediction models to obtain multiple combined models, where the set of prediction models includes multiple prediction models;
[0194] Obtain the data of the attribution point of the agricultural product to be predicted, where the data of the attribution point of the agricultural product to be predicted includes: the agricultural product to be predicted, the supply port to be predicted, the port area to be predicted, and the time to be predicted;
[0195] Obtain the data of adjacent days based on the data of the attribution point of the agricultural product to be predicted and the preprocessed historical data, import the data of adjacent days and the preprocessed historical data into multiple combined models to obtain multiple model prediction prices, calculate the historical prediction price based on the preprocessed historical data, and calculate the adjacent prediction price based on the data of adjacent days;
[0196] Obtain the initial prediction price of the data of the attribution point of the agricultural product to be predicted based on multiple model prediction prices, historical prediction prices, and adjacent prediction prices, and obtain the set of adjacent extreme influencing factors of the data of adjacent days;
[0197] If the set of adjacent extreme influencing factors is not an empty set, then obtain the corrected agricultural product price based on the set of adjacent extreme influencing factors, and generate a price warning based on the set of adjacent extreme influencing factors;
[0198] Otherwise, complete the early warning of the price fluctuation of the agricultural product based on the model prediction based on the initial prediction price.
[0199] In several embodiments provided by the present invention, it should be understood that the disclosed devices, systems and methods can be implemented in other ways. For example, the system embodiments described above are only illustrative, and there may be other division methods in actual implementation.
[0200] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0201] In addition, each functional module in each embodiment of the present invention can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware, or in the form of a combination of hardware and software functional modules.
[0202] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and can be implemented in other specific forms without departing from the spirit or basic characteristics of the present invention.
[0203] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for early warning of agricultural product price fluctuations based on model prediction, characterized in that: The method comprises: Obtaining agricultural product attribution points, obtaining a historical price data set based on the agricultural product attribution points, dividing the historical price data set to obtain multiple target years, obtaining an identified weekly price curve and an identified fluctuation curve corresponding to each of the multiple target years, and obtaining preprocessed historical data; Obtaining a prediction model set, performing a combination operation on the prediction model set to obtain a plurality of combination models, wherein the prediction model set includes a plurality of prediction models; Acquire the data of the agricultural products to be predicted, wherein the data of the agricultural products to be predicted includes: the agricultural products to be predicted, the supply ports to be predicted, the port areas to be predicted and the time to be predicted; Based on the agricultural product attribution point data to be predicted and pre-processed historical data, the adjacent day data is obtained, and the adjacent day data and the pre-processed historical data are imported into multiple combination models to obtain multiple model prediction prices, and the historical prediction price is calculated based on the pre-processed historical data, and the adjacent prediction price is calculated based on the adjacent day data; Based on multiple model prediction prices, historical prediction prices and neighboring prediction prices, the initial prediction price of the agricultural product attribution point data to be predicted is obtained, and the neighboring extreme influencing factor set of the neighboring daily data is obtained; If the set of neighboring extreme influencing factors is not an empty set, the corrected agricultural product price is obtained based on the set of neighboring extreme influencing factors, and a price warning is generated based on the set of neighboring extreme influencing factors; Otherwise, the agricultural product price fluctuation warning based on model prediction is completed based on the initial forecast price.
2. The agricultural product price fluctuation early warning method based on model prediction according to claim 1, characterized in that: The obtaining of the agricultural product attribution point includes: Get the agricultural product set and perform the following operations on the agricultural products in the agricultural product set: Acquire a supply port set corresponding to the agricultural product, extract the supply ports from the supply port set in sequence, acquire a port region set corresponding to the supply port, extract the port regions from the port region set in sequence, merge the agricultural product, the port region and the supply port, and obtain an initial agricultural product attribution point, wherein the supply port includes: a production end and a sales end, and the initial agricultural product attribution point includes: an agricultural product, a supply port and a port region; The initial agricultural product attribution points are aggregated, and the agricultural product attribution points are extracted from the aggregated initial agricultural product attribution points.
3. The agricultural product price fluctuation early warning method based on model prediction according to claim 2, characterized in that: The step of obtaining the marked weekly price curve and the marked fluctuation curve corresponding to each of the multiple target years to obtain the pre-processed historical data includes: Extract target years from multiple target years in sequence, and perform the following operations on the extracted target years: Dividing the extracted target year based on a preset weekly time series to obtain multiple weekly price time series, and using the historical price data set to fill the multiple weekly price time series to obtain multiple weekly price data sets; Perform the following operations on the weekly price datasets in multiple weekly price datasets: Count the agricultural product price sets and sample numbers in the weekly price data set, calculate the weekly price mean based on the agricultural product price set and sample number, and obtain the extreme influencing factor set of the weekly price mean in the weekly price time series, wherein the extreme influencing factor set includes zero, one or more extreme influencing factors; Summarize the weekly price averages in order from earliest to latest time to obtain multiple sequential weekly prices; Calculate multiple sequential weekly fluctuation ratios based on multiple sequential weekly prices, obtain a weekly price curve and a fluctuation curve corresponding to the target year according to the multiple sequential weekly prices and the multiple sequential weekly fluctuation ratios, and perform a marking operation on the weekly price curve and the fluctuation curve based on the extreme influencing factor set to obtain a marked weekly price curve and a marked fluctuation curve; Summarize the marked weekly price curve and the marked fluctuation curve to obtain the pre-processed historical data.
4. The agricultural product price fluctuation early warning method based on model prediction according to claim 3 is characterized in that: The calculation of the weekly price average based on the agricultural product price set and the number of samples includes: If the number of samples is greater than the preset sample size threshold, the mean of the agricultural product prices in the agricultural product price set is calculated to obtain the weekly price mean; If the number of samples is less than or equal to the sample size threshold, then obtain multiple adjacent weekly price time series and multiple agricultural product attribution points of the weekly price data set, confirm the adjacent weekly price mean corresponding to each adjacent weekly price time series in the multiple adjacent weekly price time series, and obtain multiple adjacent weekly price means, query the weekly price mean of each agricultural product attribution point in the multiple agricultural product attribution points in the weekly price time series, and obtain multiple weekly price means, calculate the average of multiple adjacent weekly price means and multiple weekly price means, and obtain the weekly price mean.
5. The agricultural product price fluctuation early warning method based on model prediction according to claim 4, characterized in that: The method of calculating multiple sequential weekly fluctuation ratios based on multiple sequential weekly prices, obtaining a weekly price curve and a fluctuation curve corresponding to a target year according to the multiple sequential weekly prices and the multiple sequential weekly fluctuation ratios, and performing a marking operation on the weekly price curve and the fluctuation curve based on a set of extreme influencing factors to obtain a marked weekly price curve and a marked fluctuation curve includes: Sequential weekly prices are sequentially extracted from a plurality of sequential weekly prices, and the next sequential weekly price adjacent to the sequential weekly price is extracted from the plurality of sequential weekly prices to obtain an adjacent sequential weekly price, a sequential fluctuation ratio is calculated based on the sequential weekly price and the adjacent sequential weekly price, and the sequential fluctuation ratios are summarized to obtain a plurality of sequential fluctuation ratios, wherein the sequential fluctuation ratios correspond to the sequential weekly prices one by one, and the calculation formula of the sequential fluctuation ratios is as follows: , in, represents the sequential fluctuation ratio, represents the adjacent weekly price, Indicates sequential weekly price; Based on the multiple weekly price time series, multiple weekly horizontal coordinates are constructed, the multiple weekly horizontal coordinates are used as the horizontal coordinates of the weekly price curve, the multiple sequential weekly prices corresponding to the multiple weekly horizontal coordinates are used as the vertical coordinates of the weekly price curve, and the weekly price curve is constructed using a pre-constructed curve fitting method; The fluctuation curve is constructed by taking multiple weekly horizontal coordinates as the horizontal coordinates of the fluctuation curve and taking multiple sequential fluctuation ratios corresponding to the multiple weekly horizontal coordinates as the vertical coordinates; Sequential weekly prices in the weekly price curve are sequentially extracted to obtain target identification points, weekly price time series, extreme influencing factor set and sequential fluctuation ratio corresponding to the target identification points are extracted to obtain sequential weekly price identifications, and identification operations are performed on the target identification points using the sequential weekly price identifications. After confirming that the identification operations are performed on all target identification points in the weekly price curve, an identification weekly price curve is obtained; The identification fluctuation curve is obtained by using the extreme influencing factor set and multiple sequential fluctuation ratios.
6. The agricultural product price fluctuation early warning method based on model prediction according to claim 5, characterized in that: The method of importing the adjacent day data and the pre-processed historical data into multiple combination models to obtain multiple model predicted prices includes: Extract the combined models from multiple combined models in sequence, and perform the following operations on the combined models: Identify the first model and the second model, divide the preprocessed historical data into a historical training set and a historical test set, use the historical training set to train the first model and the second model, and use the historical test set to test the trained first model and the trained second model, obtain a first mean square error and a second mean square error, and calculate a first weight and a second weight based on the first mean square error and the second mean square error; Importing the adjacent day data and the preprocessed historical data into the trained first model and the trained second model to obtain the initial first model and the initial second model, predicting the first predicted price and the second predicted price of the agricultural product attribution point data to be predicted based on the initial first model and the initial second model, and calculating the model predicted price based on the first predicted price, the second predicted price, the first weight and the second weight; Aggregate the model prediction prices to get multiple model prediction prices.
7. The agricultural product price fluctuation early warning method based on model prediction according to claim 6, characterized in that: The calculation formula of the model prediction price is as follows: , in, represents the model predicted price, Represents the total number of historical test prices in the historical test set, Indicates that the first model after training is used for the historical test set The first model obtained by predicting the historical test price Predict prices, The first model of the first model The predicted price corresponds to the first Historical test prices, represents the first predicted price, Indicates that the second model after training is The second model obtained by predicting the historical test price Predict prices, The second model represents the second model The predicted price corresponds to the first Historical test prices, Represents the second predicted price.
8. The agricultural product price fluctuation early warning method based on model prediction according to claim 7, characterized in that: The method of calculating the historical forecast price based on the preprocessed historical data and calculating the adjacent forecast price based on the adjacent day data includes: Extract multiple weekly price averages corresponding to the to-be-predicted time in multiple target years from the preprocessed historical data to obtain multiple initial historical weekly prices, remove the initial historical weekly prices whose corresponding extreme influencing factor sets are not empty sets from the multiple initial historical weekly prices to obtain multiple cleaned historical weekly prices, calculate the average of the multiple cleaned historical weekly prices, and obtain the historical forecast price; Based on the data of the adjacent days, a price curve of the adjacent days is drawn, and the slope corresponding to the preset adjacent time to be predicted in the price curve of the adjacent days is calculated to obtain the trend of the adjacent days, a trend line is constructed based on the trend of the adjacent days, and the ordinate of the time to be predicted in the trend line is calculated to obtain the first adjacent predicted price; Extracting identification fluctuation curves corresponding to multiple target years from preprocessed historical data to obtain multiple historical fluctuation curves, and extracting multiple historical fluctuation data groups corresponding to the to-be-predicted time in multiple target years from the multiple historical fluctuation curves, wherein the historical fluctuation data groups correspond to the historical fluctuation curves one-to-one, the historical fluctuation data groups include multiple historical fluctuation data, and the historical fluctuation data are sequential fluctuation proportions adjacent to the to-be-predicted time in the target year; Calculate the historical fluctuation mean of multiple historical fluctuation data groups, extract the adjacent price value from the adjacent daily price curve, calculate the second adjacent predicted price based on the adjacent price value and the historical fluctuation mean, and calculate the adjacent predicted price based on the first adjacent predicted price and the second adjacent predicted price.
9. The agricultural product price fluctuation early warning method based on model prediction according to claim 8, characterized in that: The method of obtaining the initial predicted price of the agricultural product attribution point data to be predicted based on multiple model predicted prices, historical predicted prices and neighboring predicted prices includes: Aggregate multiple model prediction prices, historical prediction prices and neighboring prediction prices to obtain a prediction price set; Calculating the predicted price variance of the predicted price set, and if the predicted price variance is less than a preset variance threshold, calculating the mean of the predicted price set to obtain an initial predicted price; Otherwise, the predicted price set is screened by using a pre-constructed outlier elimination method to obtain an optimized predicted price set, and the mean of the optimized predicted price set is calculated to obtain an initial predicted price.
10. An agricultural product price fluctuation early warning system based on model prediction, characterized in that: The system comprises: A preprocessing historical data module is used to obtain the agricultural product attribution point, obtain a historical price data set based on the agricultural product attribution point, divide the historical price data set to obtain multiple target years, obtain an identified weekly price curve and an identified fluctuation curve corresponding to each of the multiple target years, and obtain preprocessing historical data; The module for the attribution point data of agricultural products to be predicted is used to obtain a prediction model set, perform a combination operation on the prediction model set, obtain a plurality of combination models, wherein the prediction model set includes a plurality of prediction models, and obtain the attribution point data of agricultural products to be predicted, wherein the attribution point data of agricultural products to be predicted includes: agricultural products to be predicted, supply ports to be predicted, port areas to be predicted, and time to be predicted; An initial prediction price module is used to obtain adjacent day data based on the agricultural product to be predicted attribution point data and pre-processed historical data, import the adjacent day data and pre-processed historical data into multiple combination models to obtain multiple model prediction prices, calculate the historical prediction price based on the pre-processed historical data, calculate the adjacent prediction price based on the adjacent day data, obtain the initial prediction price of the agricultural product to be predicted attribution point data based on multiple model prediction prices, historical prediction prices and adjacent prediction prices, and obtain the adjacent extreme influencing factor set of the adjacent day data; The early warning module is used to obtain the revised agricultural product price based on the set of neighboring extreme influencing factors if the set of neighboring extreme influencing factors is not an empty set, and generate a price warning based on the set of neighboring extreme influencing factors; otherwise, the agricultural product price fluctuation warning based on the model prediction is completed based on the initial predicted price.