Demand prediction method based on machine learning

By constructing product clusters and performing feature screening, combined with cost asymmetric loss function, the demand prediction problem under high feature dimensions and small sample size is solved, more accurate demand prediction and reduce error costs are achieved, and model complexity is simplified.

CN118982197APending Publication Date: 2024-11-19ZHEJIANG UNIV +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411070293.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2021-11-04
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

In the context of high feature dimensions and small sample size, existing demand prediction methods are difficult to achieve accurate demand prediction, which can easily lead to feature screening failure and learning model failure, resulting in poor prediction effects.

Method used

By extracting product attribute features, building product clusters, and performing preliminary and secondary screening, an important feature set is obtained, combining product clusters for feature screening, inputting machine learning models for demand prediction, and using Minkowski distance, cosine similarity and other methods to calculate Similarity, optimize the model using cost asymmetric loss function.

Benefits of technology

It effectively solves the problem of feature screening failure, reduces feature dimensions, improves demand prediction effect, reduces prediction error costs, and simplifies the complexity of machine learning models, making them easy to apply in practice.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118982197A_ABST
    Figure CN118982197A_ABST
Patent Text Reader

Abstract

The invention discloses a demand prediction method based on machine learning, and relates to the technical field of data-driven decision making of machine learning, and the method comprises the specific steps: extracting product attribute features and prediction features; constructing a product cluster according to the product attribute features; performing preliminary screening on the prediction features to obtain a product important feature set; performing secondary screening according to the product important feature set in combination with the product cluster to form a secondary screening feature set; and inputting the secondary screening feature set into a machine learning model for demand prediction. According to the method, the products are classified into different product clusters, and secondary feature selection is carried out by means of feature information of other products in the same category, so that the problem of feature screening failure can be effectively solved on the basis of avoiding learning model failure, the feature dimension is reduced, the demand prediction effect of high feature dimension and small sample size is improved, and the prediction efficiency is improved. And the prediction error cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application. The application number of the original application is 202111301395.5, the application date is November 4, 2021, and the name of the invention is "A demand forecasting method, system and storage medium". Technical Field

[0002] The present invention relates to the field of data-driven decision-making technology based on machine learning, and more specifically to a demand forecasting method based on machine learning. Background Art

[0003] In the era of big data, the company's business management and decision-making have undergone a fundamental transformation - from relying on the intuition and experience of management decision-makers to being based on data and data analysis as much as possible. The combination of big data, machine learning, and optimization has formed the basic connotation of data-driven decision-making. Using large amounts of high-dimensional data to predict product demand is an important direction for data-driven decision-making, and it is also an important topic for product operations and supply chain management under the transformation of business models such as new retail.

[0004] Traditional demand forecasting considers more the case of symmetric costs, that is, the cost of over-forecasting is equal to the cost of under-forecasting. However, in reality, these two costs are often unequal (asymmetric). In addition, in real scenarios, a large number of demand forecasting tasks have high feature dimensions and small sample sizes. How to perform cost-asymmetric demand forecasting based on machine learning in the context of high feature dimensions and small sample sizes is a major challenge facing data-driven decision-making in the current big data context.

[0005] For learning tasks with high feature dimensions and small sample sizes, existing methods mostly consider symmetric costs, which mainly include three systems: (1) increasing the sample size of the data set (such as clustering). The core idea is to use specific methods or technologies to increase the number of samples. The most commonly used method is to generate virtual samples; (2) reducing the number of features through feature selection, which is usually divided into three modes: filtering, wrapping, and embedding; (3) learning methods, using machine learning methods to perform classification and prediction on small data sets, including regularized linear discriminant analysis, weighted piecewise linear discriminant analysis, transfer learning methods, etc.

[0006] In the case of asymmetric costs, high-dimensional features, and small sample sizes, the effectiveness of the above three systems is greatly reduced. Clustering and other methods can increase the sample size, but it is easy to cause model failure - for two products A and B in the same cluster, the predicted cost has a structural difference. and If the model reduces the prediction loss of product A, it will inevitably lead to an increase in the loss of product B. The relatively small sample size will weaken the effect of feature screening, and it is difficult to screen out the features that are really important to the model. Existing learning methods are more targeted at classification learning and are difficult to apply directly in regression learning scenarios.

[0007] In summary, under the framework of machine learning, the traditional small sample demand forecasting method has shortcomings in asymmetric cost scenarios, which can easily lead to feature screening failure and learning model failure, resulting in poor forecasting results. Therefore, for those skilled in the art, how to accurately forecast demand based on machine learning in scenarios with high feature dimensions and small sample sizes is an urgent problem to be solved. Summary of the invention

[0008] In view of this, the present invention provides a demand forecasting method based on machine learning to solve the problems pointed out in the background technology, and to perform accurate demand forecasting based on machine learning in the context of high feature dimensions and small sample size.

