Model training method and passenger flow prediction method

By performing multi-dimensional feature extraction and neural network model training on historical passenger flow data, high-frequency prediction of scenic spot passenger flow in any period of time is achieved, the problem that cannot be effectively predicted in the existing technology is solved, and the efficiency of scenic spot resource management and network optimization is improved.

CN119721333APending Publication Date: 2025-03-28CHINA TELECOM CORP LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411750574.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

The existing technology is difficult to predict the high frequency of tourist traffic in scenic spots at any time, and cannot effectively respond to the changes in scenic spot management and wireless networks in the short term.

Method used

By obtaining multi-dimensional data of historical passenger flow, including time-series and non-time-series data, using technical means such as attention deviation and residual connection, the data is converted into target feature vectors and trained based on neural network models to predict the probability distribution of passenger flow in the future time period.

Benefits of technology

It realizes accurate prediction of the passenger flow of scenic spots at any time, provides high-frequency data support, helps scenic spot managers and operators to reasonably arrange resources, improve service quality and management efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119721333A_ABST
    Figure CN119721333A_ABST
Patent Text Reader

Abstract

The invention discloses a model training method and a passenger flow volume prediction method. The model training method comprises the following steps: acquiring multi-dimensional data related to historical passenger flow volume; converting the time sequence data into a first feature vector, converting the non-time sequence data into a second feature vector, processing the first feature vector by using attention deviation to obtain a third feature vector, and performing residual connection and normalization processing on the second feature vector and the third feature vector to obtain a target feature vector; determining a target function according to the first probability and the second probability; and training the neural network model by using the target feature vector to update the encoder parameter and the decoder parameter, and obtaining the trained neural network model under the condition that the function value of the target function is greater than a first preset threshold. According to the method and the device, the technical problem that the scenic spot passenger flow cannot be predicted in any time period is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of deep learning technology, and more specifically, to a model training method and a passenger flow prediction method. Background Art

[0002] With the rapid growth of the tourism industry, its potential problems are gradually exposed. During the peak tourist season, many scenic spots, parks and amusement parks are overcrowded, which not only hinders the quality of tourism and resource protection, but also puts tremendous pressure on the wireless network. In the off-season, scenic spots may face the problem of scarce tourists, which leads to idle waste of tourism resources and network resources. Therefore, in the face of this challenge, how to use intelligent technology to guide scenic spot management and operators to expand capacity or add stations to better cope with network congestion in the peak tourist season and idle resources in the off-season has become an important issue before us.

[0003] With the rapid development of information technology and the popularization of the Internet in my country, the public can more easily obtain information related to scenic spots, such as policies and regulations, weather forecasts, etc. With the continuous advancement of big data and artificial intelligence technology, the accuracy of passenger flow forecasting has also been significantly improved, providing more possibilities for the development of the tourism industry. However, current passenger flow forecasting research still has some limitations. Most existing studies are limited to annual, quarterly or monthly forecasts, while actual scenic spot management and wireless network issues require high-frequency passenger flow forecasting data to cope with short-term changes.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The present application provides a model training method and a passenger flow prediction method to at least solve the technical problem of being unable to predict the passenger flow of a scenic spot at any time period.

[0006] According to one aspect of the present application, a model training method is provided, including: obtaining multidimensional data related to historical passenger flow, wherein the multidimensional data includes: time series data and non-time series data; converting the time series data into a first feature vector, and converting the non-time series data into a second feature vector, processing the first feature vector using attention bias to obtain a third feature vector, performing residual connection and normalization processing on the second feature vector and the third feature vector to obtain a target feature vector; determining an objective function according to a first probability and a second probability, wherein the first probability is the probability of generating a target sample given a latent variable, and the second probability is the probability distribution of the latent variable given a target sample, the first probability is determined by a decoder parameter in a neural network model, and the second probability is determined by an encoder parameter in the neural network model; training the neural network model using the target feature vector to update the encoder parameters and the decoder parameters, and obtaining a trained neural network model when the function value of the objective function is greater than a first preset threshold, wherein the trained neural network model is used to predict the probability distribution of passenger flow in a future time period.

[0007] Optionally, the first feature vector is processed using the attention bias to obtain a third feature vector, including: flattening the first feature vector into a first vector sequence; encoding different variables in the first vector sequence using the binary attention bias to obtain a second vector sequence; dividing the second vector sequence into a plurality of subsequences; multiplying the first weight matrix by the vector representation of the i-th subsequence at position m to obtain a target query vector, multiplying the second weight matrix by the vector representation of the j-th subsequence at position n to obtain a target key vector, wherein i, j, m, and n are positive integers; transposing the query vector, and summing the transposed result with The vector representations of the ijth subsequence are multiplied to obtain a first result, and the first result is multiplied by the target key vector to obtain a second result; when m is equal to n, the second result is added to the first bias term, and when m is not equal to n, the second result is added to the second bias term to obtain an attention score between the ith subsequence and the jth subsequence, wherein the first bias term is greater than the second bias term; the proportion of the attention score of any subsequence in the weighted sum of the attention scores of all subsequences is determined as the attention weight of any subsequence; and the third eigenvector is determined based on the attention weight of any subsequence.

[0008] Optionally, when m is equal to n, the first bias term is 1; when m is not equal to n, the second bias term is 0.

[0009] Optionally, the second eigenvector and the third eigenvector are residually connected and normalized to obtain a target eigenvector, including: performing residual connection and normalization on the second eigenvector and the third eigenvector to obtain a fourth eigenvector; inputting the fourth eigenvector into the first feedforward layer to obtain a fifth eigenvector and a sixth eigenvector output by the first feedforward layer; performing convolution and pooling on the fifth eigenvector, and inputting the processing result into the second feedforward layer to obtain the standard deviation of the latent variable output by the second feedforward layer; performing convolution and pooling on the sixth eigenvector, and inputting the processing result into the third feedforward layer to obtain the mean of the latent variable output by the third feedforward layer; adding random noise to the standard deviation of the latent variable to obtain a target standard deviation, combining the target standard deviation with the mean of the latent variable, and weighting the combined result to obtain the target eigenvector.

