Fine class prediction method and device suitable for retail industry
By performing feature dimensionality reduction and screening on the historical fine class sales data set, and combining linear regression and random forest models for fine class prediction training, the problems of insufficient generalization ability of model and unreasonable feature selection in the existing technology are solved, and the accuracy of fine class prediction and model generalization ability are improved.
Patent Information
- Application Number
- CN202510155582.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-12
- Publication Date
- 2025-05-06
AI Technical Summary
When there are many fine-class prediction methods in stores, the model generalization ability is insufficient, resulting in low prediction accuracy and unreasonable feature selection, which affects model performance.
By obtaining historical fine sales data sets, performing feature dimensionality reduction and screening, obtaining feature enhancement data sets, and combining linear regression to conduct fine prediction training on the pre-constructed random forest model to improve the generalization ability of the model.
The generalization ability and prediction accuracy of the fine prediction model are improved, more reasonable and reference features are selected, the complexity of the model is reduced, and the training effect is enhanced.
Smart Images

Figure CN119940649A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of retail industry analysis technology, and in particular to a subcategory prediction method applicable to the retail industry, a subcategory prediction device applicable to the retail industry, an electronic device and a storage medium. Background Art
[0002] Granular Forecasting in Retail refers to the process of accurately predicting sales volume or other key indicators at the level of specific categories, subcategories or single products (Stock Keeping Unit, SKU) in the retail business. In the retail industry, when stores need to be replenished, the results of granular forecasts are an important reference. A forecast result with reference value can greatly help companies reduce the risk of high inventory in stores and reduce the operating costs of enterprises. Therefore, it is crucial to build a complete and stable forecasting chain.
[0003] At present, the main method used for sub-category prediction is to first perform EDA (Exploratory Data Analysis) on the basic sales data, then perform feature screening based on the results of EDA, and then use the gradient boosting tree model (such as XGboost, LightGBM (Light Gradient Boosting Machine) etc.) to predict future sales.
[0004] When this method is used to predict subcategories, the generalization ability of the model is obviously insufficient when there are many subcategories of stores to be predicted. In this case, it is very easy to lead to low overall prediction accuracy, making the final model prediction results of little reference significance. When performing feature selection, the limitations of EDA itself may lead to unreasonable feature selection, making the selected features extremely helpful for the prediction results, reducing the overall performance of the model. Summary of the invention
[0005] The present invention provides a subcategory prediction method applicable to the retail industry, a subcategory prediction device applicable to the retail industry, an electronic device and a storage medium, which are used to solve or partially solve the technical problems of insufficient generalization ability of the subcategory prediction model and unreasonable feature selection in the current subcategory prediction method.
[0006] The present invention provides a detailed category prediction method applicable to the retail industry, the method comprising:
[0007] Get the historical sales data set of sub-categories;
[0008] Performing feature dimension reduction and screening on the historical detailed sales dataset to obtain a feature enhanced dataset;
[0009] The feature-enhanced dataset is used to train the pre-built random forest model for fine-category prediction in combination with linear regression to obtain a fine-category prediction model;
[0010] The sales data of the sub-category to be tested is obtained, and the sales data of the sub-category to be tested is input into the sub-category prediction model to perform sub-category prediction, so as to obtain the sub-category prediction result.
[0011] Optionally, performing feature dimension reduction and screening on the historical detailed sales dataset to obtain a feature enhanced dataset includes:
[0012] Using principal component analysis to perform feature dimensionality reduction on the historical sub-category sales dataset to obtain feature explanatory properties of different features in the historical sub-category sales dataset;
[0013] The historical sub-category sales data with strong feature explanations are selected from the historical sub-category sales data set to construct a feature enhanced data set.
[0014] Optionally, the feature interpretability represents the degree of dispersion of feature samples corresponding to different features when principal component analysis is used to perform feature dimensionality reduction on the historical subcategory sales data set; wherein, the greater the dispersion, the weaker the feature interpretability, and the smaller the dispersion, the stronger the feature interpretability.
[0015] Optionally, the feature-enhanced data set includes actual sales fluctuation values of the historical sub-category sales data; the step of using the feature-enhanced data set and combining linear regression to perform sub-category prediction training on a pre-built random forest model to obtain a sub-category prediction model includes:
[0016] Taking the sales fluctuation of the subcategory as the prediction target, the pre-built random forest model is trained and verified using the feature enhancement data set to obtain a preliminary prediction model and output the sales fluctuation prediction value;
[0017] Based on the actual sales fluctuation value and the predicted sales fluctuation value, data fitting is performed through linear regression to obtain a linear relationship between the actual sales fluctuation value and the predicted value, so as to construct a detailed category prediction fitting equation;
[0018] The preliminary prediction model and the sub-category prediction fitting equation are integrated as a sub-category prediction model.
[0019] Optionally, the sales volume fluctuation of the subcategory is taken as the prediction target, the feature enhancement data set is used to train and verify the pre-built random forest model, a preliminary prediction model is obtained, and the sales fluctuation prediction value is output, including:
[0020] Dividing the feature enhancement data set into a feature enhancement training set and a feature enhancement verification set according to a preset ratio;
[0021] Taking the sales fluctuation of the sub-category as the prediction target, the pre-built random forest model is trained using the feature enhancement training set, and an unbiased estimate is used as the generalization error of the model during the training process;
[0022] The trained random forest model is validated using the feature enhancement validation set to obtain a preliminary prediction model and output a sales fluctuation prediction value.
[0023] Optionally, the pre-built random forest model includes a plurality of decision trees; taking the sales volume fluctuation of a subcategory as a prediction target and using the feature enhancement training set to train the pre-built random forest model includes:
[0024] In each round of model training, a portion of data is randomly extracted from the feature enhancement training set multiple times in a random sampling method with replacement to construct a feature enhancement training subset; the number of the feature enhancement training subsets is consistent with the number of the decision trees;
[0025] Taking the sales fluctuation of the sub-category as the prediction target, each of the feature enhancement training subsets is input into each of the decision trees for sub-category prediction training, and each of the decision trees outputs its own preliminary training prediction results;
[0026] By integrating each of the preliminary training prediction results, a comprehensive training prediction result is obtained.
[0027] Optionally, inputting the sub-category sales data to be tested into the sub-category prediction model to perform sub-category prediction to obtain sub-category prediction results includes:
[0028] Inputting the sales data of the sub-category to be tested into the sub-category prediction model;
[0029] Performing preliminary sub-category prediction on the sub-category sales data to be tested by using the preliminary prediction model to obtain preliminary sub-category prediction results;
[0030] The preliminary sub-category prediction result is input into the sub-category prediction fitting equation for secondary correction to obtain the final sub-category prediction result.
[0031] The present invention also provides a detailed category prediction device applicable to the retail industry, comprising:
[0032] A data acquisition unit, used to acquire historical detailed sales data sets;
[0033] A feature dimension reduction unit, used to perform feature dimension reduction and screening on the historical sub-category sales data set to obtain a feature enhanced data set;
[0034] A model training unit, used to use the feature enhancement data set and combine linear regression to perform fine category prediction training on a pre-built random forest model to obtain a fine category prediction model;
[0035] The subcategory prediction unit is used to obtain the subcategory sales data to be tested, and input the subcategory sales data to be tested into the subcategory prediction model to perform subcategory prediction to obtain the subcategory prediction result.
[0036] The present invention also provides an electronic device, the device comprising a processor and a memory:
[0037] The memory is used to store program code and transmit the program code to the processor;
[0038] The processor is used to execute any of the above-mentioned detailed category prediction methods applicable to the retail industry according to the instructions in the program code.
[0039] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store program code, and the program code is used to execute the sub-category prediction method applicable to the retail industry as described in any one of the above items.
[0040] It can be seen from the above technical solutions that the present invention has the following advantages:
[0041] A subcategory prediction method suitable for the retail industry is provided. First, a historical subcategory sales data set is obtained, and feature dimension reduction and screening are performed on the historical subcategory sales data set to obtain a feature enhancement data set. Therefore, through feature dimension reduction and screening, more reasonable and more reference features can be selected. Then, the feature enhancement data set is used to combine linear regression to train the pre-built random forest model for subcategory prediction to obtain a subcategory prediction model. Therefore, based on the feature enhancement data set obtained by feature dimension reduction and screening, combined with random forest algorithm and linear regression for subcategory prediction training, the generalization ability of the prediction model can be further improved. Finally, the subcategory sales data to be tested is obtained, and the subcategory sales data to be tested is input into the subcategory prediction model for subcategory prediction to obtain the subcategory prediction result. Therefore, in subsequent practical applications, the subcategory prediction model with stronger generalization ability can be used for prediction, which can improve the accuracy of subcategory prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1A flowchart of the steps of a detailed category forecasting method applicable to the retail industry;
[0044] Figure 2 A schematic diagram of the prediction principle of a random forest model;
[0045] Figure 3 It is a linear regression fitting diagram based on the sales fluctuation forecast value and the actual value;
[0046] Figure 4 It is a schematic diagram of the overall process of a detailed category forecasting method applicable to the retail industry;
[0047] Figure 5 A schematic diagram showing the comparison of the results of using different models to predict fine categories;
[0048] Figure 6 The figure is a structural block diagram of a subcategory prediction device suitable for the retail industry. DETAILED DESCRIPTION
[0049] Embodiments of the present invention provide a subcategory prediction method applicable to the retail industry, a subcategory prediction device applicable to the retail industry, an electronic device and a storage medium, which are used to solve or partially solve the technical problems of insufficient model generalization ability and unreasonable feature selection of the currently used subcategory prediction means.
[0050] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the technical solutions 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 embodiments described below are only 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0051] As an example, for sub-category forecasting in the retail industry, the main method currently used is to first perform EDA on the basic sales data, then perform feature screening based on the results of EDA, and then use the gradient boosting tree model (such as XGboost, LightGBM, etc.) to predict future sales.
[0052] When using the above method to predict subcategories, when there are many subcategories of stores to be predicted, the generalization ability of the model is obviously insufficient. In this case, it is very easy to lead to low overall prediction accuracy, making the final model prediction results of little reference significance. When performing feature selection, the limitations of EDA itself may lead to unreasonable feature selection, so that the selected features are of little help to the prediction results, reducing the overall performance of the model.
[0053] Therefore, one of the core inventive points of the embodiment of the present invention is: in view of the shortcomings of the current technology, based on the idea of model fusion, a sub-category prediction method suitable for the retail industry is proposed. On the one hand, when constructing the training set, principal component analysis (PCA) is used to reduce the dimension of features and screen features with strong explanatory power (more important model features) to reduce the complexity of the prediction model obtained through training and improve the training effect. And by screening features in advance, the problem of weak feature explanatory power due to the limitations of EDA can be avoided. On the other hand, in order to improve the generalization ability of random forests and effectively reduce variance, sales fluctuations are used as the prediction target value, and the sales fluctuations of the next week are predicted by the random forest model, and then the sales of the next week are reversed, and the potential linear relationship between the actual value and the predicted value is fitted by linear regression to further improve the accuracy of sub-category prediction and obtain the final prediction model.
[0054] Reference Figure 1 , shows a flowchart of a method for predicting subcategories applicable to the retail industry provided by an embodiment of the present invention, which may specifically include the following steps:
[0055] Step 101, obtaining a historical sales data set of subcategories;
[0056] The historical sub-category sales data set referred to in the embodiment of the present invention refers to a collection of past sales data of different sub-categories in the retail industry obtained through collection and integration. For example, sales volume data of different specific categories or single products in the past two years. By collecting historical sub-category sales data sets and performing subsequent feature processing on them, a more reference data set can be obtained for model training.
[0057] Step 102, performing feature dimension reduction and screening on the historical detailed sales dataset to obtain a feature enhanced dataset;
[0058] In actual situations, due to the large number of features in the model training set, the data integration index required for algorithm learning will increase to a certain extent. When the number of feature factors in the data set is large, the learning effect will be small or even ineffective. Based on this, the embodiment of the present invention converts the high-dimensional model training set into linearly independent low-dimensional variables through principal component analysis. While achieving feature dimensionality reduction, the features of the original data can be preserved as much as possible, which plays a role in feature extraction and enhancement. By using the data set obtained after principal component analysis for model training, the time series required for prediction is shorter when the actual sub-category prediction is performed later. Even for new products that have just been on the market for a few weeks, predictions can also be made to a certain extent, with stronger generalization capabilities, which can meet the needs of large-scale sub-category predictions, rather than only screening some sub-categories for prediction.
[0059] In the specific implementation, the main principle of principal component analysis is to find a hyperplane in the n-dimensional space of feature factors so that the projections of multi-factor features on the hyperplane are separated as much as possible. In other words, principal component analysis is equivalent to converting the problem of feature extraction process into the problem of calculating the maximum value. Therefore, the dispersion of feature samples is mainly reflected by variance. The larger the variance, the greater the dispersion of feature values. Otherwise, the dispersion is smaller. In this way, the feature interpretability of different features can be obtained and important features can be selected.
[0060] In combination with the above content, the feature interpretability of the embodiment of the present invention represents the dispersion degree of feature samples corresponding to different features when the historical sub-category sales data set is subjected to feature dimensionality reduction using principal component analysis. The greater the dispersion degree, the weaker the feature interpretability. The smaller the dispersion degree, the stronger the feature interpretability.
[0061] Therefore, the implementation process of performing feature dimensionality reduction and screening on the historical sub-category sales dataset to obtain the feature enhanced dataset can be specifically as follows: using principal component analysis to perform feature dimensionality reduction on the historical sub-category sales dataset to obtain the feature interpretability of different features in the historical sub-category sales dataset; screening the historical sub-category sales data with strong feature interpretability from the historical sub-category sales dataset to construct a feature enhanced dataset.
[0062] Step 103, using the feature enhanced data set and combining linear regression to perform fine category prediction training on the pre-built random forest model to obtain a fine category prediction model;
[0063] The present invention performs preliminary fine-category prediction training based on the random forest model. Among them, the reasons for selecting the random forest are mainly as follows: First, due to the large number of fine categories in the retail industry in practical applications, even after the feature dimension reduction processing of the principal component analysis, the number of features in the obtained feature enhancement data set is still large. The random forest algorithm can process high-dimensional data. Therefore, it can perform well under multiple eigenvalues and is less affected by noise features. Secondly, after creating the random forest, the generalization error of the model uses an unbiased estimate, which enhances the generalization ability of the model. Thirdly, the random forest model has a fast training speed, and the decision trees are independent of each other during model training. Finally, the model trained based on the random forest model is used for fine-category prediction, which can maintain a high accuracy rate even in the face of missing features in the data set.
[0064] In order to realize model training and learning based on sub-category prediction, the feature enhancement data set may include the actual sales fluctuation value of the historical sub-category sales data. The actual sales fluctuation value specifically refers to the actual sales fluctuation of the historical sub-category sales data during the data collection period.
[0065] In a specific implementation, the process of using a feature-enhanced dataset and combining linear regression to train a pre-built random forest model for fine-category prediction to obtain a fine-category prediction model may include the following sub-steps S01 to S03:
[0066] Step S01: Taking the sales fluctuation of the subcategory as the prediction target, the pre-built random forest model is trained and verified using the feature enhancement data set to obtain a preliminary prediction model and output the sales fluctuation prediction value;
[0067] Furthermore, the sales fluctuation of the sub-category is taken as the prediction target, and the pre-built random forest model is trained and verified using the feature enhancement data set to obtain a preliminary prediction model and output the sales fluctuation prediction value. This process can be achieved by executing the following sub-steps S011 to S0.13:
[0068] Step S011: dividing the feature enhancement data set into a feature enhancement training set and a feature enhancement verification set according to a preset ratio;
[0069] For example, the feature enhancement dataset is divided into a feature enhancement training set and a feature enhancement verification set in a ratio of 8:2.
[0070] Step S012: Taking the sales volume fluctuation of the sub-category as the prediction target, the pre-built random forest model is trained using the feature enhancement training set, and an unbiased estimate is used as the generalization error of the model during the training process;
[0071] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present invention, Figure 2 A schematic diagram of the prediction principle of a random forest model is shown.
[0072] Combination Figure 2 The random forest algorithm creates multiple decision trees through the original data set (i.e., the training data set, corresponding to the feature enhancement training set of the present invention). Multiple decision trees constitute a weak learner. In other words, the random forest model pre-constructed by the present invention may include multiple decision trees. When the algorithm predicts, the results predicted by the weak learners can be integrated to obtain a strong learner. A larger weight is given to the decision tree with accurate prediction, and the decision tree with poor performance will have the relevant weight reduced. In order to maintain the generalization ability of the random forest model, the establishment of the decision tree inside the model must comply with the following two principles.
[0073] The first is the randomness of data selection.
[0074] When training the model, some data is randomly extracted from all samples in the feature enhancement training set to build a decision tree. In other words, when building a decision tree, the random forest randomly extracts some features from the feature enhancement training set to train the decision tree model. The extraction rule is random extraction with replacement. That is, some data may be extracted with a high frequency, while some data may be extracted with a low frequency, or even zero.
[0075] The second is feature randomness.
[0076] Randomly extract m feature factors from n feature factors to train the decision tree. For fine-category prediction, in order to improve the generalization ability of the model, the random forest model is selected as the base model. In addition, in order to further enhance the generalization ability of the model, the target value is modified to the sales fluctuation of each week, and the variance of the target value is reduced to improve the training effect.
[0077] Based on the previous discussion, taking the sales fluctuation of the sub-category as the prediction target, the process of using the feature enhancement training set to train the pre-constructed random forest model can be specifically as follows: in each round of model training, randomly extracting part of the data from the feature enhancement training set multiple times in a random sampling method with replacement to construct feature enhancement training subsets; the number of feature enhancement training subsets is consistent with the number of decision trees; taking the sales fluctuation of the sub-category as the prediction target, each feature enhancement training subset is input into each decision tree for sub-category prediction training, and each decision tree outputs its own preliminary training prediction results; and the comprehensive training prediction results are obtained by integrating the various preliminary training prediction results.
[0078] Step S013: Use the feature enhancement validation set to validate the trained random forest model, obtain a preliminary prediction model, and output the sales fluctuation prediction value.
[0079] Then, the trained random forest model was verified using the feature enhancement validation set to obtain a preliminary prediction model and output the sales fluctuation prediction value for subsequent fitting.
[0080] Step S02: Based on the actual sales fluctuation value and the predicted sales fluctuation value, data fitting is performed through linear regression to obtain a linear relationship between the actual sales fluctuation value and the predicted value, so as to construct a detailed category prediction fitting equation;
[0081] In practical applications, linear relationships are difficult to capture for decision tree models. Therefore, to make up for this shortcoming, the present invention adopts a linear regression method to reduce the gap between the actual value and the predicted value and find out the linear relationship between the actual value and the predicted value.
[0082] For example, Figure 3 A schematic diagram of linear regression fitting based on sales fluctuation forecast values and actual values is shown.
[0083] like Figure 3 As shown in the figure, the blue line is a graph with the sales fluctuation forecast value as the x-axis and the actual value as the y-axis. The red line is the sub-category forecast fitting equation obtained through linear regression. The units of the x-axis and the y-axis are both percentages, which means (this week's sales volume - last week's sales volume) × 100%. Therefore, in actual forecasting, the preliminary forecast value obtained by random forest can be substituted into the sub-category forecast fitting equation to obtain the final forecast result.
[0084] Step S03: Integrate the preliminary prediction model and the detailed category prediction fitting equation as a detailed category prediction model.
[0085] Step 104, obtaining sales data of the sub-category to be tested, and inputting the sales data of the sub-category to be tested into the sub-category prediction model to perform sub-category prediction, and obtaining sub-category prediction results.
[0086] Referring to the previous discussion, in a specific implementation, the process of inputting the sub-category sales data to be tested into the sub-category prediction model for sub-category prediction and obtaining the sub-category prediction results can be: inputting the sub-category sales data to be tested into the sub-category prediction model; performing preliminary sub-category prediction on the sub-category sales data to be tested through the preliminary prediction model to obtain preliminary sub-category prediction results; inputting the preliminary sub-category prediction results into the sub-category prediction fitting equation for secondary correction to obtain the final sub-category prediction results.
[0087] In an embodiment of the present invention, a subcategory prediction method suitable for the retail industry is provided. First, a historical subcategory sales data set is obtained, and feature dimension reduction and screening are performed on the historical subcategory sales data set based on principal component analysis to obtain a feature enhancement data set. Therefore, by performing feature dimension reduction screening through principal component analysis, more reasonable and more reference features can be selected. Then, the feature enhancement data set is used to perform subcategory prediction training on a pre-built random forest model in combination with linear regression to obtain a subcategory prediction model. Therefore, based on the feature enhancement data set obtained by feature dimension reduction screening, combined with random forest algorithm and linear regression for subcategory prediction training, the potential linear relationship between the actual value and the predicted value can be fitted, and the generalization ability of the prediction model can be further improved. Finally, the subcategory sales data to be tested is obtained, and the subcategory sales data to be tested is input into the subcategory prediction model for subcategory prediction to obtain a subcategory prediction result. Therefore, in subsequent practical applications, the subcategory prediction model with a trained generalization ability is used for prediction, which can improve the accuracy of subcategory prediction.
[0088] For better explanation, refer to Figure 4, showing an overall flow diagram of a subcategory prediction method applicable to the retail industry provided by an embodiment of the present invention. It should be noted that this embodiment only briefly describes the general process of subcategory prediction applicable to the retail industry, and the specific implementation process of each step can be understood by referring to the relevant content in the aforementioned embodiment, which will not be described here. It can be understood that the present invention is not limited to this.
[0089] Step 401: obtaining a historical sales dataset of a specific category, and performing feature dimension reduction on the historical sales dataset of specific category using principal component analysis to obtain feature explanatory properties of different features in the historical sales dataset of specific category;
[0090] Step 402: selecting historical sub-category sales data with strong feature explanatory power from the historical sub-category sales data set, and constructing a feature enhanced data set;
[0091] Step 403: taking the sales fluctuation of the subcategory as the prediction target, using the feature enhancement data set to train and verify the pre-built random forest model, obtaining a preliminary prediction model, and outputting the sales fluctuation prediction value;
[0092] Step 404: Based on the actual sales fluctuation value and the predicted sales fluctuation value, data fitting is performed through linear regression to obtain a linear relationship between the actual sales fluctuation value and the predicted value, so as to construct a detailed category prediction fitting equation;
[0093] Step 405: Acquire the sales data of the sub-category to be tested, and perform preliminary sub-category prediction on the sales data of the sub-category to be tested by using the preliminary prediction model to obtain preliminary sub-category prediction results;
[0094] Step 406: Input the preliminary detailed category prediction result into the detailed category prediction fitting equation for secondary correction to obtain the final detailed category prediction result.
[0095] In order to enable those skilled in the art to better understand the technical solution of the present invention, an embodiment of the present invention is described below by using a specific example.
[0096] The gradient boosting tree (LightGBM), BP neural network (Backpropagation Neural Network, a multi-layer feedforward neural network based on the error back propagation algorithm) and the fine category prediction method provided by the present invention are respectively used to predict the fine categories of stores.
[0097] The prediction time point selected in this example is the end of each month in 2023, and the prediction period is the next three weeks (for example, if the prediction node for October 2023 is 31st, the sales volume for the three weeks after October 31st is predicted). The specific comparison indicator is the WMAPE (Weighted Mean Absolute Percentage Error) of the full store category prediction. Among them, the prediction accuracy = 1-WMAPE, so the smaller the WMAPE, the better. The comparison results of WMAPE of different models are shown in Table 1 below:
[0098]
[0099] Table 1: Comparison of sub-category prediction results using different models
[0100] It can be seen from Table 1 above that the sub-category prediction method adopted by the embodiment of the present invention is superior to the gradient boosting tree LightGBM and BP neural network in terms of WMAPE for the prediction results of all store sub-categories in each month. It is universal and robust for special months such as October, January, and February (corresponding to National Day and Spring Festival. These two special holidays lead to a sharp increase in sales of tail stores due to factors such as population migration). In this case, WMAPE can still be maintained below 0.5. The schematic diagram of the comparison of the results of sub-category prediction using different models is shown in the figure below. Figure 5 As shown, the blue line forest corresponds to the random forest model adopted in the embodiment of the present invention, the red line LGB corresponds to LightGBM, and the green line BP corresponds to the BP neural network model.
[0101] Combined with the above example analysis, the gradient boosting tree is not suitable for sub-category prediction of stores at different levels because it cannot capture the linear relationship between the actual value and the predicted value. The hierarchical division of store sub-categories is a complicated task and is prone to bias. If the BP neural network is used for prediction, the computing power required is huge due to the excessive number of BP neural network parameters, and the cost of direct deployment is high. If the long-term memory neural network algorithm is used for prediction, it requires very long time series data. When the store sub-categories change rapidly, this method is not suitable for sub-category prediction of some stores.
[0102] Reference Figure 6 , shows a structural block diagram of a sub-category prediction device applicable to the retail industry provided by an embodiment of the present invention, which may specifically include:
[0103] The data acquisition unit 601 is used to acquire a historical detailed sales data set;
[0104] A feature dimension reduction unit 602 is used to perform feature dimension reduction and screening on the historical detailed sales data set to obtain a feature enhanced data set;
[0105] A model training unit 603 is used to use the feature enhancement data set and combine linear regression to perform fine category prediction training on a pre-built random forest model to obtain a fine category prediction model;
[0106] The subcategory prediction unit 604 is used to obtain the subcategory sales data to be tested, and input the subcategory sales data to be tested into the subcategory prediction model to perform subcategory prediction to obtain a subcategory prediction result.
[0107] In an optional embodiment, the feature dimension reduction unit 602 includes:
[0108] A feature dimension reduction subunit, used to perform feature dimension reduction on the historical sub-category sales data set by using principal component analysis to obtain feature explanatory properties of different features in the historical sub-category sales data set;
[0109] The feature screening unit is used to screen the historical sub-category sales data with strong feature explanation from the historical sub-category sales data set to construct a feature enhanced data set.
[0110] In an optional embodiment, the feature interpretability represents the degree of dispersion of feature samples corresponding to different features when principal component analysis is used to perform feature dimensionality reduction on the historical subcategory sales data set; wherein, the greater the dispersion, the weaker the feature interpretability, and the smaller the dispersion, the stronger the feature interpretability.
[0111] In an optional embodiment, the feature enhancement data set includes actual sales fluctuation values of the historical sub-category sales data; the model training unit 603 includes:
[0112] A preliminary prediction model building unit is used to take the sales volume fluctuation of the subcategory as the prediction target, use the feature enhancement data set to train and verify the pre-built random forest model, obtain a preliminary prediction model, and output the sales fluctuation prediction value;
[0113] A detailed category prediction fitting equation construction unit, used to perform data fitting through linear regression based on the actual sales fluctuation value and the predicted sales fluctuation value, to obtain a linear relationship between the actual sales fluctuation value and the predicted value, so as to construct a detailed category prediction fitting equation;
[0114] The sub-category prediction model integration unit is used to integrate the preliminary prediction model with the sub-category prediction fitting equation as a sub-category prediction model.
[0115] In an optional embodiment, the preliminary prediction model building unit includes:
[0116] A data set division unit, used for dividing the feature enhancement data set into a feature enhancement training set and a feature enhancement verification set according to a preset ratio;
[0117] A model training subunit is used to train a pre-built random forest model using the feature enhancement training set with sales fluctuations of subcategories as a prediction target, and to use an unbiased estimate as a generalization error of the model during the training process;
[0118] The model verification subunit is used to use the feature enhancement verification set to perform model verification on the trained random forest model, obtain a preliminary prediction model, and output a sales fluctuation prediction value.
[0119] In an optional embodiment, the pre-built random forest model includes multiple decision trees; the model training subunit includes:
[0120] A data extraction unit is used to randomly extract part of the data from the feature enhancement training set multiple times to construct feature enhancement training subsets in a random extraction method with replacement during each round of model training; the number of the feature enhancement training subsets is consistent with the number of the decision trees;
[0121] A preliminary training prediction result generating unit, used for taking the sales volume fluctuation of a sub-category as a prediction target, inputting each of the feature enhancement training subsets into each of the decision trees for sub-category prediction training, and outputting respective preliminary training prediction results through each of the decision trees;
[0122] The comprehensive training prediction result integration unit is used to obtain a comprehensive training prediction result by integrating each of the preliminary training prediction results.
[0123] In an optional embodiment, the detailed category prediction unit 604 includes:
[0124] A data input unit, used for inputting the sub-category sales data to be tested into the sub-category prediction model;
[0125] A preliminary sub-category prediction sub-unit is used to perform preliminary sub-category prediction on the sub-category sales data to be tested by using the preliminary prediction model to obtain preliminary sub-category prediction results;
[0126] The prediction result secondary correction unit is used to input the preliminary sub-category prediction result into the sub-category prediction fitting equation for secondary correction to obtain the final sub-category prediction result.
[0127] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the aforementioned method embodiment.
[0128] An embodiment of the present invention further provides an electronic device, the device comprising a processor and a memory:
[0129] The memory is used to store the program code and transmit the program code to the processor;
[0130] The processor is used to execute the sub-category prediction method applicable to the retail industry according to any embodiment of the present invention according to the instructions in the program code.
[0131] An embodiment of the present invention further provides a computer-readable storage medium, which is used to store program codes, and the program codes are used to execute the detailed category prediction method applicable to the retail industry according to any embodiment of the present invention.
[0132] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0133] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0134] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0135] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0136] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0137] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A sub-category prediction method applicable to the retail industry, characterized in that: include: Get the historical sales data set of sub-categories; Performing feature dimension reduction and screening on the historical detailed sales dataset to obtain a feature enhanced dataset; The feature-enhanced dataset is used to train the pre-built random forest model for fine-category prediction in combination with linear regression to obtain a fine-category prediction model; The sales data of the sub-category to be tested is obtained, and the sales data of the sub-category to be tested is input into the sub-category prediction model to perform sub-category prediction, so as to obtain the sub-category prediction result.
2. The method for predicting fine categories according to claim 1, characterized in that: The step of performing feature dimension reduction and screening on the historical detailed sales dataset to obtain a feature enhanced dataset includes: Using principal component analysis to perform feature dimensionality reduction on the historical sub-category sales dataset to obtain feature explanatory properties of different features in the historical sub-category sales dataset; The historical sub-category sales data with strong feature explanations are selected from the historical sub-category sales data set to construct a feature enhanced data set.
3. The method for predicting a subcategory according to claim 2, characterized in that: The feature interpretability represents the degree of dispersion of feature samples corresponding to different features when principal component analysis is used to perform feature dimensionality reduction on the historical sub-category sales data set; wherein, the greater the dispersion, the weaker the feature interpretability, and the smaller the dispersion, the stronger the feature interpretability.
4. The method for predicting a subcategory according to claim 2, characterized in that: The feature-enhanced data set includes actual sales fluctuation values of the historical sub-category sales data; the feature-enhanced data set is used to perform sub-category prediction training on a pre-built random forest model in combination with linear regression to obtain a sub-category prediction model, including: Taking the sales fluctuation of the subcategory as the prediction target, the pre-built random forest model is trained and verified using the feature enhancement data set to obtain a preliminary prediction model and output the sales fluctuation prediction value; Based on the actual sales fluctuation value and the predicted sales fluctuation value, data fitting is performed through linear regression to obtain a linear relationship between the actual sales fluctuation value and the predicted value, so as to construct a detailed category prediction fitting equation; The preliminary prediction model and the sub-category prediction fitting equation are integrated as a sub-category prediction model.
5. The method for predicting a subcategory according to claim 4, characterized in that: The sales fluctuation of the subcategory is taken as the prediction target, and the pre-built random forest model is trained and verified using the feature enhancement data set to obtain a preliminary prediction model and output the sales fluctuation prediction value, including: Dividing the feature enhancement data set into a feature enhancement training set and a feature enhancement verification set according to a preset ratio; Taking the sales fluctuation of the sub-category as the prediction target, the pre-built random forest model is trained using the feature enhancement training set, and an unbiased estimate is used as the generalization error of the model during the training process; The trained random forest model is validated using the feature enhancement validation set to obtain a preliminary prediction model and output a sales fluctuation prediction value.
6. The method for predicting a subcategory according to claim 5, characterized in that: The pre-built random forest model includes a plurality of decision trees; the pre-built random forest model is trained using the feature enhancement training set with sales fluctuation of a sub-category as a prediction target, including: In each round of model training, a portion of data is randomly extracted from the feature enhancement training set multiple times in a random sampling method with replacement to construct a feature enhancement training subset; the number of the feature enhancement training subsets is consistent with the number of the decision trees; Taking the sales fluctuation of the sub-category as the prediction target, each of the feature enhancement training subsets is input into each of the decision trees for sub-category prediction training, and each of the decision trees outputs its own preliminary training prediction results; By integrating each of the preliminary training prediction results, a comprehensive training prediction result is obtained.
7. The method for predicting a subcategory according to any one of claims 4 to 6, characterized in that: The step of inputting the sub-category sales data to be tested into the sub-category prediction model to perform sub-category prediction and obtain sub-category prediction results includes: Inputting the sales data of the sub-category to be tested into the sub-category prediction model; Performing preliminary sub-category prediction on the sub-category sales data to be tested by using the preliminary prediction model to obtain preliminary sub-category prediction results; The preliminary sub-category prediction result is input into the sub-category prediction fitting equation for secondary correction to obtain the final sub-category prediction result.
8. A subcategory prediction device suitable for the retail industry, characterized in that: include: A data acquisition unit, used to acquire historical detailed sales data sets; A feature dimension reduction unit, used to perform feature dimension reduction and screening on the historical detailed sales data set to obtain a feature enhanced data set; A model training unit, used to use the feature enhancement data set and combine linear regression to perform fine category prediction training on a pre-built random forest model to obtain a fine category prediction model; The subcategory prediction unit is used to obtain the subcategory sales data to be tested, and input the subcategory sales data to be tested into the subcategory prediction model to perform subcategory prediction to obtain the subcategory prediction result.
9. An electronic device, characterized in that: The device comprises a processor and a memory: The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the sub-category prediction method applicable to the retail industry as described in any one of claims 1-7 according to the instructions in the program code.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store program codes, and the program codes are used to execute the sub-category prediction method applicable to the retail industry as described in any one of claims 1-7.