Demand prediction model training method, product demand prediction method and related device
The one-dimensional time series data is converted into two-dimensional graph structure data through the Seq2Graph method, and graph convolution operation and linear fitting are used to solve the accuracy problem of user demand prediction, improve the effect of product recommendation, and reduce the shopping cart abandonment rate.
Patent Information
- Application Number
- CN202410219046.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-27
- Publication Date
- 2024-09-17
AI Technical Summary
Existing technology is difficult to accurately predict users' product needs in different time periods, resulting in poor product recommendation results, increased user disgust, and high shopping cart abandonment rates.
The Seq2Graph method is used to convert one-dimensional time series data into two-dimensional graph structure data. Through linear fitting and graph convolution operations, global and local information in product demand time series data are extracted, and demand forecast model parameters are optimized to improve forecast accuracy.
Through the Seq2Graph method, it can more accurately reflect the correlation between different time points, improve the accuracy and effect of product demand forecast, and reduce the shopping cart abandonment rate.
Smart Images

Figure CN118657550A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a training method for a demand forecasting model, a product demand forecasting method, and related devices. Background Art
[0002] Time series prediction of user demand plays a very important role in the current online ecosystem of e-commerce, promotion, scheduling, etc. By mining time series data and accurately predicting the user's demand for a product within a specific time, it is possible to specify highly targeted customer engagement activities, provide enhanced product recommendations, and even reduce the incidence of shopping cart abandonment by actively encouraging potential users to complete transactions.
[0003] However, since users’ needs vary in different time periods, recommending products at the wrong time will lead to user disgust and poor activity results. Therefore, it is necessary to accurately predict the user’s product needs at a specified time. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a demand forecasting model training method, a product demand forecasting method and related devices, so as to accurately predict user demand for products.
[0005] In order to achieve the above objectives, the present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a method for training a demand forecasting model, comprising:
[0007] Based on the first learning parameter, linear fitting is performed on a first subsequence of the sample user, where the first subsequence is obtained by performing sequence decomposition on the product demand time series data of the sample user in a historical period;
[0008] Based on the similarity between the first subsequence and the first subsequence after linear fitting, converting the first subsequence into graph structure data;
[0009] Performing a graph convolution operation on the graph structure data based on a demand prediction model to obtain a predicted demand degree of the sample user for the product;
[0010] Based on the predicted demand and reference demand of the sample users for the product, the demand prediction model and the first learning parameter are optimized and trained.
[0011] In a second aspect, an embodiment of the present application provides a product demand forecasting method, comprising:
[0012] Perform sequence decomposition on the product demand time series data of the target user in the historical period to obtain a second subsequence;
[0013] Based on the first learning parameter, performing linear fitting on the second subsequence;
[0014] Based on the similarity of the second subsequence before and after the linear fitting, converting the second subsequence into target graph structure data;
[0015] A graph convolution operation is performed on the target graph structure data based on a demand prediction model to obtain a predicted demand degree of the target user for the product.
[0016] In a third aspect, an embodiment of the present application provides a training device for a demand forecasting model, comprising:
[0017] A fitting unit, configured to perform linear fitting on a first subsequence of a sample user based on a first learning parameter, where the first subsequence is obtained by performing sequence decomposition on product demand time series data of the sample user in a historical period;
[0018] a conversion unit, configured to convert the first subsequence into graph structure data based on the similarity between the first subsequence and the first subsequence after linear fitting;
[0019] A prediction unit, configured to perform a graph convolution operation on the graph structure data based on a demand prediction model to obtain a predicted demand degree of the sample user for the product;
[0020] A training unit is used to optimize and train the demand prediction model and the first learning parameter based on the predicted demand and reference demand of the sample users for the product.
[0021] In a fourth aspect, an embodiment of the present application provides a product demand forecasting device, comprising:
[0022] A decomposition unit, used for performing sequence decomposition on the product demand time series data of the target user in the historical period to obtain a second subsequence;
[0023] A fitting unit, configured to perform linear fitting on the second subsequence based on the first learning parameter;
[0024] a conversion unit, configured to convert the second subsequence into target graph structure data based on the similarity of the second subsequence before and after the linear fitting;
[0025] The prediction unit is used to perform a graph convolution operation on the target graph structure data based on a demand prediction model to obtain the predicted demand of the target user for the product.
[0026] In a fifth aspect, an embodiment of the present application provides an electronic device, including:
[0027] processor;
[0028] a memory for storing instructions executable by the processor;
[0029] Wherein, the processor is configured to execute the instructions to implement the training method of the demand forecasting model as described in the first aspect; or, the processor is configured to execute the instructions to implement the product demand forecasting method as described in the second aspect.
[0030] In the sixth aspect, an embodiment of the present application provides a computer-readable storage medium, which, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the training method of the demand forecasting model as described in the first aspect; or, when the instructions in the storage medium are executed by the processor of an electronic device, enables the electronic device to execute the product demand forecasting method as described in the second aspect.
[0031] In the seventh aspect, an embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps in the method described in the first aspect or the second aspect.
[0032] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: according to the different regular characteristics of time series data, the product demand time series data in the historical period is decomposed into the first subsequence by means of sequence decomposition, so that the different regular characteristics in the product demand time series data can be explicitly expressed through different first subsequences, so that the different regular characteristics can be effectively exerted; on this basis, considering that the degree of influence between different time points in the subsequence is likely to be different, a Seq2Graph (a method for converting one-dimensional time series data into two-dimensional graph data) solution is designed to convert one-dimensional time series data into two-dimensional graph structure data for representation; the first subsequence is converted into graph structure data through the similarity of the first subsequence before and after linear fitting, which is helpful In the Seq2Graph process, more extensive attention is paid to the more useful global and local information in the product demand time series data. The obtained graph structure data can reflect the potential correlation between different time points, improve the display expression of product demand time series data on product demand tasks, and enable the demand forecasting model to more accurately forecast product demand based on graph structure data; in addition, the first learning parameter used for linear fitting of the first subsequence is optimized together with the demand forecasting model, and the parameters of the demand forecasting model are optimized and trained based on the predicted demand output by the demand forecasting model and the reference demand as a label, which helps to adaptively adjust the potential correlation between different time points through dynamic learning in the Seq2Graph stage, thereby improving the accuracy of Seq2Graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0034] Figure 1 A flowchart of a method for training a demand forecasting model provided for one embodiment of the present application;
[0035] Figure 2 A schematic diagram of a demand forecasting process provided for an embodiment of the present application;
[0036] Figure 3 A flowchart of a product demand forecasting method provided for one embodiment of the present application;
[0037] Figure 4 A schematic diagram of the structure of a training device for a demand forecasting model provided in one embodiment of the present application;
[0038] Figure 5 A schematic diagram of the structure of a product demand forecasting device provided for one embodiment of the present application;
[0039] Figure 6 A schematic diagram of the structure of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0041] The terms "first", "second", etc. in this specification and claims are used to distinguish similar objects, and are not used to describe a particular order or precedence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein. In addition, "and / or" in this specification and claims means at least one of the connected objects, and the character " / " generally means that the objects associated with each other are in an "or" relationship.
[0042] Some concept descriptions:
[0043] Seq2Graph (Sequence To Graph): A method that converts one-dimensional time series data into two-dimensional graph data. After the conversion, the characteristic expression of time series is added between the two-dimensional data. This two-dimensional graph data can be image-like data or some graph-type data with topological relationship expression.
[0044] GCN (Graph Convolution Network): A spatial feature extraction method that applies the convolution concept to non-Euclidean spatial topology graphs. Its theoretical essence is that each node in the graph changes its state to a certain balance due to the influence of neighboring points at different distances. The closer the neighboring points are, the greater the influence. Graph convolution theory is divided into methods based on the spatial domain and spectral domain.
[0045] STL (Seasonal and Trend decomposition using Loess) is a very general method for decomposing time series, where Loess is a method for estimating nonlinear relationships. STL uses LOESS to extract smooth estimates of the three components, thereby decomposing the time series into three main components: trend, seasonal term, and residual.
[0046] DTW (Dynamic Time Warping) is an algorithm that detects the similarity between two time series based on a dynamic programming strategy, and this similarity is usually expressed as a distance.
[0047] The embodiment of the present application provides a training method for a demand forecasting model. According to the different regular characteristics of time series data, the product demand time series data in the historical period is decomposed into a first subsequence by means of sequence decomposition, so that the different regular characteristics in the product demand time series data can be explicitly expressed through different first subsequences, so that the different regular characteristics can be effectively exerted; on this basis, considering that the degree of influence between different time points in the subsequence is likely to be different, a Seq2Graph scheme is designed to convert one-dimensional time series data into two-dimensional graph structure data for representation. The first subsequence is converted into graph structure data through the similarity of the first subsequence before and after linear fitting, which helps to better understand the Seq2Graph process. Extensive attention is paid to the more useful global and local information in the product demand time series data. The obtained graph structure data can reflect the potential correlation between different time points, improve the display expression of product demand time series data on product demand tasks, and enable the demand forecasting model to be more accurate in product demand forecasting based on graph structure data. In addition, the first learning parameter used for linear fitting of the first subsequence is optimized together with the demand forecasting model, and the parameters of the demand forecasting model are optimized and trained based on the predicted demand output by the demand forecasting model and the reference demand as a label, which helps to adaptively adjust the potential correlation between different time points through dynamic learning in the Seq2Graph stage, thereby improving the accuracy of Seq2Graph.
[0048] It should be understood that the training method of the demand forecasting model and the product demand forecasting method provided in the embodiments of the present application can be executed by an electronic device or software installed in an electronic device. The so-called electronic device here may include a terminal device, such as a smart phone, a tablet computer, a laptop computer, a desktop computer, an intelligent voice interaction device, a smart home appliance, a smart watch, a vehicle terminal, an aircraft, etc.; or, the electronic device may also include a server, such as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0049] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0050] See also Figure 1 , is a flow chart of a method for training a demand forecasting model provided by an embodiment of the present application, the method comprising the following steps:
[0051] S102: Perform linear fitting on a first subsequence of a sample user based on a first learning parameter.
[0052] The first subsequence is obtained by sequence decomposing the product demand time series data of the sample users in the historical period. Product demand time series data refers to data with time series characteristics and can reflect the user's product demand, specifically including the trend of the demand characteristics related to the product changing over time in the historical period. The historical period can be set according to actual needs, such as one month before the target time point to be predicted, etc., which is not limited in the embodiments of the present application.
[0053] The demand features related to the product can be selected according to actual needs, for example, including but not limited to at least one of the following features: weekly / monthly activity, weekly / monthly login times, weekly / monthly click times, weekly / monthly maximum weekly / monthly click times, weekly / monthly purchase times, weekly / monthly order amounts, weekly / monthly order volumes, etc. These features maintain consistent granularity over time, and there are certain differences between these features.
[0054] In order to make the product demand time series data of each sample user in the historical period have a unified time dimension, before the product demand time series data is sequence decomposed, the product demand time series data is also constructed according to the sliding window T. That is, the product demand time series data of each sample user not only contains F demand features, but also has a time dimension, that is, F demand features at T time points. At this time, the product demand time series data of a sample user is x∈R T*F .
[0055] The first subsequence includes a trend subsequence and a periodic subsequence (also called a season subsequence). Each first subsequence includes the characteristic values of sample users at different time points in the historical period. The trend subsequence represents the historical change trend characteristics of the product demand time series data, such as the overall growth / decrease trend of activity. The periodic subsequence represents the periodic fluctuation law characteristics of the product demand time series data, such as the periodic fluctuation law of activity. Of course, Figure 2 As shown in Figure 1, by performing sequence decomposition on the product demand time series data, we can also obtain random subsequences (also called residual subsequences), which indicate that the product demand time series data is affected by random interference factors, such as weather, disasters, economic turmoil and other random interference factors. In other words, x t ,x s ,x r = STL(x), where x represents product demand time series data, STL represents sequence decomposition, and x t 、x s 、x r ∈R T*F They represent trend subsequence, periodic subsequence and random subsequence respectively.
[0056] The product demand time series data can be decomposed by various sequence decomposition algorithms commonly used in the art, which are not limited in the embodiments of the present application. As an example, in order to fully express different regular features in the product demand time series data, the sequence decomposition algorithm can use a local weighted regression (STL) algorithm to decompose the product demand time series data to obtain a first subsequence.
[0057] In the embodiment of the present application, considering that the trend subsequence and the periodic subsequence are more susceptible to dynamic influences in time series, by performing Seq2Graph processing on these two subsequences as the first subsequence, deeper sequence information can be extracted. For example, by performing Seq2Graph processing on the trend subsequence, the extracted deep sequence information includes the change trend information of all demand characteristics, and by performing Seq2Graph processing on the periodic subsequence, the extracted deep sequence information includes the periodic fluctuation regularity information of all demand characteristics. Furthermore, linear fitting is performed on the first subsequence, so as to utilize the similarity of the first subsequence before and after the linear fitting, accurately mine the correlation between different time points in the historical period during the Seq2Graph processing, and then accurately convert the first subsequence into graph structure data.
[0058] As an example, different first subsequences correspond to different first learning parameters. Linear fitting of the first subsequence can be achieved by the following formulas (1) to (2).
[0059] x′ t =x t ·W t (1)
[0060] x′ s =x s ·W s (2)
[0061] Among them, x t represents the trend subsequence, x′ t represents the trend subsequence after linear fitting, W t represents the first learning parameter corresponding to the trend subsequence; x s represents a periodic subsequence, x′ s represents the periodic subsequence after linear fitting, W s represents the first learning parameter corresponding to the periodic subsequence; W t , W s ∈R T*F , x′ t , x′ s ∈R T*F .
[0062] S104: based on the similarity between the first subsequence and the first subsequence after linear fitting, convert the first subsequence into graph structure data.
[0063] The graph structure data expresses the first subsequence in the form of a two-dimensional topological graph. In an embodiment of the present application, the trend subsequence and the periodic subsequence have corresponding graph structure data, that is, the graph structure data obtained by the above S104 includes the first graph structure data converted from the trend subsequence and the second graph structure data converted from the periodic subsequence. The graph structure data includes a plurality of nodes and connecting edges between the nodes, each node corresponding to an element in the first subsequence, that is, a characteristic value at a time point in the historical period; the connecting edge represents the association relationship between the connected nodes, different connecting edges have different weights, and the weight of the connecting edge represents the distance between the nodes connected by the connecting edge, that is, the similarity between the characteristic values corresponding to the connected nodes.
[0064] Considering that the first subsequence after linear fitting can reflect the correlation between the feature values at different time points in the first subsequence, the similarity of the first subsequence before and after linear fitting can reflect the degree of influence between different time points. Based on this, Figure 2 As shown, based on the similarity between the first subsequence and the first subsequence after linear fitting, the time point with the highest correlation is selected as its adjacent time point for each time point in the historical period, and then the correlation relationship between the characteristic values of different time points in the first subsequence is established, so as to realize the transformation from the first subsequence to the graph structure data, and the graph structure data obtained by the transformation can explicitly reflect the correlation relationship between the characteristic values of different time points in the first subsequence, which helps the demand forecasting model to focus on more useful global and local information in the first subsequence during the forecasting process, so that the output forecast demand is more accurate.
[0065] Specifically, in one embodiment, the above S104 may include the following steps:
[0066] S141, determining the distances between different time points in the historical period based on the similarity between the first subsequence and the first subsequence after linear fitting.
[0067] As an example, the trend subsequence and the period subsequence are added to obtain a first fused sequence; the trend subsequence after linear fitting and the period subsequence after linear fitting are added to obtain a second fused sequence; based on the similarity between the first fused sequence and the second fused sequence, the distance between different time points in the historical period is determined.
[0068] The distance between two time points reflects the correlation between the two time points, that is, the greater the distance between the two, the smaller the correlation between the two; conversely, the greater the correlation between the two.
[0069] In this method, the distance between different time points in the historical period is determined by the similarity between the addition operation results before and after the trend subsequence and the periodic subsequence are fitted. The similarity between the changing trend information of the demand characteristics at different time points and the periodic fluctuation law information is comprehensively considered, so that the determined distance can more accurately reflect the correlation between different time points.
[0070] More specifically, the distance between any two time points in the historical period is determined by: selecting a first slice sequence from the first fusion sequence, the first slice sequence including feature values of h time points adjacent to and before the first time point in the first fusion sequence; selecting a second slice sequence from the second fusion sequence, the second slice sequence including feature values of h time points adjacent to and before the second time point in the second fusion sequence; calculating the similarity between the first slice sequence and the second slice sequence as the distance between the first time point and the second time point. The first time point and the second time point are any two time points in the historical period.
[0071] For example, in order to ensure the consistency in length between the first fusion sequence and the second fusion sequence so as to more accurately calculate the distance between the time points, the first fusion sequence is padded using the following formula (3), and the second fusion sequence is padded using the following formula (4); then, the similarity between the first fusion sequence after the padding process and the second fusion sequence after the padding process is calculated using the following formula (5), thereby obtaining the distance between the first time point and the second time point.
[0072]
[0073]
[0074]
[0075] D={d i,j} (6)
[0076] Among them, x t represents the trend subsequence, x s represents a periodic subsequence, x t +x s represents the first fusion sequence, Padding represents the padding process, x′ t represents the trend subsequence after linear fitting, x′ s represents the periodic subsequence after linear fitting, x′ t +x′ s represents the second fusion sequence, represents the first slice sequence, represents the second slice sequence, i represents the i-th time point in the historical period, j represents the j-th time point in the historical period, DTW represents the similarity between the first fused sequence after filling and the second fused sequence after filling by the dynamic time warping algorithm, d i,j represents the distance between the i-th time point and the j-th time point, D represents the similarity matrix, D∈R T*T .
[0077] In practical applications, h can also be used as a parameter of the demand forecasting model, h<<T, and is continuously optimized during the training process. In this way, during the training process, the adjacent time points of each time point in the historical period are adaptively adjusted through dynamic learning, thereby improving the accuracy of Seq2Graph. In addition, in the above example, when calculating the distance between two time points, a smoothing method is adopted to intercept the feature values of h time points before and after the time point from the fused sequence before and after the linear fitting for similarity calculation, which can eliminate the influence of noise in the fused sequence on the similarity calculation result, thereby further improving the accuracy of the distance.
[0078] As another example, the similarity between the trend subsequence and the trend subsequence after linear fitting and the similarity between the period subsequence and the period subsequence after linear fitting can be calculated respectively, and the distance between different time points in the historical period can be determined by combining the two similarities.
[0079] More specifically, for each subsequence, the specific implementation method of calculating the similarity between the subsequence and the subsequence after linear fitting is similar to the specific implementation method of calculating the similarity between the first fused subsequence and the second fused subsequence, which will not be repeated. Further, one of the mean, minimum and maximum values of the two similarities is used as the distance between the first time point and the second time point.
[0080] S142, determining a corresponding adjacent time point for each time point in the historical period based on the distances between different time points.
[0081] As an example, for each time point in the historical period, the first k (number of neighbors) time points closest to the time point in the historical period are selected as its adjacent time points. In this case, k can also be used as a parameter of the demand forecasting model and is continuously optimized during the training process. In this way, during the training process, the adjacent time points of each time point in the historical period are adaptively adjusted through dynamic learning, thereby improving the accuracy of Seq2Graph.
[0082] S143, based on the adjacent time points of each time point in the historical period, convert the first subsequence into graph structure data.
[0083] As an example, for each time point in the historical period, the feature value of the time point in the first subsequence is updated based on the third slice sequence of the adjacent time points of the time point in the first subsequence, and the third slice sequence includes the feature values of h time points before and after the adjacent time point in the first subsequence; then, based on the distance between each time point and the adjacent time point in the historical period, an adjacency matrix is generated; finally, based on the updated first subsequence and the adjacency matrix, graph structure data is generated.
[0084] Specifically, the eigenvalue of each time point in the first subsequence can be updated by the following formulas (7) to (9), and the adjacency matrix can be obtained by the following formula (10).
[0085] f 1 ,f 2 ,...,f k =arg Topk(d i,: ) (7)
[0086]
[0087]
[0088]
[0089] In the above formulas (7) to (10), f 1 ,f 2 ,...,f k represents the k adjacent time points of the i-th time point in the historical period, d i,: represents the distance between the i-th time point and other time points, Topk(d i,: ) represents the first k time points closest to the i-th time point in the historical period, represents the kth eigenvalue in the trend subsequence, represents the kth eigenvalue in the periodic subsequence, Represents x s,h (f k ) means taking the fth k The h elements before and after the eigenvalue are taken as the new kth eigenvalue. Concat means concatenation according to the spatial dimension. A represents the adjacency matrix. A∈R k*k , a i,: Represents the distance between the i-th time point and its adjacent time points.
[0090] After obtaining the updated first subsequence and adjacency matrix, the two can be used as graph structure data; alternatively, corresponding nodes can be created for each time point in the historical period, and the characteristic value of the time point in the updated first subsequence can be used as the attribute of the node corresponding to the time point. In addition, connecting edges can be created between the nodes based on the adjacency matrix, and the distance between the time points corresponding to the nodes can be used as the edge attribute of the connecting edge, thereby obtaining the corresponding graph structure data.
[0091] In the above example, a smoothing method is adopted. For each time point in the first subsequence, the feature values of h time points before and after its adjacent time point are extracted from the first subsequence, and the feature value of the time point is updated. This can eliminate the influence of noise in the fused sequence on the Seq2Graph conversion process, thereby further improving the accuracy of Seq2Graph.
[0092] As another example, the weighted sum of the eigenvalues of the adjacent time points at each time point in the first subsequence can be used to update the eigenvalue of each time point to obtain a new first subsequence; then, an adjacency matrix is generated based on the distance between each time point and the adjacent time point in the historical period, and graph structure data is generated based on the new first subsequence and the adjacency matrix.
[0093] In the above implementation, based on the similarity between the first subsequence and the first subsequence after linear fitting, the distance between different time points in the historical period is determined, and then the time point with the highest correlation is selected as its adjacent time point for each time point in the historical period according to the distance, so that the process of determining the adjacent time point is more explainable, and thus the Seq2Graph process is also more explainable and more suitable for user demand prediction.
[0094] S106, performing graph convolution operation on the graph structure data based on the demand prediction model to obtain the predicted demand of sample users for the product.
[0095] Graph convolution operations on graph structured data can be implemented through graph convolutional neural networks (GCNs) in demand forecasting models.
[0096] Considering that the changing trend characteristics of the sample users' demand for products will be affected by random interference factors and holidays, and thus affect the sample users' demand for products, and that the different regular characteristics presented by different first subsequences have different effects on product demand, in order to effectively play the different regular characteristics of different first subsequence programs, and fully integrate all the information affecting product demand, so as to further improve the accuracy of demand prediction, in one embodiment, Figure 2As shown, different graph convolution processing is performed on the graph structure data, random subsequences and holiday feature sequences corresponding to different first subsequences, that is, graph convolution (GCN) operation is performed on the first graph structure data and random subsequences corresponding to the trend subsequence, graph convolution operation is performed on the second graph structure data corresponding to the periodic subsequence, and embedding processing is performed on the holiday feature sequence, and the processing results are aggregated for demand forecasting.
[0097] Specifically, the above S106 may include the following steps: S161, performing a graph convolution operation on the trend subsequence to obtain a first convolution result; S162, performing a graph convolution operation on the second graph structure data to obtain a second convolution result; S163, embedding the event feature sequence of the target event in the historical period to obtain an embedding result; S164, aggregating the first convolution result, the second convolution result, the random subsequence and the embedding result to obtain an aggregation result; S165, performing demand forecasting based on the aggregation result to obtain the predicted demand degree of the sample users for the product.
[0098] The event sequence indicates whether the target event occurs at each time point in the historical period. The target event may include, but is not limited to, events such as designated holidays (in Figure 2 For example, if the historical period contains T time points, then the event feature sequence of the sample user is x w ∈R T*1 , wherein the event feature sequence includes values corresponding to T time points, each value indicating whether the target event occurs at the corresponding time point. The designated holidays can be set according to actual needs, for example, including but not limited to various statutory holidays, shopping festivals, etc.
[0099] As an example, in the above S161, the first convolution result may be determined by the following formula (11). In the above S162, the second convolution result may be determined by the following formula (12).
[0100]
[0101]
[0102] In the above formulas (11) to (12), Y t Represents the first convolution result, iY s The second convolution result is shown in Figure 2. i (x) represents the i-th convolutional layer, T i (x) = 2xT i-1 (x)-T i-2(x), K is one of the parameters of the demand forecasting model, which represents the convolution receptive field of the node in the i-th convolutional layer. It is usually 3 and is continuously optimized during the training process; θ i represents the shared parameters, which are also used as the parameters of the demand forecasting model and are continuously optimized during the training process; T i is a generalized polynomial expression, T i (A) is a mapping of the adjacency matrix A. The above convolution aggregation operation is recorded as Y = GCN (x).
[0103] As an example, the above S164 includes the following steps: Step A1, performing M-level first graph convolution operations on the first convolution result, the embedding result and the random subsequence, and using the M-th level operation result as the third convolution result, wherein the 1st level operation result is obtained by fusing the embedding result after performing the 1st level first graph convolution operation on the first convolution result and the random subsequence, and the m-th level operation result is obtained by fusing the embedding result after performing the m-1-th level first graph convolution operation on the random subsequence, where m is an integer greater than 1; Step A2, performing M-level second graph convolution operations on the second convolution result, and using the result obtained by the M-th level graph convolution operation as the fourth convolution result; Step A3, performing an addition operation on the third convolution result and the fourth convolution result to obtain an aggregated result.
[0104] Specifically, in step A1, the first level first graph convolution operation is performed on the first convolution result, the embedding result and the random subsequence as shown in the following formula (13); in step A2, the first level first graph convolution operation is performed on the second convolution result as shown in the following formula (14).
[0105]
[0106]
[0107] in, Represents the result of the m-th level operation, c represents the number of hidden layer neurons in the demand forecasting model; x r represents a random subsequence, represents the learning parameter corresponding to the random subsequence, x w Represents event feature sequence, Embedding represents embedded representation, and GCN represents graph convolution operation.
[0108] As an example, in the above S165, in order to increase the nonlinear learning ability of the entire time series learning, a GLU activation module is added to the demand prediction model, so the learning parameter of the last layer of neurons in the network needs to be 2c; finally, the aggregation processing result is passed to the convolution prediction layer, and the predicted demand of the sample user for the product is obtained through the following formulas (15) to (16).
[0109] [P,Q]=Y=Y t +Y s (15)
[0110] O=Conv2d(P⊙σ(Q)) (16)
[0111] Among them, Y t Represents the third convolution result, Y s Represents the fourth convolution result, Y t +Y s Represents the result of the aggregation process, P and Q are intermediate calculation variables in the activation process, and P and Q have the same length and dimension, that is, Y is cut in half along a certain dimension to become P and Q, σ is the sigmoid activation function, O∈R 1*o , o is the output feature number, and O represents the predicted demand of sample users for the product.
[0112] It can be understood that different processing is performed on each subsequence obtained by sequence decomposition of product demand time series data, which helps to effectively play the regular characteristics contained in each subsequence, and the overall expression ability is improved compared with the product demand time series data; on this basis, the calculation results of each subsequence after processing are fused and then used for demand forecasting, so that in the process of graph convolution operation, the time series data can achieve stronger information transmission, and the screened time point information can be more fully aggregated and the nonlinear fitting capability is enhanced, further improving the accuracy of the demand forecasting results.
[0113] S108, based on the predicted demand degree and reference demand degree of the sample users for the product, optimizing and training the demand prediction model and the first learning parameter.
[0114] Optimizing the demand forecasting model includes optimizing the parameters of the demand forecasting model. The parameters of the demand forecasting model may also include structural parameters of the demand forecasting model, such as the number of nodes of each network included in the demand forecasting model, the connection relationship between the nodes, etc., which is not limited in the embodiments of the present application.
[0115] By calculating the cross entropy loss between the predicted demand for the product by sample users and the reference demand, the prediction loss of the demand prediction model can be obtained; further, the back propagation algorithm is used to optimize the parameters of the demand prediction model and the first learning parameters with the goal of reducing the prediction loss.
[0116] As an example, the above cross entropy loss can be calculated by the following formula (17).
[0117]
[0118] Among them, L represents the cross entropy loss, N represents the number of sample users, represents the predicted demand of the i-th sample user for the product, y i Represents the reference demand of the i-th sample user for the product.
[0119] The training method of the demand forecasting model provided in the embodiment of the present application decomposes the product demand time series data in the historical period into the first subsequence by means of sequence decomposition, aiming at the different regular characteristics of the time series data, so as to explicitly express the different regular characteristics in the product demand time series data through different first subsequences, so that the different regular characteristics can be effectively exerted; on this basis, considering that the degree of influence between different time points in the subsequence is likely to be different, a Seq2Graph scheme is designed to convert one-dimensional time series data into two-dimensional graph structure data for representation; the first subsequence is converted into graph structure data through the similarity of the first subsequence before and after linear fitting, which is helpful to be more extensive in the Seq2Graph process. Broadly focusing on the more useful global and local information in the product demand time series data, the obtained graph structure data can reflect the potential correlation between different time points, improve the display expression of product demand time series data on product demand tasks, and enable the demand forecasting model to more accurately forecast product demand based on graph structure data; in addition, the first learning parameter used for linear fitting of the first subsequence is optimized together with the demand forecasting model, and the parameters of the demand forecasting model are optimized and trained based on the predicted demand output by the demand forecasting model and the reference demand as a label, which helps to adaptively adjust the potential correlation between different time points through dynamic learning in the Seq2Graph stage, thereby improving the accuracy of Seq2Graph.
[0120] Based on the same inventive concept, an embodiment of the present application also provides a product demand prediction method, which can use the demand prediction model trained by the above-mentioned training method to predict the demand for a product by any user at a specified time, so as to recommend products to the user more accurately.
[0121] See also Figure 3 , is a flow chart of a product demand forecasting method provided by an embodiment of the present application, the method comprising the following steps:
[0122] S302, performing sequence decomposition on the product demand time series data of the target user in the historical period to obtain a second subsequence.
[0123] The second subsequence includes a trend subsequence and a period subsequence. The product demand time series data includes the trend of the demand characteristics related to the product changing over time in the historical period. The process of obtaining the second subsequence is the same as above. Figure 1The process of obtaining the first subsequence in the illustrated embodiment is similar and will not be described in detail.
[0124] S304: Perform linear fitting on the second subsequence based on the first learning parameter.
[0125] Among them, the specific implementation of S304 is the same as Figure 1 The specific implementation of S102 in the illustrated embodiment is similar and will not be described in detail.
[0126] S306 , based on the similarity of the second subsequence before and after the linear fitting, convert the second subsequence into target graph structure data.
[0127] Among them, the specific implementation of S306 is the same as Figure 1 The specific implementation of S104 in the illustrated embodiment is similar and will not be described in detail.
[0128] S308, performing graph convolution operation on the target graph structure data based on the demand prediction model to obtain the predicted demand of the target user for the product.
[0129] Among them, the specific implementation of S308 is Figure 1 The specific implementation of S106 in the illustrated embodiment is similar and will not be described in detail.
[0130] Aiming at the different regular characteristics of time series data, the product demand time series data of target users are decomposed into second subsequences, including trend subsequences and periodic subsequences, by means of sequence decomposition, so as to explicitly express the different regular characteristics in the product demand time series data through different second subsequences, so that different regular characteristics can be effectively exerted; on this basis, considering that the degree of influence between different time points in the subsequences is likely to be different, a Seq2Graph scheme is designed to convert one-dimensional time series data into two-dimensional graph structure data for representation. The second subsequence is converted into target graph structure data through the similarity of the second subsequence before and after linear fitting, which helps to pay more attention to more useful global and local information in the product demand time series data in the Seq2Graph process. The obtained target graph structure data can reflect the potential correlation between different time points, improve the display expression of product demand time series data in product demand tasks, and enable the demand forecasting model to more accurately forecast product demand based on the target graph structure data.
[0131] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0132] Based on the same inventive concept, the present application also provides a training device for a demand forecasting model. Figure 4 , which is a structural diagram of a training device 400 for a demand forecasting model provided in an embodiment of the present application, wherein the device 400 includes: a fitting unit 410, a conversion unit 420, a forecasting unit 430 and a training unit 440.
[0133] The fitting unit 410 is used to perform linear fitting on a first subsequence of the sample user based on a first learning parameter, where the first subsequence is obtained by performing sequence decomposition on the product demand time series data of the sample user in a historical period.
[0134] The conversion unit 420 is configured to convert the first subsequence into graph structure data based on the similarity between the first subsequence and the first subsequence after linear fitting.
[0135] The prediction unit 430 is used to perform a graph convolution operation on the graph structure data based on the demand prediction model to obtain the predicted demand of the sample user for the product.
[0136] The training unit 440 is used to optimize the demand prediction model and the first learning parameter based on the predicted demand and reference demand of the sample users for the product.
[0137] In another embodiment, when converting the first subsequence into graph structure data based on the similarity between the first subsequence and the first subsequence after linear fitting, the conversion unit 420 performs the following steps:
[0138] determining distances between different time points in the historical period based on the similarity between the first subsequence and the first subsequence after linear fitting;
[0139] Determining a corresponding adjacent time point for each time point in the historical period based on the distances between the different time points;
[0140] The first subsequence is converted into the graph structure data based on adjacent time points of each time point in the historical period.
[0141] In another embodiment, the first subsequence includes a trend subsequence and a period subsequence; when determining the distance between different time points in the historical period based on the similarity between the first subsequence and the first subsequence after linear fitting, the conversion unit 420 performs the following steps:
[0142] Performing an addition operation on the trend subsequence and the period subsequence to obtain a first fused sequence;
[0143] Add the trend subsequence after linear fitting and the period subsequence after linear fitting to obtain the second fusion sequence;
[0144] Based on the similarity between the first fused sequence and the second fused sequence, distances between different time points in the historical period are determined.
[0145] In another embodiment, the distance between any two time points in the historical period is determined by:
[0146] Selecting a first slice sequence from the first fused sequence, where the first slice sequence includes feature values of h time points adjacent to and before a first time point in the first fused sequence;
[0147] Selecting a second slice sequence from the second fused sequence, where the second slice sequence includes feature values of h time points adjacent to and before the second time point in the second fused sequence;
[0148] Calculating the similarity between the first slice sequence and the second slice sequence as the distance between the first time point and the second time point;
[0149] The first time point and the second time point are any two time points in the historical period.
[0150] In another embodiment, the conversion unit 420 performs the following steps when converting the first subsequence into the graph structure data based on the adjacent time points of each time point in the historical period:
[0151] For each time point in the historical time period, updating the feature value of the time point in the first subsequence based on a third slice sequence of adjacent time points of the time point in the first subsequence, wherein the third slice sequence includes feature values of h time points before and after the adjacent time point in the first subsequence;
[0152] Generate an adjacency matrix based on the distance between each time point and its adjacent time points in the historical period;
[0153] The graph structure data is generated based on the updated first subsequence and the adjacency matrix.
[0154] In another embodiment, the first subsequence includes a trend subsequence and a period subsequence; the graph structure data includes first graph structure data converted from the trend subsequence and second graph structure data converted from the period subsequence;
[0155] When the prediction unit 430 performs a graph convolution operation on the graph structure data based on the demand prediction model to obtain the predicted demand of the sample user for the product, the following steps are performed:
[0156] Performing a graph convolution operation on the first graph structure data to obtain a first convolution result;
[0157] Performing a graph convolution operation on the second graph structure data to obtain a second convolution result;
[0158] Embedding the event feature sequence of the target event in the historical period to obtain an embedding result, wherein the event feature sequence indicates whether the target event occurs at each time point in the historical period;
[0159] Aggregating the first convolution result, the second convolution result, the random subsequence, and the embedding result to obtain an aggregated result, wherein the random subsequence is obtained by performing sequence decomposition on the product demand time series data;
[0160] Demand forecasting is performed based on the aggregation result to obtain the predicted demand of the sample users for the product.
[0161] In another embodiment, when the prediction unit 430 aggregates the first convolution result, the second convolution result, and the embedding result to obtain an aggregated result, the prediction unit 430 performs the following steps:
[0162] Performing M-level first graph convolution operations on the first convolution result, the embedding result, and the random subsequence, and using the M-th level operation result as the third convolution result, wherein the first-level operation result is obtained by fusing the embedding result after performing the first-level first graph convolution operation on the first convolution result and the random subsequence, and the m-th level operation result is obtained by fusing the embedding result after performing the m-1-th level first graph convolution operation on the random subsequence, where m is an integer greater than 1;
[0163] Performing an M-level second graph convolution operation on the second convolution result, and using a result obtained by the M-th level graph convolution operation as a fourth convolution result;
[0164] The third convolution result and the fourth convolution result are added to obtain the aggregation result.
[0165] Obviously, the training device for the demand forecasting model provided in the embodiment of the present application can be used as Figure 1 The execution body of the training method of the demand forecasting model shown, for example Figure 1 In the training method of the demand forecasting model shown in FIG. 1 , step S102 may be performed by Figure 4 The fitting unit 410 in the training device of the demand forecasting model shown in FIG. 1 is executed, and step S104 can be performed by Figure 4 The conversion unit 420 in the training device of the demand forecasting model shown in FIG. 1 is executed, and step S106 can be performed by Figure 4 The prediction unit 430 in the training device of the demand prediction model shown in FIG. 1 is executed, and step S108 can be performed by Figure 4 The training unit 440 in the training device of the demand forecasting model shown is executed.
[0166] According to another embodiment of the present application, Figure 4 The various modules in the training device of the demand forecasting model shown can be separately or completely combined into one or several other modules to constitute, or one (some) of the modules can be further divided into multiple smaller modules in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In practical applications, the function of one module can also be implemented by multiple modules, or the functions of multiple modules can be implemented by one module. In an embodiment of the present application, the training device of the demand forecasting model may also include other modules. In practical applications, these functions can also be implemented with the assistance of other modules, and can be implemented by the collaboration of multiple modules.
[0167] According to another embodiment of the present application, the program can be executed on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. Figure 1 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Figure 4 The training device of the demand forecasting model shown in the figure, and the training method of the demand forecasting model to implement the embodiment of the present application. The computer program can be recorded on, for example, a computer-readable storage medium, and transferred to an electronic device through the computer-readable storage medium and run therein.
[0168] Based on the same inventive concept, the present application embodiment also provides a product demand forecasting device. Figure 5, is a structural schematic diagram of a product demand forecasting device 500 provided in an embodiment of the present application, the device 500 includes: a decomposition unit 510, a fitting unit 520, a conversion unit 530 and a forecasting unit 540.
[0169] The decomposition unit 510 is used to perform sequence decomposition on the product demand time series data of the target user in the historical period to obtain a second subsequence.
[0170] The fitting unit 520 is configured to perform linear fitting on the second subsequence based on the first learning parameter.
[0171] The conversion unit 530 is used to convert the second subsequence into target graph structure data based on the similarity of the second subsequence before and after the linear fitting.
[0172] The prediction unit 540 is used to perform a graph convolution operation on the target graph structure data based on the demand prediction model to obtain the predicted demand of the target user for the product.
[0173] Obviously, the product demand forecasting device provided in the embodiment of the present application can be used as Figure 3 The execution body of the product demand forecasting method shown, for example Figure 3 In the product demand forecasting method shown in FIG. 1 , step S302 may be performed by Figure 5 The decomposition unit 510 in the product demand forecasting device shown in FIG. 1 is executed, and step S304 can be performed by Figure 5 The fitting unit 520 in the product demand forecasting device shown in FIG. 1 is executed, and step S306 can be performed by Figure 5 The conversion unit 530 in the product demand forecasting device shown in FIG. 1 is executed, and step S308 can be performed by Figure 5 The prediction unit 540 in the product demand prediction device shown is executed.
[0174] According to another embodiment of the present application, Figure 5 The various modules in the product demand forecasting device shown can be separately or completely combined into one or several other modules to form, or one (some) of the modules can be further divided into multiple smaller modules in function to form, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In practical applications, the functions of one module can also be implemented by multiple modules, or the functions of multiple modules can be implemented by one module. In the embodiments of the present application, the product demand forecasting device may also include other modules. In practical applications, these functions can also be implemented with the assistance of other modules, and can be implemented by the collaboration of multiple modules.
[0175] According to another embodiment of the present application, the program can be executed on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. Figure 3 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Figure 5 The product demand forecasting device shown in the figure, and the product demand forecasting method according to the embodiment of the present application are implemented. The computer program can be recorded on, for example, a computer-readable storage medium, and transferred to an electronic device through the computer-readable storage medium, and run therein.
[0176] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 6 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0177] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0178] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0179] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a training device for the demand forecasting model at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0180] Based on the first learning parameter, linear fitting is performed on a first subsequence of the sample user, where the first subsequence is obtained by performing sequence decomposition on the product demand time series data of the sample user in a historical period;
[0181] Based on the similarity between the first subsequence and the first subsequence after linear fitting, converting the first subsequence into graph structure data;
[0182] Performing a graph convolution operation on the graph structure data based on a demand prediction model to obtain a predicted demand degree of the sample user for the product;
[0183] Based on the predicted demand and reference demand of the sample users for the product, the demand prediction model and the first learning parameter are optimized and trained.
[0184] Alternatively, the processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a product demand forecasting device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0185] Perform sequence decomposition on the product demand time series data of the target user in the historical period to obtain a second subsequence;
[0186] Based on the first learning parameter, performing linear fitting on the second subsequence;
[0187] Based on the similarity of the second subsequence before and after the linear fitting, converting the second subsequence into target graph structure data;
[0188] A graph convolution operation is performed on the target graph structure data based on a demand prediction model to obtain a predicted demand degree of the target user for the product.
[0189] The above application Figure 1 The method performed by the training device of the demand forecasting model disclosed in the embodiment shown, or the above-mentioned method of the present application Figure 3The method performed by the product demand forecasting device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0190] The electronic device may also perform Figure 1 The method is used to implement the training device of the demand forecasting model. Figure 1 , Figure 2 Alternatively, the electronic device may also perform the functions of the embodiments shown. Figure 3 The method is used to realize the product demand forecasting device. Figure 3 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0191] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0192] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 1 The method of the embodiment shown is specifically used to perform the following operations:
[0193] Based on the first learning parameter, linear fitting is performed on a first subsequence of the sample user, where the first subsequence is obtained by performing sequence decomposition on the product demand time series data of the sample user in a historical period;
[0194] Based on the similarity between the first subsequence and the first subsequence after linear fitting, converting the first subsequence into graph structure data;
[0195] Performing a graph convolution operation on the graph structure data based on a demand prediction model to obtain a predicted demand degree of the sample user for the product;
[0196] Based on the predicted demand and reference demand of the sample users for the product, the demand prediction model and the first learning parameter are optimized and trained.
[0197] Alternatively, when the instruction is executed by a portable electronic device including a plurality of application programs, the portable electronic device can execute Figure 3 The method of the embodiment shown is specifically used to perform the following operations:
[0198] Perform sequence decomposition on the product demand time series data of the target user in the historical period to obtain a second subsequence;
[0199] Based on the first learning parameter, performing linear fitting on the second subsequence;
[0200] Based on the similarity of the second subsequence before and after the linear fitting, converting the second subsequence into target graph structure data;
[0201] A graph convolution operation is performed on the target graph structure data based on a demand prediction model to obtain a predicted demand degree of the target user for the product.
[0202] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0203] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0204] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0205] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0206] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A training method for a demand forecasting model, characterized in that: include: Based on the first learning parameter, linear fitting is performed on a first subsequence of the sample user, where the first subsequence is obtained by performing sequence decomposition on the product demand time series data of the sample user in a historical time period; Based on the similarity between the first subsequence and the first subsequence after linear fitting, converting the first subsequence into graph structure data; Performing a graph convolution operation on the graph structure data based on a demand prediction model to obtain a predicted demand degree of the sample user for the product; Based on the predicted demand and reference demand of the sample users for the product, the demand prediction model and the first learning parameter are optimized and trained.
2. The method according to claim 1, characterized in that: The converting the first subsequence into graph structure data based on the similarity between the first subsequence and the first subsequence after linear fitting includes: Determining distances between different time points in the historical period based on a similarity between the first subsequence and the first subsequence after linear fitting; Determining a corresponding adjacent time point for each time point in the historical period based on the distances between the different time points; The first subsequence is converted into the graph structure data based on adjacent time points of each time point in the historical period.
3. The method according to claim 2, characterized in that The first subsequence includes a trend subsequence and a period subsequence; and determining the distance between different time points in the historical period based on the similarity between the first subsequence and the first subsequence after linear fitting includes: Performing an addition operation on the trend subsequence and the period subsequence to obtain a first fused sequence; Add the trend subsequence after linear fitting and the period subsequence after linear fitting to obtain the second fusion sequence; Based on the similarity between the first fused sequence and the second fused sequence, distances between different time points in the historical period are determined.
4. The method according to claim 3, characterized in that The distance between any two time points in the historical period is determined as follows: Selecting a first slice sequence from the first fused sequence, where the first slice sequence includes feature values of h time points adjacent to and before a first time point in the first fused sequence; Selecting a second slice sequence from the second fused sequence, where the second slice sequence includes feature values of h time points adjacent to and before the second time point in the second fused sequence; Calculating the similarity between the first slice sequence and the second slice sequence as the distance between the first time point and the second time point; The first time point and the second time point are any two time points in the historical period.
5. The method according to claim 2, characterized in that: The first subsequence includes a feature value of each time point in the historical time period; and the converting the first subsequence into the graph structure data based on the adjacent time points of each time point in the historical time period includes: For each time point in the historical time period, updating the feature value of the time point in the first subsequence based on a third slice sequence of adjacent time points of the time point in the first subsequence, wherein the third slice sequence includes feature values of h time points before and after the adjacent time point in the first subsequence; Generate an adjacency matrix based on the distance between each time point and its adjacent time points in the historical period; The graph structure data is generated based on the updated first subsequence and the adjacency matrix.
6. The method according to claim 1, characterized in that The first subsequence includes a trend subsequence and a period subsequence; the graph structure data includes first graph structure data converted from the trend subsequence and second graph structure data converted from the period subsequence; The performing graph convolution operation on the graph structure data based on the demand prediction model to obtain the predicted demand of the sample user for the product includes: Performing a graph convolution operation on the first graph structure data to obtain a first convolution result; Performing a graph convolution operation on the second graph structure data to obtain a second convolution result; Embedding the event feature sequence of the target event in the historical period to obtain an embedding result, wherein the event feature sequence indicates whether the target event occurs at each time point in the historical period; Aggregating the first convolution result, the second convolution result, the random subsequence, and the embedding result to obtain an aggregated result, wherein the random subsequence is obtained by performing sequence decomposition on the product demand time series data; Demand forecasting is performed based on the aggregation result to obtain the predicted demand of the sample users for the product.
7. The method according to claim 6, characterized in that The aggregating the first convolution result, the second convolution result, and the embedding result to obtain an aggregated result includes: Performing M-level first graph convolution operations on the first convolution result, the embedding result, and the random subsequence, and using the M-th level operation result as the third convolution result, wherein the first-level operation result is obtained by fusing the embedding result after performing the first-level first graph convolution operation on the first convolution result and the random subsequence, and the m-th level operation result is obtained by fusing the embedding result after performing the m-1-th level first graph convolution operation on the random subsequence, where m is an integer greater than 1; Performing an M-level second graph convolution operation on the second convolution result, and using a result obtained by the M-th level graph convolution operation as a fourth convolution result; The third convolution result and the fourth convolution result are added to obtain the aggregation result.
8. A product demand forecasting method, characterized in that: include: Perform sequence decomposition on the product demand time series data of the target user in the historical period to obtain a second subsequence; Based on the first learning parameter, performing linear fitting on the second subsequence; Based on the similarity of the second subsequence before and after the linear fitting, converting the second subsequence into target graph structure data; A graph convolution operation is performed on the target graph structure data based on a demand prediction model to obtain a predicted demand degree of the target user for the product.
9. A training device for a demand forecasting model, characterized in that: include: A fitting unit, configured to perform linear fitting on a first subsequence of a sample user based on a first learning parameter, where the first subsequence is obtained by performing sequence decomposition on product demand time series data of the sample user in a historical period; a conversion unit, configured to convert the first subsequence into graph structure data based on the similarity between the first subsequence and the first subsequence after linear fitting; A prediction unit, configured to perform a graph convolution operation on the graph structure data based on a demand prediction model to obtain a predicted demand degree of the sample user for the product; A training unit is used to optimize and train the demand prediction model and the first learning parameter based on the predicted demand and reference demand of the sample users for the product.
10. A product demand forecasting device, characterized in that: include: A decomposition unit, used for performing sequence decomposition on the product demand time series data of the target user in the historical period to obtain a second subsequence; A fitting unit, configured to perform linear fitting on the second subsequence based on the first learning parameter; a conversion unit, configured to convert the second subsequence into target graph structure data based on the similarity of the second subsequence before and after the linear fitting; The prediction unit is used to perform a graph convolution operation on the target graph structure data based on a demand prediction model to obtain the predicted demand of the target user for the product.
11. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; Wherein, the processor is configured to execute the instructions to implement the training method of the demand forecasting model as described in any one of claims 1 to 7; or, the processor is configured to execute the instructions to implement the product demand forecasting method as described in claim 8.
12. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to execute the training method of the demand forecasting model as described in any one of claims 1 to 7; or, when the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to execute the product demand forecasting method as described in claim 8.
13. A computer program product, characterized in that The computer program product comprises a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute part or all of the steps in the method according to any one of claims 1 to 7 or claim 8.