[0010] Optionally, weights are assigned to the combined results to obtain a target feature vector, including: inputting the combined results into the self-attention layer in the decoder to obtain a weighted aggregated seventh feature vector output by the self-attention layer; performing residual connection and normalization processing on the seventh feature vector to obtain an eighth feature vector; inputting the eighth feature vector into the fourth feedforward layer to obtain a ninth feature vector output by the fourth feedforward layer, performing residual connection and normalization processing on the ninth feature vector to obtain a tenth feature vector; and performing linear transformation and activation processing on the tenth feature vector to obtain a target feature vector.

[0011] Optionally, the objective function is expressed by the following formula: Where θ is the decoder parameter, is the encoder parameter, For about The expectation operation of is the second probability, P θ (x (i) |z) is the first probability, x (i) is the target sample, z is the latent variable, is the second probability and P θ (z), P θ (z) is the preset probability distribution of the latent variable.

[0012] Optionally, after obtaining the trained neural network model, the method also includes: determining the mean scaling interval score based on the actual value and predicted value of passenger flow, the number of samples, the length of the prediction interval, the upper limit predicted value of the prediction interval, the lower limit predicted value of the prediction interval, the actual value of the time step, and the length of the time series; when the mean scaling interval score is greater than a second preset threshold, adjusting the hyperparameters of the trained neural network model.

[0013] According to another aspect of the present application, a method for predicting passenger flow is also provided, comprising: obtaining target data related to passenger flow; inputting the target data into a trained neural network model to obtain a probability distribution of passenger flow in a future time period output by the trained neural network model, wherein the trained neural network model is obtained by training using the above-mentioned model training method.

[0014] According to another aspect of the present application, a model training device is also provided, including: an acquisition module for acquiring multidimensional data related to historical passenger flow, wherein the multidimensional data includes: time series data and non-time series data; a processing module for converting the time series data into a first feature vector, and converting the non-time series data into a second feature vector, processing the first feature vector using attention bias to obtain a third feature vector, performing residual connection and normalization processing on the second feature vector and the third feature vector to obtain a target feature vector; a determination module for determining an objective function based on a first probability and a second probability, wherein the first probability is the probability of generating a target sample under a given latent variable, and the second probability is the probability distribution of the latent variable under a given target sample, the first probability is determined by a decoder parameter in the neural network model, and the second probability is determined by an encoder parameter in the neural network model; a training module for training the neural network model using the target feature vector to update the encoder parameters and the decoder parameters, and obtaining a trained neural network model when the function value of the objective function is greater than a first preset threshold, wherein the trained neural network model is used to predict the probability distribution of passenger flow in a future time period.

[0015] According to another aspect of the present application, a non-volatile storage medium is also provided, the storage medium includes a stored program, wherein when the program runs, the device where the storage medium is located is controlled to execute the above model training method.

[0016] According to another aspect of the present application, an electronic device is provided, including: a memory and a processor, the processor being used to run a program stored in the memory, wherein the above model training method is executed when the program is running.

[0017] According to another aspect of the present application, a computer program is also provided, wherein the above model training method is implemented when the computer program is executed by a processor.

[0018] According to another aspect of the present application, a computer program product is also provided, which includes a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above model training method is implemented.

[0019] In the present application, the multi-dimensional data related to the historical passenger flow is obtained, wherein the multi-dimensional data includes: time series data and non-time series data; the time series data is converted into a first feature vector, and the non-time series data is converted into a second feature vector, the first feature vector is processed using attention bias to obtain a third feature vector, the second feature vector and the third feature vector are residually connected and normalized to obtain a target feature vector; the target function is determined according to the first probability and the second probability, wherein the first probability is the probability of generating a target sample under a given latent variable, and the second probability is the probability distribution of the latent variable under a given target sample, and the first probability is given by The decoder parameters in the neural network model are determined, and the second probability is determined by the encoder parameters in the neural network model; the neural network model is trained using the target feature vector to update the encoder parameters and the decoder parameters, and when the function value of the target function is greater than the first preset threshold, a trained neural network model is obtained, wherein the trained neural network model is used to predict the probability distribution of passenger flow in a future time period, thereby achieving the purpose of predicting the passenger flow of the scenic spot in any time period, thereby achieving the technical effect of reasonably arranging network resources that match the passenger flow of the scenic spot, and further solving the technical problem of being unable to predict the passenger flow of the scenic spot in any time period. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] 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:

[0021] Figure 1 is a flow chart of a model training method according to an embodiment of the present application;

[0022] Figure 2 is an architecture diagram of a deep learning model according to an embodiment of the present application;

[0023] Figure 3 is a schematic diagram of a prediction curve according to an embodiment of the present application;

[0024] Figure 4 is a structural diagram of a model training device according to an embodiment of the present application;

[0025] Figure 5 It is a hardware structure block diagram of a computer terminal according to a model training method of an embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. 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 creative work should fall within the scope of protection of this application.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0028] According to an embodiment of the present application, a method embodiment of a model training method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0029] Figure 1 is a flow chart of a model training method according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:

[0030] Step S102, obtaining multi-dimensional data related to historical passenger flow, wherein the multi-dimensional data includes: time series data and non-time series data.

[0031] Collect data related to historical passenger flow from multiple channels, including but not limited to: Time series data: such as historical daily passenger flow, mobile network traffic, etc. Non-time series data: such as weather conditions, holiday information, special event arrangements, etc. Pre-process the collected data, including data cleaning, missing value processing, outlier detection and correction, data standardization, etc., to ensure data quality and prepare for subsequent feature vector conversion.

[0032] Step S104, convert the time series data into a first eigenvector, and convert the non-time series data into a second eigenvector, use the attention bias to process the first eigenvector to obtain a third eigenvector, perform residual connection and normalization on the second eigenvector and the third eigenvector to obtain a target eigenvector.

[0033] The time series data is processed using the Time2Vec layer and converted into the first eigenvector. This step uses the periodicity and trend of the time series to enhance the expressiveness of the time features. The non-time series data is embedded and transformed to obtain the second eigenvector. This conversion process considers the categorical nature of non-time series data and uses the embedding matrix to map it to a high-dimensional space to capture potential semantic information. The attention bias is introduced through the Any-Variate Attention layer, and the first eigenvector is processed to distinguish different variables and capture complex relationships to obtain the third eigenvector. This process enhances the model's understanding of multivariate time series. The second eigenvector is residually connected with the third eigenvector to avoid information loss and gradient vanishing problems, and then normalized to ensure that the magnitude of the features is consistent to obtain the target eigenvector.