[0009] In order to achieve the above object, the present invention adopts the following technical solution: On the one hand, a demand forecasting method based on machine learning is provided, and the specific steps include the following:

[0010] Extract product attribute features and prediction features;

[0011] Constructing a product cluster according to the product attribute characteristics;

[0012] Preliminarily screening the prediction features to obtain a set of important product features;

[0013] Perform secondary screening based on the important feature set of the product and the product cluster to form a secondary screening feature set;

[0014] The secondary screening feature set is input into the machine learning model for demand forecasting.

[0015] Optionally, the product attribute characteristics include origin, brand, material, craftsmanship, specifications, categories, functional parameters, price, channel characteristics, social attributes, service life, consumption speed, relative price level, and market performance characteristics.

[0016] Optionally, the product cluster is constructed by a clustering method, which includes a partitioning method, a hierarchical method, a density algorithm, a graph theory clustering method, a grid algorithm, and a model algorithm.

[0017] Optionally, it also includes calculating the unimportance of the product prediction feature, specifically, for product i, calculating the similarity between other products k in the cluster to which i belongs and i, and calculating the weight value of other products k based on the similarity Calculate the unimportance of the sth feature of product i. The calculation formula is: in,

[0018] Optionally, the similarity is calculated using one of the following methods: Minkowski distance, cosine similarity, and Pearson correlation coefficient.

[0019] Optionally, it also includes calculating the loss function of the machine learning model, and the calculation formula is:

[0020]

[0021] Among them, i represents the i-th product, j represents the j-th sample, Represents the prediction loss of the model for the i-th product and the j-th sample; and denote the costs of over-forecasting and under-forecasting, respectively; represents the prediction features of the i-th product and the j-th sample; Represents the predicted value of the i-th product and the j-th sample.

[0022] Optionally, the method for performing preliminary screening includes chi-square selection method, correlation coefficient method, chi-square test, mutual information method, recursive feature elimination method, feature selection method based on penalty term, and feature selection method based on tree model.

[0023] On the other hand, a demand forecasting system based on similar product feature information is provided, including a feature extraction module, a product cluster construction module, a primary screening module, a fine screening module, and a forecasting module; wherein:

[0024] The feature extraction module is used to extract product attribute features and prediction features;

[0025] The product cluster building module is used to build a product cluster according to the product attribute characteristics;

[0026] The preliminary screening module is used to perform preliminary screening on the predicted features to obtain a set of important product features;

[0027] The fine screening module is used to perform secondary screening based on the important feature set of the product in combination with the product cluster to form a secondary screening feature set;

[0028] The prediction module is used to input the secondary screening feature set into the machine learning model to perform demand prediction.

[0029] Optionally, a loss function calculation module is also included, which is used to calculate the loss function of the machine learning model.

[0030] Finally, a computer storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the demand forecasting method based on similar product feature information are implemented.

[0031] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses a demand forecasting method based on machine learning, which has the following beneficial technical effects:

[0032] (1) The present invention classifies products into different categories (product clusters) and performs secondary feature selection with the help of feature information of other products in the same category. This can effectively solve the problem of feature screening failure on the basis of avoiding the failure of the learning model and reduce the feature dimension, thereby improving the demand forecasting effect with high feature dimension, small sample size and considering asymmetric cost (including symmetric cost), and reducing the error cost of prediction.

[0033] (2) The present invention performs secondary dimensionality reduction on features, which improves the prediction effect while reducing the complexity of the machine learning model, making the model easier to apply in practice. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0035] Figure 1 is a flow chart of the method of the present invention;

[0036] Figure 2 It is a system structure diagram of the present invention. DETAILED DESCRIPTION

