A method for hidden exogenous variable discovery on a group
By employing causal discovery domain algorithms and identifiable variational autoencoder networks, the problem of unobservable exogenous variables in delivery scenarios is solved, enabling effective prediction of exogenous variables such as weather. This improves the accuracy of order acceptance rate and pricing, and enhances the performance of prediction models for delivery scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANJING UNIV
- Filing Date
- 2023-05-19
- Publication Date
- 2026-07-21
AI Technical Summary
In delivery scenarios, the unobservable nature of exogenous variables makes prediction difficult and affects the accuracy of endogenous variables. In particular, when exogenous variables such as weather are unknown, it is difficult to accurately estimate the order acceptance rate and pricing, which affects the stability of revenue.
We employ causal discovery algorithms, constructing encoder and decoder networks to discover and predict latent exogenous variables using endogenous, auxiliary, and latent exogenous variables. We train the network using a recognizable variational autoencoder algorithm to obtain the posterior distribution of the exogenous variables and update the network.
It enables effective inference of exogenous variables, improves the accuracy of endogenous variable prediction, enhances the performance of prediction models in delivery scenarios, ensures the rationality of order acceptance rate and pricing, and improves the stability of revenue.
Smart Images

Figure CN116562734B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for discovering latent exogenous variables in a group, applicable to the prediction of delivery scenarios, facilitating the discovery of latent exogenous variables in delivery scenarios, and making delivery allocation reasonable and accurate. Background Technology
[0002] In delivery scenarios, we often encounter situations where exogenous variables are unobservable. Exogenous variables are those unaffected by other variables within the model. Their values are determined by factors outside the model and are not influenced by other variables. Changes in exogenous variables can affect endogenous variables, but endogenous variables cannot affect exogenous variables. For example, if we want to predict the order acceptance rate at the next moment, factors such as the order acceptance rate and the order evaluation time are endogenous variables, changing with different order premiums. Conversely, factors like the weather and competitors' pricing strategies are exogenous variables; they exist objectively and are not affected by our actions.
[0003] In real-world delivery scenarios, exogenous variables such as weather conditions have a significant impact on order acceptance rates. If weather conditions are unknown and only information such as order surcharges and assessment times is available, it's impossible to accurately estimate order acceptance rates. This makes transfer model predictions in delivery scenarios difficult. For example, in pricing issues, it's hard to determine whether long delivery times are due to pricing problems or inclement weather, and it's also impossible to predict delivery times under different weather conditions. This severely impacts the stability of revenue from surcharges, making it difficult to price orders reasonably. Therefore, obtaining information on exogenous variables is crucial, as they help identify the true causal relationships between endogenous variables. Ignoring the influence of exogenous variables makes it difficult to predict the desired endogenous variables.
[0004] Latent exogenous variables refer to exogenous variables whose data are unavailable. This may be due to the data not being recorded or being unobservable. For example, information such as competitors' pricing strategies is often unavailable, and necessary information like weather data may not have been considered or recorded in the past. In the past, the common approach to dealing with this problem was to retain only complete data to infer the reasonableness of the bid and improve the bidding strategy. This strategy not only significantly reduces the available data but may also lead to incorrect estimations of the reasons for poor customer experience, thus negatively impacting customer satisfaction. Summary of the Invention
[0005] Objective: To address the problems and shortcomings of existing technologies, this invention provides a method for discovering latent exogenous variables in groups. It utilizes causal discovery algorithms to discover latent exogenous variables, inferring missing exogenous variables in delivery scenario data, and avoiding the impact of missing exogenous variables on delivery scenario prediction and other issues.
[0006] Technical solution: A method for discovering latent exogenous variables in a group, comprising the following steps:
[0007] S11, Obtain the required endogenous variable dataset based on system records, and obtain auxiliary variables; the system refers to any system that can obtain relevant delivery data;
[0008] S12, construct the network based on the endogenous variables, auxiliary variables, and latent exogenous variables;
[0009] S13, Discover latent exogenous variables on homogeneous groups that have the same latent exogenous variables and are sampled independently;
[0010] S14, obtain the results of the latent exogenous variables and the transition model.
[0011] The endogenous variables mentioned include state variables. and predictor variables The auxiliary variable is The latent exogenous variable is Where N is the amount of data in the dataset, d x ,d y ,d u ,d z The dimensions are defined as state variables, predictor variables, auxiliary variables, and latent exogenous variables. State variables include the current order's assessment time and order acceptance rate, the pre-given additional price, and the assessment time the rider needs to reach for that additional price. Predictor variables are the probability of order acceptance during the time interval from the current bid to the next bid. Auxiliary variables are the region IDs of the business divisions. Latent exogenous variables are the weather conditions. It is assumed that all orders in the same region have the same latent exogenous variable Z. Auxiliary variables are observable and are a new variable added in addition to endogenous variables.
[0012] The constructed network includes encoder p θ (z|y,u;x), decoder p f (y|z;x) and p λ (z|u;x), where the encoder is used to infer the latent exogenous variables based on the existing order data, the decoder is used to predict the order acceptance probability based on the latent exogenous variables and the state variables, and other networks are only used for training; specifically, the encoder takes the state variable x, the prediction variable y, and the auxiliary variable u as input and outputs the posterior distribution of the latent exogenous variables. Where μ θ , These represent the mean and variance of the Gaussian distribution of the predicted latent exogenous variable, respectively. Similarly, the decoder takes the latent exogenous variable z and the state variable x as input and outputs the posterior distribution of the predicted variable. Where μ f , p represents the mean and variance of the posterior Gaussian distribution of the predictor variable, respectively. λ Network inputs u, x output the posterior distribution of latent exogenous variables , where μ λ , These are the mean and variance of the corresponding posterior Gaussian distribution, respectively.
[0013] The specific steps for discovering latent exogenous variables in step S13, which involves finding latent exogenous variables in homogeneous groups that share the same latent exogenous variables and are sampled independently, are as follows:
[0014] S131, set the loop counter t to 0;
[0015] S132, Randomly sample n data points from the dataset collected in step S11. Where x i Let y be the state variable corresponding to the i-th data. i Let u be the predictor variable corresponding to the i-th data point. i Let z be the auxiliary variable corresponding to the i-th data point. We can consider all numbers in the same region as a homogeneous group because orders in the same region correspond to the same weather, meaning orders in the same region have the same latent variables. We obtain the latent exogenous variable z corresponding to each data point using the method of uniformly predicting latent exogenous variables for homogeneous groups. i ;
[0016] S133, according to p λ (z|u;x) Calculate the mean and variance of the posterior distribution of the corresponding latent exogenous variable for each data point. Latent exogenous variables and state data obtained through sampling The decoder can be used to obtain the mean and variance of the posterior distribution of the predictor variable.
[0017] S134, based on the Gaussian probability density function The probability density P(z) corresponding to each data point can be calculated. i |y i ,u i ;x i ),P(z i |u i ;x i ),P(y i |z i ;x i ), i = 1, ..., N, where z i These are the latent exogenous variables generated in step S132;
[0018] S135, under the assumption of independent and identically distributed data, meaning that data in the same region are sampled independently, the state variable corresponding to the group in the same region is: Predictor variables are The probability density on the group is calculated based on the loss function L = -(lnP(Y,u|z;X) - lnP(z|u,Y;X)), and the network is updated with gradients.
[0019] S136, loop counter t = t + 1. If the loop counter reaches the specified number of loops T, the loop ends; otherwise, return to step S132.
[0020] In step S132, the method for uniformly predicting latent exogenous variables for homogeneous groups and obtaining the latent exogenous variable corresponding to each data point is as follows: data in the same region u are considered as a group, resulting in K sets. u k Let N be the auxiliary variable value corresponding to the k-th region. k Let K be the number of data points in the k-th region, and K be the total number of regions. For each region, obtain the mean and variance of the posterior distribution of the latent exogenous variables of all data using the encoder. Through formula (j is the index of all data within this group) We can obtain the Gaussian distribution parameters corresponding to the uniform latent exogenous variables in each region, and sample from this distribution to obtain the latent exogenous variables z corresponding to each data in the region. j Similarly, the corresponding latent exogenous variables are calculated for all regions.
[0021] The method for calculating the probability density of data in a group in step S135 is as follows: for groups in the same region, P(z|Y,u;X)=∏ i P(z|y i ,u;x i ),P(z,Y|u;X)=∏ i P(z,y i |u;x i The loss function at the data granularity can be obtained as follows:
[0022] Finally, the latent exogenous variables are obtained by using a unified prediction method for latent exogenous variables in the same region. The method is consistent with the method for unified prediction of latent exogenous variables using homogeneous groups described in step S132 above. After predicting the distribution of latent exogenous variables corresponding to each region, the mean of this distribution is used as the latent exogenous variable corresponding to the region; the transition model is the decoder p. f (y|z;x), based on the current state variables and the obtained latent exogenous variables, i.e., the weather conditions, the order acceptance rate for the next moment can be predicted. The transition model and decoder are defined in the same way, that is, the order acceptance rate for the next moment is predicted through the state variables and latent variables. The network update part is updated in step S135.
[0023] This invention utilizes the update method of the Identifiable Variational Autoencoder (IVAE) algorithm, thus generating identifiable latent exogenous variables. Based on the obtained latent exogenous variable results and the transition model, it can be applied in various scenarios, such as in model-based reinforcement learning, assisting the model's learning process and serving as policy input to improve prediction accuracy and achieve better policies. We have also conducted experiments in a delivery scenario to demonstrate the effectiveness of the latent exogenous variable discovery method.
[0024] Beneficial Effects: To prove the correctness of generating latent exogenous variables, we constructed a delivery order simulator that can simulate real-world environments to generate random state variables, auxiliary variables, and latent exogenous variables. We simulated rider order acceptance probabilities based on real order acceptance conditions, returning the rider's order acceptance probability for the generated state variables, auxiliary variables, and latent exogenous variables. The order acceptance probability prediction logic includes the following: under the same conditions, the order acceptance probability is higher for data with higher premiums, and lower for orders with severe weather. After obtaining this data, we used our method to predict the weather conditions of the latent exogenous variables at that time, and used the Pearson correlation coefficient to determine the consistency between the generated latent exogenous variables and the real exogenous variables, where consistency is between [0,1], with higher consistency being closer to 1. We also compared the latent exogenous variables generated by the original variational autoencoder and the original identifiable variational autoencoder. Our algorithm can quickly achieve a consistency close to 1, while other algorithms cannot achieve this consistency and exhibit instability. Our algorithm significantly outperforms other algorithms in performance. Attached Figure Description
[0025] Figure 1 This is a basic flowchart of an embodiment of the present invention;
[0026] Figure 2 This is a flowchart of the algorithm for solving hidden exogenous variables on a homogeneous group in step S13 of an embodiment of the present invention.
[0027] Figure 3 To illustrate the consistency of latent exogenous variables generated by the example of this invention (PBIVAE) during training, comparative experiments were conducted, including the generation of latent exogenous variables by the original variational autoencoder (VAE) and the generation of latent exogenous variables by the identifiable variational autoencoder (IVAE). Detailed Implementation
[0028] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. After reading the present invention, any modifications of the present invention in various equivalent forms by those skilled in the art will fall within the scope defined by the appended claims.
[0029] like Figure 1 As shown, firstly, the required state variables and predictor variables are obtained from the delivery system records. State variable X includes the current order assessment time and order acceptance rate, the additional surcharge we provide, and the assessment time the rider needs to achieve for that surcharge. The predictor variable Y is the order acceptance rate for the next moment. Additionally, auxiliary variable U (region ID) and latent exogenous variable Z (current weather conditions) are obtained. Then, a relevant network is constructed based on state variable X, predictor variable Y, auxiliary variable U, and latent exogenous variable Z, including encoder p. θ (z|y,u;x), decoder p f (y|z;x) and p λ (z|u;x), all output in Gaussian distribution form. Next, based on the obtained data and the network, the data in the same region u will be grouped together, and a unified prediction method will be used to discover latent exogenous variables within this group. Finally, we will obtain the latent exogenous variable results and transition model based on the solved network.
[0030] The specific methods and processes for discovering latent exogenous variables are as follows: Figure 2 As shown, the process will be explained below based on a delivery scenario. First, we aim to infer the weather conditions at the time using the collected state and predictor variable data, i.e., the latent exogenous variable Z, and define the latent exogenous variable as having only one dimension: weather conditions. For our selected auxiliary variables, the weather conditions within the same area are generally similar, and there are a total of 10 areas K = {1, 2, ..., 10}. After initializing the network, we begin solving for the exogenous variables.
[0031] First, set the counter to 0. Then, sample the dataset to obtain n data points. Subsequent operations will be performed on these n data points. Group the data points in the same region u as a single group to obtain 10 sets O. k ={(x j ,u j )|u j =k}, k = 1, 2, ..., 10. For group O1 in the first region, input the data into encoder p. θ (z|y,u;x) yields the mean and variance of the posterior distribution. Through formula The Gaussian distribution parameters of the latent exogenous variables in the first region corresponding to group O1 can be obtained, and the posterior values of all latent exogenous variables in group O1 are uniformly assigned to this distribution. The latent exogenous variable z is obtained by sampling on this distribution for all data in this region. j Using this method, the corresponding latent exogenous variables for each of the 10 regions were calculated to obtain the dataset. Input all n data points into network p f(y|z;x) and p λ (z|u;x) can be used to obtain the Gaussian distribution parameters as follows:
[0032]
[0033] Next, we use the probability density function. The probabilities of the actual data appearing in the estimated posterior probabilities are calculated as follows:
[0034]
[0035]
[0036] Under the assumption of independent and identically distributed (i.i.d.), meaning that data in the same region u are sampled independently, data in the same region u have...
[0037] P(z|Y,u;X)=∏ i P(z|y i ,u;x i ),P(z,Y|u;X)=∏ i P(z,y i |u;x i Furthermore, the loss function on the group is L = -(lnP(Y,u|z;X) - lnP(z|u,Y;X)), which yields the loss function at the data granularity. At this point, calculate the loss function for all n sampled data points and update the gradient of the network.
[0038] After each network update, the loop counter is incremented by 1, and it is checked whether the loop count T = 20000 has been reached. If the loop count has been reached, the network training part ends; otherwise, the training returns to the data sampling part.
[0039] After training, it is necessary to obtain the latent exogenous variable, weather conditions. The method for solving the latent exogenous variable distribution is the same as the calculation method for sampling z during training. That is, all data are grouped according to region ID, and the encoder is used to calculate the posterior distribution of the uniformly predicted latent exogenous variable on all data corresponding to each region. Then, the mean of this distribution is used as the latent exogenous variable corresponding to all data in that region. At the same time, the decoder p obtained during training... f (y|z;x) can predict the order acceptance rate at the next moment based on the current state x and the weather condition z, thus achieving the prediction of the transfer.
[0040] This example only uses the order acceptance rate as a one-dimensional predictor variable. In real-world scenarios, if other predictor variables need to be added, the current network can be expanded. Furthermore, this invention can be applied not only to the discovery of latent exogenous variables in delivery scenarios but also to other fields, such as inferring certain unobservable individual characteristics of patients in medical medication or the condition of ground outside the field of view in autonomous driving. The invention has a wide range of applications and is convenient and simple to use.
Claims
1. A method for discovering latent exogenous variables in a group, characterized in that, Includes the following steps: S11, Obtain the required endogenous variable dataset based on system records, and obtain auxiliary variables; S12, construct the network based on the endogenous variables, auxiliary variables, and latent exogenous variables; S13, Discover latent exogenous variables on homogeneous groups that have the same latent exogenous variables and are sampled independently; S14, obtain the results of latent exogenous variables and the transition model; The endogenous variables include state variables and predictor variables; the state variables include the current order's assessment time and order acceptance rate, the pre-given additional price, and the assessment time the rider needs to achieve for that additional price; the predictor variable is the probability of order acceptance during the time interval from the current bid to the next bid; the auxiliary variable is the region ID of the business segment; the latent exogenous variable is the weather condition; it is assumed that all orders in the same region have the same latent exogenous variables. Auxiliary variables are observable; they are new variables added in addition to endogenous variables. The specific steps for discovering latent exogenous variables in step S13, which involves finding latent exogenous variables in homogeneous groups that share the same latent exogenous variables and are sampled independently, are as follows: S131, set the loop counter t to 0; S132, Randomly sample from the dataset collected in step S11 Each data point contains a state variable, a predictor variable, and an auxiliary variable; the latent exogenous variable corresponding to each data point is obtained using a method that uniformly predicts latent exogenous variables for homogeneous groups. S133, calculate the mean and variance of the posterior distribution of the latent exogenous variable for each data point. Using the latent exogenous variable and state data obtained by sampling, the decoder is used to obtain the mean and variance of the posterior distribution of the predictor variable. S134, calculate the probability density corresponding to each data point based on the Gaussian distribution probability density function; S135, under the assumption of independent and identically distributed data, i.e., data in the same region are sampled independently, the state variables and prediction variables corresponding to the groups in the same region are obtained, the probability density of the groups is calculated according to the loss function, and the gradient is updated for the network. S136, Cyclic Counter If the loop counter reaches the specified number of loops If the condition is met, the loop ends; otherwise, return to step S132.
2. The method for discovering latent exogenous variables in a group according to claim 1, characterized in that, The endogenous variables mentioned include state variables. and predictor variables The auxiliary variable is The latent exogenous variable is ,in For the amount of data in the dataset, These are defined as the dimensions of state variables, predictor variables, auxiliary variables, and latent exogenous variables, respectively.
3. The method for discovering latent exogenous variables in a group according to claim 1, characterized in that, The network being built includes an encoder. decoder and The encoder is used to infer the latent exogenous variables based on the order data at that time, the decoder is used to predict the order acceptance probability based on the latent exogenous variables and state variables at that time, and the other networks are only used for training; the encoder's input state variables Predictor variables and auxiliary variables Output the posterior distribution of the latent exogenous variables. ,in These are the mean and variance of the Gaussian distribution used to predict latent exogenous variables, respectively. Similarly, the decoder input latent exogenous variables Output the posterior distribution of the predictor variables ,in These are the mean and variance of the posterior Gaussian distribution of the predictor variables, respectively. Network input Output the posterior distribution of the latent exogenous variables. ,in These are the mean and variance of the corresponding posterior Gaussian distribution, respectively.
4. The method for discovering latent exogenous variables in a group according to claim 1, characterized in that, The specific steps for discovering latent exogenous variables in step S13, which involves finding latent exogenous variables in homogeneous groups that share the same latent exogenous variables and are sampled independently, are as follows: S131, set the loop counter t to 0; S132, Randomly sample from the dataset collected in step S11 Data ,in For the first The state variables corresponding to each data point For the first The predictor variable corresponding to each data point For the first The auxiliary variables corresponding to each data point are obtained by using a method that uniformly predicts latent exogenous variables for homogeneous groups. ; S133, according to the decoder Calculate the mean and variance of the posterior distribution of the corresponding latent exogenous variable for each data point. Latent exogenous variables and state data obtained through sampling Use the decoder to obtain the mean and variance of the posterior distribution of the predictor variable. ; S134, based on the Gaussian probability density function Calculate the probability density corresponding to each data point. ,in These are the latent exogenous variables generated in step S132; S135, under the assumption of independent and identically distributed data, i.e., data in the same region are sampled independently, the state variable corresponding to the group in the same region is: The predictor variable is According to the loss function Calculate the probability density over the group and update the gradient of the network; S136, Cyclic Counter If the loop counter reaches the specified number of loops If the condition is met, the loop ends; otherwise, return to step S132.
5. The method for discovering latent exogenous variables on a group according to claim 4, characterized in that, In step S132, the method for uniformly predicting latent exogenous variables for homogeneous groups and obtaining the latent exogenous variables corresponding to each data point is as follows: [The text abruptly ends here, likely due to an incomplete sentence or a missing section.] The data above is a group, obtained a set , For the first The auxiliary variable values corresponding to the region, For the first The amount of data in each region The total number of regions; for each region, obtain the mean and variance of the posterior distribution of the latent exogenous variables of all data according to the encoder. Through formula We obtain the Gaussian distribution parameters corresponding to the uniform latent exogenous variables in each region, and sample from this distribution to obtain the latent exogenous variables corresponding to each data point in the region. Similarly, the corresponding latent exogenous variables are calculated for all regions.
6. The method for discovering latent exogenous variables in a group according to claim 4, characterized in that, The method for calculating the probability density of data in a group in step S135 is as follows: for groups in the same region, The loss function obtained at the data granularity is: .
7. The method for discovering latent exogenous variables on a group according to claim 4, characterized in that, Finally, latent exogenous variables were obtained by using a unified prediction method for latent exogenous variables in the same region. This method, consistent with the unified prediction method for homogeneous groups, uses the mean of the latent exogenous variable distribution for each region as the corresponding latent exogenous variable after predicting the distribution. The transition model is the decoder. Based on the current state variables and the obtained latent exogenous variables, namely the weather conditions, the order acceptance rate for the next moment can be predicted.