[0034] Step S106, determine the objective function based on the first probability and the second probability, wherein the first probability is the probability of generating a target sample given a latent variable, and the second probability is the probability distribution of the latent variable given a target sample, the first probability is determined by the decoder parameters in the neural network model, and the second probability is determined by the encoder parameters in the neural network model.

[0035] In the decoder, given the latent variable z, the decoder parameters are used to calculate the probability p(x|z) of generating the target sample. This probability reflects the ability of the model to generate specific time series data in the latent variable space. In the encoder, given the target sample x, the encoder parameters are used to calculate the probability distribution q(z|x) of the latent variable z. This probability distribution reflects the expression of the real data in the latent variable space. The KL divergence between the true distribution p(z|x) of the latent variable and the distribution q(z|x) assumed by the model is calculated as part of the objective function to ensure that the model's estimate of the latent variable is as close to the true distribution as possible. The error between the decoder output and the original input is calculated as another part of the objective function. The final objective function is the weighted sum of the KL divergence and the reconstruction error. By minimizing this objective function, the model is trained to learn the optimal encoder and decoder parameters.

[0036] Step S108, using the target feature vector, the neural network model is trained to update the encoder parameters and the decoder parameters, and when the function value of the target function is greater than the first preset threshold, a trained neural network model is obtained, wherein the trained neural network model is used to predict the probability distribution of passenger flow in a future time period.

[0037] Initialize the parameters of the encoder and decoder according to the architecture of the neural network. Input the target feature vector obtained in step S104 into the model to start the training process. According to the objective function defined in step S106, calculate the loss value under the current model parameters. Use the back propagation algorithm to update the parameters of the encoder and decoder according to the calculated loss value to minimize the objective function. Repeat the process of feature vector input, loss function calculation and parameter update until the function value of the objective function is lower than the preset threshold or other stopping conditions are met, such as reaching the maximum number of training rounds. During the training process, regularly test the model performance on the validation set, monitor the changes in the loss function value, ensure that the model is not overfitting, and adjust the training strategy to optimize the model performance. When the model training is completed and satisfactory performance indicators are achieved, save the trained model parameters to prepare for subsequent passenger flow predictions.

[0038] According to the above steps, multi-dimensional data related to historical passenger flow is obtained, wherein the multi-dimensional data includes: time series data and non-time series data; the time series data is converted into a first feature vector, and the non-time series data is converted into a second feature vector, the first feature vector is processed by attention bias to obtain a third feature vector, and the second feature vector and the third feature vector are residually connected and normalized to obtain a target feature vector; according to the first probability and the second probability, the target function is determined, wherein the first probability is the probability of generating a target sample under a given latent variable, and the second probability is the probability distribution of the latent variable under a given target sample, the first probability is determined by the decoder parameters in the neural network model, and the second probability is determined by the encoder parameters in the neural network model; the neural network model is trained by using the target feature vector to update the encoder parameters and the decoder parameters, and when the function value of the target function is greater than the first preset threshold, a trained neural network model is obtained, wherein the trained neural network model is used to predict the probability distribution of passenger flow in a future time period, thereby achieving the purpose of predicting the passenger flow of a scenic spot in any time period, thereby achieving the technical effect of reasonably arranging network resources that match the passenger flow of the scenic spot.

[0039] Figure 2 This is an architecture diagram of a deep learning model according to an embodiment of the present application. Figure 2 right Figure 1 The steps shown are exemplary and explanatory.

[0040] According to some optional embodiments of the present application, the first eigenvector is processed using the attention bias to obtain the third eigenvector, which can be achieved by the following method: flattening the first eigenvector into a first vector sequence; using the binary attention bias to encode different variables in the first vector sequence to obtain a second vector sequence; dividing the second vector sequence into multiple subsequences; multiplying the first weight matrix with the vector representation of the i-th subsequence at position m to obtain a target query vector, and multiplying the second weight matrix with the vector representation of the j-th subsequence at position n to obtain a target key vector, wherein i, j, m, and n are positive integers; and performing the query vector multiplication. Transpose the rows, multiply the transposed result by the vector representation of the ij-th subsequence to obtain a first result, and multiply the first result by the target key vector to obtain a second result; when m is equal to n, add the second result to the first bias term, and when m is not equal to n, add the second result to the second bias term to obtain the attention score between the ith subsequence and the j-th subsequence, wherein the first bias term is greater than the second bias term; determine the attention weight of any subsequence as the proportion of the attention score of any subsequence in the weighted sum of the attention scores of all subsequences; determine the third eigenvector according to the attention weight of any subsequence.

[0041] Optionally, when m is equal to n, the first bias term is 1; when m is not equal to n, the second bias term is 0.

[0042] Expand the first feature vector extracted from the time series data into a vector sequence, namely the first vector sequence. Ensure that all time series features are correctly ordered so that subsequent processing can capture their temporal order. For each variable in the first vector sequence, encode it using a binary attention bias. Introduce a bias term to distinguish different variables in the sequence and enhance the model's variable recognition ability when processing multivariate time series. Assume that the sequence contains multiple variables, each variable occupies a continuous position in the sequence, and use binary encoding to mark the beginning and end of the variable to help the model understand the sequence structure.

[0043] The flattened first vector sequence is divided into multiple subsequences, each of which represents a complete set of variables at a time point. For the vector representation of the i-th subsequence at position m, the first weight matrix is ​​multiplied with it to obtain the target query vector; for the vector representation of the j-th subsequence at position n, the second weight matrix is ​​multiplied with it to obtain the target key vector. This step converts the original vector into a form suitable for the attention mechanism through the mapping of the weight matrix.

[0044] The query vector is transposed and multiplied with the vector representation of the ijth subsequence to obtain the first result. This operation captures the correlation between the query vector and features at other positions in the sequence through matrix transposition and multiplication. The first result is multiplied by the target key vector to obtain the second result. The calculation of the attention score is adjusted using the bias term: when m is equal to n, that is, the comparison of the same variable at different time points, the second result is added to the first bias term to obtain the attention score; when m is not equal to n, that is, the comparison between different variables, the second result is added to the second bias term to obtain the attention score, where the first bias term is greater than the second bias term, ensuring that the model pays more attention to the comparison of the same variable at different time points.

