Time series prediction method and device for layered services
By encoding and modeling multi-level hierarchical time series in hierarchical business scenarios, a prediction sequence with consistency constraints is generated, which solves the problem of how to improve the accuracy of time series prediction and realizes the effective fusion of hierarchical information and improve the accuracy of prediction results.
Patent Information
- Application Number
- CN202210621721.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-02
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-06-02
AI Technical Summary
How to make full use of the timing information of the hierarchical structure to improve the accuracy of time series prediction, especially in hierarchical business scenarios.
By obtaining the historical time series of each business entity in a multi-level hierarchy, encoding these time series, determining the joint probability distribution that the coded vector satisfies, and sampling based on this distribution, a prediction sequence that satisfies the consistency constraints.
This method can make full use of the time series correlations at each level, improve the accuracy of prediction results, and ensure the consistency of prediction results between different levels.
Smart Images

Figure CN115034461B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of computer technology, and in particular, to a method and apparatus for predicting time series for layered services. Background Art
[0002] A time series (or dynamic series) is a series of values of the same statistical indicator arranged in the order of their occurrence. The main purpose of time series analysis is to predict the future based on existing historical data. Time series prediction can be applied to various scenarios, such as the time series prediction of customer flow in commodity supermarkets, the time series prediction of funds in financial services, the prediction of computing resource flow required in cloud computing, logistics demand, and power consumption in smart grids, etc. The prediction results can serve business decisions, for example. With the development of artificial intelligence, machine learning models can be used for time series analysis.
[0003] Hierarchical time series is a special kind of time series that can describe related businesses from multiple levels, making the time series have a hierarchical structure. For example, the time series of sales of large supermarkets can have a hierarchical structure according to the hierarchical structure of their geographical locations, such as being divided into the following multiple levels: national total sales time series; sales time series of each province and city; sales time series of each store; etc. How to make full use of the time series information of the hierarchical structure is an important issue in time series prediction. Summary of the invention
[0004] One or more embodiments of the present specification describe a method and device for time series prediction for layered services, to solve one or more problems mentioned in the background technology.
[0005] According to a first aspect, a time series prediction method for layered services is provided, which is used to predict a time series consisting of business volumes of business entities on multiple levels on predetermined business indicators, wherein a single level corresponds to at least one business entity; the method comprises: obtaining each historical time series corresponding to each business entity in the multiple levels, a single historical time series comprising each business volume corresponding to a single business entity in a plurality of predetermined time periods arranged in sequence; encoding each historical time series to obtain corresponding encoding vectors; determining a joint probability distribution satisfied by each encoding vector; based on each sampling sequence obtained by sampling each business entity according to the joint probability distribution, determining each prediction sequence for each business entity, wherein a single prediction sequence describes each business volume of a single business entity in a plurality of subsequent predetermined time periods, and each prediction sequence satisfies a consistency constraint, wherein for any subsequent time period, the business volume of a single business entity at a higher level is consistent with the sum of the business volumes of each business entity corresponding to it at a lower level.
[0006] In one embodiment, the consistency constraint is described by a predetermined optimization matrix; the determination of each prediction sequence for each business subject based on each sampling sequence obtained by sampling each business subject according to the joint probability distribution includes: taking the sampling matrix obtained by sequentially arranging each sampling sequence as a preliminary prediction result; and adjusting the preliminary prediction result using the optimization matrix so that it satisfies the consistency constraint, thereby obtaining each prediction sequence.
[0007] In a further embodiment, the optimization matrix is determined based on the hierarchical structure of each business entity in the multiple levels, and is formed by concatenating the unit matrix used to describe the business entity at the lowest level and the inverse matrix of the sum matrix describing the business entities at other levels, or by concatenating the negative unit matrix with the sum matrix.
[0008] In a further embodiment, the business entities at the lowest level correspond one-to-one to the rows / columns of the corresponding unit matrix, and the single business entities at other levels correspond to a single row / column in the matrix, which is formed by superimposing the rows / columns of the corresponding unit matrix on the business entities corresponding to the single business entity at the lowest level.
[0009] In another embodiment, the consistency constraint is limited by the product of the optimization matrix and the sampling matrix being 0, and the use of the optimization matrix to adjust the preliminary prediction results so that they satisfy the consistency constraint, thereby obtaining each prediction sequence includes: under the consistency constraint, solving the timing matrix that minimizes the gap with the preliminary prediction results, as the prediction matrix obtained by prediction; determining each prediction sequence according to each row / column in the prediction matrix.
[0010] In one embodiment, the gap between the timing matrix and the preliminary prediction result is measured by the modulus of the difference between the timing matrix and the sampling matrix.
[0011] In one embodiment, the encoding of each historical time series is implemented by one of the following neural networks: a single recurrent neural network; an unfolded recurrent neural network consisting of multiple recurrent neural networks corresponding to each business entity.
[0012] In one embodiment, the joint probability distribution is a multivariate Gaussian distribution, and the multivariate Gaussian distribution corresponds to a first mean matrix and a first covariance matrix, and a single sampling sequence is determined in the following manner: sampling a first vector in a standardized multivariate Gaussian distribution, wherein the mean matrix of the standardized multivariate Gaussian distribution is a 0 matrix, and the covariance matrix is a unit matrix; determining the single sampling sequence based on a superposition result of superimposing the first mean matrix on the product of the quadratic root of the first covariance matrix and the first vector.
[0013] According to a second aspect, a time series prediction device for layered services is provided, which is used to predict the time series of business volumes of business entities at multiple levels on predetermined business indicators, wherein a single level corresponds to at least one business entity; the device comprises:
[0014] An acquisition unit is configured to acquire each historical time series corresponding to each business subject in the multi-level hierarchy, wherein each historical time series corresponds to each business volume corresponding to each business subject in a plurality of predetermined time periods arranged in sequence;
[0015] An encoding unit configured to encode each historical time series to obtain corresponding encoding vectors;
[0016] A mapping unit configured to determine a joint probability distribution satisfied by each encoding vector;
[0017] The prediction unit is configured to determine each prediction sequence for each business subject based on each sampling sequence obtained by the sampling module sampling each business subject according to the joint probability distribution, wherein a single prediction sequence describes each business volume of a single business subject in a plurality of subsequent predetermined time periods, and each prediction sequence satisfies a consistency constraint, and the consistency constraint includes: for any subsequent time period, the business volume of a single business subject at a higher level is consistent with the sum of the business volume of at least one business subject corresponding to it at a lower level.
[0018] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed in a computer, the computer is caused to execute the method of the first aspect.
[0019] According to a fourth aspect, a computing device is provided, comprising a memory and a processor, wherein an executable code is stored in the memory, and when the processor executes the executable code, the method of the first aspect is implemented.
[0020] Through the method and device provided in the embodiments of this specification, in the time series prediction process for layered services, the time series of each level are mapped to a high-order vector and a joint probability distribution is constructed, so as to consider the correlation of the time series of each level, and resample according to the joint probability distribution to obtain the corresponding predicted time series. This prediction method makes full use of the correlation between business data at different levels to achieve information fusion, thereby improving the accuracy of the prediction results. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0022] Figure 1 A specific architectural diagram showing hierarchical timing issues;
[0023] Figure 2 A flow chart of an improved time series prediction method for layered services is shown;
[0024] Figure 3 A schematic diagram of a historical time series processing architecture according to a specific example is shown;
[0025] Figure 4 A schematic block diagram of a time series prediction device for layered services according to an embodiment is shown. DETAILED DESCRIPTION
[0026] The technical solution provided in this specification is described below in conjunction with the accompanying drawings.
[0027] Figure 1 A specific architecture diagram showing the hierarchical timing problem. Figure 1 As shown in the figure, in this specific application scenario, three business levels are involved. The lowest business level is the level corresponding to specific business entities (such as business entities D, E, F, G, etc.), the higher level is the level corresponding to business entities with certain comprehensive significance (such as business entities B, C, etc.), and the higher level can be the level corresponding to more comprehensive business entities (such as business entity A, etc.). The business entity here can be an entity that can independently distinguish and count the corresponding business, such as a store, a category of goods, goods or stores in a region, and so on. Figure 1 A hierarchical business problem with a three-level structure is shown in FIG. 1 . In practice, the hierarchical business structure may have more (eg, 8 levels) or fewer levels (eg, 2 levels), which is not limited here.
[0028] A single business subject can correspond to a certain amount of business volume for the corresponding business indicators in a single time period. The business volume of multiple time periods constitutes a time series. Figure 1 For example, business entity A (such as a large supermarket with stores across the country) corresponds to time series y. A,t (such as the sales volume business indicator describing the sales business), business entity B (such as a large supermarket store in North China) corresponds to the time series y B,t , business entity D (such as a large supermarket store in South China) corresponds to the time series y D,t , etc. Among them, each time period of the sampling time series can be continuous or discontinuous, and this specification does not limit this. For example, in one embodiment, a single time period is a week, and data from multiple consecutive weeks constitute a time series. In another embodiment, a single time period is a Monday, and data from multiple Mondays constitute a time series, but the time between two adjacent Mondays is discontinuous.
[0029] Among them, according to different specific business scenarios, the business subjects at each level are also different, and the corresponding business indicators are also different. For example, in the shopping platform scenario, the lowest level can correspond to each merchant, and the corresponding business indicator is, for example, sales volume, and the corresponding time period can be one week, one day, one month, etc. The higher level can correspond to a small category of business subjects, such as merchants in categories such as kitchen appliances, newborn clothes, and home decoration materials, and the higher level can correspond to a larger category of business subjects, such as merchants in categories such as electrical appliances, clothing, and building materials. Similarly, in the investment and financial management scenario, the highest level can correspond to various investment channels, such as insurance, funds, fixed deposits, stocks, etc., and the higher level can correspond to various investment objects, such as insurance companies, fund units, banks, stock subject categories, etc. The lower level corresponds to various specific investment methods, such as insurance types, fund types, bank fixed deposit product types, stock subjects, etc. The business indicators described by the time series are investment amount, investment ratio, number of investment users, etc. In other business scenarios, the business subjects of each level can also be in other forms, which will not be repeated here.
[0030] According to the meaning of layered business, the time series of business entities at adjacent levels corresponding to certain business indicators have the following consistency relationship: within a single time period, the business volume corresponding to a single business entity at a higher level is the sum of the business volumes of the corresponding business entities at lower levels. Furthermore, when the time periods corresponding to the time series are consistent, the time series corresponding to a single business entity at a higher level can be the sum of the time series corresponding to the business entities at lower levels. Figure 1 As shown, there are: y A,t =y B,t +y C,t ;yB,t =y D,t +y E,t ;y C,t =y F,t +y G,t .
[0031] In such Figure 1 In the hierarchical time series forecasting process shown, candidate time series can be predicted based on the historical time series of each business entity. For example, based on the historical time series corresponding to the sales volume of each business entity in the past three months, the time series corresponding to the sales volume of each business entity in the next 30 days can be predicted.
[0032] To this end, the time series of each business entity can be predicted separately and then reconciled. For example, the time series corresponding to the sales of business entities A, B, C, D, E, F, and G in the past three months can be independently predicted, and then the prediction results can be reconciled so that the final prediction results meet the consistency constraints. For example, the time series predicted for A is the sum of the time series predicted for B and C, the time series predicted for B is the sum of the time series predicted for D and E, and the time series predicted for C is the sum of the time series predicted for F and G.
[0033] In fact, there may be a correlation between the time series of various business entities. For example, when the sales of maternal and infant products continue to rise, the sales of a single maternal and infant store with low historical sales will also continue to rise in the future. For another example, when the proportion of insurance, fund, and stock investment continues to rise, the proportion of fixed deposit investment decreases. Therefore, this specification provides a time series prediction solution for layered businesses, which establishes a joint probability distribution between the historical time series of various business entities and explores the correlation between the time series of various business entities, so as to more accurately predict the future time series of various business entities.
[0034] Reference below Figure 2 A specific example is shown to describe the technical concept of this specification.
[0035] like Figure 2 As shown, a time series prediction process for layered services in one embodiment is shown. The execution subject of the process can be a computer, device or server with certain computing capabilities. The process can be implemented with the assistance of a machine learning model. The corresponding machine learning model can be called a prediction model according to its function. For the convenience of description, Figure 2 In the illustrated embodiment, it can be assumed as an example that the business entity hierarchy includes at least a first level (such as Figure 1 The level where B and C are located) and the second level (such as Figure 1If it is assumed that any business subject at the first level corresponds to N second business subjects at the second level, the current time series prediction process for layered business can predict the time series of each business subject including these N+1 business subjects on the predetermined business indicators.
[0036] like Figure 2 As shown, the time series prediction process for layered services may include the following steps: Step 201, obtaining each historical time series corresponding to each business subject in multiple hierarchical levels, wherein a single historical time series corresponds to each business volume corresponding to a single business subject in a plurality of predetermined time periods arranged in sequence; Step 202, encoding each historical time series to obtain corresponding encoding vectors; Step 203, determining the joint probability distribution satisfied by each encoding vector; Step 204, determining each prediction sequence for each business subject based on a sampling sequence obtained by sampling each business subject according to the joint probability distribution, wherein a single prediction sequence describes each business volume of a single business subject in a plurality of subsequent predetermined time periods, and each prediction sequence satisfies a consistency constraint, and the consistency constraint includes: for any subsequent time period, the business volume of a single business subject at a higher hierarchical level is consistent with the sum of the business volumes of each business subject corresponding to it at a lower hierarchical level.
[0037] First, in step 201, each historical time series corresponding to each service subject in the multi-level hierarchy of the layered service is obtained. It can be understood that the layered service can correspond to multiple levels, such as Figure 1 There are three levels in each level. There is at least one business subject in each level, and each lower level corresponds to a higher-level business subject in the higher level, for example, corresponding to a more general type of business subject in the higher level. On the other hand, a single higher-level business subject corresponds to at least one lower-level business subject in the lower level.
[0038] The business volumes corresponding to each single business subject in the sequentially arranged historical multiple predetermined time periods can constitute a single historical time series. A single predetermined time period can be set according to business needs, such as one day, one week, one month, etc. Multiple time periods can be continuous or discontinuous in time. Taking a single predetermined time period of 1 day as an example, assuming that multiple time periods are continuous, such as sampling sales for multiple consecutive days, then for a single merchant as a business subject, the sales sampled for multiple consecutive days (such as 60 days) can be used as its historical time series. Assuming that multiple time periods are discontinuous, such as sampling only weekend sales, then for a single merchant as a business subject, the sales sampled for multiple weekends (such as 52 weekends) can be used as its historical time series. The historical time series can be represented by a multi-dimensional vector, array, or by a set, etc., which is not limited here. Taking the hierarchical business including the aforementioned first level and second level as an example, for the first business subject in the first level and its corresponding N business subjects in the second level, one-to-one corresponding N+1 historical time series can be obtained. Each historical time series can be represented by a matrix or by each vector, which is not limited here.
[0039] In an optional embodiment, a single business volume data in a historical time series can also be represented by data of multiple dimensions, and a single dimension of a single historical time series can be expanded into multi-dimensional data. As an example, if a single business volume data corresponds to 2-dimensional data (such as data of two dimensions of passenger flow and sales volume, in which case the predetermined business indicators can be two business indicators of passenger flow and sales volume), then the business volume of 60 time periods can correspond to a 120-dimensional vector or array, or to a 2×60-dimensional matrix, and so on.
[0040] Next, in step 202, each historical time series is encoded to obtain corresponding encoding vectors. It can be understood that for a single historical time series, the specific business volume of a single business entity in a certain period can be described. In order to represent it abstractly, the historical time series can be encoded to explore the deep correlation between each business volume in the time series. In a possible design, step 202 can be implemented by any reasonable model, such as a recurrent neural network (RNN), a neural network based on an attention mechanism, BERT, etc. The model that implements step 202 can be called an encoding module.
[0041] Since historical time series usually have causal correlation and periodicity, it is preferred to use a recurrent neural network (RNN) to process them. In one embodiment, each historical time series can be processed separately by a recurrent neural network. In this case, the historical time series of a single business entity can be regarded as the input features corresponding to multiple time points. Through the processing of the recurrent unit of the recurrent neural network, the processing result can be obtained as the encoding result for the corresponding historical time series. In another embodiment, the matrix composed of multiple historical time series can also be processed by an unrolled recurrent neural network (Unrolling RNN). Figure 3 As shown, for example, each historical time series can be described in matrix form, and the recurrent unit of the recurrent neural network is unfolded and flattened into multiple copies (i.e., unfolding the recurrent neural network). In this way, a single recurrent unit corresponds to a single business entity, and the output result of a single recurrent unit corresponds to the encoding result of a historical time series. For example, N+1 recurrent units output the encoding results of N+1 business entities.
[0042] In an optional implementation, when the data of a single business subject in a single time period is multi-dimensional, the single input data processed by a single loop unit can be the corresponding multi-dimensional data. The encoding result for an encoding object can be in vector form, for example, called an encoding vector. The encoding vector can have a higher dimension than the time series to better describe the time series.
[0043] Then, according to step 203, the joint probability distribution satisfied by each coding vector is determined. Among them, the joint probability distribution is referred to as the joint distribution, which is the probability distribution of random variables composed of two or more random variables. The joint probability distribution is, for example, a multivariate Gaussian distribution, a multivariate exponential distribution, a multivariate Poisson distribution, a multivariate student-T distribution, and the like. The joint probability distribution in this specification can be a distribution applicable to data statistical scenarios such as a multivariate Gaussian distribution and a multivariate student-T distribution. This article describes the multivariate Gaussian distribution as an example. The multivariate Gaussian distribution can be regarded as a joint Gaussian distribution of data of multiple dimensions. For example, N+1 coding vectors can be regarded as data of N+1 dimensions, and more coding vectors can be regarded as data of more dimensions. The corresponding joint Gaussian distribution can be constructed by mining the multidimensional relationship between each coding vector.
[0044] In this specification, it is assumed that the multivariate Gaussian distribution satisfied by each coding vector is expressed in the following form:
[0045]
[0046] Where z is the standardized parameter that satisfies the Gaussian distribution (0, 1), the multivariate Gaussian distribution represented by z is the standard multivariate Gaussian distribution, x represents the variable matrix composed of various coding vectors, μ x is the mean matrix of the multivariate Gaussian distribution, Σ represents the covariance matrix corresponding to the variable matrix x, and the i-th row and j-th column are the variables x i and x j The covariance of (e.g., the covariance of the i-th coding vector and the j-th coding vector), n is the total number of service entities in each level of the layered service. Figure 1 In the architecture of the layered service shown, n = 7. When the variables are independent of each other, Σ is a diagonal matrix, z, μ x ,Σ satisfy:
[0047]
[0048] as well as:
[0049]
[0050] In a standardized multivariate Gaussian distribution, σ i 2 =1, Σ is the n×n dimensional unit matrix, each encoding vector corresponds to the standard Gaussian distribution N(0, I), I represents the unit matrix. x , Σ are the distribution parameters of the joint Gaussian distribution constructed for each encoding vector.
[0051] The process of determining the multivariate Gaussian distribution satisfied by each encoding vector can also be regarded as the mean matrix μ of the multivariate Gaussian distribution x , the process of determining the covariance matrix Σ. By extension, the process of determining other joint probability distributions for each coding vector can also be regarded as the process of determining other parameters of other joint probability distributions besides the independent variables.
[0052] Further, in step 204, based on the sampling sequences obtained by sampling each business subject according to the joint probability distribution, each prediction sequence for each business subject is determined. In practice, sampling can be performed for each business subject that needs to predict the time series to obtain each sampling sequence. Among them, the business subject that needs to predict the time series can be all business subjects in the layered business, or it can be part of the business subjects, which is not limited here.
[0053] It can be understood that due to some statistical characteristics of the hierarchical structure, in the historical time series, the bottom-level time series is based on the description of the business scenario in the previous article, and the business volume (or time series) of each business subject is mutually constrained. That is, the business volume (or time series) of a business subject in a high-level layer is the sum of the business volume (or time series) of each business subject corresponding to it in a certain lower-level layer. For example Figure 1 In the example shown, the time series corresponding to business subject B is the sum of the time series corresponding to business subjects D and E. This can also be called a consistency constraint. Figure 2 In the illustrated embodiment, the consistency constraint includes: the sum of the prediction sequence corresponding to the first business subject and the prediction sequences of the corresponding N business subjects.
[0054] Since the business volumes of business entities at other levels are determined by adding up the business volumes of business entities at the lowest level, in a possible design, during the sampling process, the business entities at the lowest level can be sampled first, and then the corresponding sampling results can be added up as the sampling results of higher levels. Figure 1 In the example, the prediction sequences corresponding to business entities D, E, F, and G are directly sampled from the joint probability distribution, and then the prediction sequence corresponding to business entity B is determined based on the prediction sequence corresponding to business entities D and E, and the prediction sequence corresponding to business entity C is determined based on the prediction sequence corresponding to business entities F and G, and then the prediction sequence corresponding to business entity A is determined based on the prediction sequence corresponding to business entities B and C. In this way, it can be ensured that each prediction sequence meets the consistency constraint.
[0055] According to another possible design, in order to ensure the randomness of sampling, a corresponding sampling sequence can be sampled from the joint probability distribution for each business subject as a preliminary prediction result, and the consistency constraint between each business subject can be achieved by adjusting the preliminary prediction result. In particular, according to one embodiment, the sampling result is obtained by using a sampling matrix composed of each sampling sequence. Description, the preliminary prediction results can be adjusted by a predetermined matrix to obtain a prediction result that satisfies consistency. The matrix used to adjust the preliminary prediction results can be called an optimization matrix. The optimization matrix can process the preliminary prediction results in a predetermined manner to make them meet the consistency constraints, such as Figure 1 The y in A,t =y B,t +y C,t ;y B,t =y D,t +y E,t ;y C,t =y F,t +y G,t .
[0056] According to the above formula, in order to construct a consistency constraint, one side of the equation describing the consistency constraint can be changed to a constant. For example, move the right side to the left or move the left side to the right, so that one side is 0. In one embodiment, the product of the optimization matrix R and the timing matrix y composed of each time series to be predicted can be used as a consistency constraint, such as recorded as Ry=0. Among them, each row / column of y can correspond to a time series to be predicted of a business entity. In order to meet the consistency constraint when Ry=0, the optimization matrix R can be constructed according to the structure of the hierarchical business entity (which can be provided in advance by the corresponding business party). According to the business volume rules of the hierarchical business entities, in the process of constructing the optimization matrix, the sum matrix can be constructed first. Since the business entities at the lowest level are independent of each other, they can be described by the unit matrix. With Figure 1 Taking the implementation architecture shown as an example, the lowest-level business entities D, E, F, and G can be described by a 4×4-dimensional diagonal matrix, namely:
[0057]
[0058] Assuming that each row of the above matrix represents a business entity, the business entities at higher levels can be represented by the vectors corresponding to the business entities at the lowest level. Figure 1 The time series of business entities A, B, and C in the higher level can all be represented by business entities D, E, F, and G in the lowest level. C,t =y F,t +y G,t Get the vector (0, 0, 1, 1) corresponding to C, according to y B,t =y D,t +y E,t Get the vector (1, 1, 0, 0) corresponding to B, and according to y A,t =y B,t +y C,t The vector corresponding to A is (1, 1, 1, 1). In this way, the matrix composed of the vectors corresponding to A, B, and C can be called a sum matrix, for example, denoted as a sum matrix S, such as:
[0059]
[0060] In order to make Ry = 0, a unit matrix representing the business entities other than the lowest level and the inverse matrix -S of the matrix S can be combined with the corresponding unit matrix I S When each row of y corresponds to a business entity, the concatenation result is recorded as R = [I S |-S], such as:
[0061]
[0062] It is easy to understand that R can also be constructed in other forms that satisfy the consistency constraint, such as the concatenation matrix of the negative identity matrix and the sum matrix. Assuming that the predicted sequence is y, under the consistency constraint Ry=0, a row of R describes a constraint, and y is regarded as a column vector represented as (y A ,y B ,y C ,y D ,y E ,y F ,y G ) T For example, the product of the first row and y describes that the difference between the predicted amount of business subject A and the predicted amount of the lowest-level business subjects D, E, F, and G in the first time period in the future is 0 (that is, equal to their sum), and so on, thereby forming a consistency constraint on the final time series matrix y.
[0063] In a specific example, in Based on this, a time series matrix y is adjusted as little as possible, so that the time series matrix y becomes the prediction matrix Y composed of the final predicted time series. For example, based on the constraint Ry=0, solve The smallest modulus y (such as ), as the prediction matrix Y. The norm here can be expressed as the first-order norm, the second-order norm, etc. For example, the time series matrix y and the sampling matrix It can be understood that, here, the prediction matrix in the pending state is represented by y, and the determined prediction matrix is represented by Y, and each row / column of Y can describe the time series predicted for a business entity.
[0064] According to a specific method, the closed-form solution can be obtained using the Lagrange multiplier method:
[0065]
[0066] In other embodiments, the initial prediction results of the sampling can also be constrained by other reasonable constraints. Optimization is performed, and other forms of optimization matrices and other solution methods are constructed accordingly, which will not be described here. When the optimization form is determined, the optimization matrix can be a hyperparameter matrix constructed based on the historical time series. In this way, the randomness of sampling is guaranteed, and the consistency of the final prediction results is also guaranteed.
[0067] The dimension of the sampling result or prediction result can be any dimension, for example, A ,y B ,y C ,y D ,y E ,y F ,y GIt can be any consistent dimension, such as 7 dimensions. In other words, the length of the forecast sequence and the length of the historical time series can be independent of each other. For example, the sales volume of 30 days can be used as the historical time series to predict the sales time series of the next 30 days, 10 days, 3 days, 40 days, etc.
[0068] It can be understood that the joint probability distribution obtained in step 203 is a complex distribution. When sampling the distribution, in order to ensure that the prediction process is differentiable and continuous, according to a possible design, a re-parameterization technique can be used for sampling. Taking the joint probability distribution as a multivariate Gaussian distribution as an example, according to the re-parameterization technique, from the distribution N(μ, σ 2 ), which is equivalent to sampling a variable ε from the standard distribution N(0,1), and then setting Z = μ + ε × σ. Specifically, in step 204, the variable z can be first sampled from the standard multivariate Gaussian distribution, that is, z ~ N(0, I), and then converted into a sampling result from a joint multivariate probability distribution, such as: The dimension of the sampled variable z can be consistent with or inconsistent with the dimension of the historical time series. The process of sampling from a standard multivariate Gaussian distribution is not described here. It can be described in matrix form: each row / column corresponds to a business entity (corresponding to a vector ), each column / row corresponds to a future time period. It can be understood that the above multivariate probability distribution is a continuous distribution. Therefore, the sampling process is for the continuous distribution, and the model parameters can be adjusted using gradient-related methods.
[0069] It is worth noting that the above prediction process can be implemented by a prediction model, and each step is implemented as each module of the prediction model. For example, step 202 is implemented by a coding module, step 203 is implemented by a mapping module, and step 204 is implemented by a sampling module. At this time, in the prediction model training process, the parameters of the coding module, the parameters of the mapping module or the joint probability distribution parameters (optionally, sampling parameters can also be included) can be used as pending parameters, and the historical time series of each business entity in the hierarchical business structure are used as sample data, and the subsequent time series of the historical time series are used as sample labels to determine the model loss and adjust each pending parameter. The model loss can be measured in various reasonable ways such as variance and cross entropy, which are not limited here. The adjustment of model parameters can adopt various suitable methods. Among them, in a continuously differentiable prediction model, gradient descent method, Newton method and other gradient-related methods can be used to adjust each pending parameter in the direction of reducing model loss. Using gradient is usually a better parameter adjustment method.
[0070] Looking back at the above process, the technical concept provided in this specification constructs a joint probability distribution by utilizing the historical time series of each business entity, integrates the time series information of business entities at all levels, fully fuses information, and mines the mutual influence of data between business entities, thereby improving the accuracy of time series prediction.
[0071] According to another embodiment, a time series prediction device for layered services is provided, which is used to predict the time series consisting of the business volume of business entities at multiple levels on predetermined business indicators, wherein a single level corresponds to at least one business entity.
[0072] Figure 4 FIG. 4 shows a time series prediction device 400 for layered services according to an embodiment. Figure 4 As shown, the device 400 includes: an acquisition unit 401, configured to acquire each historical time series corresponding to each business subject in multiple levels, and a single historical time series corresponds to each business volume corresponding to a single business subject in multiple predetermined time periods arranged in sequence; an encoding unit 402, configured to encode each historical time series to obtain corresponding encoding vectors; a mapping unit 403, configured to determine the joint probability distribution satisfied by each encoding vector; a prediction unit 404, configured to determine each prediction sequence for each business subject based on each sampling sequence obtained by sampling each business subject according to the joint probability distribution by the sampling module, wherein a single prediction sequence describes each business volume of a single business subject in multiple subsequent predetermined time periods, and each prediction sequence satisfies a consistency constraint, and the consistency constraint includes: for any subsequent time period, the business volume of a single business subject at a higher level is consistent with the sum of the business volume of at least one business subject corresponding to it at a lower level.
[0073] According to a possible design, the consistency constraint is described by a predetermined optimization matrix; the prediction unit 404 is further configured as follows:
[0074] The sampling matrix obtained by sequentially arranging each sampling sequence is used as the preliminary prediction result;
[0075] The optimization matrix is used to adjust the preliminary prediction results so as to satisfy the consistency constraints, thereby obtaining various prediction sequences.
[0076] In one embodiment, the optimization matrix is determined based on the hierarchical structure of each business entity in multiple levels, and is formed by concatenating the unit matrix used to describe the business entity at the lowest level and the inverse matrix of the sum matrix describing the business entities at other levels.
[0077] In one embodiment, the business entities at the lowest level correspond one-to-one to the rows / columns of the corresponding unit matrix, and the single business entities at other levels correspond to a single row / column in the matrix, which is formed by superimposing the rows / columns of the corresponding unit matrix on the business entities corresponding to the single business entity at the lowest level.
[0078] In some optional implementations, the consistency constraint is defined by the product of the optimization matrix and the sampling matrix being 0, and the prediction unit 404 is further configured as follows:
[0079] Under the consistency constraint, solving a time series matrix that minimizes the gap with the preliminary prediction result as the prediction matrix obtained by prediction;
[0080] Each prediction sequence is determined according to each row / column in the prediction matrix.
[0081] In one embodiment, the encoding unit 402 may be a single recurrent neural network, or an expanded recurrent neural network consisting of a plurality of recurrent neural networks corresponding one-to-one to each business entity.
[0082] In one possible implementation, the joint probability distribution is a multivariate Gaussian distribution, and the multivariate Gaussian distribution corresponds to a first mean matrix and a first covariance matrix, and the apparatus 400 further includes a sampling unit (not shown). The sampling unit is configured to determine a single sampling sequence in the following manner:
[0083] Sampling a first vector in a standardized joint probability distribution, wherein a mean matrix of the standardized joint probability distribution is a zero matrix and a covariance matrix is an identity matrix;
[0084] A single sampling sequence is determined based on a superposition result of the mean matrix on the product of the second root of the covariance matrix and the first vector.
[0085] It is worth mentioning that Figure 4 The device 400 shown is Figure 2 The method described corresponds to Figure 2 The corresponding description in the method embodiment is also applicable to the device 400 and will not be repeated here.
[0086] According to another embodiment, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute a combination of Figure 2 The method described by et al.
[0087] According to another embodiment of the present invention, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the Figure 2 The method described by et al.
[0088] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of this specification can be implemented by hardware, software, firmware, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.
[0089] The specific implementation methods described above further explain in detail the purpose, technical solutions and beneficial effects of the technical concept of this specification. It should be understood that the above description is only the specific implementation method of the technical concept of this specification, and is not used to limit the protection scope of the technical concept of this specification. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the embodiments of this specification should be included in the protection scope of the technical concept of this specification.
Claims
1. A time series prediction method for hierarchical business, used to predict the time series of business volume of business entities at multiple levels on predetermined business indicators, wherein the predetermined business indicator is one of the following: computing resource flow required for cloud computing, power consumption in smart grids, and logistics demand; wherein: A single layer corresponds to at least one business entity; the method comprises: Acquire each historical time series corresponding to each business subject in the multi-level hierarchy, wherein a single historical time series includes each business volume corresponding to each business subject in a plurality of predetermined time periods arranged in sequence; Encode each historical time series to obtain the corresponding encoding vectors; Determine the joint probability distribution satisfied by each encoding vector; Based on each sampling sequence obtained by sampling each business subject according to the joint probability distribution, each prediction sequence for each business subject is determined, wherein a single prediction sequence describes the business volume of a single business subject in multiple subsequent predetermined time periods, and each prediction sequence satisfies a consistency constraint, and the consistency constraint includes: for any subsequent time period, the business volume of a single business subject at a higher level is consistent with the sum of the business volumes of each corresponding business subject at a lower level.
2. The method according to claim 1, wherein: The consistency constraint is described by a predetermined optimization matrix; the determination of each prediction sequence for each business subject based on each sampling sequence obtained by sampling each business subject according to the joint probability distribution includes: The sampling matrix obtained by sequentially arranging each sampling sequence is used as the preliminary prediction result; The optimization matrix is used to adjust the preliminary prediction results so as to satisfy the consistency constraint, thereby obtaining various prediction sequences.
3. The method according to claim 2, wherein: The optimization matrix is determined based on the hierarchical structure of each business entity in the multiple levels, and is formed by concatenating the unit matrix used to describe the business entity at the lowest level and the inverse matrix of the sum matrix describing the business entities at other levels, or by concatenating the negative unit matrix with the sum matrix.
4. The method according to claim 3, wherein: The business entities at the lowest level correspond one-to-one to the rows / columns of the corresponding unit matrix, and the single business entities at other levels correspond to a single row / column in the matrix, which is formed by superimposing the rows / columns of the corresponding unit matrix on the business entities corresponding to the single business entity at the lowest level.
5. The method according to claim 2, wherein: The consistency constraint is defined by the product of the optimization matrix and the sampling matrix being 0, and the use of the optimization matrix to adjust the preliminary prediction result so that it satisfies the consistency constraint, thereby obtaining each prediction sequence includes: Under the consistency constraint, solving the time series matrix with the smallest difference from the preliminary prediction result as the prediction matrix obtained by prediction; Each prediction sequence is determined according to each row / column in the prediction matrix.
6. The method according to claim 5, wherein: The difference between the timing matrix and the preliminary prediction result is measured by the modulus of the difference between the timing matrix and the sampling matrix.
7. The method according to claim 1, wherein: The encoding of each historical time series is achieved by one of the following neural networks: Single recurrent neural network; An unfolded recurrent neural network consisting of multiple recurrent neural networks corresponding to each business entity.
8. The method according to claim 1, wherein: The joint probability distribution is a multivariate Gaussian distribution, and the multivariate Gaussian distribution corresponds to a first mean matrix and a first covariance matrix. The single sampling sequence is determined in the following manner: Sampling a first vector in a standardized multivariate Gaussian distribution, wherein a mean matrix of the standardized multivariate Gaussian distribution is a zero matrix and a covariance matrix is a unit matrix; The single sampling sequence is determined based on a superposition result of superimposing the first mean matrix on the product of the second root of the first covariance matrix and the first vector.
9. A time series prediction device for hierarchical business, used to predict the time series of business volume of business entities at multiple levels on predetermined business indicators, wherein the predetermined business indicator is one of the following: computing resource flow required for cloud computing, power consumption in smart grids, and logistics demand; wherein, A single layer corresponds to at least one business entity; the device comprises: An acquisition unit is configured to acquire each historical time series corresponding to each business subject in the multi-level hierarchy, wherein each historical time series corresponds to each business volume corresponding to each business subject in a plurality of predetermined time periods arranged in sequence; An encoding unit configured to encode each historical time series to obtain corresponding encoding vectors; A mapping unit configured to determine a joint probability distribution satisfied by each encoding vector; The prediction unit is configured to determine each prediction sequence for each business subject based on each sampling sequence obtained by sampling each business subject according to the joint probability distribution, wherein a single prediction sequence describes each business volume of a single business subject in a plurality of subsequent predetermined time periods, and each prediction sequence satisfies a consistency constraint, wherein the consistency constraint includes: for any subsequent time period, the business volume of a single business subject at a higher level is consistent with the sum of the business volumes of each corresponding business subject at a lower level.
10. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 8.
11. A computing device comprising a memory and a processor, characterized in that: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
User behavior layered association prediction method facing mobile social environment
CN106991496A
Method and device for predicting service index
CN110009384A