Sales prediction model and evaluation method thereof, and electronic equipment
Through a sales forecasting model, a weight matrix is generated using sequence feature data to predict the sales volume of products at different selling prices, solving the problem of unpredictable sales volume before making decisions, and achieving more accurate sales forecasting and pricing optimization.
Patent Information
- Application Number
- CN202411244632.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2025-02-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Before making a decision, the sales volume of the product at different selling prices is not predicted, making it difficult to determine the optimal pricing of the product to maximize revenue.
A sales volume prediction model is proposed to predict the sales volume of products at different selling prices by generating a weight matrix, predicting the sales value of sales benchmark values and discount feature vectors, and calculating the discount expansion coefficient.
有效降低了对销量跨度大的商品对模型预测结果准确性的影响,帮助电商在决策前更准确地预测商品销量,从而优化定价策略。
Smart Images

Figure CN119398834A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of commodity pricing, and more specifically, to a sales forecasting model and an evaluation method thereof, and electronic equipment. Background Art
[0002] The issue of product pricing is one of the core issues of e-commerce. Whether a reasonable price can be set for a product determines whether the sales of the product can bring maximum profit.
[0003] Generally speaking, the logic of pricing affecting revenue is: the higher the price of a product, the lower the sales volume. Under this quantity-price relationship, there must be an optimal price for the product, which maximizes its revenue. Therefore, when the quantity-price relationship is determined, the optimal pricing of the product is fixed and can be sought. Therefore, when we obtain a reliable quantity-price relationship for each product on sale in the Hyperchain project, we can calculate the optimal theoretical selling price for each product through operations research methods, thereby maximizing the revenue brought by each product.
[0004] The problem with existing technologies is that it is impossible to predict the sales volume of a product at different selling prices before making a decision. Summary of the invention
[0005] The present application aims to propose a sales forecasting model and its evaluation method and electronic equipment to solve the problem that the sales volume of a product at different selling prices cannot be predicted before making a decision when releasing a new product.
[0006] According to one aspect of the present application, a sales prediction model is proposed, including a model parameter generation unit, configured to generate a weight matrix of the sales prediction model according to the sequence feature data of the commodity; a model prediction unit, configured to generate a predicted sales reference value and a discount feature vector using the weight matrix according to the static feature data of the commodity; a discount mask generation unit, configured to generate a discount mask vector according to a preset discount range; a discount expansion coefficient generation unit, configured to generate a discount expansion coefficient according to the discount feature vector and the discount mask vector; and a sales prediction unit, configured to generate a predicted sales volume according to the predicted sales reference value and the discount expansion coefficient.
[0007] According to some embodiments, the model parameter generation unit is further configured to generate a weight matrix of the sales prediction model through a Transformer encoder based on the sequence feature data of the product.
[0008] According to some embodiments, the sequence feature data includes sales data, exposure traffic data and / or transaction price discount of the product. According to some embodiments, the model prediction unit includes a first prediction subunit, a second prediction subunit and a third prediction subunit, and the weight matrix includes a first prediction subunit weight matrix, a second prediction subunit weight matrix and a third prediction subunit weight matrix, wherein: the first prediction subunit is configured to generate a decoding feature vector through a first neural network based on the static feature data of the product and the first prediction subunit weight matrix; the second prediction subunit is configured to generate the predicted sales reference value through a second neural network using the decoding feature vector and the second prediction subunit weight matrix; the third prediction subunit is configured to generate the discount feature vector through a third neural network using the decoding feature vector and the third prediction subunit weight matrix.
[0009] According to some embodiments, the first neural network includes a three-layer neural network, and the first prediction subunit weight matrix includes a first prediction subunit first weight matrix, a first prediction subunit second weight matrix and a first prediction subunit third weight matrix, wherein: the first layer in the first neural network is configured to perform a multiplication operation on the static feature data of the commodity and the first prediction subunit first weight matrix to obtain a first multiplication operation result, and perform a nonlinear transformation on the first multiplication operation result to obtain a first nonlinear transformation result; the second layer in the first neural network is configured to perform a multiplication operation on the first nonlinear transformation result and the first prediction subunit second weight matrix to obtain a second multiplication operation result, and perform a nonlinear transformation on the second multiplication operation result to obtain a second nonlinear transformation result; the third layer in the first neural network is configured to perform a multiplication operation on the second nonlinear transformation result and the first prediction subunit third weight matrix to obtain the decoding feature vector.
[0010] According to some embodiments, the second neural network includes a three-layer neural network, and the second prediction subunit weight matrix includes a second prediction subunit first weight matrix, a second prediction subunit second weight matrix and a second prediction subunit third weight matrix, wherein: the first layer in the second neural network is configured to perform a multiplication operation on the decoded feature vector and the second prediction subunit first weight matrix to obtain a first multiplication operation result, and perform a nonlinear transformation on the first multiplication operation result to obtain a first nonlinear transformation result; the second layer in the second neural network is configured to perform a multiplication operation on the first nonlinear transformation result and the second prediction subunit second weight matrix to obtain a second multiplication operation result, and perform a nonlinear transformation on the second multiplication operation result to obtain a second nonlinear transformation result; the third layer in the second neural network is configured to perform a multiplication operation on the second nonlinear transformation result and the second prediction subunit third weight matrix to obtain the predicted sales reference value.
[0011] According to some embodiments, the third neural network includes a neural network with a three-layer structure, and the third prediction subunit weight matrix includes a third prediction subunit first weight matrix, a third prediction subunit second weight matrix and a third prediction subunit third weight matrix, wherein: the first layer in the third neural network is configured to perform a multiplication operation on the decoded feature vector and the third prediction subunit first weight matrix to obtain a first multiplication operation result, and perform a nonlinear transformation on the first multiplication operation result to obtain a first nonlinear transformation result; the second layer in the third neural network is configured to perform a multiplication operation on the first nonlinear transformation result and the third prediction subunit second weight matrix to obtain a second multiplication operation result, and perform a nonlinear transformation on the second multiplication operation result to obtain a second nonlinear transformation result; the third layer in the third neural network is configured to perform a multiplication operation on the second nonlinear transformation result and the third prediction subunit third weight matrix to obtain a third multiplication operation result, and perform a nonlinear transformation on the third multiplication operation result to obtain the discounted feature vector.
[0012] According to some embodiments, the discount mask generation unit is further configured to determine a basic discount vector based on a preset discount range, a preset discount step and an initial value of a basic discount vector, and generate the discount mask vector using the basic discount vector based on the predicted sales volume discount.
[0013] According to some embodiments, the discounted dilation coefficient generating unit is further configured to perform an inner product operation on the discounted feature vector and the discounted mask vector to obtain the discounted dilation coefficient.
[0014] According to some embodiments, the discount expansion coefficient generation unit is further configured to calculate the discount expansion coefficient in the order of the discount values in the discount feature vector from large to small, and when calculating the discount expansion coefficient after the first element in the discount feature vector, the value of the calculated discount expansion coefficient is the sum of the value of the discount expansion coefficient corresponding to the adjacent previous discount and the corresponding discount feature in the discount feature vector.
[0015] According to some embodiments, the sales volume prediction unit is further configured to perform a multiplication operation on the predicted sales volume reference value and the discount expansion coefficient to generate the predicted sales volume.
[0016] According to some embodiments, the model prediction unit further includes a pricing unit configured to calculate the profit of the product under different discounts according to the following formula, and determine the discount of the product according to the maximum value of the calculated profit to determine the pricing of the product,
[0017] Profit=(P1*discount-P0)*Qty
[0018] Among them, Profit is the calculated profit, P1 is the original price of the product on the page, discount is the discount of the product, P0 is the cost price of the product, and Qty is the sales volume of the product predicted by the sales prediction model when the discount of the product is discount.
[0019] According to one aspect of the present application, a method for evaluating a sales forecast model is proposed, comprising: responding to an evaluation instruction, generating predicted sales of corresponding commodities using the sales forecast model; grouping the predicted sales according to the size of the predicted sales; calculating the weighted average absolute percentage error of each group of commodities corresponding to the grouping; calculating a weighted average value using the weighted average absolute percentage error of each group of commodities, and evaluating the sales forecast model using the weighted average value.
[0020] According to one aspect of the present application, an electronic device is provided, comprising a processor; and a memory storing a computer program, wherein when the computer program is executed by the processor, the processor executes the evaluation method as described in any of the previous embodiments.
[0021] According to the embodiments of the present application, the weight matrix of the model prediction unit is generated by utilizing the sequence characteristics of commodities, thereby enhancing the ability of the model prediction unit to fit and infer based on historical data, thereby enabling sales forecasts to be made for different commodities, thereby reducing the impact of commodities with a large sales span on the accuracy of the model prediction results.
[0022] It should be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments. By describing the exemplary embodiments in detail with reference to the drawings, the above and other objectives, features and advantages of the present application will become more apparent.
[0024] Figure 1 A block diagram of a sales forecasting model according to an example embodiment of the present application is shown.
[0025] Figure 2 A block diagram of another sales forecasting model according to an example embodiment of the present application is shown.
[0026] Figure 3 A schematic diagram of the architecture of a sales forecasting model according to an example embodiment of the present application is shown.
[0027] Figure 4 A schematic diagram of the training process of a sales prediction model according to an example embodiment of the present application is shown.
[0028] Figure 5 A flow chart of an evaluation method for a sales forecasting model according to an example embodiment of the present application is shown.
[0029] Figure 6 A schematic diagram of the proof process of using the sales forecasting model of the example embodiment of the present application to perform sales forecasting, in which only one calculation is required for each commodity to obtain a discount feature vector and a predicted sales benchmark value.
[0030] Figure 7 An electronic device according to an exemplary embodiment of the present application is shown. DETAILED DESCRIPTION
[0031] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this application will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. In the figures, the same figures show the same or similar parts, and thus their repeated description will be omitted.
[0032] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0033] The described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of these specific details, or other modes, components, materials, devices or operations may be adopted. In these cases, known structures, methods, devices, implementations, materials or operations will not be shown or described in detail.
[0034] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0035] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0036] The specific embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0037] Figure 1 A sales forecasting model block diagram according to an exemplary embodiment of the present application is shown as follows: Figure 1 The sales prediction model shown includes a model parameter generation unit 101 , a model prediction unit 103 , a discount mask generation unit 105 , a discount expansion coefficient generation unit 107 and a sales prediction unit 109 .
[0038] According to an embodiment of the present application, the model parameter generation unit 101 is configured to generate a weight matrix of the sales prediction model according to the sequence feature data of the commodity.
[0039] In some embodiments, the serial feature data of a product includes sales data, exposure traffic data, and / or transaction price discount of the product.
[0040] In some other embodiments, the model parameter generation unit 101 includes a Transformer encoder, and the model parameter generation unit 101 is configured to generate a weight matrix of the sales prediction model through the Transformer encoder according to the sequence feature data of the product.
[0041] The model prediction unit 103 is configured to generate a predicted sales volume reference value and a discount feature vector using the weight matrix according to the static feature data of the commodity.
[0042] In practice, static feature data refers to data that reflects the semantic information of the product title and the characteristics of the product in the search scenario, including but not limited to the merchant's geographic location, click-through rate, conversion rate, product category and / or supported after-sales service type (for example, whether shipping is free).
[0043] According to an embodiment of the present application, the model prediction unit 103 is configured to first perform feature encoding processing on the static feature data of the commodity to obtain feature encoding data; then, use the feature encoding data to generate a predicted sales benchmark value and a discount feature vector.
[0044] In a specific embodiment, the model prediction unit 103 includes a first prediction subunit, a second prediction subunit and a third prediction subunit, and the weight matrix includes a first prediction subunit weight matrix, a second prediction subunit weight matrix and a third prediction subunit weight matrix. The first prediction subunit is configured to generate a decoding feature vector through a first neural network based on the static feature data of the commodity and the first prediction subunit weight matrix; the second prediction subunit is configured to generate a predicted sales reference value through a second neural network using the decoding feature vector and the second prediction subunit weight matrix; the third prediction subunit is configured to generate a discount feature vector through a third neural network using the decoding feature vector and the third prediction subunit weight matrix.
[0045] In some embodiments, the first neural network includes a three-layer neural network, and the first prediction subunit weight matrix includes a first prediction subunit first weight matrix, a first prediction subunit second weight matrix, and a first prediction subunit third weight matrix. Among them, the first layer in the first neural network is configured to perform a multiplication operation on the static feature data of the commodity and the first prediction subunit first weight matrix to obtain a first multiplication operation result, and perform a nonlinear transformation on the first multiplication operation result to obtain a first nonlinear transformation result; the second layer in the first neural network is configured to perform a multiplication operation on the first nonlinear transformation result and the first prediction subunit second weight matrix to obtain a second multiplication operation result, and perform a nonlinear transformation on the second multiplication operation result to obtain a second nonlinear transformation result; the third layer in the first neural network is configured to perform a multiplication operation on the second nonlinear transformation result and the first prediction subunit third weight matrix to obtain a decoding feature vector.
[0046] In some other embodiments, the second neural network includes a three-layer neural network, and the second prediction subunit weight matrix includes a second prediction subunit first weight matrix, a second prediction subunit second weight matrix, and a second prediction subunit third weight matrix. The first layer in the second neural network is configured to perform a multiplication operation on the decoded feature vector and the second prediction subunit first weight matrix to obtain a first multiplication operation result, and perform a nonlinear transformation on the first multiplication operation result to obtain a first nonlinear transformation result; the second layer in the second neural network is configured to perform a multiplication operation on the first nonlinear transformation result and the second prediction subunit second weight matrix to obtain a second multiplication operation result, and perform a nonlinear transformation on the second multiplication operation result to obtain a second nonlinear transformation result; the third layer in the second neural network is configured to perform a multiplication operation on the second nonlinear transformation result and the second prediction subunit third weight matrix to obtain a predicted sales reference value.
[0047] In some other embodiments, the third neural network includes a neural network with a three-layer structure, and the third prediction subunit weight matrix includes a third prediction subunit first weight matrix, a third prediction subunit second weight matrix, and a third prediction subunit third weight matrix. Wherein, the first layer in the third neural network is configured to perform a multiplication operation on the decoded feature vector and the first weight matrix of the third prediction subunit to obtain a first multiplication operation result, and perform a nonlinear transformation on the first multiplication operation result to obtain a first nonlinear transformation result; the second layer in the third neural network is configured to perform a multiplication operation on the first nonlinear transformation result and the second weight matrix of the third prediction subunit to obtain a second multiplication operation result, and perform a nonlinear transformation on the second multiplication operation result to obtain a second nonlinear transformation result; the third layer in the third neural network is configured to perform a multiplication operation on the second nonlinear transformation result and the third weight matrix of the third prediction subunit to obtain a third multiplication operation result, and perform a nonlinear transformation on the third multiplication operation result to obtain a discounted feature vector.
[0048] According to an embodiment of the present application, the discount mask generating unit 105 is configured to generate a discount mask vector according to a preset discount range.
[0049] In some embodiments, the discount mask generation unit is further configured to determine a basic discount vector according to a preset discount range, a preset discount step and an initial value of the basic discount vector, and generate a discount mask vector using the basic discount vector according to the predicted sales volume discount.
[0050] The discounted dilation coefficient generation unit 107 is configured to generate a discounted dilation coefficient according to the discounted feature vector and the discounted mask vector.
[0051] According to an embodiment of the present application, the discounted dilation coefficient generation unit 107 is configured to perform an inner product operation on the discounted feature vector and the discounted mask vector to obtain the discounted dilation coefficient.
[0052] In a specific embodiment, the discount expansion coefficient generation unit 107 is configured to calculate the discount expansion coefficient in the order of the discount values in the discount feature vector from large to small. When calculating the discount expansion coefficient after the first element in the discount feature vector, the calculated discount expansion coefficient value is the sum of the value of the discount expansion coefficient corresponding to the adjacent previous discount and the corresponding discount feature in the discount feature vector.
[0053] The sales volume prediction unit 109 is configured to generate predicted sales volume according to the predicted sales volume reference value and the discount expansion coefficient.
[0054] According to an embodiment of the present application, the sales volume prediction unit 109 is configured to perform a multiplication operation on the predicted sales volume reference value and the discount expansion coefficient to generate the predicted sales volume.
[0055] according to Figure 1 The sales forecasting model shown uses the serial characteristics of commodities to generate the weight matrix of the model forecasting unit, which strengthens the ability of the model forecasting unit to fit and infer based on historical data, so that sales forecasts can be made for different commodities, reducing the impact of commodities with a large sales span on the accuracy of the model's forecasting results.
[0056] In some embodiments, a discount mask is used to control the sales prediction model so that the sales predicted at a high selling price must be less than or equal to the sales predicted at a low selling price, thereby avoiding possible erroneous attribution when training the sales prediction model with biased product data.
[0057] Figure 2 Another sales forecasting model block diagram according to an exemplary embodiment of the present application is shown, and Figure 1 compared to, Figure 2 The sales prediction model shown includes a model parameter generation unit 101, a model prediction unit 103, a discount mask generation unit 105, a discount expansion coefficient generation unit 107 and a sales prediction unit 109, and also includes a pricing unit 111. For convenience, only the following are described here. Figure 2 and Figure 1 The differences between the two will not be repeated here.
[0058] like Figure 2 As shown, the pricing unit 111 is configured to calculate the profit of the product under different discounts according to the following formula, and determine the discount of the product according to the maximum value of the calculated profit to determine the price of the product, as shown in formula (1).
[0059] Profit=(P1*discount-P0)*Qty (1)
[0060] Among them, Profit is the calculated profit, P1 is the original price of the product on the page, discount is the discount of the product, P0 is the cost price of the product, and Qty is the sales volume of the product predicted by the sales prediction model when the discount of the product is discount.
[0061] Figure 3 A schematic diagram of the architecture of a sales forecasting model according to an exemplary embodiment of the present application is shown below. Figure 3 Taking as an example, the relationship between the various sub-modules of a sales forecasting model according to an exemplary embodiment of the present application is described in detail.
[0062] like Figure 3 As shown in the figure, Original Features is the product data, including the product's sequence feature (Seq Data) data and static feature (Static Features) data. Figure 3 In the embodiment shown, the commodity data is split according to its features. The sequence features are used as the input of the self-attention module (Transformer Block), and the sequence features (SeqFeatures) vector of the commodity data is obtained by using the transformer encoder in the Transformer Block module. Then, the weight values of the model prediction units (including Feature Encoder, Base Qty Decoder and DiscountDecoder) are generated by the weight generator (Weight Generator) using the sequence feature vector.
[0063] In a specific embodiment, the sequence feature vector and the preset initial weight value are multiplied to generate the weight value of the model prediction unit, as shown in formula (2).
[0064]
[0065] Among them, 1≤i≤b, 1≤j≤c, W is the weight value of the generated model prediction unit, x is the sequence feature vector, W0 is the preset initial weight value, W0∈R a*b*c , W∈R b*c , a, b, c are integers greater than zero, used to describe the shape of the array. In this embodiment, W_0 is a three-dimensional array with a length of a, a width of b, and a height of c, and W is a two-dimensional array with a length of b and a width of c.
[0066] Since the optimization algorithm will adjust the weight value according to the difference between the sales forecast model prediction value and the actual value during the sales forecast model learning process, the present application does not limit the method of obtaining the initial weight value. In the embodiment of the present application, the initial weight value is obtained by randomly generating. Figure 3 As shown, the model prediction unit includes three modules, namely, Feature Encoder, Base Qty Decoder and Discount Decoder. In practice, each module of the model prediction unit is a neural network with different shapes. In this embodiment, each module of the model prediction unit is a 3-layer neural network with different shapes. Therefore, the sequence feature vectors output by the transformer encoder of the self-attention module (Transformer Block) need to be calculated as shown in formula (2) with 9 different three-dimensional matrices W0 to generate 9 weight matrices with different shapes.
[0067] like Figure 3 As shown in the figure, the input feature data (Input Features) of the feature encoder (Feature Encoder) is the static feature data (Static Features) of the product, and the output is the encoded feature data (Encoded Features). The encoded feature data (Encoded Features) are used as the input data of the base sales decoder (Base Qty Decoder) and the discount decoder (Discount Decoder). The base sales decoder (Base Qty Decoder) outputs the predicted sales base value (Base_q), and the discount decoder (Discount Decoder) generates a discount feature vector (Discount features).
[0068] According to an embodiment of the present application, the discount mask generation unit determines a basic discount vector according to a preset discount range, a predicted discount step and an initial value of the basic discount vector, and generates a discount mask vector (Discount Mask) using the basic discount vector according to the predicted sales volume discount.
[0069] In a specific embodiment, assuming that the discount range (Discount) of the product is (0, 20), the initial value of the basic discount vector is 1 according to the step size of 0.1, and a basic discount vector with a length of 201 and all elements of 1 is obtained. Let the discount of the product be x∈{0.0, 0.1, ..., 19.9, 20.0}, set the first 10x elements of the basic discount vector to 0, and obtain the discount mask vector (Discount Mask) corresponding to the product under the discount.
[0070] like Figure 3 As shown in the figure, the inner product operation (inner Product) is performed on the discount feature vector (Discount features) and the discount mask vector (DiscountMask) to obtain the discount expansion factor (Discount Uplift Factor). Then, the discount expansion factor (Discount Uplift Factor) is multiplied by the predicted sales base value (Base_q) to obtain the predicted product sales (Predicted_q) when the product discount is x.
[0071] After determining the structure of the sales forecasting model, it is necessary to train the sales forecasting model and use the trained sales forecasting model to predict the sales volume of goods under a certain discount.
[0072] Figure 4 A schematic diagram of the training process of a sales forecasting model according to an exemplary embodiment of the present application is shown below. Figure 4 Taking the example of the present invention, the training process of a sales forecasting model according to the exemplary embodiment of the present application is described in detail.
[0073] like Figure 4 As shown, in step S401, training data is prepared.
[0074] Since the historical sales data of commodities includes a large amount of noise data, it is necessary to sample and clean the original historical sales data.
[0075] Since the sampling of training data needs to be as balanced as possible, while the real sales data is extremely unbalanced, that is, a small number of products have high sales, while most products have low sales or even no sales data. In practice, different sales intervals are sampled and cleaned to ensure that there is an appropriate amount of product data in different sales intervals, so as to ensure that the model can be trained correctly. In practice, downsampling is performed for the part with low sales but a large proportion of products, that is, for this part of products, only a part of the samples is sampled at a small proportion; upsampling is performed for the part with high sales but a small proportion of products, that is, for this part of products, the products are randomly repeatedly sampled according to a preset fixed probability; the result of upsampling and downsampling of the two products is that the quantity distribution of products with different sales in the final data set is more even, which helps the model learn effective information that affects the relationship between quantity and price of different products.
[0076] Since there are fake orders, unauthorized orders, offline payments, etc. on the platform, it is necessary to clean up abnormal data that does not conform to the actual situation. For example, filter out products whose sales standard deviation exceeds 500 within 30 days. For another example, filter out data whose transaction price discount is less than 0.5 or greater than 2;
[0077] In a specific embodiment, the sequence characteristics and static characteristics of the historical sales data of commodities are adopted.
[0078] In practice, sequence features include the historical sales volume of the product every day in the past thirty days (sequence data with a length of 30), the historical exposure traffic of the product every day in the past thirty days (sequence data with a length of 30), and the historical transaction price discount of the product every day in the past thirty days (sequence data with a length of 30). Static features include the feature vector of the product, which refers to the 64-dimensional semantic vector of the product in the search scenario, reflecting the semantic information of the product title and the characteristics of the product in the search scenario. For example, product category, click-through rate in the past N days, conversion rate in the past N days, merchant geographic location (for example, the city where the merchant is located) and / or after-sales service type (whether free shipping). The final sequence feature (seq data) is a 30*3 matrix composed of sales volume, discount, and page views of the product in the past thirty days; static features (Static Features) are 30-dimensional vectors composed of features such as merchant geographic location, product category, and / or supported after-sales service.
[0079] In step S403, the sales prediction model is trained.
[0080] According to an embodiment of the present application, in step S403, first, a sequence feature vector is generated.
[0081] In a specific embodiment, the sequence feature (seq data) of dimension 30*3 is used as the input of TransformerBlock (including Transformer encoder), and Transformer Block processes the sequence feature data using the back propagation algorithm to obtain a 32-dimensional sequence feature vector (Seq Feature), so that this 32-dimensional vector can reflect the product characteristics contained in the product history sequence.
[0082] Then, the sequence feature vector is used to generate the weight value of the model prediction unit (including Feature Encoder, Base Qty Decoder and Discount Decoder) through the weight generator according to the method shown in formula (1).
[0083] In a specific embodiment, Feature Encoder, Base Qty Decoder and Discount Decoder are three-layer neural networks with different shapes.
[0084] Then, the static features of the product and the weight values of the generation model prediction unit are used to generate the predicted sales base value (Base_q) and the discount feature vector (Discount features).
[0085] In a specific embodiment, first, a 30-dimensional static feature vector of a product is input into a feature encoder (FeatureEncoder) to obtain a 256-dimensional feature vector.
[0086] In practice, Feature Encoder is a three-layer neural network, which processes the input features by multiplying them by a matrix and then performing a nonlinear transformation, which is repeated three times, and there is no nonlinear transformation in the last step. The shapes of the three matrices are 30*512 (the input 30-dimensional vector will become 512-dimensional after being processed by this matrix), 512*512, and 512*256 (the third matrix controls the final output vector dimension to 256). In some embodiments, the nonlinear transformation used is the leaky_relu function.
[0087] It should be noted that the scale of the matrix and the nonlinear transformation used in the Feature Encoder are variable. This is only an example and should not be construed as a limitation to the present application.
[0088] After obtaining the encoded 256-dimensional feature vector (Encoded Features), the Discount Decoder and the Base Qty Decoder are used to process the Encoded Features in the same way.
[0089] In practice, the Discount Decoder and the Base Qty Decoder are also three-layer neural networks. The input Encoded Features are processed by multiplying by a matrix first, then performing a nonlinear transformation, and repeating three times, and there is no nonlinear transformation in the last step. The nonlinear mapping used by the two decoders uses the leaky_relu function. Among them, the linear transformation matrix of the Discount Decoder has the shape of 256*256, 256*256 and 256*201, and the linear transformation matrix of the Base Qty Decoder has the shape of 256*256, 256*256 and 256*1. At the same time, the Discount Decoder performs an additional sigmoid nonlinear transformation at the end to make all elements of the output 201-dimensional discount feature greater than 0. According to the above calculation, the Base Qty Decoder outputs the predicted sales benchmark value of the product (a scalar), while the Discount Decoder outputs a 201-dimensional discount feature vector.
[0090] Theoretically, the lower the price of a product, the higher its sales volume. However, in practice, when a product has just experienced a big promotion or other activities or the product is highly correlated with a social hot spot, there may be an abnormal situation where the price of the product is high but the sales volume is still high. If this situation is not intervened, the sales prediction model obtained may learn the abnormal quantity-price relationship and attribute the increase in product sales volume to the increase in product price, that is, the higher the price, the higher the sales volume. Therefore, in an example embodiment of the present application, the discount mask generation unit determines the basic discount vector based on the preset discount range, the predicted discount step size and the initial value of the basic discount vector, and generates a discount mask vector (Discount Mask) based on the discount of the predicted sales volume using the basic discount vector, and uses the generated discount mask vector to control the sales prediction model to predict the sales volume at a high selling price to be less than or equal to the sales volume predicted at a low selling price, so as to avoid biased data causing model misattribution.
[0091] In a specific embodiment, assuming that the discount range (Discount) of the product is (0, 20), the initial value of the basic discount vector is 1 according to the step size of 0.1, and a basic discount vector with a length of 201 and all elements of 1 is obtained. Let the discount of the product be x∈{0.0, 0.1, ..., 19.9, 20.0}, set the first 10x elements of the basic discount vector to 0, and obtain the discount mask vector (Discount Mask) corresponding to the product under the discount. The characteristics of the discount mask are: the lower the discount, the more 1s in the mask, and when the price changes from high to low, the boundary between 0 and 1 in the mask will gradually move to the left until all elements of the mask are 1 (corresponding to 0 discount).
[0092] For example, the first 98 elements of the discount mask corresponding to a 9.8% discount are 0, and the last 103 elements are 1.
[0093] For another example, all elements of the discount mask corresponding to a 0% discount (free gift) product are 1.
[0094] For another example, for a product with a 20% discount (twice the original price), only the last element of the discount mask is 1, and the rest are 0.
[0095] After obtaining the non-negative discount feature vector output by the discount decoder and the discount mask vector generated according to the discount, perform the inner product operation (inner Product) on the discount feature vector (Discount features) and the discount mask vector (Discount Mask) to obtain the discount expansion factor (Discount Uplift Factor). Then, the discount expansion factor (Discount Uplift Factor) is multiplied by the predicted sales base value (Base_q) to obtain the predicted sales volume of the product when the product discount is x. Since all elements in the discount feature vector of the product are non-negative, the lower the product discount, the more 1s in the discount mask, the more elements in the summed discount features, and the higher the discount expansion factor, the higher the sales volume of the product predicted by the model.
[0096] During the execution of step S403, the error between the predicted commodity sales volume and the actual historical sales volume is calculated and used as the loss function of the sales volume prediction model to train the sales volume prediction model and obtain the sales volume prediction model.
[0097] During the training process, there will be multiple sales forecasting models. In order to select the best sales forecasting model, it is necessary to evaluate the obtained multiple sales forecasting models.
[0098] Figure 5 A flow chart of an evaluation method for a sales forecasting model according to an exemplary embodiment of the present application is shown. Figure 5 As shown, in step S501, in response to the evaluation instruction, the sales forecasting model is used to generate the predicted sales of the corresponding product.
[0099] In step S503, the predicted sales volume is grouped according to the size of the predicted sales volume.
[0100] In step S505, the weighted average absolute percentage error of each group of commodities after grouping is calculated.
[0101] In step S507, a weighted average value is calculated using the weighted average absolute percentage error of each group of commodities, so as to evaluate the sales forecast model using the weighted average value. The smaller the weighted average value, the more accurate the sales forecast model.
[0102] In a specific embodiment, in step S507, the weighted average absolute percentage errors of each group of commodities are added to obtain a weighted average value.
[0103] Figure 5 The evaluation method shown is shown in formula (2).
[0104]
[0105] Among them, cnt(itemt ) indicates the number of products in the group; sum_cnt indicates the total number of products; WMAPE t It represents the weighted mean absolute percentage error of each group of products; T represents the number of groups of products, and DWMAPE is the calculated weighted average value.
[0106] In use Figure 5 After the evaluation method shown determines the optimal sales forecasting model, it is necessary to use the sales forecasting model to determine the optimal pricing of the product. The sales forecasting model of this application is trained based on the discount of the product on the day, the feature data of the product, the historical feature data of the day, and the historical sales, so it has the ability to predict the sales of the product on the day. During the actual prediction and reasoning, the data input into the sales forecasting model is the feature data of the product in the scene of the day, the acceptable discount of the product (70% to 20% off), and 131 sales of the product under 131 possible discounts are predicted.
[0107] In a specific embodiment, first, the estimated sales volume of the product at various prices is calculated, and then the optimal product pricing is solved in combination with the business goal (ie, profit), as shown in formula (3).
[0108] Profit=(P1*discount-P0)*Qty=(P1*discount-P0)*F(discount) (3)
[0109] Among them, Profit is the calculated profit, P1 is the original price of the product page, discount is the discount degree of the product, P0 is the cost price of the product, F(discount) is the sales forecast model, and Qty is the sales volume predicted by the sales forecast model when the product discount is discount.
[0110] The current sales forecasting model needs to make predictions for different prices of the same product when making quantity and price decisions. The number of samples actually used for reasoning is the number of products * the number of alternative prices, which requires a lot of calculations. Figure 6 As shown, only one calculation is needed for each product to obtain the discount feature vector and the predicted sales benchmark value. This is because the discount diffusion coefficient corresponding to different discounts of the same product is obtained by summing the elements of different ranges of the same discount feature. The range of the summed elements is controlled by the discount mask, and the process of generating different discount masks for different discounts basically consumes no computing resources. Therefore, when the predicted discount range is 131 prices ranging from 70% to 20%, according to the embodiment of the present application, the number of inferences can be reduced to 1 / 131 of the original.
[0111] Since the Discount Features slice corresponding to the high price must be a subset of the Discount Features slice corresponding to the low price, and the sales expansion coefficient corresponding to different discounts is directly equal to the sum of the elements of the corresponding Discount Features slice. Therefore, Figure 7 As shown, it is not necessary to sum the Discount Features slices corresponding to the discount each time. It is only necessary for the expansion coefficient of each discount to reuse the expansion coefficient of the previous adjacent discount plus the component elements of the Discount Features corresponding to the current discount. According to an embodiment of the present application, when calculating the discount expansion coefficient, the discount expansion coefficient is calculated in descending order of the discount values in the discount feature vector. When calculating the discount expansion coefficient after the first element in the discount feature vector, the calculated discount expansion coefficient value is the sum of the discount expansion coefficient value corresponding to the previous adjacent discount and the corresponding discount feature in the discount feature vector.
[0112] Assuming that the discount expansion coefficient when the discount is x / 10 is d, that is, the corresponding discount expansion coefficient when the discount is (x-1) / 10 is d', the relationship between d and d' is shown in formula (4).
[0113] d′=f x +f x+1 +…+f 201 =f x +d (4)
[0114] Therefore, when calculating d', there is no need to sum the corresponding elements in Discount Features from the beginning. You only need to add the discount expansion coefficient corresponding to the previous discount to the single element of the corresponding discount feature.
[0115] When the predicted discount range is 131 prices with a 70% discount to a 20% discount, starting from a 20% discount, the discount value is reduced accordingly. In this embodiment, only 131 summations are required. If the method of summing the corresponding elements of the discount feature for each discount is adopted, the total number of summations is 1+2+3…+131=2046. It can be seen that the embodiment of the present application reduces the amount of calculation to the original 131 / 2046, that is, the original 2046 summation operations required to predict sales under 131 discounts are reduced to 131 times, which is 1.5% of the original.
[0116] Figure 7 An electronic device according to an exemplary embodiment of the present application is shown. Figure 7 The electronic device 200 according to this embodiment of the present application is described. Figure 7 The electronic device 200 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0117] like Figure 7 As shown, the electronic device 200 is in the form of a general computing device. The components of the electronic device 200 may include, but are not limited to: at least one processing unit 210, at least one storage unit 220, a bus 230 connecting different system components (including the storage unit 220 and the processing unit 210), a display unit 240, etc.
[0118] The storage unit stores program codes, which can be executed by the processing unit 210, so that the processing unit 210 executes the methods described in this specification according to various exemplary embodiments of the present application. For example, the processing unit 210 can execute the following: Figure 1 The method shown in .
[0119] The storage unit 220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 2201 and / or a cache memory unit 2202 , and may further include a read-only memory unit (ROM) 2203 .
[0120] The storage unit 220 may also include a program / utility 2204 having a set (at least one) of program modules 2205, such program modules 2205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0121] Bus 230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0122] The electronic device 200 may also communicate with one or more external devices 300 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 200, and / or communicate with any device that enables the electronic device 200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 250. Furthermore, the electronic device 200 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 260. The network adapter 260 may communicate with other modules of the electronic device 200 via the bus 230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0123] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. The technical solution according to the implementation method of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the implementation method of the present application.
[0124] The software product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0125] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.
[0126] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0127] The computer-readable medium carries one or more programs. When the one or more programs are executed by a device, the computer-readable medium implements the aforementioned functions.
[0128] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.
[0129] According to an embodiment of the present application, a computer program is provided, including a computer program or an instruction. When the computer program or the instruction is executed by a processor, the method described above can be executed.
[0130] The embodiments of the present application are described in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application. At the same time, changes or deformations made by those skilled in the art based on the ideas of the present application, the specific implementation methods and the scope of application of the present application, all belong to the scope of protection of the present application. In summary, the content of this specification should not be construed as a limitation on the present application.
Claims
1. A sales forecasting model, characterized in that: include: A model parameter generating unit, configured to generate a weight matrix of the sales prediction model according to the sequence feature data of the commodity; A model prediction unit, configured to generate a predicted sales volume benchmark value and a discount feature vector using the weight matrix according to the static feature data of the commodity; a discount mask generating unit, configured to generate a discount mask vector according to a preset discount range; a discount expansion coefficient generating unit configured to generate a discount expansion coefficient according to the discount feature vector and the discount mask vector; The sales volume forecasting unit is configured to generate forecast sales volume according to the forecast sales volume reference value and the discount expansion coefficient.
2. The sales volume forecasting model according to claim 1, characterized in that: The model parameter generation unit is further configured to generate a weight matrix of the sales prediction model through a Transformer encoder based on the sequence feature data of the product.
3. The sales forecasting model according to claim 2, characterized in that: The sequence feature data includes sales data, exposure traffic data and / or transaction price discount of the product.
4. The sales forecasting model according to claim 1, characterized in that: The model prediction unit includes a first prediction subunit, a second prediction subunit and a third prediction subunit, and the weight matrix includes a first prediction subunit weight matrix, a second prediction subunit weight matrix and a third prediction subunit weight matrix, wherein: The first prediction subunit is configured to generate a decoding feature vector through a first neural network according to the static feature data of the commodity and the first prediction subunit weight matrix; The second prediction subunit is configured to generate the predicted sales volume reference value through a second neural network using the decoded feature vector and the second prediction subunit weight matrix; The third prediction subunit is configured to generate the discounted feature vector through a third neural network using the decoded feature vector and the third prediction subunit weight matrix.
5. The sales volume forecasting model according to claim 4, characterized in that: The first neural network includes a three-layer neural network, and the first prediction subunit weight matrix includes a first prediction subunit first weight matrix, a first prediction subunit second weight matrix, and a first prediction subunit third weight matrix, wherein: The first layer in the first neural network is configured to perform a multiplication operation on the static feature data of the commodity and the first weight matrix of the first prediction subunit to obtain a first multiplication operation result, and perform a nonlinear transformation on the first multiplication operation result to obtain a first nonlinear transformation result; The second layer in the first neural network is configured to perform a multiplication operation on the first nonlinear transformation result and the second weight matrix of the first prediction subunit to obtain a second multiplication operation result, and perform a nonlinear transformation on the second multiplication operation result to obtain a second nonlinear transformation result; The third layer in the first neural network is configured to perform a multiplication operation on the second nonlinear transformation result and the third weight matrix of the first prediction subunit to obtain the decoded feature vector.
6. The sales volume prediction model according to claim 4, characterized in that: The second neural network includes a three-layer neural network, and the second prediction subunit weight matrix includes a second prediction subunit first weight matrix, a second prediction subunit second weight matrix, and a second prediction subunit third weight matrix, wherein: The first layer in the second neural network is configured to perform a multiplication operation on the decoded feature vector and the first weight matrix of the second prediction subunit to obtain a first multiplication operation result, and perform a nonlinear transformation on the first multiplication operation result to obtain a first nonlinear transformation result; The second layer in the second neural network is configured to perform a multiplication operation on the first nonlinear transformation result and the second weight matrix of the second prediction subunit to obtain a second multiplication operation result, and perform a nonlinear transformation on the second multiplication operation result to obtain a second nonlinear transformation result; The third layer in the second neural network is configured to perform a multiplication operation on the second nonlinear transformation result and the third weight matrix of the second prediction subunit to obtain the predicted sales reference value.
7. The sales volume forecasting model according to claim 4, characterized in that: The third neural network includes a three-layer neural network, and the third prediction subunit weight matrix includes a third prediction subunit first weight matrix, a third prediction subunit second weight matrix, and a third prediction subunit third weight matrix, wherein: The first layer in the third neural network is configured to perform a multiplication operation on the decoded feature vector and the first weight matrix of the third prediction subunit to obtain a first multiplication operation result, and perform a nonlinear transformation on the first multiplication operation result to obtain a first nonlinear transformation result; The second layer in the third neural network is configured to perform a multiplication operation on the first nonlinear transformation result and the second weight matrix of the third prediction subunit to obtain a second multiplication operation result, and perform a nonlinear transformation on the second multiplication operation result to obtain a second nonlinear transformation result; The third layer in the third neural network is configured to perform a multiplication operation on the second nonlinear transformation result and the third weight matrix of the third prediction subunit to obtain a third multiplication operation result, and perform a nonlinear transformation on the third multiplication operation result to obtain the discounted feature vector.
8. The sales forecasting model according to claim 1, characterized in that: The discount mask generating unit is further configured to determine a basic discount vector according to a preset discount range, a preset discount step and an initial value of a basic discount vector, and generate the discount mask vector using the basic discount vector according to the discount of the predicted sales volume.
9. The sales forecasting model according to claim 1, characterized in that: The discounted expansion coefficient generating unit is further configured to perform an inner product operation on the discounted feature vector and the discounted mask vector to obtain the discounted expansion coefficient.
10. The sales volume prediction model according to claim 9, characterized in that: The discount expansion coefficient generating unit is further configured to calculate the discount expansion coefficient in the order of the discount values in the discount feature vector from large to small. When calculating the discount expansion coefficient after the first element in the discount feature vector, the calculated discount expansion coefficient value is the sum of the value of the discount expansion coefficient corresponding to the adjacent previous discount and the corresponding discount feature in the discount feature vector.
11. The sales volume prediction model according to claim 1, characterized in that: The sales volume prediction unit is further configured to perform a multiplication operation on the predicted sales volume reference value and the discount expansion coefficient to generate the predicted sales volume.
12. The sales forecasting model according to claim 1, characterized in that: Also includes: The pricing unit is configured to calculate the profit of the product under different discounts according to the following formula, and determine the discount of the product according to the maximum value of the calculated profit to determine the price of the product. Profit=(P1*discount-P0)*Qty Among them, Profit is the calculated profit, P1 is the original price of the product on the page, discount is the discount of the product, P0 is the cost price of the product, and Qty is the sales volume of the product predicted by the sales prediction model when the discount of the product is discount.
13. A sales forecasting model evaluation method, characterized in that: include: In response to the evaluation instruction, generating predicted sales of the corresponding product using the sales prediction model; grouping the predicted sales volume according to the size of the predicted sales volume; Calculate the weighted average absolute percentage error of each group of products after grouping; The weighted average is calculated using the weighted average absolute percentage error of each group of commodities, so as to evaluate the sales forecasting model using the weighted average.
14. An electronic device comprising: processor; as well as A memory storing a computer program, which, when executed by the processor, enables the processor to perform the evaluation method according to any one of claim 13.