[0045] For any subsequence, calculate the proportion of its attention score in the weighted sum of the attention scores of all subsequences. This proportion is the attention weight of the subsequence, which reflects the importance of the subsequence in the overall model. According to the attention weight of each subsequence, the first vector sequence is weighted and summed to obtain the third eigenvector. This vector comprehensively considers the weights of each subsequence in the sequence and more accurately reflects the characteristics of the time series data and the relationship between variables.

[0046] The second eigenvector (non-time series data eigenvector) is residually connected to the third eigenvector to ensure that the model can learn both time series and non-time series features and avoid the gradient vanishing problem that may occur in deep networks. The eigenvectors after residual connection are normalized to eliminate the magnitude difference between features and ensure the stability of the model during training. The residual connection and normalized eigenvectors are fused to obtain the final target eigenvector. This vector contains comprehensive information of time series and non-time series data, providing a comprehensive data expression for model training and subsequent predictions.

[0047] In summary, Figure 2 The Any-Variate Attention layer in is used to handle any number of variables by flattening all variables into a single sequence, which enables the model to consider both the time dimension and the variable dimension, thereby capturing complex relationships in multivariate time series. Since all variables are flattened into a sequence, a binary attention bias is used to distinguish different variables. The query vector and the key vector are transformed into a rotation space using a rotation matrix to better capture periodic patterns in the time series. Assuming the query vector Q(i,m) and the key vector K(j,n), where i represents the time index and m represents the variable index, the attention score calculation formula is as follows:

[0048] E ij,mn =(W Q x i,m ) T R i-j (W Kx j,n )+u (1) *I {m=n} +u (2) *I {m≠n}

[0049]

[0050] Among them, W Q x i,m and W K x j,n are the respective query vector and key vector, R i-j is the rotation matrix, which is formed by stacking the vectors generated by the sine and cosine functions, u (1) and u (2) are two learnable scalars, I {m=n} is an indicator function, which takes the value of 1 when m=n and 0 otherwise. These two terms weight and adjust the attention scores of the same variable and different variables respectively. The binary attention bias component allows the ambiguity between variables to be eliminated through the attention score and can be extended to any number of variables. Then the attention score E ij,mn Divide by the weighted sum of all attention scores to get the normalized attention weight A ij,mn .

[0051] Finally, the local time features are extracted through convolution operation, the maximum pooling operation simplifies the model and improves the efficiency of data feature utilization, the feedforward neural network adapts to the standard deviation and mean of the latent variables, and performs reparameterization techniques and sampling. The following formula is used to obtain data from the latent variable space to solve the problem of being unable to derive when sampling from a distribution with parameters. From p θ (z) is sampled to preserve the gradient information.

[0052] J θ =∫p θ (z)f(z)dz

[0053] Furthermore, the decoder consists of two self-attention layers. The first layer is used to obtain the feature vector of the decoder input. Through the multivariate self-attention mechanism, the relationship between the variables is retained and the prediction value matrix is ​​extracted. Through convolution operations and maximum pooling, the output has the same features as the encoder as the query vector of the next self-attention layer. Then the residual network is used to improve its feature extraction ability, and the normalization operation is used to eliminate the magnitude difference between the data. Finally, the vector is mapped to a low dimension through the linear layer, and the linearly transformed vector is converted into a probability distribution through the softmax layer, and the probability distribution of the future time series is output.

[0054] According to some other optional embodiments of the present application, performing residual connection and normalization processing on the second eigenvector and the third eigenvector to obtain a target eigenvector can be achieved by the following method: performing residual connection and normalization processing on the second eigenvector and the third eigenvector to obtain a fourth eigenvector; inputting the fourth eigenvector into the first feedforward layer to obtain a fifth eigenvector and a sixth eigenvector output by the first feedforward layer; performing convolution and pooling processing on the fifth eigenvector, and inputting the processing result into the second feedforward layer to obtain the standard deviation of the latent variable output by the second feedforward layer; performing convolution and pooling processing on the sixth eigenvector, and inputting the processing result into the third feedforward layer to obtain the mean of the latent variable output by the third feedforward layer; adding random noise to the standard deviation of the latent variable to obtain a target standard deviation, combining the target standard deviation with the mean of the latent variable, and weighting the combined result to obtain the target eigenvector.

[0055] The second eigenvector (non-time series data eigenvector) is residually connected with the third eigenvector (time series data eigenvector processed with attention bias). The difference between the two vectors can be directly passed to the subsequent neural network layer as an additional input to maintain the integrity of the information flow and avoid the gradient vanishing problem in the deep network. The vector after residual connection is normalized to ensure that the dimensions of the eigenvector are of similar magnitude to avoid excessive influence of certain features on model training due to their numerical size. The fourth eigenvector after residual connection and normalization is input into the first feedforward layer. The feedforward layer is usually composed of a fully connected neural network for further processing and feature extraction. The output of this layer is split into two parts, namely the fifth and sixth eigenvectors, which will be used for the subsequent calculation of standard deviation and mean, respectively.

[0056] The fifth eigenvector is convolved and pooled. Convolution is used for local feature extraction, and pooling is used for feature dimensionality reduction, reducing the amount of calculation and avoiding overfitting. The processed result is input into the second feedforward layer, and the output of this layer is the standard deviation of the latent variable. Similarly, the sixth eigenvector is convolved and pooled, and then the processed result is input into the third feedforward layer, and the output of this layer is the mean of the latent variable. Random noise is added to the standard deviation of the latent variable to obtain the target standard deviation. The introduction of random noise to achieve uncertainty estimation of the model helps the model learn the potential distribution of the data.

[0057] The target standard deviation is combined with the mean of the latent variable, and the reparameterization technique is used, that is, sampling from the normal distribution defined by the mean and standard deviation to obtain the latent variable. Then, the latent variable is weighted, that is, the latent variable is mapped into a new feature vector through the weight matrix in the model. This feature vector can be regarded as the target feature vector finally extracted by the model, which integrates the time series and non-time series information.

