Retail terminal order demand prediction method and device, equipment and medium
By combining the historical order data and geographical information characteristics of retail terminals, the XGBoost algorithm is used to establish an order demand prediction model, which solves the tedious and inaccurate problems of traditional forecasting methods, achieves accurate prediction of retail terminal order demand and supports production decisions, and reduces the cost of production. Slow sales of goods and waste of resources.
Patent Information
- Application Number
- CN202410859686.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-03
AI Technical Summary
The traditional order demand forecasting method has cumbersome steps and is difficult to accurately predict product order demand for a long period of time in the future. It is also difficult to accurately place products according to consumer groups, retail terminal groups, and urban business districts with different consumption levels and social attributes. , affecting product sales.
By obtaining the external and internal historical order data sets of retail terminals in the grid area to be predicted, combined with the grid topology features, geographical information point of interest features and ID data sets, the XGBoost machine learning algorithm is used for data processing to extract sales volume features and orders Features, establish a retail terminal order demand prediction model, and realize the prediction of order data that cannot be obtained.
It achieves accurate prediction of retail terminal order demand, supports corporate production decisions, reduces overcapacity or unsalable goods, stabilizes commodity prices and corporate profits, and reduces resource waste.
Smart Images

Figure CN118586958A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data technology, and in particular to a method, device, equipment and medium for predicting retail terminal order demand. Background Art
[0002] With the rapid economic development, the production and sales process of commodities has become increasingly mature. Commodities refer to tangible items or intangible services sold by merchants to consumers, including various daily necessities, electronic products, clothing, food, cosmetics, automobiles and other products. In the process of commodity production and sales, the time series order demand forecasting method can be used to make fuzzy predictions on the sales data of commodities in the short term in the future, which makes it easier for staff to plan the production volume of commodities and reduce the occurrence of overcapacity or unsalable commodities.
[0003] However, most of the traditional order demand forecasting methods are too complicated, which makes it difficult for staff to accurately predict the order demand of goods in a long period of time in the future, and thus it is difficult to provide production decision support to enterprises. At the same time, traditional order demand forecasting methods are difficult to accurately place goods according to consumer groups, retail terminal groups, and urban business districts with different consumption levels and social attributes, which in turn has an adverse impact on the sales of goods. Summary of the invention
[0004] In view of this, the present invention provides a retail terminal order demand forecasting method, device, equipment and medium to solve the problem that the traditional order demand forecasting method has complicated steps and cannot accurately predict the commodity order demand situation in a long period of time in the future.
[0005] In a first aspect, the present invention provides a method for predicting retail terminal order demand, the method comprising:
[0006] Obtain a first historical order dataset outside the retail terminal and a historical order dataset inside the retail terminal within the grid area to be predicted; obtain a grid topology feature dataset, a grid geographic information point of interest feature dataset and a grid ID dataset for the grid area to be predicted; use the grid ID dataset to extract sales data features from the first historical order dataset outside the retail terminal to obtain a sales feature dataset outside the retail terminal; based on the grid topology feature dataset, the grid geographic information point of interest feature dataset and the sales feature dataset outside the retail terminal, after processing with the XGBoost machine learning algorithm, determine a second historical order dataset outside the retail terminal; based on the first historical order dataset outside the retail terminal, the historical order dataset inside the retail terminal and the second historical order dataset outside the retail terminal, after processing with a preset feature extraction method and the XGBoost machine learning algorithm, obtain a retail terminal order demand prediction result within the grid area to be predicted.
[0007] The retail terminal order demand prediction method provided by the present invention can extract the retail terminal external sales feature data set in the first historical order data set outside the retail terminal through the grid ID data set of the grid area to be predicted. Further, in combination with the obtained grid topology feature data set and the grid geographic information point of interest feature data set, other order data other than the first historical order data set outside the retail terminal that cannot be obtained in the grid area to be predicted can be predicted. Further, on the basis of the obtained first historical order data set outside the retail terminal and the internal historical order data set of the retail terminal, combined with the predicted second historical order data set outside the retail terminal, the order features in the grid area to be predicted can be accurately extracted through a preset feature extraction method, and then combined with the XGBoost machine learning algorithm for processing, the retail terminal order demand in the predicted grid area can be predicted more accurately, and then production decision support can be provided for the enterprise, so that the produced goods can meet the internal and external sales needs within the corresponding time period, thereby reducing the situation of overcapacity or unsalable goods, thereby stabilizing the price of goods and the profit of the enterprise, and also reducing the phenomenon of waste of resources.
[0008] In an optional implementation, obtaining a grid topology structure feature dataset, a grid geographic information point of interest feature dataset, and a grid ID dataset of a grid area to be predicted includes:
[0009] Obtain the grid center point location data and grid ID data set of the grid area to be predicted; based on the grid center point location data, after processing by a preset calculation method and Node2Vec random walk algorithm, obtain the grid topology structure feature data set; based on the grid ID data set, after processing by a preset processing method and feature screening method, obtain the grid geographic information interest point feature data set.
[0010] The present invention can obtain a grid topology structure feature data set of the grid area to be predicted through grid center point location data, combined with a preset calculation method and a Node2Vec random walk algorithm. Furthermore, the grid ID data set is processed by a preset processing method and a feature screening method to obtain a grid geographic information interest point feature data set of the grid area to be predicted, which provides support for the prediction of other order data that cannot be obtained in the subsequent grid area to be predicted except for the first historical order data set outside the retail terminal.
[0011] In an optional implementation, based on the grid center point position data, a grid topology structure feature data set is obtained through a preset calculation method and a Node2Vec random walk algorithm, including:
[0012] Using the grid center point position data, multiple grid distance values in the grid area to be predicted are calculated; based on the multiple grid distance values, multiple grid distance weight values are calculated; based on the multiple grid distance weight values, the Node2Vec random walk algorithm is used to process and obtain a grid topology structure feature data set.
[0013] In an optional implementation, based on the grid topology structure feature dataset, the grid geographic information point of interest feature dataset, and the retail terminal external sales feature dataset, after being processed by the XGBoost machine learning algorithm, a second historical order dataset external to the retail terminal is determined, including:
[0014] Based on the grid topology feature dataset, the grid geographic information point of interest feature dataset and the retail terminal external sales feature dataset, a retail terminal external order data prediction model is established after being processed by the XGBoost machine learning algorithm. The retail terminal external order data prediction model is used to predict the retail terminal external order data in the predicted grid area to obtain the second historical order dataset of the retail terminal external.
[0015] The present invention combines the obtained grid topology structure feature data set, the grid geographic information point of interest feature data set and the retail terminal external sales feature data set, and can establish a corresponding retail terminal external order data prediction model through XGBoost machine learning algorithm training. Furthermore, the retail terminal external order data prediction model can realize the prediction of other order data except the first historical order data set outside the retail terminal that cannot be obtained in the predicted grid area.
[0016] In an optional implementation, based on the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal, after being processed by a preset feature extraction method and an XGBoost machine learning algorithm, a retail terminal order demand forecast result within the grid area to be forecasted is obtained, including:
[0017] Acquire the internal feature data set of the retail terminal; based on the first historical order data set outside the retail terminal, the internal historical order data set of the retail terminal and the second historical order data set outside the retail terminal, obtain the retail terminal derived feature data set, the retail terminal external feature data set and the retail terminal one-hot feature data set after processing by a preset feature extraction method; based on the retail terminal derived feature data set, the internal feature data set of the retail terminal, the external feature data set of the retail terminal and the retail terminal one-hot feature data set, establish a retail terminal order demand prediction model after processing by an XGBoost machine learning algorithm; use the retail terminal order demand prediction model to predict the retail terminal order demand in the grid area to be predicted, and obtain the retail terminal order demand prediction result.
[0018] The present invention can accurately extract retail terminal derived features, retail terminal internal features, retail terminal external features and retail terminal one-hot features in the grid area to be predicted by performing feature extraction on a first historical order data set outside the retail terminal, a historical order data set inside the retail terminal and a second historical order data set outside the retail terminal. Furthermore, the three feature data are combined and processed by the XGBoost machine learning algorithm to establish a corresponding retail terminal order demand prediction model, and the model can be used to more accurately predict the retail terminal order demand in the grid area to be predicted.
[0019] In an optional implementation, based on the first historical order dataset external to the retail terminal, the historical order dataset internal to the retail terminal, and the second historical order dataset external to the retail terminal, before obtaining the retail terminal derived feature dataset, the retail terminal external feature dataset, and the retail terminal one-hot feature dataset through processing using a preset feature extraction method, the method further includes:
[0020] The first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal are processed respectively.
[0021] The present invention can improve the accuracy of the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal through data processing, thereby providing data support for more accurate subsequent prediction of retail terminal order demand within the prediction grid area.
[0022] In an optional embodiment, the method further includes:
[0023] Obtain a preset evaluation index set; evaluate the retail terminal order demand forecasting model based on the preset evaluation index set to obtain a model evaluation result.
[0024] The present invention can evaluate the established retail terminal order demand forecasting model through a preset evaluation index set.
[0025] In an optional implementation, the derived feature data set of the retail terminal is calculated based on the order volume of the retail terminal in the past 4 weeks, 13 weeks, and 26 weeks, wherein 4 weeks, 13 weeks, and 26 weeks represent monthly features, quarterly features, and semi-annual features, respectively, and specifically include: the mean, maximum value, minimum value, standard deviation, standard error, variance (var), median, number of weeks with 0 order volume, and number of weeks with non-0 order volume; number of holidays within 4 weeks, 13 weeks, and 26 weeks; order volume of specifications with price>=1000, order volume of specifications with price500<=<1000, order volume of specifications with price100<=<500, order volume of specifications with price<100, last week's order volume of specifications - last week's order volume (order volume trend), and last week's order volume of a certain specification;
[0026] The retail terminal internal feature dataset represents the characteristics of the retail terminal itself, including: retail terminal format, retail terminal scale, type of region where the retail terminal is located, retail terminal type, retail terminal stall, type of business district where the retail terminal is located, marketing department where the retail terminal is located, and terminal type used by the retail terminal;
[0027] The XGBoost machine learning algorithm model is expressed as the following relationship:
[0028]
[0029] Where: h m (x; a m ) represents the mth decision tree; M represents the number of base learner decision trees; a m Represents the parameters of the decision tree.
[0030] In a second aspect, the present invention provides a retail terminal order demand forecasting device, the device comprising:
[0031] The first acquisition module is used to acquire a first historical order dataset outside the retail terminal and a historical order dataset inside the retail terminal within the grid area to be predicted; the second acquisition module is used to acquire a grid topology feature dataset, a grid geographic information point of interest feature dataset and a grid ID dataset for the grid area to be predicted; the feature extraction module is used to extract sales data features from the first historical order dataset outside the retail terminal using the grid ID dataset to obtain a sales feature dataset outside the retail terminal; the determination module is used to determine a second historical order dataset outside the retail terminal based on the grid topology feature dataset, the grid geographic information point of interest feature dataset and the sales feature dataset outside the retail terminal after processing with the XGBoost machine learning algorithm; the processing module is used to obtain a retail terminal order demand prediction result within the grid area to be predicted based on the first historical order dataset outside the retail terminal, the historical order dataset inside the retail terminal and the second historical order dataset outside the retail terminal after processing with a preset feature extraction method and the XGBoost machine learning algorithm.
[0032] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the retail terminal order demand forecasting method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0033] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the retail terminal order demand forecasting method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 is a flow chart of a method for predicting retail terminal order demand according to an embodiment of the present invention;
[0036] Figure 2 is a flow chart of another retail terminal order demand forecasting method according to an embodiment of the present invention;
[0037] Figure 3 is a flow chart of another method for predicting retail terminal order demand according to an embodiment of the present invention;
[0038] Figure 4 is a structural block diagram of a retail terminal order demand prediction device according to an embodiment of the present invention;
[0039] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0041] According to an embodiment of the present invention, an embodiment of a method for predicting order demand at a retail terminal is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0042] In this embodiment, a method for predicting retail terminal order demand is provided. Figure 1 is a flowchart of a method for predicting retail terminal order demand according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0043] Step S101, obtaining a first historical order dataset external to the retail terminal and a historical order dataset internal to the retail terminal within the grid area to be predicted.
[0044] Specifically, the first historical order data set outside the retail terminal represents external consumption data of cigarette products that can be directly obtained through market trend data, industry data, and competitor data.
[0045] Furthermore, the historical order data set within the retail terminal can be directly obtained from the inside, including internal order data, sales data, inventory data, etc.
[0046] Step S102, obtaining a grid topology structure feature data set, a grid geographic information point of interest feature data set and a grid ID data set of the grid area to be predicted.
[0047] Specifically, the grid topology structure feature data set may reflect the grid topology structure features of the grid area to be predicted.
[0048] Furthermore, the grid geographic information point of interest feature dataset reflects the impact on external consumption data of cigarette products.
[0049] Step S103, using the grid ID data set to extract sales data features from the first historical order data set outside the retail terminal, to obtain a sales feature data set outside the retail terminal.
[0050] Specifically, by using multiple grid IDs in the grid ID data set, the sales volume of different cigarettes in the grid area to be predicted can be aggregated.
[0051] Furthermore, the aggregated cigarette sales data corresponding to all grid IDs are combined into a large table, and missing values are filled with 0 to obtain the corresponding retail terminal external sales feature data set.
[0052] Step S104, based on the grid topology structure feature dataset, the grid geographic information point of interest feature dataset and the retail terminal external sales feature dataset, after being processed by the XGBoost machine learning algorithm, a second historical order dataset outside the retail terminal is determined.
[0053] Among them, the XGBoost machine learning algorithm represents a machine learning algorithm that improves the Boosting algorithm based on GBDT and adds a regular term of model complexity.
[0054] Specifically, by combining the obtained grid topology structure feature dataset, grid geographic information point of interest feature dataset and retail terminal external sales feature dataset, and processing and predicting through the XGBoost machine learning algorithm, other order data except the first historical order dataset outside the retail terminal that cannot be obtained in the corresponding grid area to be predicted can be obtained, that is, the second historical order dataset outside the retail terminal.
[0055] Step S105, based on the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal and the second historical order data set outside the retail terminal, after being processed by a preset feature extraction method and an XGBoost machine learning algorithm, a retail terminal order demand prediction result within the grid area to be predicted is obtained.
[0056] Specifically, based on the acquired first historical order dataset outside the retail terminal and the historical order dataset inside the retail terminal, combined with the predicted second historical order dataset outside the retail terminal, the order features in the grid area to be predicted can be accurately extracted through a preset feature extraction method, and then processed in combination with the XGBoost machine learning algorithm, so as to more accurately predict the order demand of the retail terminal in the predicted grid area, and thus provide production decision support for the enterprise.
[0057] The retail terminal order demand prediction method provided in this embodiment can extract the retail terminal external sales feature data set in the first historical order data set outside the retail terminal through the grid ID data set of the grid area to be predicted. Further, in combination with the obtained grid topology feature data set and the grid geographic information point of interest feature data set, other order data other than the first historical order data set outside the retail terminal that cannot be obtained in the grid area to be predicted can be predicted. Further, on the basis of the obtained first historical order data set outside the retail terminal and the internal historical order data set of the retail terminal, combined with the predicted second historical order data set outside the retail terminal, the order features in the grid area to be predicted can be accurately extracted through the preset feature extraction method, and then combined with the XGBoost machine learning algorithm for processing, the retail terminal order demand in the predicted grid area can be predicted more accurately, and then production decision support can be provided for the enterprise, so that the produced goods can meet the internal and external sales needs within the corresponding time period, thereby reducing the situation of overcapacity or unsalable goods, thereby stabilizing the price of goods and the profit of the enterprise, and also reducing the phenomenon of waste of resources.
[0058] In this embodiment, a method for predicting retail terminal order demand is provided. Figure 2 is a flowchart of a method for predicting retail terminal order demand according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0059] Step S201, obtain the first historical order data set outside the retail terminal and the historical order data set inside the retail terminal in the grid area to be predicted. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0060] Step S202, obtaining a grid topology structure feature data set, a grid geographic information point of interest feature data set and a grid ID data set of the grid area to be predicted.
[0061] Specifically, the above step S202 includes:
[0062] Step S2021, obtaining the grid center point position data and grid ID data set of the grid area to be predicted.
[0063] Specifically, the grid center point position data represents the longitude and latitude information of the grid center point in the grid area to be predicted.
[0064] Step S2022, based on the grid center point position data, a grid topology structure feature data set is obtained through processing using a preset calculation method and a Node2Vec random walk algorithm.
[0065] Among them, the Node2Vec random walk algorithm represents a graph embedding method that comprehensively considers the DFS neighborhood and the BFS neighborhood. Specifically, it is an extension of deepwalk, which is a deepwalk that combines the DFS (depth-first search algorithm) and BFS (breadth-first search algorithm) random walks.
[0066] Among them, deepwalk represents a graph structure data mining algorithm that combines the random walk (Random Walk) and the Word2Vec model.
[0067] Specifically, a grid topology structure feature data set of the grid area to be predicted can be obtained by combining the preset calculation method and the Node2Vec random walk algorithm.
[0068] In some optional implementations, the above step S2022 includes:
[0069] Step a1, using the grid center point position data, calculate multiple grid distance values in the grid area to be predicted.
[0070] Step a2, calculating multiple grid distance weight values based on multiple grid distance values.
[0071] Step a3, based on multiple grid distance weight values, a grid topology structure feature data set is obtained through processing by the Node2Vec random walk algorithm.
[0072] Specifically, the distance between any two grids in the grid area to be predicted can be calculated based on the longitude and latitude of the grid center point, and the paths between grids with distance values less than 10 kilometers are retained.
[0073] Furthermore, the corresponding weight can be calculated according to the calculated distance value between the grids: grid distance weight value=1 / grid distance value.
[0074] Furthermore, through the Node2Vec random walk algorithm, the corresponding 16-dimensional topological structure features can be generated and the corresponding grid topological structure feature data set can be formed.
[0075] Step S2023, based on the grid ID data set, a grid geographic information point of interest feature data set is obtained by processing using a preset processing method and a feature screening method.
[0076] Specifically, based on the grid ID data set, grid geographic information interest point data aggregation is performed in combination with the grid geographic information interest point categories in the grid area to be predicted.
[0077] Among them, the grid geographic information point of interest categories are divided into: sub_poi and big_poi (sub: underlying classification, accurate to specific categories; big: abstract classification, of a general nature).
[0078] Furthermore, feature importance screening is performed using feature screening methods:
[0079] a. Different geographic information POI data have different influences on different features of external data. In order to reduce noise, XGBoost modeling is performed on each dimension of external data features, and then the 10 features with the greatest influence are selected based on SHAP Value (industry standard);
[0080] b. The above 10 features with the greatest impact on external data are combined to obtain the 92 most important external POI features, and form the corresponding grid geographic information point of interest feature data set.
[0081] Step S203: Use the grid ID data set to extract sales data features from the first historical order data set outside the retail terminal to obtain a sales feature data set outside the retail terminal. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0082] Step S204, based on the grid topology structure feature dataset, the grid geographic information point of interest feature dataset and the retail terminal external sales feature dataset, after being processed by the XGBoost machine learning algorithm, a second historical order dataset outside the retail terminal is determined.
[0083] Specifically, the above step S204 includes:
[0084] Step S2041, based on the grid topology structure feature data set, the grid geographic information point of interest feature data set and the retail terminal external sales feature data set, after being processed by the XGBoost machine learning algorithm, a retail terminal external order data prediction model is established.
[0085] Specifically, when acquiring the external order data of the retail terminal, it may be restricted by other factors, resulting in failure to acquire all the external order data of the retail terminal.
[0086] Therefore, by splicing the obtained grid topology structure feature dataset, grid geographic information point of interest feature dataset and retail terminal external sales feature dataset together, corresponding to the existing external data grid id, a training dataset is obtained, and 80% of the data is randomly divided as training data and 20% of the data as verification data.
[0087] Furthermore, by using XGBoost to model each dimensional feature of the external data, the corresponding retail terminal external order data prediction model can be obtained.
[0088] Step S2042, using the retail terminal external order data prediction model to predict the retail terminal external order data in the prediction grid area, to obtain a second retail terminal external historical order data set.
[0089] Specifically, the obtained retail terminal external order data prediction model can be used to predict other order data except the first retail terminal external historical order data set that cannot be obtained in the prediction grid area, and obtain the predicted retail terminal external second historical order data set.
[0090] Step S205: Based on the first historical order dataset outside the retail terminal, the historical order dataset inside the retail terminal, and the second historical order dataset outside the retail terminal, a predetermined feature extraction method and an XGBoost machine learning algorithm are used to obtain a retail terminal order demand forecast result within the grid area to be forecasted. Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.
[0091] The retail terminal order demand prediction method provided in this embodiment, combined with the preset calculation method and the Node2Vec random walk algorithm processing, can obtain the grid topology structure feature data set of the grid area to be predicted. Further, by processing the grid ID data set through the preset processing method and the feature screening method, the grid geographic information point of interest feature data set of the grid area to be predicted can be obtained. At the same time, the retail terminal external sales feature data set in the first historical order data set outside the retail terminal can be extracted through the grid ID data set of the grid area to be predicted. Further, in combination with the obtained grid topology structure feature data set, the grid geographic information point of interest feature data set and the retail terminal external sales feature data set, a corresponding retail terminal external order data prediction model can be established through the XGBoost machine learning algorithm training. Further, through the retail terminal external order data prediction model, it is possible to realize the prediction of other order data that cannot be obtained in the grid area to be predicted except for the first historical order data set outside the retail terminal. Furthermore, based on the obtained first historical order data set outside the retail terminal and the historical order data set inside the retail terminal, combined with the predicted second historical order data set outside the retail terminal, the order features in the grid area to be predicted can be accurately extracted through a preset feature extraction method, and then processed in combination with the XGBoost machine learning algorithm. The retail terminal order demand in the predicted grid area can be predicted more accurately, thereby providing production decision support for the enterprise, so that the produced goods can meet the internal and external sales needs within the corresponding time period, thereby reducing the situation of overcapacity or unsalable goods, thereby stabilizing the price of goods and the profit of the enterprise, and also reducing the waste of resources.
[0092] In this embodiment, a method for predicting retail terminal order demand is provided. Figure 3 is a flowchart of a method for predicting retail terminal order demand according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0093] Step S301, obtain the first historical order data set outside the retail terminal and the historical order data set inside the retail terminal in the grid area to be predicted. Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0094] Step S302, obtaining a grid topology feature dataset, a grid geographic information point of interest feature dataset, and a grid ID dataset for the grid area to be predicted. Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0095] Step S303: Use the grid ID data set to extract sales data features from the first historical order data set outside the retail terminal to obtain a sales feature data set outside the retail terminal. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0096] Step S304: Based on the grid topology feature dataset, the grid geographic information point of interest feature dataset and the retail terminal external sales feature dataset, the second retail terminal external historical order dataset is determined through XGBoost machine learning algorithm processing. Figure 2 Step S204 of the illustrated embodiment will not be described in detail here.
[0097] Step S305, based on the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal and the second historical order data set outside the retail terminal, after being processed by a preset feature extraction method and an XGBoost machine learning algorithm, a retail terminal order demand prediction result within the grid area to be predicted is obtained.
[0098] Specifically, the above step S305 includes:
[0099] Step S3051, obtaining a retail terminal internal feature data set.
[0100] Specifically, the internal characteristics of the retail terminal represent the characteristics of the retail terminal itself, such as the scale of the retail terminal, the region where it is located, etc. These characteristics are encoded using one-hot, and may include: retail terminal business format (business_type), retail terminal scale (scale_type), retail terminal location type (area_type), retail terminal type (abc_type), retail terminal gear position (gear_position), retail terminal location type (business_district), retail terminal marketing department (marketing_type), and retail terminal type (terminal_type).
[0101] Step S3052, based on the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal and the second historical order data set outside the retail terminal, a retail terminal derived feature data set, a retail terminal external feature data set and a retail terminal one-hot feature data set are obtained by processing with a preset feature extraction method.
[0102] Specifically, the derived characteristics of the retail terminal are mainly calculated based on the order volume of the retail terminal in the past 4 weeks, 13 weeks, and 26 weeks, that is, they can be calculated based on the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal.
[0103] Among them, 4 weeks, 13 weeks, and 26 weeks represent monthly characteristics, quarterly characteristics, and half-year characteristics respectively.
[0104] Furthermore, the characteristics calculated by month, quarter, and half year are as follows:
[0105] a) Mean (mean), maximum (max), minimum (min), standard deviation (std), standard error (sem), variance (var), median (median) of the order quantity;
[0106] b) Weeks with a zero order quantity and weeks with a non-zero order quantity;
[0107] c) Number of holidays in a 4-week, 13-week, or 26-week period;
[0108] d) Order quantity of products with price range>=1000, order quantity of products with price range500<=1000, order quantity of products with price range100<=500, order quantity of products with price range of cigarettes<100;
[0109] e) Order quantity of a product specification last week - order quantity of the week before last (order quantity trend), the order quantity of a product specification last week.
[0110] Furthermore, the retail terminal external feature data set may be obtained by processing the retail terminal external first historical order data set and the retail terminal external second historical order data set.
[0111] Furthermore, the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal include order data within multiple weeks.
[0112] Furthermore, by one-hoting the weekly data in the first historical order dataset outside the cigarette retail terminal, the historical order dataset inside the retail terminal, and the second historical order dataset outside the retail terminal, the corresponding retail terminal one-hot feature dataset can be obtained.
[0113] Step S3053, based on the retail terminal derived feature data set, the retail terminal internal feature data set, the retail terminal external feature data set and the retail terminal one-hot feature data set, after being processed by the XGBoost machine learning algorithm, a retail terminal order demand prediction model is established.
[0114] Specifically, the obtained retail terminal derived feature data set, retail terminal internal feature data set, retail terminal external feature data set and retail terminal one-hot feature data set are concatenated together to form a training data set.
[0115] Furthermore, based on the training data set, the corresponding retail terminal order demand prediction model can be obtained by training through the XGBoost machine learning algorithm.
[0116] Among them, 80% of the data in the training data set is used for training, and 20% of the data is used for validation.
[0117] Furthermore, the XGBoost machine learning algorithm model is expressed as the following equation (1):
[0118]
[0119] Where: h m (x; a m ) represents the mth decision tree; M represents the number of base learner decision trees; a m The parameters of the decision tree are as follows:
[0120] JSON
[0121] xgb.XGBRegressor(eta=0.05,max_depth=8,tree_method='exact',
[0122] n_estimators = 100)
[0123] in:
[0124] (1) eta = 0.05: The learning rate of the model is 0.05.
[0125] (2) max_depth = 8: The depth of each tree is 8.
[0126] (3) tree_method = 'exact': Use the exact method to build the decision tree, that is, try to evaluate each split point of each feature to find the best split point.
[0127] (4) n_estimators = 100: there are 100 decision trees.
[0128] Step S3054, using the retail terminal order demand forecasting model to forecast the retail terminal order demand in the forecasting grid area, to obtain the retail terminal order demand forecasting result.
[0129] Specifically, the obtained retail terminal order demand forecasting model can be used to forecast the retail terminal order demand in the grid area to be forecasted, and obtain the corresponding retail terminal order demand forecasting result.
[0130] Furthermore, the predicted retail terminal order demand forecast results can be visualized.
[0131] Specifically, the visualization display includes time trend display, geographical distribution display and heat map display. The predicted order demand data is displayed according to the time dimension through a line graph, which clearly shows the changing trend of order demand, and the distribution of order demand in different regions or stores is displayed through geographical distribution. The heat map display intuitively shows the order demand heat of different commodities or categories, helping users understand the distribution and concentration of order demand.
[0132] In some optional implementations, before the above step S3052, the method further includes: processing the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal respectively.
[0133] Specifically, firstly, errors, missing values and abnormal values in the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal and the second historical order data set outside the retail terminal are processed to ensure the accuracy and consistency of the data.
[0134] Furthermore, normalizing the processed data can eliminate the dimensional differences between different features or attributes.
[0135] Furthermore, by performing deduplication operations on the data, duplicate records are removed to ensure the uniqueness of each record in the data set.
[0136] Among them, the normalized data processing adjusts the data to the characteristic range and normalizes the feature vector to the standard normal distribution, making it easier for the model to capture the pattern. The specific calculation formula is shown in the following relationship (2):
[0137] X′=(XX min )(X max -X min ) (2)
[0138] Where: X′ represents the normalized value; X represents the original value; X max Indicates the maximum value; X min Indicates the minimum value.
[0139] In some optional implementations, after the above step S3053, the method further includes: obtaining a preset evaluation index set; and evaluating the retail terminal order demand forecasting model based on the preset evaluation index set to obtain a model evaluation result.
[0140] Specifically, the preset evaluation index set may include three evaluation indexes: mean square error (MSE), root mean square error (RSME) and coefficient of determination (R2).
[0141] Furthermore, the established retail terminal order demand forecasting model can be evaluated by these three evaluation indicators:
[0142] (1) Mean square error (MSE) is a method to measure the difference between the predicted value and the true value. It is the expected value of the square of the difference between the parameter estimate and the true value of the parameter. The smaller the value of MSE, the better the prediction effect of the retail terminal order demand forecasting model.
[0143] (2) Root mean square error (RSME) is the square root of mean square error (MSE). The smaller the value of RSME, the better the prediction effect of the retail terminal order demand forecasting model.
[0144] (3) The coefficient of determination (R2) is the degree of fit between the data and the regression model. The closer the R2 value is to 1, the better the retail terminal order demand forecasting model is.
[0145] The retail terminal order demand prediction method provided in this embodiment can extract the retail terminal external sales feature data set in the first historical order data set outside the retail terminal through the grid ID data set of the grid area to be predicted. Further, in combination with the obtained grid topology feature data set and the grid geographic information point of interest feature data set, other order data other than the first historical order data set outside the retail terminal that cannot be obtained in the grid area to be predicted can be predicted. Further, by extracting features from the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal, the retail terminal derivative features, the internal features of the retail terminal, the external features of the retail terminal, and the one-hot features of the retail terminal in the grid area to be predicted can be accurately extracted. Further, by combining the three feature data and processing them through the XGBoost machine learning algorithm, a corresponding retail terminal order demand prediction model can be established, and then the retail terminal order demand in the predicted grid area can be predicted more accurately through the model. At the same time, through data processing, the accuracy of the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal can be improved. Further, the established retail terminal order demand prediction model can also be evaluated by a preset evaluation index set. Therefore, by implementing the present invention, the demand for retail terminal orders within the forecast grid area can be predicted more accurately, thereby providing production decision support for the enterprise, so that the produced goods can meet the needs of internal and external sales within the corresponding time period, thereby reducing the situation of overcapacity or unsalable goods, thereby stabilizing the price of goods and the profit of the enterprise, and also reducing the waste of resources.
[0146] In this embodiment, a retail terminal order demand forecasting device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0147] This embodiment provides a retail terminal order demand forecasting device, such as Figure 4 As shown, including:
[0148] The first acquisition module 401 is used to acquire a first historical order dataset outside the retail terminal and a historical order dataset inside the retail terminal in the grid area to be predicted.
[0149] The second acquisition module 402 is used to acquire a grid topology structure feature data set, a grid geographic information point of interest feature data set and a grid ID data set of the grid area to be predicted.
[0150] The feature extraction module 403 is used to extract sales data features from the first historical order data set outside the retail terminal using the grid ID data set to obtain a sales feature data set outside the retail terminal.
[0151] The determination module 404 is used to determine the second historical order dataset outside the retail terminal based on the grid topology structure feature dataset, the grid geographic information point of interest feature dataset and the retail terminal external sales feature dataset after being processed by the XGBoost machine learning algorithm.
[0152] Processing module 405 is used to obtain the retail terminal order demand prediction result within the grid area to be predicted based on the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal and the second historical order data set outside the retail terminal through a preset feature extraction method and an XGBoost machine learning algorithm.
[0153] In some optional implementations, the second acquisition module 402 includes:
[0154] The first acquisition submodule is used to obtain the grid center point position data and the grid ID data set of the grid area to be predicted.
[0155] The first processing submodule is used to obtain a grid topology structure feature data set based on the grid center point position data through a preset calculation method and a Node2Vec random walk algorithm.
[0156] The second processing submodule is used to obtain a grid geographic information point of interest feature data set based on the grid ID data set through a preset processing method and a feature screening method.
[0157] In some optional implementations, the second processing submodule includes:
[0158] The first calculation unit is used to calculate multiple grid distance values in the grid area to be predicted by using the grid center point position data.
[0159] The second calculation unit is used to calculate multiple grid distance weight values based on the multiple grid distance values.
[0160] The processing unit is used to obtain a grid topology structure feature data set based on multiple grid distance weight values and processed by a Node2Vec random walk algorithm.
[0161] In some optional implementations, the determination module 404 includes:
[0162] The third processing submodule is used to establish a retail terminal external order data prediction model based on the grid topology structure feature data set, the grid geographic information point of interest feature data set and the retail terminal external sales feature data set after being processed by the XGBoost machine learning algorithm.
[0163] The first prediction submodule is used to predict the retail terminal external order data in the prediction grid area by using the retail terminal external order data prediction model to obtain a second retail terminal external historical order data set.
[0164] In some optional implementations, the processing module 405 includes:
[0165] The second acquisition submodule is used to acquire the internal feature data set of the retail terminal.
[0166] The fourth processing submodule is used to obtain a retail terminal derived feature data set, a retail terminal external feature data set and a retail terminal one-hot feature data set based on the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal and the second historical order data set outside the retail terminal through a preset feature extraction method.
[0167] The fifth processing submodule is used to establish a retail terminal order demand prediction model based on the retail terminal derived feature data set, the retail terminal internal feature data set, the retail terminal external feature data set and the retail terminal one-hot feature data set after being processed by the XGBoost machine learning algorithm.
[0168] The second prediction submodule is used to predict the retail terminal order demand in the to-be-predicted grid area by using the retail terminal order demand prediction model to obtain the retail terminal order demand prediction result.
[0169] In some optional implementations, the processing module 405 further includes:
[0170] The sixth processing submodule is used to process the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal respectively.
[0171] In some optional implementations, the processing module 405 further includes:
[0172] The third acquisition submodule is used to obtain a preset evaluation index set.
[0173] The evaluation submodule is used to evaluate the retail terminal order demand forecasting model based on a preset evaluation index set to obtain a model evaluation result.
[0174] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0175] The retail terminal order demand forecasting device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0176] The embodiment of the present invention also provides a computer device having the above Figure 4 The retail terminal order demand forecasting device is shown.
[0177] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0178] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0179] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0180] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0181] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0182] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0183] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0184] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for predicting retail terminal order demand, characterized in that: The method comprises: Obtain a first historical order dataset external to the retail terminal and a historical order dataset internal to the retail terminal in the grid area to be predicted; Acquire a grid topology structure feature data set, a grid geographic information point of interest feature data set, and a grid ID data set of the grid area to be predicted; Using the grid ID data set, extracting sales data features from the first historical order data set outside the retail terminal to obtain a sales feature data set outside the retail terminal; Based on the grid topology structure feature dataset, the grid geographic information point of interest feature dataset and the retail terminal external sales feature dataset, after being processed by the XGBoost machine learning algorithm, a second historical order dataset external to the retail terminal is determined; Based on the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal and the second historical order data set outside the retail terminal, after being processed by a preset feature extraction method and the XGBoost machine learning algorithm, a retail terminal order demand forecast result within the grid area to be predicted is obtained.
2. The method according to claim 1, characterized in that Obtaining a grid topology structure feature dataset, a grid geographic information point of interest feature dataset, and a grid ID dataset of the grid area to be predicted, including: Obtaining the grid center point position data and the grid ID data set of the grid area to be predicted; Based on the grid center point position data, the grid topology structure feature data set is obtained through a preset calculation method and a Node2Vec random walk algorithm. Based on the grid ID data set, the grid geographic information point of interest feature data set is obtained through processing by a preset processing method and a feature screening method.
3. The method according to claim 2, characterized in that Based on the grid center point position data, the grid topology structure feature data set is obtained through a preset calculation method and Node2Vec random walk algorithm, including: Calculate multiple grid distance values in the grid area to be predicted using the grid center point position data; Calculating a plurality of grid distance weight values based on the plurality of grid distance values; Based on the multiple grid distance weight values, the grid topology structure feature data set is obtained through processing by the Node2Vec random walk algorithm.
4. The method according to claim 1, characterized in that: Based on the grid topology structure feature dataset, the grid geographic information point of interest feature dataset and the retail terminal external sales feature dataset, after being processed by the XGBoost machine learning algorithm, a second historical order dataset external to the retail terminal is determined, including: Based on the grid topology structure feature data set, the grid geographic information point of interest feature data set and the retail terminal external sales feature data set, after being processed by the XGBoost machine learning algorithm, a retail terminal external order data prediction model is established; The retail terminal external order data prediction model is used to predict the retail terminal external order data in the to-be-predicted grid area to obtain the retail terminal external second historical order data set.
5. The method according to claim 1, characterized in that Based on the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal, after being processed by a preset feature extraction method and an XGBoost machine learning algorithm, a retail terminal order demand forecast result within the grid area to be forecasted is obtained, including: Obtaining internal feature datasets of retail terminals; Based on the first historical order dataset external to the retail terminal, the historical order dataset internal to the retail terminal, and the second historical order dataset external to the retail terminal, a retail terminal derived feature dataset, a retail terminal external feature dataset, and a retail terminal one-hot feature dataset are obtained after being processed by the preset feature extraction method; Based on the retail terminal derived feature data set, the retail terminal internal feature data set, the retail terminal external feature data set and the retail terminal one-hot feature data set, after being processed by the XGBoost machine learning algorithm, a retail terminal order demand prediction model is established; The retail terminal order demand prediction model is used to predict the retail terminal order demand in the to-be-predicted grid area to obtain the retail terminal order demand prediction result.
6. The method according to claim 5, characterized in that Based on the first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal, before obtaining the retail terminal derived feature data set, the retail terminal internal feature data set, the retail terminal external feature data set, and the retail terminal one-hot feature data set through processing by the preset feature extraction method, the method further includes: The first historical order data set outside the retail terminal, the historical order data set inside the retail terminal, and the second historical order data set outside the retail terminal are processed respectively.
7. The method according to claim 5, characterized in that The method further comprises: Get the preset evaluation index set; The retail terminal order demand forecasting model is evaluated based on the preset evaluation index set to obtain a model evaluation result.
8. The method according to claim 5, characterized in that The retail terminal derived feature data set is calculated based on the order volume of the retail terminal in the past 4 weeks, 13 weeks, and 26 weeks, where 4 weeks, 13 weeks, and 26 weeks represent monthly features, quarterly features, and semi-annual features, respectively, and specifically includes: the mean, maximum value, minimum value, standard deviation, standard error, variance (var), median, number of weeks with 0 order volume, and number of weeks with non-0 order volume; number of holidays in 4 weeks, 13 weeks, and 26 weeks; order volume of specifications with price>=1000, order volume of specifications with price500<=<1000, order volume of specifications with price100<=<500, order volume of specifications with price<100, last week's order volume of specifications - last week's order volume (order volume trend), and last week's order volume of a certain specification; The retail terminal internal feature data set represents the features of the retail terminal itself, specifically including: retail terminal format, retail terminal scale, type of region where the retail terminal is located, retail terminal type, retail terminal stall, type of business district where the retail terminal is located, marketing department where the retail terminal is located, and terminal type used by the retail terminal; The XGBoost machine learning algorithm model is expressed as the following relational expression: Where: h m (x; a m ) represents the mth decision tree; M represents the number of base learner decision trees; a m Represents the parameters of the decision tree.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the retail terminal order demand forecasting method according to any one of claims 1 to 8 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the retail terminal order demand forecasting method according to any one of claims 1 to 8.
Citation Information
Cited By
Unmanned aerial vehicle scheduling method and device, computer equipment and storage medium
CN119312990A
UAV dispatching method, device, computer equipment and storage medium
CN119312990B