[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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.

[0038] Embodiment 1 of the present invention discloses a demand forecasting method based on machine learning, such as Figure 1 As shown, the specific steps are:

[0039] S1, extract product attribute features and prediction features;

[0040] S2. Construct product clusters based on product attribute characteristics;

[0041] S3. Preliminary screening of prediction features to obtain a set of important product features;

[0042] S4, performing secondary screening based on the product important feature set and product clusters to form a secondary screening feature set;

[0043] S5. Input the secondary screening feature set into the machine learning model for demand forecasting.

[0044] Furthermore, the steps of the method of the present invention are described in conjunction with specific embodiments.

[0045] A mainstream domestic e-commerce platform needs to predict the demand for some products on sale in the next day to assist its ordering decision. 189 SKUs on sale on the platform were selected, and the original data was collected and desensitized, including product attribute information, price data, online access data, marketing activity data, and sales data. The data time interval is from August 10, 2017 to October 25, 2018 (440 days). In other words, the sales time series length of a single product is only 440 days at most, and the maximum number of samples that can be used for machine learning model training and prediction of a single product is only 440.

[0046] Step 1: Extract product attribute feature set AF i .

[0047]

[0048] AF i It is a vector of length 10, which means that 10 product attribute features are extracted.

[0049] Step 2: Based on the product attribute characteristics, the hierarchical clustering algorithm is used to divide the 189 SKUs into 5 product clusters (categories), which are denoted as CL1, CL2, CL3, CL4, and CL5 respectively.

[0050] Step 3: Extract the initial prediction feature set OF for each product i from the original data set i .

[0051]

[0052] Indicates the first feature, and so on, there are a total of 175 initial features. The corresponding feature data is:

[0053] Among them, FEA i M i ×N matrix (M i ≤440), Represents the numerical vectors of 175 features, each containing M i A numerical value, indicating the number of samples (time series length) of product i.

[0054] Step 4: Extract the demand vector for each product i

[0055]

[0056] and D i The prediction data set that constitutes the input machine learning model is denoted as OFD i The prediction data set is divided into three parts according to the ratio of 8:1:1: training set, validation set, and test set.

[0057] Step 5: Input the training set of each product prediction data set into the random forest model (tree model) for preliminary feature screening to obtain the importance label vector of the product prediction feature set.

[0058]

[0059] Among them, the mark Indicates that the rth feature is an important feature, marked Indicates that the importance of the rth feature is uncertain, marked Indicates that the rth feature is an unimportant feature. Select the features marked as 1 to construct the important feature set at the product level.

[0060] Step 6: In each product cluster, for each product i, calculate the attribute similarity between other products k in the cluster and product i Calculate the weight value of other products k according to the following formula

[0061] Step 7: Combine the feature importance mark and the feature importance information of the products in the cluster to calculate the unimportance of the e-th feature of product i: (Feature e is marked as -1), construct the feature unimportance vector of product i

[0062] Step 7: For any product i, according to the unimportance vector U i , select the least important n features among the features marked as 1 i Features, n i The value of is calculated by the following formula

[0063] ni=min{ln(Mi),|Labeli|}.

[0064] Table 1 compares the feature number distribution of all product data sets after the first screening (random forest) and the second screening (based on similar product feature information). It can be seen that after the second screening, the overall feature number of the prediction data set is greatly reduced, with the average value dropping from 15 to 6, achieving the second dimension reduction of the features.

[0065] Table 1

[0066]

[0067] Step 8: For any product i, add the n obtained from the secondary screening i The features are input into a multi-hidden layer neural network for model training, the validation set is used for parameter adjustment, and the test set is used for evaluating the effect of demand forecasting.

[0068] Among them, the loss function used for parameter adjustment and effect evaluation is

[0069]

[0070] in,

[0071] Table 2 shows the prediction results of the neural network model when using two feature selection methods. Among them, BP_QQC_AF refers to the test scheme using the above-mentioned cost asymmetric loss function and the initial prediction feature set; BP_QQC_RF uses the above-mentioned cost asymmetric loss function and uses the important feature set selected by the random forest algorithm to perform model training and demand forecasting; BP_QQC_New represents the scheme using the above-mentioned cost asymmetric loss function and the feature set selected by the method proposed in this invention for secondary screening to perform model training and demand forecasting.

[0072] Table 2

[0073]

[0074] In Table 2, compared with the traditional one-shot screening method (BP_QQC_RF), the results of the method proposed in the present invention show that the average daily error cost of the test set decreased by 31.6% (from 509 yuan to 348 yuan), and the median daily error cost decreased by 30.3% (from 264 to 184). Therefore, the method proposed in the present invention significantly improves the demand forecasting effect with asymmetric cost in learning tasks with high feature dimensions and small sample sizes.

[0075] Example 2

[0076] The only difference between Example 2 and Example 1 is as follows, and the rest are the same. For the same parts, refer to Example 1:

[0077] Step 6: In each product cluster, for each product i, calculate the attribute similarity between other products k in the cluster and product i Calculate the weight value of other products k according to the following formula:

[0078]

[0079] Combining the feature importance mark and the feature importance information of the products in the cluster, the unimportance of the e-th feature of product i is calculated: (Feature e is marked as -1), construct the feature unimportance vector of product i

[0080] For any product i, according to the frequency vector FR s , select the n with the highest frequency among the features marked as 1 i Features, n i The value of is calculated by the following formula

[0081] n i =min{ln(M i ),|Label i |}.

[0082] Table 3 below compares the feature number distribution of all product data sets after the first screening (random forest) and the second screening (based on similar product feature information). It can be seen that after the second screening, the overall feature number of the prediction data set is greatly reduced, with the average value dropping from 15 to 6, achieving the second dimension reduction of the features.

[0083] Table 3

[0084]

[0085] For any product i, the n obtained from the secondary screening i The features are input into the random forest model for training, the validation set is used for parameter adjustment, and the test set is used for evaluating the effect of demand forecasting. The loss function used for parameter adjustment and effect evaluation is

[0086]

[0087] in,

[0088] Table 4 shows the prediction results of the random forest model when using two feature selection methods. Among them, RF_LLC_AF refers to the test scheme using the above linear cost asymmetric loss function and the initial prediction feature set; RF_LLC_RF uses the above linear cost asymmetric loss function and uses the important feature set selected by the random forest algorithm to perform model training and demand forecasting; RF_LLC_ICPF refers to the scheme using the above linear cost asymmetric loss function and the feature set selected by the random forest algorithm for secondary screening based on similar product feature information to perform model training and demand forecasting.

[0089] Table 4

[0090] method Average cost of training set Average cost of test set Median test set cost RF_LLC_AF 126 567 285 RF_LLC_RF 121 522 275 RF_LLC_ICPF 133 437 240

[0091] In Table 4, compared with the traditional one-time screening method (RF_QQC_RF), the results of the method proposed in the present invention show that the average daily error cost of the test set decreased by 16.3% (from 522 yuan to 437 yuan), and the median daily error cost decreased by 12.7% (from 275 to 240). Therefore, the method proposed in the present invention significantly improves the demand forecasting effect with asymmetric cost in learning tasks with high feature dimensions and small sample sizes, and the improvement effect is more significant under different machine learning models.

[0092] Embodiment 3 of the present invention provides a demand forecasting system based on similar product feature information, such as Figure 2 As shown, it includes feature extraction module, product cluster construction module, primary screening module, fine screening module and prediction module; among them,

[0093] Feature extraction module, used to extract product attribute features and prediction features;

[0094] Product cluster building module, used to build product clusters based on product attribute characteristics;

[0095] The initial screening module is used to perform preliminary screening of the prediction features to obtain the important feature set of the product;

[0096] The fine screening module is used to perform secondary screening based on the important feature set of the product combined with the product cluster to form a secondary screening feature set;

[0097] The prediction module is used to input the secondary screening feature set into the machine learning model for demand prediction.

[0098] Furthermore, it also includes a loss function calculation module for calculating the loss function of the machine learning model.

[0099] Finally, a computer storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of a demand forecasting method based on similar product feature information are implemented.

[0100] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0101] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A demand forecasting method based on machine learning, characterized in that: The specific steps include the following: Extract product attribute features and prediction features; Constructing a product cluster according to the product attribute characteristics; Preliminarily screening the prediction features to obtain a set of important product features; Perform secondary screening based on the important feature set of the product and the product cluster to form a secondary screening feature set; Inputting the secondary screening feature set into a machine learning model for demand forecasting; It also includes calculating the loss function of the machine learning model, and the calculation formula is: Among them, i represents the i-th product, j represents the j-th sample, represents the actual demand for the i-th product and the j-th sample, Represents the prediction loss of the model for the i-th product and the j-th sample; It represents the unit holding cost caused by the predicted value exceeding the actual value. It indicates the unit out-of-stock loss caused by the predicted value being lower than the actual value; represents the prediction features of the i-th product and the j-th sample; and Represents the predicted value of the i-th product and the j-th sample.