[0058] In some optional embodiments of the present application, weight assignment is performed on the combination result to obtain a target feature vector, which can be achieved by the following method: inputting the combination result into the self-attention layer in the decoder to obtain a weighted aggregated seventh feature vector output by the self-attention layer; performing residual connection and normalization processing on the seventh feature vector to obtain an eighth feature vector; inputting the eighth feature vector into the fourth feedforward layer to obtain a ninth feature vector output by the fourth feedforward layer, performing residual connection and normalization processing on the ninth feature vector to obtain a tenth feature vector; performing linear transformation and activation processing on the tenth feature vector to obtain the target feature vector.

[0059] The combined result of the latent variables is input to the self-attention layer in the decoder. The self-attention layer performs weighted aggregation on the input features according to the multivariate self-attention mechanism described above to obtain the seventh eigenvector that takes into account the complex relationship between the latent variables and the multivariate time series. The seventh eigenvector is residually connected, and then the vector after residual connection is normalized to ensure that the magnitude of each dimension of the eigenvector is consistent, which helps the stability and efficiency of model training. The eighth eigenvector is sent to the fourth feedforward layer, which further extracts and transforms features through a full connection operation to obtain the ninth eigenvector. The ninth eigenvector is residually connected and normalized to ensure the continuity of the information flow and the standardization of the eigenvector to obtain the tenth eigenvector. The tenth eigenvector is linearly transformed and mapped to a low-dimensional space through a linear layer (or a combination of multiple linear layers) to meet the needs of the prediction task. Subsequently, an activation function (such as ReLU, tanh or sigmoid) is applied to the result of the linear transformation to perform a nonlinear transformation to obtain the final target eigenvector. Using the target eigenvector, the output of the decoder can be linearly transformed and activated to obtain the probability distribution of future passenger flow. This probability distribution is converted into a probability distribution for predicting passenger flow through the softmax layer, providing decision makers with comprehensive prediction information about future scenic spot passenger flow.

[0060] As some optional embodiments of the present application, the objective function is expressed by the following formula: Where θ is the decoder parameter, are encoder parameters, About The expectation operation of is the second probability, P θ (x (i) |z) is the first probability, x (i) is the target sample, z is the latent variable, is the second probability and P θ (z), P θ(z) is the preset probability distribution of the latent variable.

[0061] It needs to be explained that in the probability prediction model, it is assumed that the true distribution is the result of a combination of one or more known probability distributions, whose parameters determine the distribution of the sample. When the posterior probability form is relatively simple, the parameters of these probability distributions can be calculated by maximum likelihood estimation. However, in practical applications, the posterior probability is usually too complex, which makes the integral calculation infeasible and the corresponding parameters cannot be determined by the likelihood function. In order to meet this challenge, a simple function can be used to approximate the complex posterior probability. Specifically, if a lower bound of the function f(x) can be found and optimized, an approximation of f(x) can be obtained, which is the basic principle of variational inference.

[0062] Assume that the time series value is Where N is the number of samples, represents the latent variable used to generate the probability distribution of x, and θ represents the parameters of the model. Therefore, the goal of variational inference of the entire model is to minimize the KL divergence.

[0063] D KL (q(z|x)||p(z|x))

[0064] p θ (x) = ∫p θ (z)p θ (x|z)dz

[0065] Among them, D KL (q(z|x)||p(z|x)) is the KL divergence, which measures the difference between two probability distributions q(z|x) and p(z|x), where q(z|x) is the posterior distribution of the latent variable z assumed by the model and p(z|x) is the prior distribution of the latent variable z assumed by the model. θ (x) is the probability density function of the random variable X taking the value x under the condition represented by . However, p θ (x) is not directly computable, p θ (z|x) is also difficult to solve. So assume the distribution To approximate p θ (x).

[0066] The approximate probability function of the distribution of N data points is as follows. The first part calculates the KL divergence between the two probability distributions, and the second part calculates the cross entropy loss. The model parameters θ and The loss function is used to measure the difference between the predicted value and the true value:

[0067]

[0068] Then according to You can get:

[0069]

[0070] Finally, we get the lower bound of KL divergence The larger the value of and p θ (x) is closer, so the objective function is to maximize Right now

[0071] In some optional embodiments of the present application, after obtaining the trained neural network model, the following steps can also be performed: determine the mean scaling interval score based on the actual value and predicted value of passenger flow, the number of samples, the length of the prediction interval, the upper limit prediction value of the prediction interval, the lower limit prediction value of the prediction interval, the actual value of the time step, and the length of the time series; when the mean scaling interval score is greater than the second preset threshold, adjust the hyperparameters of the trained neural network model.

[0072] It is understandable that after obtaining the trained neural network model, the trained model will be evaluated and used to predict the passenger flow of the scenic spot. First, the trained model is evaluated using the test set to understand the generalization ability and performance of the model. The various performance indicators of the model on the test set are calculated to evaluate the prediction accuracy of the model, and MAE, CRPS and MSIS are used to evaluate the prediction effect of the model. MAE is an indicator used to measure the deviation between the model prediction results and the actual observations, CRPS is used to measure the distance between the predicted distribution and the actual observations, and MSIS is used to evaluate the coverage and width of the prediction interval.

[0073] Specifically, the mean scaled interval score MSIS can be determined by the following formula:

[0074]

[0075] Among them, y i and They represent the actual value and predicted value of the scenic spot passenger flow, N represents the number of samples, F(z) is the predicted cumulative distribution function, h is the length of the prediction interval, and U t is the upper limit of the prediction interval, L t is the lower limit of the prediction interval, Y t is the true value at the tth time step, a is the significance level, n is the length of the time series, and m is the length of the seasonal cycle. In addition, the smaller the values ​​of MAE, CRPS, and MSIS are, the better the prediction effect is.

[0076] If the performance of the model does not meet the expected requirements, consider adjusting the model architecture and hyperparameters. Once the model has been evaluated and confirmed to meet the performance requirements, use the model to predict the future passenger flow of the scenic spot. Provide data such as the date, weather, holidays, whether there are activities, and mobile network traffic in the next week as input to the model, and then use the trained model to predict passenger flow.

