Banking outlet people flow prediction method and related device
Through the improved DTW algorithm and the Seq2Seq model of the two-stage attention mechanism, the problem of low traffic prediction accuracy in the existing technology is solved, and more efficient timing information memory and prediction accuracy are achieved.
Patent Information
- Application Number
- CN202411742869.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-21
AI Technical Summary
The existing bank branch traffic prediction method uses a single long and short-term memory neural network, which has problems such as gradient explosion and gradient disappearance. It is impossible to remember long-term timing information and the prediction accuracy is not high.
The improved dynamic time regularization DTW algorithm is used to determine the sub-historical time series classification set with the highest similarity to the real-time time series from the historical time series classification set, and the real-time time series is input into the sequence of the two-stage attention mechanism into the sequence Seq2Seq model for people flow prediction. The improved DTW algorithm combines position distance and cosine distance to improve the accuracy of time series similarity calculation.
It improves the accuracy of predicting traffic at bank branches, can more effectively remember and utilize long-term timing information, and improves the accuracy of prediction results.
Smart Images

Figure CN119671038A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method and related device for predicting the flow of people at a bank branch. Background Art
[0002] Bank branches are the offline carriers of various banking businesses, and play a vital role in financial services, customer contact points, brand image display, community services, risk management, etc.
[0003] However, most bank branches currently have large customer flow and limited counter service staff, resulting in long waiting times for customers at bank branches and uneven distribution of bank branch resources during peak and trough customer flow. This not only brings inconvenience to customers, but also increases the operating costs of bank branches.
[0004] In order to solve the above problems, a bank branch flow prediction method based on time series prediction technology is proposed in the known technology. Specifically, the flow of people in bank branches is predicted based on a single long short-term memory neural network. However, due to the use of a single long short-term memory neural network, there are problems such as gradient explosion and gradient disappearance, and it is impossible to remember long-term time series information, and the prediction accuracy is not high. Summary of the invention
[0005] In view of the above problems, the present application provides a bank branch passenger flow prediction method and related devices to achieve the purpose of improving the prediction accuracy of bank branch passenger flow. The specific scheme is as follows:
[0006] The first aspect of the present application provides a method for predicting the flow of people at a bank branch, comprising:
[0007] Obtain real-time traffic data of target bank branches and associated data of real-time traffic data;
[0008] Fusion of real-time traffic data and associated data to obtain real-time time series with high-dimensional features;
[0009] The improved dynamic time warping (DTW) algorithm is used to determine the sub-historical time series classification set with the highest similarity to the real-time time series from the historical time series classification set; the historical time series classification set is obtained based on the time series clustering model; the time series clustering model is configured as follows: the similarity between each sub-historical time series in the historical time series set is calculated according to the improved DTW algorithm, and the sub-historical time series whose similarity meets the preset clustering conditions are clustered into one category, so as to obtain a historical time series classification set including multiple sub-historical time series classification sets; the improved DTW algorithm is an algorithm that uses fusion distance to characterize the similarity between time series; the fusion distance is determined based on the position distance and the cosine distance;
[0010] The real-time time series is input into the pedestrian flow prediction model to obtain the pedestrian flow prediction result of the target bank branch; the pedestrian flow prediction model is a sequence-to-sequence Seq2Seq model with a two-stage attention mechanism that uses a sub-historical time series classification set for training and uses the improved shape and time distortion DILATE loss function for model update; the improved DILATE loss function is the loss function that integrates the improved DTW algorithm.
[0011] In a possible implementation, the position distance is used to characterize the degree of distance between the positions of the time series; and the cosine distance is used to characterize the degree of directional similarity between the time series.
[0012] In a possible implementation, the similarity between each sub-historical time series in the historical time series set is calculated according to the improved DTW algorithm, and the sub-historical time series whose similarity meets the preset clustering condition are clustered into one category, so as to obtain a historical time series classification set including multiple sub-historical time series classification sets, including:
[0013] The improved DTW algorithm is used to calculate the fusion distance between each sub-historical time series in the historical time series set to obtain a similarity measurement matrix set;
[0014] The density-based clustering DBSCAN algorithm is used to cluster the sub-historical time series with high similarity in the similarity measurement matrix set into a sub-historical time series classification set to obtain the historical time series classification set.
[0015] In a possible implementation, an improved dynamic time warping (DTW) algorithm is used to determine a sub-historical time series classification set with the highest degree of similarity to the real-time time series from the historical time series classification set, including:
[0016] Calculate the fusion distance between the real-time time series and each sub-historical time series in each sub-historical time series classification set to obtain a fusion distance set;
[0017] The sub-historical time series classification set corresponding to the sub-historical time series with the maximum fusion distance in the fusion distance set is selected as the sub-historical time series classification set with the highest similarity to the real-time time series.
[0018] In a possible implementation, the method further includes:
[0019] Obtain real traffic data of target bank branches;
[0020] The improved DILATE loss function is used to determine the temporal and spatial differences between the real flow data and the flow prediction results; the spatial difference is determined by the improved DTW algorithm;
[0021] Determine the parameters that need to be adjusted corresponding to the crowd flow prediction model based on the time difference and the spatial difference;
[0022] The parameters required to be adjusted in the crowd flow prediction model are adjusted to obtain an updated crowd flow prediction model.
[0023] In a possible implementation, it includes:
[0024] The associated data of real-time traffic data includes traffic data, weather data, holiday data, marketing campaign data and outlet data.
[0025] A second aspect of the present application provides a bank branch traffic prediction device, comprising:
[0026] an acquisition unit, a fusion unit, a determination unit and a prediction unit; wherein;
[0027] An acquisition unit, used to acquire real-time human traffic data of a target bank branch and associated data of the real-time human traffic data;
[0028] Fusion unit, used to fuse real-time traffic data and related data to obtain real-time time series with high-dimensional features;
[0029] A determination unit is used to use an improved dynamic time warping (DTW) algorithm to determine a sub-historical time series classification set with the highest similarity to a real-time time series from a historical time series classification set; the historical time series classification set is obtained based on a time series clustering model; the time series clustering model is configured to: calculate the similarity between each sub-historical time series in the historical time series set according to the improved DTW algorithm, cluster the sub-historical time series whose similarity meets a preset clustering condition into one category, and obtain a historical time series classification set including multiple sub-historical time series classification sets; the improved DTW algorithm is an algorithm that uses a fusion distance to characterize the similarity between time series; the fusion distance is determined based on the position distance and the cosine distance;
[0030] The prediction unit is used to input the real-time time series into the pedestrian flow prediction model to obtain the pedestrian flow prediction result of the target bank branch; the pedestrian flow prediction model is: a sequence-to-sequence Seq2Seq model with a two-stage attention mechanism that uses a sub-historical time series classification set for training and uses an improved shape and time distortion DILATE loss function for model update; the improved DILATE loss function is a loss function that integrates the improved DTW algorithm.
[0031] A third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements a bank branch flow prediction method as described in any one of the above.
[0032] In a fourth aspect, the present application provides a bank branch traffic prediction device, comprising at least one processor and a memory connected to the processor, wherein:
[0033] The memory is used to store computer programs;
[0034] The processor is used to execute a computer program so that the bank branch traffic prediction device can implement the bank branch traffic prediction method as described in any one of the above.
[0035] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement a bank branch traffic prediction method as described in any one of the above.
[0036] By means of the above technical scheme, the bank branch traffic prediction method and related devices provided by the present application integrate real-time traffic data and related data of real-time traffic data to obtain a real-time time series with high-dimensional features, and use the improved DTW algorithm to determine the sub-time series classification set with the highest similarity to the real-time time series from the historical time series classification set, and then input the real-time time series into the traffic prediction model corresponding to the sub-time series classification set to obtain the traffic prediction result. In the present application, the improved DTW algorithm is applied in the selection of the sub-historical time series classification set with the highest similarity to the real-time time series, the training and use of the time series clustering model, and the updating process of the traffic prediction model. The algorithm takes into account the distance between the positions of the time series and the similarity of the directions, and improves the calculation accuracy of the similarity between the time series. The calculation of the similarity between the time series is permeated in each key step of the bank branch traffic prediction of the present application, thereby improving the prediction accuracy of the entire bank branch traffic prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0038] Figure 1 A flow chart of a method for predicting the flow of people at bank outlets provided in this application;
[0039] Figure 2 This is an example diagram of the calculation principle of the DTW algorithm provided by this application;
[0040] Figure 3 This is an example diagram of the calculation principle of the DTW algorithm provided in this application;
[0041] Figure 4 An example diagram of the calculation principle of the cosine distance provided in this application;
[0042] Figure 5 An example diagram of the compression principle of the Douglas Peucker compression algorithm provided for this application;
[0043] Figure 6 Example diagram of clustering provided for this application;
[0044] Figure 7 This is an example diagram of the comparison between the common loss function MSE and DILATE provided in this application;
[0045] Figure 8 This is a structural example diagram of the DAD-Seq2Seq model provided in this application;
[0046] Fig. 9 A flow chart showing an example of a method for predicting the flow of people at a bank branch provided in this application;
[0047] Fig.10 A schematic diagram of the structure of a bank branch traffic prediction device provided in this application;
[0048] Fig.11 A schematic diagram of the structure of the bank branch traffic prediction device provided in this application. DETAILED DESCRIPTION
[0049] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0050] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0051] 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 need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0052] After entering the era of mobile Internet, online systems such as "Mobile Banking" APP and mini programs have become one of the options for customers to conduct banking business. However, traditional bank branches are still the preferred place for many customers to conduct important financial transactions and consultations. This has led to problems such as large customer flow at bank branches, limited counter service staff, long queues at bank branches, and uneven distribution of bank branch resources during peak and valley customer flow.
[0053] In order to solve the above problems, there is a method and device for monitoring the flow of people in bank branches in the known technology (patent number: CN202311491882.1). The method includes: first, obtaining the monitoring video image of the bank branch according to the preset time period; determining the flow of people in the bank branch in the current time period based on the monitoring video image of the bank branch in the current time period; using a single long short-term memory neural network to predict the current business processing waiting time of the bank branch based on the flow of people in the bank branch in the current time period; sending the flow of people in the bank branch in the time period and the current business processing waiting time. This technology uses a single long short-term memory neural network, which has the problems of gradient explosion and gradient disappearance, cannot remember long-term time series information, and has low prediction accuracy.
[0054] The bank branch traffic prediction method in the prior art has problems such as gradient explosion and gradient vanishing due to the use of a single long short-term memory neural network, and cannot remember long-term time series information, resulting in low prediction accuracy. In addition, many bank branch traffic prediction methods in the prior art generally have the problem of low prediction accuracy.
[0055] However, accurate prediction of the flow of people in bank branches is crucial to the management and service of banking business. It can not only help banks optimize resource allocation, improve service efficiency and service quality, but also improve security and protect the safety of customers and bank assets. In order to solve the above problems and achieve the above beneficial effects, the present application provides a bank branch flow prediction method and related devices.
[0056] Alternatively, see Figure 1 , a flow chart of a bank branch traffic prediction method provided in this application.
[0057] like Figure 1 As shown, the bank branch traffic prediction method provided by this application includes the following steps:
[0058] Step 101: Acquire real-time passenger flow data of a target bank branch and associated data of the real-time passenger flow data.
[0059] It should be noted that real-time pedestrian flow data includes but is not limited to the pedestrian flow data of the outlets collected in real time through the outlet number-taking machines, infrared probes at the door and indoor cameras, and may also include customer appointment records collected through the "Mobile Banking" back-end system and the location of the target bank outlets and external special services; the associated data of the real-time pedestrian flow data includes but is not limited to traffic data: the number of buses, subways and parking spaces around the target bank outlets; weather data: rainy and snowy weather and non-rainy and snowy weather; holiday data: whether it is a weekday, weekend or holiday; marketing data: the number of marketing activities of the target bank outlets, and may also include marketing activity data of bank outlets around the target bank outlets; outlet data: the area of the target bank outlets, the number of windows, etc.
[0060] Optionally, real-time traffic data of the target bank branch and traffic data, weather data, holiday data, marketing activity data and branch data associated with the target bank branch are obtained.
[0061] Step 102: Fuse the real-time traffic data and the associated data to obtain a real-time time series with high-dimensional features.
[0062] Optionally, the above real-time traffic data and related data are fused and processed into a real-time time series with high-dimensional features.
[0063] Step 103: Using an improved dynamic time warping (DTW) algorithm, determine the sub-historical time series classification set with the highest similarity to the real-time time series from the historical time series classification set; the historical time series classification set is obtained based on a time series clustering model; the time series clustering model is configured as follows: calculating the similarity between each sub-historical time series in the historical time series set according to the improved DTW algorithm, clustering the sub-historical time series whose similarity meets the preset clustering conditions into one category, and obtaining a historical event sequence classification set including multiple sub-historical time series classification sets; the improved DTW algorithm is an algorithm that uses a fusion distance to characterize the similarity between time series; the fusion distance is determined based on the position distance and the cosine distance.
[0064] It should be noted that the DTW (Dynamic Time Wrapping) algorithm is a method for calculating the similarity between two time series. The algorithm specifically uses Euclidean distance or Manhattan distance to measure the similarity between two time series. For example, see Figure 2 , an example diagram of the calculation principle of the DTW algorithm provided in this application.
[0065] like Figure 2 As shown in the figure, the algorithm mainly calculates the similarity by constructing a cumulative distance matrix and using the idea of dynamic programming to find the optimal alignment between two time series.
[0066] However, this DTW algorithm in the known technology has a disadvantage: local information is easily lost. For example, see Figure 3 , the calculation principle example diagram of the DTW algorithm provided in this application. Figure 3 As shown in the figure, after the DTW algorithm in the known technology is used for calculation, the Euclidean distance of AB may be shorter and they will be classified into the same category. However, it is obvious that the local trends of B and C are more similar and should be grouped into one category.
[0067] In order to more effectively measure the changing trends between time series and overcome the problem of easy loss of local information in the DTW algorithm in the known technology, the present application proposes an improved DTW algorithm. The algorithm uses fusion distance to characterize the similarity between time series. Specifically, the fusion distance can be determined by position distance and cosine distance. Among them, the position distance is used to measure the distance between the positions of the time series, and the cosine distance is used to measure the directional similarity between the time series. The position distance is equivalent to the Euclidean distance mentioned above, and the cosine distance can also be called the directional distance.
[0068] It can be understood that the improved DTW algorithm can take into account both the position distance and local trend between time series.
[0069] For example, see Figure 4 , an example diagram of the calculation principle of cosine distance provided in this application.
[0070] like Figure 4 As shown in the figure, the cosine distance can characterize the directional trend of the local sequence between the two time series in the figure. Specifically, the calculation formula of the cosine distance between P1P2 and Q1Q2 in the figure can be:
[0071]
[0072] Among them, dist C is the cosine distance, used to distinguish dist L Location distance; is the directed line segment between P1 and P2; is the directed line segment between Q1 and Q2;
[0073] Then, the fusion distance formula between the time series is calculated. The calculation formula of the fusion distance can be:
[0074]
[0075] Among them, dist represents the fusion distance; dist C Represents cosine distance; dist L Indicates location distance; dist max Indicates the maximum cosine distance threshold;
[0076] It should be noted that the above formula first determines whether the position distance between the two time series is significantly different, and then determines whether the local trends within the time are similar.
[0077] Optionally, an improved DTW algorithm is used to calculate the fusion distance between the real-time time series and each sub-historical time series in each sub-historical time series classification set in the historical time series classification set to obtain a fusion distance set, and the sub-historical time series classification set corresponding to the maximum fusion distance in the fusion distance set is selected as the sub-historical time series classification set with the highest similarity to the real-time time series.
[0078] The reason for selecting the sub-historical time series classification set with the highest similarity to the real-time time series is that the application provides a crowd flow prediction model corresponding to each sub-historical time series classification set, and each crowd flow prediction model is trained using the corresponding sub-historical time series classification set as training data. Selecting the sub-historical time series classification set with the highest similarity to the real-time time series means selecting the crowd flow prediction model that best matches the real-time time series. Naturally, the prediction accuracy of the most matching crowd flow prediction model is also the highest among many crowd flow prediction models.
[0079] It should be noted that the historical time series classification set is obtained based on the time series clustering model. The time series clustering model calculates the similarity between each sub-historical time series in the historical time series set according to the improved DTW algorithm, and clusters the sub-historical time series whose similarity meets the preset clustering conditions into one category, thus obtaining a historical time series classification set including multiple sub-historical event sequence classification sets.
[0080] The specific process of applying the time series clustering model to cluster and obtain the historical time series classification set can be as follows:
[0081] Step 1: Obtain the historical traffic data of each bank branch and data related to the historical traffic data;
[0082] The historical traffic data and related data are merged and processed into a historical time series with high-dimensional features according to a certain time step, such as 10 minutes. Then, the entire time series can be divided according to the week to obtain a historical time series set with high-dimensional features for each week.
[0083] Step 2: preprocess each high-dimensional feature historical time series in the high-dimensional feature historical time series set to obtain each preprocessed high-dimensional feature historical time series.
[0084] Specifically, the number of people who obviously exceed the carrying capacity of the network area, negative number of people, etc. are cleared; considering that the long-term data collected will inevitably lead to an increase in the data scale, the data needs to be compressed. For example, if the number of people in many consecutive time steps at night is 0, a compression algorithm can be used to compress these times into a record. Specifically, the Douglas Peucker compression algorithm can be used. The basic principle of this algorithm is to determine whether the change of the current point is significant. If it is not significant, it can be deleted and represented by adjacent points. For example, see Figure 5 , the present application provides an example diagram of the compression principle of the Douglas Peucker compression algorithm. Figure 5 As shown, the algorithm deleted p1, p3, p5 and p7 with insignificant changes, and retained p0, p2, p4, p6 and p8.
[0085] Step 3: Use the improved DTW algorithm to calculate the fusion distance between the preprocessed high-dimensional feature historical time series to obtain a similarity measurement matrix. Among them, the preprocessed high-dimensional feature historical time series can be understood as each time slice.
[0086] Step 4: Then, use the DBSCAN algorithm to perform clustering operations on the similarity measurement matrix. Specifically, the DBSCAN algorithm will read the pre-processed similarity measurement data between the pairwise high-dimensional feature historical time series, and divide all time slices into different sub-historical time series classification sets, and specifically divide time slices with similar trends into the same sub-historical time series classification set.
[0087] For example, see Figure 6 , the clustering example diagram provided by this application. Figure 6 As shown, the time series of outlets 3 and 4 in a certain period of time will be classified into the same sub-historical time series classification set, and the time series of outlets 1 and 2 in a certain period of time will be classified into the same sub-historical time series classification set.
[0088] It should be noted that the preset clustering condition mentioned above may be the clustering condition of the DBSCAN algorithm, and may also be understood as the similarity between the high-dimensional feature historical time series reaching a certain level.
[0089] Step 104: input the real-time time series into the crowd flow prediction model to obtain the crowd flow prediction result of the target bank branch; the crowd flow prediction model is: a sequence-to-sequence Seq2Seq model with a two-stage attention mechanism that uses a sub-historical time series classification set for training and uses an improved shape and time distortion DILATE loss function for model update; the improved DILATE loss function is a loss function that integrates the improved DTW algorithm.
[0090] It can be seen from step 103 that the real-time time series is input into the pedestrian flow prediction model corresponding to the sub-historical time series classification set with the highest similarity to the time series. The pedestrian flow prediction model is a sequence-to-sequence Seq2Seq model based on a two-stage attention mechanism trained on the sub-historical time series classification set, and the pedestrian flow prediction model will use the improved DILATE loss function to update the model.
[0091] It should be noted that the two-stage attention mechanism Seq2Seq model is an autoencoder model that includes two recurrent neural networks, one of which acts as an encoder to encode the input information, and the other as a decoder to decode the encoded data and the input data to obtain the final result. Among them, the recurrent neural network is a network structure composed of high-dimensional hidden states of nonlinear dynamics, which can store, remember and process complex signals in the past for a long time. The recurrent neural network can map the input sequence to the output sequence in the current time step and predict the sequence in the next time step.
[0092] Specifically, in the Seq2Seq encoder, the encoder attention mechanism is used, so that the encoder can adaptively select the features of each moment when receiving input data, so as to more efficiently utilize the information of each dimension of the pedestrian flow time series sequence; in the second stage of decoding, the temporal attention mechanism is used to select the more effective hidden layer features in each time step.
[0093] In the first stage, through the feature self-attention mechanism, the input x for each moment t Each feature dimension in is assigned a weight This weight is used to evaluate the importance of the kth feature in the tth time step, so, is the weight of any dimension from 1 to m at the t-th time step; after being processed by the feature attention mechanism, x t Will be updated to The update formula can be as follows:
[0094]
[0095] Among them, x t is the input data of the tth time step; is the weight of the first dimension at the tth time step; is the weight of the second dimension of the tth time step; is the weight of the nth dimension at the tth time step; is the passenger flow vector at time t; for example, It can represent the weight of the flow of people at time t × the flow of people at time t, the weight of the user's reservation record at time t × the number of user's reservation records at time t;
[0096] It should be noted that Specifically, we can use the hidden layer state h of the encoder at the previous time step t-1 and the cell state h t-1 The calculation formula can be as follows:
[0097]
[0098] in, is the dimension weight before normalization, t is the time step, k is the dimension of the input parameter; tanh(·) is the bidirectional tangent function; h t-1 is the value of the hidden layer at the previous moment of the current moment; c t-1 is the state value of the LSTM memory unit at the previous moment of the current moment; x k It is a vector composed of the values of the corresponding positions of all slices in the k dimension; is a dynamic adjustment parameter; v e , W e and U e is the learning parameter, [h t-1 ;c t-1 ] is the connection between the hidden layer state and the unit state at the t-1th time step; the formula is calculated to get After that, the softmax function is used to normalize the final The calculation formula can be as follows:
[0099]
[0100] in, is the dimension weight before normalization, t is the time step, i is the dimension of the input parameter; exp() is an exponential function with the natural constant e as the base.
[0101] Finally, the hidden layer state calculation formula of the hidden layer at the next moment can be as follows:
[0102]
[0103] Among them, h t is the hidden layer state of the recurrent neural network unit at time t; f is the RNN recurrent unit, and Bi-LSTM is specifically used in this application.
[0104] The second stage of attention mechanism is the decoding stage, using the Bahdanau attention mechanism for Seq2Seq. The specific operation is as follows:
[0105] The encoder RNN is a bidirectional RNN. The forward RNN passes from x1 to x T Read the input sequence in order and calculate the forward hidden layer state of the encoder The backward RNN generates the backward hidden layer state by reading the input sequence in reverse order Finally, the forward hidden layer state of each time step and the backward hidden layer state Splice to get the final hidden layer state Then in the decoder of the model, for a given sequence x, the conditional probability of each output is calculated as follows:
[0106] p(y1y1,y2,...,y i-1 ,x)=g(y i-1 ,s i , c i )
[0107] Among them, s i is the hidden layer state of the decoder at time i, y i is the output of the current time step; c i is the state of the neural unit; g() is the calculation process inside the neural unit.
[0108] s i The calculation formula can be as follows:
[0109] s i =f(s i-1 ,y i-1 ,c i )
[0110] Among them, S i-1 is the hidden layer state at time i-1; y i-1 is the output of the time step i-1.
[0111] Different from the traditional Seq2Seq decoder, each output y in the attention-based Seq2Seq decoder i Both need to rely on a separate context vector c i , this context vector depends on the hidden layer states (h1, h2, ..., h T ). Because it is a bidirectional RNN, h i Contains the information of the entire input sequence, then we need to focus on the information around the i-th input. i The calculation formula can be as follows:
[0112]
[0113] Among them, α ij is the hidden layer state h at the jth time step j The weight, α ij The calculation formula can be as follows:
[0114]
[0115] Among them, e ik is the matching degree between the input at time step i and the output at time step k; e ij =a(s i-1 ,h j ), is a feedforward neural network alignment model for scoring, which is used to evaluate the matching degree of information near input position j and output position i. It is jointly trained with the entire model, and the calculation formula can be as follows:
[0116]
[0117] Among them, α(S i-1 ,h j ) is the alignment model; W α , U α and is the parameter matrix; W a ∈R n×n , U a ∈R n×2n , v a ∈R n is the network parameter;
[0118] It should also be noted that the pedestrian flow prediction model provided in this application will use the improved DILATE loss function to update the model, and more effectively correct the error between the predicted sequence and the actual time series of the pedestrian flow prediction model during the model update process.
[0119] The improved DILATE loss function is used in this application.
[0120] The DILATE loss function is used to evaluate the difference between the model output and the actual result, and is mainly used to optimize the model. The full name of DILATE is "DIstortion Loss including shApe and TimE", which is translated into "shape and time distortion loss" in Chinese. The general loss function only considers the error between the output values and the actual sample, while the DILATE loss function comprehensively considers the relationship between shape and time, so that the model can output a predicted sequence that is closer to the actual sequence in shape and time.
[0121] For example, see Figure 7 , This application provides an example diagram of the comparison effect of the common loss function MSE and DILATE.
[0122] like Figure 7 As shown in Figure 2, the DILATE loss function can make the shape and time of the model output closer to the predicted sequence of the real sequence.
[0123] The improved DILATE loss function provided in this application guides the training and use of the crowd flow prediction model and the subsequent model update. The improved DILATE loss function incorporates the improved DTW algorithm when considering the spatial difference between the actual crowd flow data and the crowd flow prediction results. The calculation formula of the loss function can be as follows:
[0124]
[0125] Among them, L DILATE is the improved loss function; is the predicted sequence; y is the true sequence, and the length of the predicted sequence and the true sequence are both k; is the shape distortion loss function; is the time distortion loss function; α is the weight factor used to balance the shape distortion loss function and the time distortion loss function.
[0126]
[0127] in, Represents the prediction sequence The similarity measure between and the true sequence y; represents the distance matrix between two time series, DTW γ represents a differentiable DTW algorithm with a smoothing constant γ; γ is a large
[0128] A is the set of all possible alignment paths. Indicates the points that each path from the upper left corner to the lower right corner needs to pass through, 1 means passing through, 0 means not passing through; A k*k Represents all valid alignment paths from the starting point to the end point;
[0129]
[0130] Among them, A * represents the optimal alignment path, that is, the path that minimizes the alignment cost (weighted distance) among all alignment paths; Z represents the normalization constant, which keeps the calculation result of the entire loss function within a manageable range to avoid numerical problems; Ω represents the ideal "perfect alignment path" (also called the first diagonal, usually (1,1), (2,2), ..., (n,n), that is, the time points correspond one to one); Represents the DTW calculation process, that is, comparing the optimal alignment path A * Align the path Ω with the ideal and quantify the deviation to obtain the time deviation of the two sequences;
[0131] Optionally, the real-time time series is input into a pedestrian flow prediction model to obtain a pedestrian flow prediction result for a target bank branch.
[0132] It should be noted that before starting the next target bank branch traffic forecast, the traffic forecast model used for the current target bank branch traffic forecast will be updated. The update process of the traffic forecast model is as follows:
[0133] Obtaining the actual passenger flow data corresponding to the passenger flow prediction result obtained by performing passenger flow prediction for the target bank branch this time;
[0134] Then, the improved DILATE loss function is used to determine the time difference and spatial difference between the real crowd flow data and the crowd flow prediction results; the improved DTW algorithm is used to replace the previously used DTW algorithm for the spatial difference;
[0135] Then, the parameters of the crowd flow prediction model that need to be adjusted are determined based on the time difference and the spatial difference;
[0136] The parameters required to be adjusted in the crowd flow prediction model are adjusted to obtain an updated crowd flow prediction model.
[0137] Specifically, the improvement process of the DILATE loss function can be as follows:
[0138] The improved DTW algorithm is used to replace the DTW algorithm in the DILATE loss function to obtain DTW * , DTW * The calculation formula can be as follows:
[0139]
[0140] Among them, DTW * is the improved DTW algorithm; Δ * Represents the improved fusion distance;.
[0141] Then, using DTW * calculate The calculation formula can be as follows:
[0142]
[0143] at last and The final loss function is obtained by summing the weights The calculation formula can be as follows:
[0144]
[0145] The improved loss function This can make the finally trained model have better performance in local directions.
[0146] In summary, combined with the Seq2Seq of the dual-stage attention mechanism, the present invention uses the improved DILATE loss function to obtain the final model DAD-Seq2Seq. Figure 8 , the structural example diagram of the DAD-Seq2Seq model provided in this application:
[0147] like Figure 8 As shown in the figure, the DAD-Seq2Seq model is a Seq2Seq prediction model based on a two-stage attention mechanism. It includes the encoder attention mechanism and the decoder attention mechanism. The encoder attention mechanism uses the Bi-LSTM network, which is called "BiDirection Long Short-Term Memory" in Chinese: that is, a reverse-connected memory unit is added to each hidden layer of the long short-term memory neural network, so that the output of each hidden layer is jointly determined by the forward and reverse units, so as to achieve the simultaneous use of past and future data for prediction, which can effectively improve the prediction accuracy; the decoder attention mechanism uses the LSTM neural network, which is called "Long Short-Term Memory" in Chinese. It is a special recurrent neural network. It uses different neural units and has better adaptability and stronger memory ability.
[0148] In addition, the improved DILATE loss function is used to guide the training of the DAD-Seq2Seq model, making the model perform better than other models of direct prediction and clustering prediction. Moreover, after the initial completion of the DAD-Seq2Seq model, the model will run online, and the current flow of people in each bank branch will be obtained in real time through the data collection and preprocessing system for subsequent prediction.
[0149] where x={x1,...,x T} is a set of input data with a time step of T, is the predicted sequence output by the decoder, and y is the true sequence.
[0150] This application is based on the bank branch scenario. In order to solve the problems of unpredictable bank branch traffic, mismatch of bank branch resources, and low user experience, a set of combined traffic prediction models is proposed based on the fact that there are few branch traffic prediction models and poor results in the known technologies. In view of the large amount of data and multiple dimensions, a set of systematic data collection and preprocessing processes are established; in view of the problem of local information loss in the original DTW algorithm, a fusion distance is proposed, and thus an improved DTW similarity measurement algorithm is proposed. After comparative experiments, the experiments show that this clustering method can effectively divide isomorphic time series into a cluster, and outperforms traditional clustering methods in terms of clustering indicators.
[0151] In summary, the bank branch traffic prediction method provided by the present application integrates real-time traffic data and related data of real-time traffic data to obtain a real-time time series with high-dimensional features, uses an improved DTW algorithm to determine the sub-time series classification set with the highest similarity to the real-time time series from the historical time series classification set, and then inputs the real-time time series into the traffic prediction model corresponding to the sub-time series classification set to obtain the traffic prediction result. In the present application, the improved DTW algorithm is applied in the selection of the sub-historical time series classification set with the highest similarity to the real-time time series, the training and use of the time series clustering model, and the updating process of the traffic prediction model. The algorithm takes into account the distance between the positions of the time series and the similarity of the directions, and improves the calculation accuracy of the similarity between the time series. The calculation of the similarity between the time series is permeated in each key step of the bank branch traffic prediction of the present application, thereby improving the prediction accuracy of the entire bank branch traffic prediction.
[0152] Optional, see Fig. 9 , a flow chart of an example of a method for predicting the flow of people at bank branches provided in this application.
[0153] like Fig. 9 As shown in the figure, the time series of the target bank branch is input into the pedestrian flow prediction model. First, the set to which the time series belongs is determined. The set specifically refers to each set determined based on the time series clustering model of the improved DTW. Then, the DAD-Seq2Seq model trained with the set is used to predict the pedestrian flow of the target bank branch, and the prediction result of the target bank branch is output.
[0154] Specifically, the bank branch traffic prediction method provided by the present application can use the branch number machine and monitor to obtain the original historical traffic data, and perform pre-processing such as repairing and compressing the data to obtain high-quality time-sharing traffic data; use the idea of classification to pre-process the time-sharing traffic data, and use the similarity measurement method based on the improved DTW algorithm to cluster, and obtain multiple different "same-shape" data sets; use the target branch real-time traffic data and various "same-shape" traffic data sets to match according to the similarity measurement method, determine the traffic data set used for prediction model training, and use this set of data to train the prediction model, the prediction model uses a two-stage attention mechanism to extract the association between input data and output data, and uses the improved DILATE loss function to evaluate the difference between the predicted data and the real data, thereby improving the accuracy of the prediction model prediction. Finally, the prediction results are pushed to the user in real time through the "Palm Bank" APP, so that the user can reasonably arrange the time to go to the bank to handle business.
[0155] The above introduces a bank branch passenger flow prediction method provided by the present application, and the following will introduce a device for executing the above bank branch passenger flow prediction method.
[0156] See also Fig.10 , Fig.10 This is a schematic diagram of the structure of a bank branch traffic prediction device provided in this application. Fig.10 As shown, the device 700 includes:
[0157] An acquisition unit 10, a fusion unit 20, a determination unit 30 and a prediction unit 40; wherein:
[0158] An acquisition unit 10 is used to acquire real-time human traffic data of a target bank branch and associated data of the real-time human traffic data;
[0159] A fusion unit 20 is specifically used to fuse the real-time human flow data and the associated data to obtain a real-time time series of high-dimensional features;
[0160] The determination unit 30 is specifically used to use the improved dynamic time warping DTW algorithm to determine the sub-historical time series classification set with the highest similarity to the real-time time series from the historical time series classification set; the historical time series classification set is obtained based on the time series clustering model; the time series clustering model is configured to: calculate the similarity between each sub-historical time series in the historical time series set according to the improved DTW algorithm, cluster the sub-historical time series whose similarity meets the preset clustering condition into one category, and obtain the historical time series classification set including multiple sub-historical time series classification sets; the improved DTW algorithm is an algorithm that uses a fusion distance to characterize the similarity between time series; the fusion distance is determined based on the position distance and the cosine distance;
[0161] The prediction unit 40 is specifically used to input the real-time time series into the pedestrian flow prediction model to obtain the pedestrian flow prediction result of the target bank branch; the pedestrian flow prediction model is: a sequence-to-sequence Seq2Seq model with a two-stage attention mechanism that uses a sub-historical time series classification set for training and uses an improved shape and time distortion DILATE loss function for model update; the improved DILATE loss function is a loss function that integrates the improved DTW algorithm.
[0162] In one embodiment, the position distance in the determination unit 30 is used to characterize the degree of distance between the positions of the time series; and the cosine distance is used to characterize the degree of directional similarity between the time series.
[0163] In one implementation, the determination unit 30 is specifically configured to:
[0164] The improved DTW algorithm is used to calculate the fusion distance between each sub-historical time series in the historical time series set to obtain a similarity measurement matrix set;
[0165] The density-based clustering DBSCAN algorithm is used to cluster the sub-historical time series with high similarity in the similarity measurement matrix set into a sub-historical time series classification set to obtain the historical time series classification set.
[0166] In one implementation, the determination unit 30 is specifically configured to:
[0167] Calculate the fusion distance between the real-time time series and each sub-historical time series in each sub-historical time series classification set to obtain a fusion distance set;
[0168] The sub-historical time series classification set corresponding to the sub-historical time series with the maximum fusion distance in the fusion distance set is selected as the sub-historical time series classification set with the highest similarity to the real-time time series.
[0169] In one embodiment, the bank branch traffic flow prediction method device further includes a model updating unit; the unit is specifically used for:
[0170] Obtain real traffic data of target bank branches;
[0171] The improved DILATE loss function is used to determine the temporal and spatial differences between the real flow data and the flow prediction results; the spatial difference is determined by the improved DTW algorithm;
[0172] Determine the parameters that need to be adjusted corresponding to the crowd flow prediction model based on the time difference and the spatial difference;
[0173] The parameters required to be adjusted in the crowd flow prediction model are adjusted to obtain an updated crowd flow prediction model.
[0174] In one embodiment, the associated data of the real-time pedestrian flow data in the acquisition unit 10 includes traffic data, weather data, holiday data, marketing activity data and network point data.
[0175] The present application also provides a bank branch traffic prediction device. Fig.11 As shown, it shows a schematic diagram of the structure of the bank branch traffic prediction device suitable for implementing the bank branch traffic prediction device provided by the present application. The bank branch traffic prediction device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Fig.11 The bank branch traffic prediction device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0176] like Fig.11 As shown, the bank branch traffic flow prediction device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 to a random access memory (RAM) 603. When the bank branch traffic flow prediction device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0177] Typically, the following devices may be connected to the I / O interface 605: input devices 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 608 including, for example, a memory card, a hard disk, etc.; and communication devices 609. The communication device 609 may allow the bank branch traffic prediction device to communicate with other devices wirelessly or by wire to exchange data. Fig.11 The bank branch traffic prediction device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0178] Also provided in an embodiment of the present application is a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements any of the bank branch traffic prediction methods provided in the embodiments of the present application.
[0179] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any bank branch traffic prediction method provided in the embodiment of the present application.
[0180] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0181] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the method of each embodiment of the present application.
[0182] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0183] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a training device or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device or data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integration. Available media can be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., DVD), or semiconductor media (e.g., solid-state hard disk (SSD)), etc.
Claims
1. A method for predicting the flow of people at a bank branch, characterized in that: include: Acquire real-time traffic data of target bank outlets and associated data of the real-time traffic data; The real-time human flow data and the associated data are integrated to obtain a real-time time series with high-dimensional features; An improved dynamic time warping (DTW) algorithm is used to determine a sub-historical time series classification set with the highest similarity to the real-time time series from a historical time series classification set; the historical time series classification set is obtained based on a time series clustering model; the time series clustering model is configured to: calculate the similarity between each sub-historical time series in the historical time series set according to the improved DTW algorithm, cluster the sub-historical time series whose similarity meets a preset clustering condition into one category, and obtain the historical time series classification set including multiple sub-historical time series classification sets; the improved DTW algorithm is an algorithm that uses a fusion distance to characterize the similarity between time series; the fusion distance is determined based on the position distance and the cosine distance; The real-time time series is input into a pedestrian flow prediction model to obtain a pedestrian flow prediction result of the target bank branch; the pedestrian flow prediction model is a sequence-to-sequence Seq2Seq model with a two-stage attention mechanism that uses the sub-historical time series classification set for training and uses an improved shape and time distortion DILATE loss function for model update; the improved DILATE loss function is a loss function that integrates the improved DTW algorithm.
2. The method for predicting the flow of people at a bank branch according to claim 1, characterized in that: The position distance is used to characterize the degree of distance between the positions of the time series; and the cosine distance is used to characterize the degree of directional similarity between the time series.
3. The method for predicting the flow of people at a bank outlet according to claim 2, characterized in that: The improved DTW algorithm is used to calculate the similarity between each sub-historical time series in the historical time series set, and the sub-historical time series whose similarity meets the preset clustering condition are clustered into one category, so as to obtain the historical time series classification set including multiple sub-historical time series classification sets, including: The improved DTW algorithm is used to calculate the fusion distance between each sub-historical time series in the historical time series set to obtain a similarity measurement matrix set; The density-based clustering DBSCAN algorithm is used to cluster the sub-historical time series with high similarity in the similarity measurement matrix set into a sub-historical time series classification set to obtain the historical time series classification set.
4. The method for predicting the flow of people at a bank branch according to claim 2, characterized in that: The improved dynamic time warping (DTW) algorithm is used to determine the sub-historical time series classification set with the highest similarity to the real-time time series from the historical time series classification set, including: Calculating the fusion distance between the real-time time series and each sub-historical time series in each sub-historical time series classification set in the historical time series classification set to obtain a fusion distance set; The sub-historical time series classification set corresponding to the maximum fusion distance in the fusion distance set is selected as the sub-historical time series classification set with the highest similarity to the real-time time series.
5. The method for predicting the flow of people at a bank outlet according to claim 1, characterized in that: Also includes: Obtaining real traffic data of the target bank branch; The improved DILATE loss function is used to determine the time difference and spatial difference between the actual crowd flow data and the crowd flow prediction result; the spatial difference is determined by the improved DTW algorithm; Determining the parameters that need to be adjusted corresponding to the crowd flow prediction model based on the time difference and the spatial difference; The parameters required to be adjusted in the crowd flow prediction model are adjusted to obtain an updated crowd flow prediction model.
6. The method for predicting the flow of people at a bank branch according to claim 1, characterized in that: include: The associated data of the real-time human flow data includes traffic data, weather data, holiday data, marketing activity data and network point data.
7. A bank branch traffic prediction device, characterized in that: include: Acquisition unit, fusion unit, determination unit and prediction unit; wherein: The acquisition unit is used to acquire the real-time flow data of people at the target bank branch and the associated data of the real-time flow data; The fusion unit is used to fuse the real-time human flow data and the associated data to obtain a real-time time series of high-dimensional features; The determination unit is used to use an improved dynamic time warping (DTW) algorithm to determine a sub-historical time series classification set with the highest similarity to the real-time time series from a historical time series classification set; the historical time series classification set is obtained based on a time series clustering model; the time series clustering model is configured to: calculate the similarity between each sub-historical time series in the historical time series set according to the improved DTW algorithm, cluster the sub-historical time series whose similarity meets a preset clustering condition into one category, and obtain the historical time series classification set including multiple sub-historical time series classification sets; the improved DTW algorithm is an algorithm that uses a fusion distance to characterize the similarity between time series; the fusion distance is determined based on the position distance and the cosine distance; The prediction unit is used to input the real-time time series into the pedestrian flow prediction model to obtain the pedestrian flow prediction result of the target bank branch; the pedestrian flow prediction model is: a sequence-to-sequence Seq2Seq model with a two-stage attention mechanism that uses the sub-historical time series classification set for training and uses the improved shape and time distortion DILATE loss function for model update; the improved DILATE loss function is a loss function that integrates the improved DTW algorithm.
8. A computer program product, characterized in that It includes computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the method for predicting the flow of people at a branch network as described in any one of claims 1 to 6.
9. A device for predicting the flow of people at a bank outlet, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the pedestrian flow prediction device of the bank outlet can implement the pedestrian flow prediction method of any one of claims 1 to 6.
10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the method for predicting pedestrian flow at a branch network as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Banking outlet people flow monitoring method and device
CN117475376A