2. The demand forecasting method based on machine learning according to claim 1, characterized in that: The product attribute characteristics include origin, brand, material, craftsmanship, specifications, categories, functional parameters, price, channel characteristics, social attributes, service life, consumption speed, relative price level, and market performance characteristics.

3. The demand forecasting method based on machine learning according to claim 1, characterized in that: The product cluster is constructed by clustering methods, which include partitioning method, hierarchical method, density algorithm, graph clustering method, grid algorithm, and model algorithm.

4. The demand forecasting method based on machine learning according to claim 1, characterized in that: It also includes calculating the unimportance of product prediction features. Specifically, for product i, calculate the similarity between other products k in the cluster to which i belongs and i, and calculate the weight value of other products k based on the similarity. Calculate the unimportance of the sth feature of product i. The calculation formula is: in, 5. The demand forecasting method based on machine learning according to claim 4, characterized in that: The similarity is calculated using one of the following methods: Minkowski distance, cosine similarity, and Pearson correlation coefficient.

6. The demand forecasting method based on machine learning according to claim 1, characterized in that: The methods for performing preliminary screening include chi-square selection method, correlation coefficient method, chi-square test, mutual information method, recursive feature elimination method, feature selection method based on penalty term, and feature selection method based on tree model.

7. The demand forecasting method based on machine learning according to claim 4, characterized in that: The weight values ​​of other products k in the cluster to which product i belongs The calculation formula is: Where: Indicates the attribute similarity between other products k in the cluster and product i.

8. The demand forecasting method based on machine learning according to claim 4, characterized in that: The weight values ​​of other products k in the cluster to which product i belongs The calculation formula is: Where: Indicates the attribute similarity between other products k in the cluster and product i.