[0077] Figure 3 is a schematic diagram of a prediction curve according to an embodiment of the present application, based on Figure 1 The model trained by the model training method shown in the figure is used to predict the change in the tourist flow of the scenic spot from June 12 to June 18, 2024. Figure 3 The graph shows the true value, predicted value, 0.5 and 0.9 confidence intervals, and the predicted value of the GRU neural network. Figure 3 It can be seen that in the process of comparing with the GRU neural network, the method proposed in this application significantly reduced the MAE, showing its obvious advantages in prediction accuracy.

[0078] Compared with the true value, the standardized MAE is 0.267, which is significantly lower than the error of the GRU neural network, indicating that this application has higher prediction accuracy. In addition, the CRPS value is 0.279, indicating that the error between the predicted distribution and the actual observation results is small, and the prediction accuracy is high. The MSIS value is 8.461, indicating that the coverage of the prediction interval is relatively sufficient, further improving the reliability of the prediction.

[0079]

[0080] In summary, compared to the existing research data which is mostly limited to annual, quarterly or monthly situations, this application breaks through this limitation and uses daily passenger flow information for prediction. This high-frequency prediction method enables us to more accurately capture the dynamic changes in scenic spot passenger flow, thereby providing accurate decision-making basis for scenic spot managers and operators. By using the operator's unique mobile network traffic data, a key dimension feature is added compared to the traditional prediction model, which improves the prediction accuracy. By adjusting the scenic spot management strategy and network expansion strategy according to the prediction results, the scenic spot management efficiency and service level can be effectively improved, thereby enhancing the customer experience.

[0081] This application approximates complex true distributions through variational inference, simplifies maximum likelihood estimation, and makes it possible to handle high-dimensional and complex posterior distributions. Combined with the Time2Vec layer and the Any-Variate Attention layer, the model can effectively capture long-term dependencies, complex relationships, and periodic patterns in time series, and improve the processing capabilities of multivariate time series. In the model evaluation stage, multiple performance indicators such as MAE, CRPS, and MSIS are used to comprehensively measure the prediction accuracy, the distance between the predicted distribution and the actual observed value, and the coverage and width of the prediction interval to ensure that the model has good generalization ability and practical application performance. Through experimental comparison, this application has higher accuracy and provides information about the uncertainty of the prediction results to understand the possible range of predictions. Therefore, this application has higher accuracy and reliability in predicting the passenger flow of scenic spots, providing better decision support for scenic spot managers and operators.

[0082] The embodiment of the present application also provides a method for predicting passenger flow, including: obtaining target data related to passenger flow; inputting the target data into a trained neural network model to obtain a probability distribution of passenger flow in a future time period output by the trained neural network model, wherein the trained neural network model is a method for predicting passenger flow using Figure 1 The model training method shown is used for training.

[0083] Specifically, relevant time series and non-time series data in the future time period are collected, including date, weather forecast, holiday information, whether an event is held, and mobile network traffic data, etc. These data will be used as model input for prediction. The collected data will be preprocessed, including data cleaning, missing value filling, outlier detection, data standardization and other steps to ensure data quality and consistency and provide accurate input for model prediction.

[0084] Using the same preprocessing method and feature extraction method as in the training process, the preprocessed predicted data is converted into feature vectors, namely the first feature vector (time series data feature vector) and the second feature vector (non-time series data feature vector). The first feature vector and the second feature vector are fused into the fourth feature vector, and the magnitude consistency and information integrity between the feature vectors are ensured through the residual connection and normalization processing described above. The fourth feature vector is used as input and sent to the trained neural network model. The self-attention mechanism and ResNet structure of the decoder part are used to output the probability distribution of passenger flow in the future time period. The decoder will generate a probability distribution reflecting possible changes in future passenger flow based on the latent variable space learned by the model and the characteristics of the predicted data.

[0085] The model outputs the probability distribution of future passenger flow, rather than a single predicted value. This provides uncertainty information about future passenger flow, allowing decision makers to have a more comprehensive understanding of the reliability of the forecast. For example, by calculating the forecast interval at different confidence levels, it can provide a decision basis for scenic area management. Based on the probability distribution of future passenger flow predicted by the model, scenic area managers and operators can formulate corresponding management strategies and network optimization plans, such as adjusting the opening hours of scenic spots, optimizing the allocation of tourism resources, formulating emergency plans, planning network expansion or adding stations, etc., to better cope with changes in passenger flow and improve service quality.

[0086] It should be noted that the preferred implementation of the above embodiment can be found in Figure 1 The relevant description of the illustrated embodiment will not be repeated here.

[0087] Figure 4 is a structural diagram of a model training device according to an embodiment of the present application, such as Figure 4 As shown, the device comprises:

[0088] The acquisition module 42 is used to acquire multi-dimensional data related to historical passenger flow, wherein the multi-dimensional data includes: time series data and non-time series data.

[0089] The processing module 44 is used to convert the time series data into a first feature vector and convert the non-time series data into a second feature vector, use the attention bias to process the first feature vector to obtain a third feature vector, perform residual connection and normalization on the second feature vector and the third feature vector to obtain a target feature vector.

[0090] The determination module 46 is used to determine the target function based on the first probability and the second probability, wherein the first probability is the probability of generating a target sample given a latent variable, and the second probability is the probability distribution of the latent variable given a target sample, the first probability is determined by the decoder parameters in the neural network model, and the second probability is determined by the encoder parameters in the neural network model.

[0091] The training module 48 is used to train the neural network model using the target feature vector to update the encoder parameters and the decoder parameters, and obtain a trained neural network model when the function value of the target function is greater than a first preset threshold, wherein the trained neural network model is used to predict the probability distribution of passenger flow in a future time period.

[0092] Optionally, the processing module 44 is further used to perform the following steps: flatten the first feature vector into a first vector sequence; use the binary attention bias to encode different variables in the first vector sequence to obtain a second vector sequence; divide the second vector sequence into multiple subsequences; multiply the first weight matrix by the vector representation of the i-th subsequence at position m to obtain a target query vector, and multiply the second weight matrix by the vector representation of the j-th subsequence at position n to obtain a target key vector, wherein i, j, m, and n are positive integers; transpose the query vector, and add the transposed result to the ij-th subsequence. The first result is obtained by multiplying the vector representation of m and the target key vector to obtain a second result; when m is equal to n, the second result is added to the first bias term, and when m is not equal to n, the second result is added to the second bias term to obtain an attention score between the ith subsequence and the jth subsequence, wherein the first bias term is greater than the second bias term; the proportion of the attention score of any subsequence in the weighted sum of the attention scores of all subsequences is determined as the attention weight of any subsequence; and the third eigenvector is determined according to the attention weight of any subsequence.

[0093] Optionally, when m is equal to n, the first bias term is 1; when m is not equal to n, the second bias term is 0.

[0094] Optionally, the processing module 44 is also used to perform the following steps: perform residual connection and normalization processing on the second eigenvector and the third eigenvector to obtain a fourth eigenvector; input the fourth eigenvector into the first feedforward layer to obtain a fifth eigenvector and a sixth eigenvector output by the first feedforward layer; perform convolution and pooling processing on the fifth eigenvector, and input the processing result into the second feedforward layer to obtain the standard deviation of the latent variable output by the second feedforward layer; perform convolution and pooling processing on the sixth eigenvector, and input the processing result into the third feedforward layer to obtain the mean of the latent variable output by the third feedforward layer; add random noise to the standard deviation of the latent variable to obtain a target standard deviation, combine the target standard deviation with the mean of the latent variable, and weight the combined result to obtain a target eigenvector.

[0095] Optionally, the processing module 44 is also used to perform the following steps: input the combination result into the self-attention layer in the decoder to obtain the weighted aggregated seventh eigenvector output by the self-attention layer; perform residual connection and normalization processing on the seventh eigenvector to obtain an eighth eigenvector; input the eighth eigenvector into the fourth feedforward layer to obtain a ninth eigenvector output by the fourth feedforward layer, perform residual connection and normalization processing on the ninth eigenvector to obtain a tenth eigenvector; perform linear transformation and activation processing on the tenth eigenvector to obtain a target eigenvector.

[0096] Optionally, the objective function is expressed by the following formula: Where θ is the decoder parameter, are encoder parameters, About The expectation operation of is the second probability, P θ (x (i) |z) is the first probability, x (i) is the target sample, z is the latent variable, is the second probability and P θ (z), P θ (z) is the preset probability distribution of the latent variable.

[0097] Optionally, the model training device is also used to perform the following steps after obtaining the trained neural network model: determine the mean scaling interval score based on the actual value and predicted value of passenger flow, the number of samples, the length of the prediction interval, the upper limit prediction value of the prediction interval, the lower limit prediction value of the prediction interval, the actual value of the time step and the length of the time series; when the mean scaling interval score is greater than a second preset threshold, adjust the hyperparameters of the trained neural network model.

[0098] It should be noted that the above Figure 4 The modules in the embodiment may be program modules (e.g., a set of program instructions for implementing a specific function) or hardware modules. For the latter, they may be expressed in the following forms, but are not limited thereto: the expression form of the above modules is a processor, or the functions of the above modules are implemented by a processor.

[0099] It should be noted that Figure 4 The preferred implementation of the illustrated embodiment can be found in Figure 1 The relevant description of the illustrated embodiment will not be repeated here.

[0100] Figure 5 FIG. 1 shows a hardware structure block diagram of a computer terminal for implementing a model training method. Figure 5 As shown, the computer terminal 50 may include one or more (502a, 502b, ..., 502n are used to illustrate) processors 502 (the processor 502 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 504 for storing data, and a transmission module 506 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 5 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 5 More or fewer components as shown, or with Figure 5 Different configurations are shown.

[0101] It should be noted that the one or more processors 502 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 50. As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0102] The memory 504 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the model training method in the embodiment of the present application. The processor 502 executes various functional applications and data processing by running the software programs and modules stored in the memory 504, that is, the above-mentioned model training method is realized. The memory 504 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 504 may further include a memory remotely arranged relative to the processor 502, and these remote memories may be connected to the computer terminal 50 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0103] The transmission module 506 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 50. In one example, the transmission module 506 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission module 506 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0104] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 50 .

[0105] It should be noted that, in some optional embodiments, the above Figure 5The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 5 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.

[0106] It should be noted that Figure 5 The computer terminal shown is used to execute Figure 1 The model training method shown, therefore the relevant explanations in the execution method of the above commands are also applicable to the electronic device and will not be repeated here.

[0107] An embodiment of the present application also provides a non-volatile storage medium, which includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the above model training method.

[0108] A program for a non-volatile storage medium to perform the following functions: obtaining multi-dimensional data related to historical passenger flow, wherein the multi-dimensional data includes: time series data and non-time series data; converting the time series data into a first feature vector, and converting the non-time series data into a second feature vector, processing the first feature vector using attention bias to obtain a third feature vector, performing residual connection and normalization processing on the second feature vector and the third feature vector to obtain a target feature vector; determining an objective function based on a first probability and a second probability, wherein the first probability is the probability of generating a target sample given a latent variable, and the second probability is the probability distribution of the latent variable given a target sample, the first probability is determined by a decoder parameter in a neural network model, and the second probability is determined by an encoder parameter in the neural network model; training the neural network model using the target feature vector to update the encoder parameters and the decoder parameters, and obtaining a trained neural network model when the function value of the objective function is greater than a first preset threshold, wherein the trained neural network model is used to predict the probability distribution of passenger flow in a future time period.

[0109] An embodiment of the present application also provides an electronic device, including: a memory and a processor, the processor being used to run a program stored in the memory, wherein the above model training method is executed when the program is running.

[0110] The processor is used to run a program that performs the following functions: obtaining multi-dimensional data related to historical passenger flow, wherein the multi-dimensional data includes: time series data and non-time series data; converting the time series data into a first feature vector, and converting the non-time series data into a second feature vector, processing the first feature vector using attention bias to obtain a third feature vector, performing residual connection and normalization processing on the second feature vector and the third feature vector to obtain a target feature vector; determining an objective function based on a first probability and a second probability, wherein the first probability is the probability of generating a target sample given a latent variable, and the second probability is the probability distribution of the latent variable given a target sample, the first probability is determined by a decoder parameter in a neural network model, and the second probability is determined by an encoder parameter in the neural network model; using the target feature vector, training the neural network model to update the encoder parameters and the decoder parameters, and obtaining a trained neural network model when the function value of the objective function is greater than a first preset threshold, wherein the trained neural network model is used to predict the probability distribution of passenger flow in a future time period.

[0111] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0112] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0113] In the above-mentioned embodiments of the present application, the collected information is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary protection measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0114] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0115] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0116] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0117] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.

[0118] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A model training method, characterized in that: include: Acquire multi-dimensional data related to historical passenger flow, wherein the multi-dimensional data includes: time series data and non-time series data; The time series data is converted into a first feature vector, and the non-time series data is converted into a second feature vector, the first feature vector is processed using attention bias to obtain a third feature vector, and the second feature vector and the third feature vector are residually connected and normalized to obtain a target feature vector; Determine an objective function according to a first probability and a second probability, wherein the first probability is the probability of generating a target sample given a latent variable, the second probability is the probability distribution of the latent variable given a target sample, the first probability is determined by a decoder parameter in a neural network model, and the second probability is determined by an encoder parameter in the neural network model; The neural network model is trained using the target feature vector to update the encoder parameters and the decoder parameters, and when the function value of the target function is greater than a first preset threshold, a trained neural network model is obtained, wherein the trained neural network model is used to predict the probability distribution of passenger flow in a future time period.

2. The method according to claim 1, characterized in that The first feature vector is processed using the attention bias to obtain a third feature vector, including: Flattening the first eigenvector into a first vector sequence; Encoding different variables in the first vector sequence using a binary attention bias to obtain a second vector sequence; dividing the second vector sequence into a plurality of subsequences; The first weight matrix is ​​multiplied by the vector representation of the i-th subsequence at position m to obtain the target query vector, and the second weight matrix is ​​multiplied by the vector representation of the j-th subsequence at position n to obtain the target key vector, where i, j, m, and n are positive integers; Transpose the query vector, multiply the transposed result by the vector representation of the ijth subsequence to obtain a first result, and multiply the first result by the target key vector to obtain a second result; When m is equal to n, the second result is added to the first bias term, and when m is not equal to n, the second result is added to the second bias term to obtain an attention score between the i-th subsequence and the j-th subsequence, wherein the first bias term is greater than the second bias term; The proportion of the attention score of any subsequence in the weighted sum of the attention scores of all subsequences is determined as the attention weight of any subsequence; The third eigenvector is determined according to the attention weight of the arbitrary subsequence.

3. The method according to claim 2, characterized in that When m is equal to n, the first bias term is 1; when m is not equal to n, the second bias term is 0.

4. The method according to claim 1, characterized in that: Performing residual connection and normalization processing on the second eigenvector and the third eigenvector to obtain a target eigenvector, including: Performing residual connection and normalization processing on the second eigenvector and the third eigenvector to obtain a fourth eigenvector; Inputting the fourth eigenvector into the first feed-forward layer to obtain a fifth eigenvector and a sixth eigenvector output by the first feed-forward layer; Performing convolution and pooling processing on the fifth eigenvector, and inputting the processing result into the second feed-forward layer to obtain the standard deviation of the latent variable output by the second feed-forward layer; Performing convolution and pooling processing on the sixth eigenvector, and inputting the processing result into the third feed-forward layer to obtain the mean value of the latent variable output by the third feed-forward layer; Random noise is added to the standard deviation of the latent variable to obtain a target standard deviation, the target standard deviation is combined with the mean of the latent variable, and a weight is assigned to the combined result to obtain the target feature vector.

5. The method according to claim 4, characterized in that The combined result is weighted to obtain the target feature vector, including: Inputting the combined result into the self-attention layer in the decoder to obtain a weighted aggregated seventh eigenvector output by the self-attention layer; Performing residual connection and normalization processing on the seventh eigenvector to obtain an eighth eigenvector; Inputting the eighth eigenvector into the fourth feed-forward layer to obtain a ninth eigenvector output by the fourth feed-forward layer, performing residual connection and normalization processing on the ninth eigenvector to obtain a tenth eigenvector; The tenth eigenvector is subjected to linear transformation and activation processing to obtain the target eigenvector.

6. The method according to claim 1, characterized in that The objective function is expressed by the following formula: Where θ is the decoder parameter, are the encoder parameters, About The expectation operation of For the second probability, P θ (x (i) |z) is the first probability, x (i) is the target sample, z is the latent variable, For the second probability and P θ (z), P θ (z) is the preset probability distribution of the latent variable.

7. The method according to claim 1, characterized in that After obtaining the trained neural network model, the method further includes: Determine the mean scaled interval score based on the actual value and predicted value of passenger flow, the number of samples, the length of the prediction interval, the upper predicted value of the prediction interval, the lower predicted value of the prediction interval, the actual value of the time step, and the length of the time series; When the mean scaling interval score is greater than a second preset threshold, the hyperparameters of the trained neural network model are adjusted.

8. A method for predicting passenger flow, characterized in that: include: Obtain targeted data related to passenger flow; The target data is input into a trained neural network model to obtain a probability distribution of passenger flow in a future time period output by the trained neural network model, wherein the trained neural network model is obtained by training using the model training method described in any one of claims 1 to 7.

9. A model training device, characterized in that: include: An acquisition module, used to acquire multi-dimensional data related to historical passenger flow, wherein the multi-dimensional data includes: time series data and non-time series data; A processing module, used to convert the time series data into a first feature vector, and convert the non-time series data into a second feature vector, process the first feature vector using attention bias to obtain a third feature vector, and perform residual connection and normalization processing on the second feature vector and the third feature vector to obtain a target feature vector; A determination module, configured to determine a target function according to a first probability and a second probability, wherein the first probability is a probability of generating a target sample given a latent variable, the second probability is a probability distribution of the latent variable given a target sample, the first probability is determined by a decoder parameter in a neural network model, and the second probability is determined by an encoder parameter in the neural network model; A training module is used to train the neural network model using the target feature vector to update the encoder parameters and the decoder parameters, and obtain a trained neural network model when the function value of the target function is greater than a first preset threshold, wherein the trained neural network model is used to predict the probability distribution of passenger flow in a future time period.

10. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the model training method described in any one of claims 1 to 7.

11. An electronic device, characterized in that: include: A memory and a processor, wherein the processor is used to run a program stored in the memory, wherein the program executes the model training method described in any one of claims 1 to 7 when running.

12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the model training method described in any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Model reasoning acceleration method and system, electronic equipment, storage medium and product

    CN120258152A