Prediction model training method, people flow prediction method, device, equipment, medium and program product
By introducing a self-attention mechanism into the prediction model, the model learns the dependency features of public opinion types and lifecycles among sample base stations, thus solving the problem that existing models cannot effectively capture the relationship between pedestrian traffic in different areas of the city and achieving more accurate pedestrian traffic prediction.
Patent Information
- Application Number
- CN202511254988.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-04
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-09-04
AI Technical Summary
Existing location signaling-based regional pedestrian flow prediction models often only focus on local spatial patterns and cannot effectively capture the pedestrian flow relationships between different functional areas of the city, resulting in low accuracy of prediction results.
By acquiring road network information and pedestrian flow information within the sample area, the dependency features between sample base stations are learned using a self-attention mechanism, including dependency features under the influence of public opinion type and life cycle. The prediction model is iteratively trained until the predetermined conditions are met, and the preset prediction model is obtained.
It improves the accuracy of pedestrian flow prediction, and can more comprehensively consider the dependence characteristics at different distances and time periods, thereby improving the accuracy of the prediction results.
Smart Images

Figure CN120744515B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of big data, and particularly relates to a prediction model training method, a people flow prediction method, a device, equipment, a medium and a program product. BACKGROUND
[0002] In the related art, the existing area people flow prediction model based on location signaling often only focuses on local space patterns (for example, people moving speed or population density), which limits the ability of the people flow prediction model to learn dynamic people flow patterns. Secondly, due to the functional division of cities, the relationship between areas far apart is difficult to capture. This results in low accuracy of the prediction results of the people flow prediction model. SUMMARY
[0003] The present application provides a prediction model training method, a people flow prediction method, a device, equipment, a medium and a program product.
[0004] The technical solution of the present application is implemented as follows:
[0005] The present application provides a prediction model training method, which comprises the following steps:
[0006] Obtaining sample road network information and sample people flow information in a sample area; wherein the sample road network information comprises the adjacency relationship of sample base stations in the sample area; and the sample people flow information is used to represent the people flow in the range of the sample base stations in a historical period;
[0007] Inputting the sample road network information and the sample people flow information into an initial prediction model to determine first dependency features of the people flow between sample base stations with different distances under the influence of public opinion types, and second dependency features of the people flow of sample base stations in different time periods under the influence of public opinion life cycles;
[0008] Iteratively training the initial prediction model based on the first dependency features and the second dependency features until a predetermined training condition is reached to stop training, and obtaining a preset prediction model.
[0009] In the above solution, the sample road network information comprises at least one of the following: relevant attributes of each sample base station in the sample area, the number of hops between each two sample base stations in the sample area, and adjacency features of the sample base stations in the sample area;
[0010] The sample people flow information comprises people flow features of each sample base station in the sample area in each sub-period; wherein the historical period comprises T sub-periods; and T is an integer greater than 1.
[0011] In the scheme, the first dependent feature of the sample base station with different distances between each other under the influence of the public opinion type and the second dependent feature of the sample base station under the influence of the public opinion life cycle in different time periods are determined, including:
[0012] The adjacency feature and the passenger flow feature are converted to the same dimension for fusion to determine the first fusion feature, wherein the first fusion feature is determined based on the dimension of the sub-period, the dimension of the sample base station and the embedding dimension;
[0013] The first sample feature is obtained by slicing the first fusion feature according to the fixed dimension of the sub-period, and the second sample feature is obtained by slicing the first fusion feature according to the fixed dimension of the sample base station;
[0014] The first dependency is determined based on the first initial parameter and the first sample feature, and the first dependent feature under the self-attention mechanism is determined by processing the first dependency based on the public opinion type, the name attribute of each sample base station and the hop number between different sample base stations, wherein the first dependency is used to represent the dependency of the passenger flow of each sample base station in the spatial dimension in the historical period;
[0015] The second dependent feature under the self-attention mechanism is determined by processing the second sample feature based on the second initial parameter and the public opinion life cycle of each sample base station in each sub-period.
[0016] In the scheme, the adjacency feature and the passenger flow feature are converted to the same dimension for fusion to determine the first fusion feature, including:
[0017] The base station spatial structure feature in the sample area is determined based on the adjacency feature;
[0018] The spatial dimension feature is obtained by decomposing the base station spatial structure feature, and the first embedding feature is determined by projecting the spatial dimension feature according to the embedding dimension;
[0019] The passenger flow feature is processed by the embedding feature corresponding to each time dimension to determine the time dimension feature under each time dimension, and the second embedding feature is determined by combining each time dimension feature; wherein the dimension of the embedding feature is the embedding dimension;
[0020] The first embedding feature and the second embedding feature are fused to determine the first fusion feature.
[0021] In the scheme, the first dependency is determined based on the first initial parameter and the first sample feature, and the first dependent feature under the self-attention mechanism is determined by processing the first dependency based on the public opinion type, the name attribute of each sample base station and the hop number between different sample base stations, including:
[0022] determine a first dependency between the number of people of each sample base station in each sub-period based on a product of the first initial parameter and the first sample feature;
[0023] update the first dependency based on a similarity between a type feature of the type of public opinion of each sample base station in each sub-period and the number of people feature of each sample base station in each sub-period;
[0024] determine a mask feature based on a similarity between the number of hops and the name attribute between each two sample base stations;
[0025] determine a first dependency feature based on a product of the mask feature and the updated first dependency.
[0026] In the above scheme, the first initial parameter includes: a first query parameter, a first key parameter and a first value parameter;
[0027] determine a first dependency between the number of people of each sample base station in each sub-period based on a product of the first initial parameter and the first sample feature, including:
[0028] determine a first query feature based on a product of the first query parameter and the first sample feature, and determine a first key feature based on a product of the first key parameter and the first sample feature;
[0029] determine the first dependency based on a ratio of a Tth power of a product of the first query feature and the first key feature to a dimension corresponding to the first query feature.
[0030] In the above scheme, update the first dependency based on a similarity between a type feature of the type of public opinion of each sample base station in each sub-period and the number of people feature of each sample base station in each sub-period, including:
[0031] convert the type feature and the number of people feature of each sample base station in each sub-period to the same dimension for similarity comparison to determine a similarity weight of the type feature of each sample base station in each sub-period;
[0032] weight and sum the type feature of each sample base station in each sub-period based on the similarity weight and a third initial parameter to determine a historical public opinion number of people feature corresponding to each sample base station;
[0033] update the first key feature based on each historical public opinion number of people feature.
[0034] In the above scheme, the mask feature includes: a first mask matrix and a second mask matrix; determine the mask feature based on a similarity between the number of hops and the name attribute between each two sample base stations, including:
[0035] Determine each element of the first mask matrix based on a size relationship between the hop count between each two sample base stations and the first preset threshold, to obtain the first mask matrix.
[0036] Determine each element of the second mask matrix based on a size relationship between the similarity of the name attribute between each two sample base stations and the second preset threshold, to obtain the second mask matrix.
[0037] In the above scheme, the first dependent feature includes a first sub-dependent feature and a second sub-dependent feature; the first dependent feature is determined based on the product of the mask feature and the updated first dependency, including:
[0038] The first sub-dependent feature is determined based on the product of the first mask matrix and the first dependency, and the second sub-dependent feature is determined based on the product of the second mask matrix and the first dependency;
[0039] The first sub-dependent feature is used to represent the dependency between the human flow of different sample base stations under the influence of the public opinion type and the distance; and the second sub-dependent feature is used to represent the dependency between the human flow of different sample base stations under the influence of the public opinion type and the name attribute.
[0040] In the above scheme, the second sample feature is processed based on the second initial parameter and the public opinion life cycle of each sample base station in each sub-period, to determine the second dependent feature under the self-attention mechanism, including:
[0041] The second dependency of the human flow of each sample base station in different sub-periods is determined based on the product of the second initial parameter and the second sample feature;
[0042] Determine a third mask matrix based on the public opinion life cycle of each sample base station in each sub-period;
[0043] Determine the second dependent feature based on the product of the third mask matrix and the second dependency.
[0044] In the above scheme, the third mask matrix is determined based on the public opinion life cycle of each sample base station in each sub-period, including:
[0045] Determine the reconstruction error of the public opinion life cycle of each sample base station in each sub-period based on the number of comments of the public opinion of each sample base station in each sub-period;
[0046] Determine each element in the third mask matrix based on a size relationship between the reconstruction error and the third preset threshold, to obtain the third mask matrix.
[0047] In the above scheme, the initial prediction model is iteratively trained based on the first dependent feature and the second dependent feature, and the training is stopped when a predetermined training condition is reached, to obtain a preset prediction model, including:
[0048] determine a loss of the initial prediction model based on the second fusion feature fused based on the first dependency feature and the second dependency feature;
[0049] update the first initial parameter, the second initial parameter and the third initial parameter based on the loss iteratively until a predetermined training condition is reached to stop training, and obtain a preset prediction model.
[0050] The embodiment of the application also provides a human flow prediction method, comprising:
[0051] obtain target road network information in a target area; wherein the target road network information is used to represent the adjacency relationship of target base stations in the target area;
[0052] input the target road network information into the preset prediction model to determine a human flow prediction result for the target area;
[0053] The preset prediction model is obtained by iteratively training an initial prediction model based on a first dependency feature and a second dependency feature until a predetermined training condition is reached to stop training; the sample road network information and the sample human flow information are input into the initial prediction model to determine the first dependency feature of the human flow of the sample base stations with different distances between each other under the influence of the public opinion type, and the second dependency feature of the human flow of the sample base stations in different time periods under the influence of the public opinion life cycle; the sample road network information includes the adjacency relationship of the sample base stations in the sample area; and the sample human flow information is used to represent the human flow in the range of the sample base stations in the historical period.
[0054] The embodiment of the application also provides a prediction model training device, comprising:
[0055] a first information acquisition unit configured to obtain sample road network information and sample human flow information in a sample area; wherein the sample road network information includes the adjacency relationship of sample base stations in the sample area; and the sample human flow information is used to represent the human flow in the range of the sample base stations in the historical period;
[0056] a first determination unit configured to input the sample road network information and the sample human flow information into an initial prediction model to determine the first dependency feature of the human flow of the sample base stations with different distances between each other under the influence of the public opinion type, and the second dependency feature of the human flow of the sample base stations in different time periods under the influence of the public opinion life cycle;
[0057] an update unit configured to iteratively train the initial prediction model based on the first dependency feature and the second dependency feature until a predetermined training condition is reached to stop training, and obtain a preset prediction model.
[0058] The embodiment of the application also provides a human flow prediction device, comprising:
[0059] The second information acquisition unit is configured to acquire target road network information in the target area, wherein the target road network information is used to represent the adjacency relationship of the target base stations in the target area.
[0060] The second determination unit is configured to input the target road network information into a preset prediction model to determine a crowd flow prediction result for the target area.
[0061] The preset prediction model is obtained by iteratively training an initial prediction model based on the first dependency feature and the second dependency feature until a predetermined training condition is reached; the sample road network information and the sample crowd flow information are input into the initial prediction model to determine the first dependency feature of the crowd flow of the sample base stations with different distances between each other under the influence of the public opinion type, and the second dependency feature of the crowd flow of the sample base stations in different time periods under the influence of the public opinion life cycle; the sample road network information includes the adjacency relationship of the sample base stations in the sample area; and the sample crowd flow information is used to represent the crowd flow in the sample base station range in the historical period.
[0062] The embodiment of the present application also provides a first electronic device, including a first memory and a first processor, the first memory stores a computer program capable of running on the first processor, and the first processor implements the steps in the method of the side of the prediction model training device when executing the computer program.
[0063] The embodiment of the present application also provides a second electronic device, including a second memory and a second processor, the second memory stores a computer program capable of running on the second processor, and the second processor implements the steps in the method of the side of the crowd flow prediction device when executing the computer program.
[0064] The embodiment of the present application also provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps in the method of the side of the prediction model training device when executed by the first processor.
[0065] The embodiment of the present application also provides a computer readable storage medium, which stores a computer program, and the computer program implements the steps in the method of the side of the crowd flow prediction device when executed by the second processor.
[0066] The embodiment of the present application also provides a computer program product, which includes a computer program, and the computer program implements the steps in the method of the side of the prediction model training device when executed by the first processor.
[0067] The embodiment of the present application also provides a computer program product, which includes a computer program, and the computer program implements the steps in the method of the side of the crowd flow prediction device when executed by the second processor.
[0068] In the embodiment of the present application, sample road network information and sample passenger flow information in a sample area are obtained; wherein the sample road network information comprises the adjacency relationship of sample base stations in the sample area; the sample passenger flow information is used to represent the passenger flow in the range of the sample base stations in a historical period; the sample road network information and the sample passenger flow information are input into an initial prediction model to determine first dependency characteristics of the passenger flow of sample base stations with different distances under the influence of public opinion types, and second dependency characteristics of the passenger flow of sample base stations in different periods under the influence of the life cycle of public opinion; the initial prediction model is iteratively trained based on the first dependency characteristics and the second dependency characteristics, and the training is stopped when a predetermined training condition is reached, and a preset prediction model is obtained. In this way, the dependency characteristics of the passenger flow of sample base stations in different distances and in different periods under public opinion can be learned based on the first dependency characteristics and the second dependency characteristics, which is more comprehensive and considers more factors than the prediction model in the related art, so that the passenger flow prediction result determined based on the trained preset prediction model is more accurate. BRIEF DESCRIPTION OF DRAWINGS
[0069] Figure 1 Flowchart of the prediction model training method provided by the embodiment of the present application Figure 1 ;
[0070] Figure 2 Flowchart of the prediction model training method provided by the embodiment of the present application Figure 2 ;
[0071] Figure 3 Effect diagram of the prediction model training method provided by the embodiment of the present application Figure 1 ;
[0072] Figure 4 Flowchart of the prediction model training method provided by the embodiment of the present application Figure 3 ;
[0073] Figure 5 Flowchart of the prediction model training method provided by the embodiment of the present application Figure 4 ;
[0074] Figure 6 Flowchart of the prediction model training method provided by the embodiment of the present application Figure 5 ;
[0075] Figure 7 Flowchart of the prediction model training method provided by the embodiment of the present application Figure 6 ;
[0076] Figure 8 Effect diagram of the prediction model training method provided by the embodiment of the present application Figure 2 ;
[0077] Figure 9 Flowchart of the prediction model training method provided by the embodiment of the present application Figure 7
[0078] Figure 10 Effect diagram of the prediction model training method provided by the embodiment of the present application Figure 3
[0079] Figure 11 Flowchart of the people flow prediction method provided by the embodiment of the present application Figure 1
[0080] Figure 12 Structure diagram of the prediction model training device provided by the embodiment of the present application
[0081] Figure 13 Hardware entity diagram of the first electronic device provided by the embodiment of the present application
[0082] Figure 14 Structure diagram of the people flow prediction device provided by the embodiment of the present application
[0083] Figure 15 Hardware entity diagram of the second electronic device provided by the embodiment of the present application DETAILED DESCRIPTION
[0084] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme of the present application will be further described in detail below in combination with the drawings and embodiments, and the described embodiments should not be regarded as limiting the present application, and all other embodiments obtained by those skilled in the art without making creative efforts belong to the scope of protection of the present application.
[0085] In the following description, “some embodiments” are described, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” can be the same subset or different subset of all possible embodiments, and can be combined with each other without conflict.
[0086] If similar descriptions of “first / second” appear in the application file, the following description is added, in the following description, the terms “first\second\third” involved only distinguish similar objects, and do not represent the specific order of the objects, and it can be understood that “first\second\third” can be interchanged in the specific order or sequence as allowed, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0087] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of this application.
[0088] The embodiments of the present application provide a prediction model training method, please refer to Figure 1 The flowchart of the prediction model training method provided by the embodiments of the present application is shown in Figure 1 The steps shown will be described in combination with Figure 1 The steps shown will be described in combination with
[0089] S101, sample road network information and sample passenger flow information in a sample area are acquired; wherein, the sample road network information comprises the adjacency relationship of sample base stations in the sample area; the sample passenger flow information is used to represent the passenger flow in the range of the sample base stations in a historical period.
[0090] In the embodiments of the present application, the prediction model training device can determine a sample area, and acquire sample road network information and sample passenger flow information from sample base stations in the sample area. Wherein, the sample road network information comprises the adjacency relationship of sample base stations in the sample area; the sample passenger flow information is used to represent the passenger flow in the range of the sample base stations in a historical period.
[0091] Wherein, the sample road network information comprises at least one of the following: the relevant attribute of each sample base station in the sample area, the hop number between each two sample base stations in the sample area, and the adjacency feature of the sample base stations in the sample area; the sample passenger flow information comprises: the passenger flow feature of each sample base station in the sample area in each sub-period; wherein, the historical period comprises: T sub-periods, and T is an integer greater than 1.
[0092] In the embodiments of the present application, the passenger flow feature corresponding to each sample base station can be determined according to the position signaling received by the sample base station in the sub-period. Wherein, the passenger flow feature can comprise inflow feature and outflow feature.
[0093] Wherein, the sample road network information can be represented by G, which comprises a set of N sample base station attributes, a set of edges between each two sample base stations, and an adjacency matrix of sample base stations in the sample area (adjacency feature). The passenger flow feature of each sample base station in each sub-period is an NxC dimensional matrix, wherein C is the dimension of the passenger flow. For example, when the passenger flow feature comprises inflow and outflow, C=2. The historical period can comprise T sub-periods. The passenger flow feature in the historical period is a T×N×C dimensional matrix. N is an integer greater than 1.
[0094] S102, input the sample road network information and the sample passenger flow information into the initial prediction model, determine the first dependency feature of the passenger flow of the sample base station with different distances between each other under the influence of the public opinion type, and the second dependency feature of the passenger flow of the sample base station in different time periods under the influence of the public opinion life cycle.
[0095] In the embodiment of the application, during training, it is also necessary to crawl the public opinion information in the area corresponding to each sample base station from the network. The public opinion information includes: public opinion quantity, public opinion type, public opinion life cycle, and public opinion comment quantity and other information. The prediction model training device can input the sample road network information and the sample passenger flow information into the initial prediction model, fuse the sample road network information and the sample passenger flow information, and determine the first fusion feature. The first sample feature is obtained by slicing the first fusion feature according to the dimension of the fixed sub-period, and the second sample feature is obtained by slicing the first fusion feature according to the dimension of the fixed sample base station. The first dependency is determined based on the passenger flow feature corresponding to each sample base station and the first initial parameter, the first dependency is updated using the public opinion type, and the first dependency feature under the self-attention mechanism is determined by processing the first dependency based on the related features (including hop count and name attribute information) of the sample base station with different distances between each other. At the same time, the second sample feature can be processed using the second initial parameter and the sample base station public opinion life cycle feature in different time periods to determine the second dependency feature under the self-attention mechanism.
[0096] Among them, the first initial parameter and the second initial parameter are parameters in the self-attention module in the initial detection model.
[0097] In the embodiment of the application, when fusing the sample road network information and the sample passenger flow information, the sample road network information and the sample passenger flow information can be converted into features in the same dimension for fusion to determine the first fusion feature. In the conversion process of the sample passenger flow information, the influence of different time periods on passenger flow can also be considered. The sample passenger flow information is first converted into passenger flow features corresponding to different periods, and then the passenger flow features corresponding to different periods are combined and converted to the same dimension for fusion.
[0098] Among them, the public opinion information in the area corresponding to each sample base station can include: the public opinion information in each area crawled on the network through the crawler technology. Since there is a corresponding relationship between the area and the sample base station, the public opinion information corresponding to the sample base station can be determined.
[0099] The opinion life cycle refers to the process of the opinion from formation, development to subsidence. The process can be divided into several stages, including the budding period, the development period, the peak period, the recession period and the subsidence period. The comment quantity of the opinion corresponding to different stages is different, so the comment quantity of the opinion can reflect the corresponding opinion life cycle. The positive and negative emotions of the opinion event are marked to determine the opinion type of the opinion event, which indicates positive opinion, negative opinion or no opinion. For example, words such as "good" and "excellent" tend to be positive emotions, and words such as "bad" and "terrible" tend to be negative emotions.
[0100] S103, iteratively training the initial prediction model based on the first dependency feature and the second dependency feature until a predetermined training condition is reached to stop training, obtaining a preset prediction model.
[0101] In the embodiment of the application, the prediction model training device can determine the loss function of the processing prediction model according to the first dependency feature and the second dependency feature, and then update the parameters of the initial prediction model according to the loss until the predetermined training condition is reached to stop training, obtaining the preset prediction model.
[0102] In the embodiment of the application, sample road network information and sample passenger flow information in the sample area are obtained; the sample road network information includes the adjacency relationship of the sample base stations in the sample area; the sample passenger flow information is used to represent the passenger flow in the range of the sample base stations in the historical period; the sample road network information and the sample passenger flow information are input into the initial prediction model to determine the first dependency feature of the passenger flow between the sample base stations with different distances under the influence of the opinion type, and the second dependency feature of the passenger flow of the sample base stations in different time periods under the influence of the opinion life cycle; the initial prediction model is iteratively trained based on the first dependency feature and the second dependency feature until a predetermined training condition is reached to stop training, obtaining a preset prediction model. In this way, the dependency features of the passenger flow of the sample base stations under the opinion at different distances and in different time periods can be learned based on the first dependency feature and the second dependency feature, which is more comprehensive and considers more factors than the prediction model in the related art, so that the passenger flow prediction result determined based on the trained preset prediction model is more accurate.
[0103] Please refer to Figure 2 The flowchart of the prediction model training method provided in the embodiment of the application Figure 2 , Figure 1 S102 in the embodiment of the application can also be implemented by S201 to S204, which will be described in combination with the steps shown in Figure 2
[0104] S201, convert the adjacency feature and the passenger flow feature to the same dimension for fusion to determine a first fusion feature; wherein the first fusion feature is determined based on the dimension of the sub-period, the dimension of the sample base station, and the embedding dimension.
[0105] In the embodiments of the present application, the elements in the adjacency feature are used to represent the connection between each two sample base stations. The adjacency feature is an N x N matrix. The passenger flow feature in the historical period is an N x T matrix. The prediction model training device can convert the adjacency feature and the passenger flow feature to the same dimension for fusion in combination with the embedding dimension d to determine the first fusion feature. The determined first fusion feature is an N x T x d matrix. d is an integer greater than 1.
[0106] For example, the adjacency feature can be represented by the following matrix A, where A i,j represents the connection between sample base station i and sample base station j. If sample base station i and sample base station j have an edge, i.e., adjacent, then A i,j = 1, otherwise A i,j = 0.
[0107]
[0108] In the embodiments of the present application, the prediction model training device can convert the input adjacency feature and the passenger flow feature in each sub-period into high-dimensional representation, and can convert the input features into an N x T x d matrix. In order to encode the sample base station network structure and the periodicity of the passenger flow, two mechanisms of spatial graph Laplacian embedding and time periodicity embedding can be used for conversion, wherein the spatial graph Laplacian embedding is used to encode the adjacency feature, and the time periodicity embedding is used to encode the periodicity of the passenger flow feature.
[0109] S202, slice the first fusion feature according to the fixed sub-period dimension to obtain a first sample feature, and slice the first fusion feature according to the fixed sample base station dimension to obtain a second sample feature.
[0110] In the embodiments of the present application, the prediction model training device can fix the time step t, retain the elements of the N and d dimensions within the step, and determine the first sample feature. The sample base station step n can be fixed, the elements of the T and d dimensions within the step can be retained, and the second sample feature can be determined.
[0111] wherein the first sample feature can represent a fixed time step t, retaining all elements of N and d dimensions, and the resulting matrix has a dimension of Nxd. For example, when T=0, this slice corresponds to an Nxd feature matrix of all samples at time step 0. The second sample feature can represent a fixed sample base station step n, retaining all data of Txd dimensions, and the resulting matrix has a dimension of Txd. For example, when n=0, this slice corresponds to a Txd feature matrix of the first sample over the time sequence.
[0112] In S203, a first dependency is determined based on the first initial parameter and the first sample feature, and the first dependency is processed based on the public opinion type, the name attribute of each sample base station, and the hop number between different sample base stations to determine a first dependency feature under a self-attention mechanism.
[0113] In the embodiments of the present application, the prediction model training apparatus can determine the first dependency based on the first initial parameter and the first sample feature. Then, the first dependency is updated according to the similarity between the type feature of the public opinion type of each sample base station in each sub-period and the corresponding human flow feature. Then, the mask feature of the sample base station in the spatial dimension under different distances is determined according to the name attribute of the sample base station and the hop number between different sample base stations, and the updated first dependency is processed using the mask feature to determine the first dependency feature. The first dependency is used to represent the dependency of the human flow of each sample base station in the spatial dimension in the historical period.
[0114] In the embodiments of the present application, the prediction model training apparatus can determine the mask feature of the sample base station in the spatial dimension under different distances according to the similarity between the name attributes of each sample base station and the size relationship between the hop number between different sample base stations and the corresponding threshold. The mask feature of the sample base station in the spatial dimension under long distances, that is, the long-distance spatial feature, can be determined according to the similarity between the name attributes. The mask feature of the sample base station in the spatial dimension under short distances, that is, the short-distance spatial feature, can be determined according to the hop number between different sample base stations.
[0115] For example, there are multiple same functional areas in a city distributed in various corners. The sample base stations in different functional areas are far away from each other, but still have similar human flow information. Therefore, these base stations also have the same spatial characteristics. Figure 3 As shown in the figure, the circles represent a set of sample base stations with short-distance spatial features, and the base stations connected by dashed lines represent sample base stations with long-distance spatial features.
[0116] In S204, the second sample feature is processed based on the second initial parameter and the public opinion life cycle of each sample base station in each sub-period to determine a second dependency feature under a self-attention mechanism.
[0117] In the embodiment of the present application, the prediction model training device can determine the corresponding second dependency by using the second initial parameter and the second sample feature. The second dependency is used to represent the dependency feature of the passenger flow between the base stations in different time periods. Then, a mask matrix is determined according to the public opinion life cycle of each sample base station in each sub-period, the second dependency is processed by using the mask matrix, and the second dependency feature is determined.
[0118] In the embodiment of the present application, the adjacency feature and the passenger flow feature are converted to the same dimension for fusion to determine the first fusion feature. The first fusion feature is determined based on the dimension of the sub-period, the dimension of the sample base station and the embedding dimension. The first sample feature is obtained by slicing the first fusion feature according to the dimension of the fixed sub-period, and the second sample feature is obtained by slicing the first fusion feature according to the dimension of the fixed sample base station. The first initial parameter is determined based on the name attribute of each sample base station and the hop number between different sample base stations. The first sample feature is processed based on the first initial parameter to determine the first dependency feature under the self-attention mechanism. The second initial parameter is used to process the second sample feature based on the public opinion life cycle of each sample base station in each sub-period to determine the second dependency feature under the self-attention mechanism. In this way, the dependency feature of the passenger flow of the sample base station under the public opinion at different distances and in different time periods can be learned based on the first dependency feature and the second dependency feature. Compared with the prediction model in the related art, the learning is more comprehensive and the factors considered are more. Therefore, the passenger flow prediction result determined based on the trained preset prediction model is more accurate.
[0119] Please refer to Figure 4 The flowchart of the prediction model training method provided in the embodiment of the present application Figure 3 , Figure 2 S201 in the embodiment of the present application can also be implemented by S301 to S304. The steps shown in Figure 4 will be described in combination:
[0120] S301, determine the base station spatial structure feature in the sample area based on the adjacency feature.
[0121] In the embodiment of the present application, the prediction model training device can determine the base station spatial structure feature in combination with the adjacency matrix, the degree matrix and the unit matrix.
[0122] In order to represent the network structure of the sample base station, we use the graph Laplacian matrix (base station spatial structure feature), which can better describe the distance between the sample base stations in the sample area. First, we calculate the normalized Laplacian matrix wherein is the Laplacian matrix, A is the adjacency matrix, D is the degree matrix, and I is the unit matrix.
[0123] S302, decompose the base station spatial structure feature to obtain a spatial dimension feature, and project the spatial dimension feature according to an embedding dimension to determine a first embedding feature.
[0124] In the embodiment of the application, the prediction model training device can decompose the base station spatial structure feature to obtain a spatial dimension feature, and project the spatial dimension feature according to an embedding dimension to determine a first embedding feature.
[0125] The prediction model training device can perform eigen-decomposition on the Laplace matrix to obtain a feature matrix and a feature vector matrix (spatial dimension feature). Wherein T represents the number of T sub-periods in the historical period. The d smallest non-zero feature vectors are used for linear projection to generate the first embedding feature. The first embedding feature is an Nxd matrix. Wherein N is the number of sample base stations, and d is the number of selected feature vector matrix, which is also the embedding dimension.
[0126] S303, process the passenger flow feature by the embedding features corresponding to the plurality of time dimensions respectively, determine the time dimension feature under each time dimension, and combine each time dimension feature to determine a second embedding feature; wherein the dimension of the embedding feature is the embedding dimension.
[0127] In the embodiment of the application, the prediction model training device can pre-configure the embedding features under a plurality of time dimensions. Wherein the dimension of each embedding feature is the embedding dimension, that is, d. The prediction model training device can multiply the embedding feature of each time dimension with the passenger flow feature in the historical period to determine the time dimension feature under each time dimension. And combine the time dimension feature under each time dimension to obtain the second embedding feature.
[0128] S304, fuse the first embedding feature and the second embedding feature to determine a first fusion feature.
[0129] In the embodiment of the application, the first embedding feature and the second embedding feature can be combined to determine the corresponding first fusion feature.
[0130] In the embodiment of the application, because the passenger flow is affected by the travel mode and the living area, the passenger flow in the sample area has obvious periodicity, such as week cycle, day cycle and seasonality. Therefore, three embedding features are introduced to represent the week dimension embedding feature, the day dimension embedding feature and the season dimension embedding feature, denoted as , and The three embedding features are each d-dimensional. Among them, w(t), d(t), s(t) are respectively sine and cosine functions that map time t to a week index (1 to 7), a minute index (1 to 1440), and a season index. The time-dimension feature determined based on each embedding feature and the T-dimensional passenger flow feature is Txd-dimensional. Finally, the respective time-dimension features are added to determine the corresponding second embedding feature.
[0131] In the embodiments of the present application, the base station spatial structure feature in the sample area is determined based on the adjacency feature; the spatial-dimension feature is obtained by decomposing the base station spatial structure feature, and the spatial-dimension feature is projected according to the embedding dimension to determine the first embedding feature; the passenger flow feature is processed by the respective embedding features of the multiple time dimensions to determine the time-dimension feature under each time dimension, and each time-dimension feature is combined to determine the second embedding feature; wherein the dimension of the embedding feature is the embedding dimension; the first embedding feature and the second embedding feature are fused to determine the first fusion feature. In this way, because the first embedding feature represents the distance feature between the sample base stations, the second embedding feature represents the passenger flow feature under different time dimensions, and the first fusion feature fused by the first embedding feature and the second embedding feature has the distance feature between the sample base stations and the passenger flow feature under different time dimensions, the initial prediction model can be trained using the first fusion feature with multiple types of features, so that the features learned by the initial prediction model are more comprehensive, and the prediction accuracy of the preset prediction model is improved.
[0132] Please refer to Figure 5 The flowchart of the prediction model training method provided in the embodiments of the present application is shown in Figure 4 , Figure 5 S203 in the embodiments of the present application can also be implemented by S401 to S404, which will be described in combination with the steps shown in Figure 5
[0133] S401, determine the first dependency between the passenger flow of each sample base station in each sub-period based on the product of the first initial parameter and the first sample feature.
[0134] In the embodiments of the present application, the first initial parameter includes a first query parameter, a first key parameter, and a first value parameter; a first query feature is determined based on the product of the first query parameter and the first sample feature, and a first key feature is determined based on the product of the first key parameter and the first sample feature; the first dependency is determined based on the ratio of the Tth power of the product of the first query feature and the first key feature to the dimension of the first query feature.
[0135] In the embodiments of the present application, a spatial self-attention module is designed to capture dynamic spatial dependency. In the t time step, the first query feature, the first key feature and the first value feature concerned by the self-attention mechanism can be represented by the following formula:
[0136] Formula (1)
[0137] Formula (2)
[0138] Formula (3)
[0139] wherein, represents the first sample feature, represents the first query parameter, represents the first key parameter, represents the first value parameter. represents the first query feature, represents the first key feature, represents the first value feature. , and are learnable parameters, and the dimensions are , is the dimension of the first query feature, the first key feature and the first value feature, and d is the dimension of the input feature. In this way, self-attention can be applied in the spatial dimension to model the interaction between sample base stations, and the first dependency (attention score) between all sample base stations at the t time step can be obtained. The first dependency can be determined by formula (4).
[0140] Formula (4)
[0141] wherein, represents the first dependency of the t sub-period, represents the first query feature, represents the first key feature. T represents the number of sub-periods. is the dimension of the first query feature, the first key feature and the first value feature.
[0142] In this way, it can be seen that the first dependency between sample base stations is different in different time slices, that is, dynamic. Therefore, it can be used to capture dynamic spatial dependency. Finally, we can use the first dependency to multiply the first value feature to obtain the output of the spatial self-attention module.
[0143] S402, update the first dependency based on the similarity between the type feature of the type of public opinion of each sample base station in each sub-period and the passenger flow feature of each sample base station in each sub-period.
[0144] In the embodiment of the present application, the prediction model training device can crawl the public opinion information corresponding to each sample base station on the network. And according to the public opinion information corresponding to each sample base station, the type features of the cluster centers of each sample base station are determined. The type features of each sample base station corresponding to each sub-period can be converted to the same dimension for similarity comparison, and the similarity weight of each type feature is determined, and then the type features of each sample base station in each sub-period are weighted and summed to determine a feature using the similarity weight. Then the feature summation of multiple sample base stations is used to update the first dependency.
[0145] In the embodiment of the present application, in order to simplify the public opinion type of complex public opinion events, the time series clustering algorithm is also used to cluster the public opinion type corresponding to each sample base station, P i The type feature corresponding to the cluster center of the public opinion type represents the type feature corresponding to the i th sub-period. Each sample base station corresponds to T time series P i . Wherein, P i may represent any one of positive public opinion flow features, negative public opinion flow features and non-public opinion normal flow features.
[0146] S403, based on the number of hops and the similarity of the name attribute between each two sample base stations, determine the mask feature.
[0147] In the embodiment of the present application, the prediction model training device can determine each element in the mask feature according to the size of the number of hops between each two sample base stations and the similarity between the name attributes of each two sample base stations, and then obtain the corresponding mask feature.
[0148] In the embodiment of the present application, the prediction model training device can determine each element of the first mask matrix based on the size relationship between the number of hops between each two sample base stations and the first preset threshold, and obtain the first mask matrix; determine each element of the second mask matrix based on the size relationship between the similarity of the name attribute between each two sample base stations and the second preset threshold, and obtain the second mask matrix.
[0149] Wherein, from the short distance, the first mask matrix can be defined, and the dimension of the first mask matrix is N×N. If the number of hops between two sample base stations is less than the first preset threshold, it is determined that the corresponding element of the two sample base stations in the first mask matrix is 1, otherwise it is 0.
[0150] Wherein, from the long distance, the second mask matrix can be defined, and the dimension of the second mask matrix is N×N. If the similarity of the name attribute between two sample base stations is greater than the second preset threshold, it is determined that the corresponding element of the two sample base stations in the second mask matrix is 1, otherwise it is 0.
[0151] S404. Determine the first dependency feature based on the product of the mask feature and the updated first dependency.
[0152] In this embodiment of the application, the prediction model training device can determine a first sub-dependency feature based on the product of a first mask matrix and a first dependency, and determine a second sub-dependency feature based on the product of a second mask matrix and the first dependency; wherein, the first sub-dependency feature is used to characterize the dependency between different sample base stations on pedestrian traffic under the influence of public opinion type and distance; the second sub-dependency feature is used to characterize the dependency between different sample base stations on pedestrian traffic under the influence of public opinion type and name attribute.
[0153] Based on the two mask matrices mentioned above, we designed two spatial self-attention modules: geospatial self-attention and similarity-based spatial self-attention. These two modules together form the spatial self-attention module, used to capture the spatial characteristics of pedestrian traffic between sample base stations at both long and short distances.
[0154] In this embodiment, the first initial parameter is updated and determined based on the similarity between the type characteristics of public opinion type of each sample base station in each sub-time period and the traffic flow characteristics of each sample base station in each sub-time period. The first dependency between the traffic flow of each sample base station in each sub-time period is determined based on the product of the first initial parameter and the first sample feature. The first dependency characterizes the spatial dependency of the traffic flow of each sample base station in historical time periods. A mask feature is determined based on the similarity of hop count and name attribute between any two sample base stations. The first dependency feature is determined based on the product of the mask feature and the first dependency. Thus, the determined first dependency feature includes the dependency features between the traffic flow of sample base stations affected by public opinion type over short and long distances. Training the initial prediction model with the first dependency feature allows the initial prediction model to learn the traffic flow characteristics of sample base stations affected by public opinion type over short and long distances, learning more than in related technologies, thereby improving the performance of the preset prediction model and making the prediction results more accurate.
[0155] Please see Figure 6 This is a flowchart illustrating the prediction model training method provided in the embodiments of this application. Figure 6 , Figure 2 S402 in the above can also be implemented through S501 to S503, combining Figure 7 The steps shown are explained below:
[0156] S501, convert the type feature and the passenger flow feature of each sample base station in each sub-period to the same dimension for similarity comparison to determine the similarity weight of the type feature of each sample base station in each sub-period.
[0157] In the embodiments of the present application, the prediction model training device can convert the type feature of each sample base station in each sub-period to the same dimension for similarity comparison with the passenger flow feature of each sample base station in each sub-period to determine the similarity weight of the type feature of each sample base station in each sub-period.
[0158] In the embodiments of the present application, the prediction model training device can convert the type feature of each sample base station in each sub-period to the corresponding dimension to obtain a type feature sequence corresponding to each sample base station. The passenger flow feature of each sample base station in each sub-period can be converted to the same dimension to obtain a passenger flow feature sequence. Then, similarity comparison is performed on the two sequences to determine the similarity weight of the type feature of each sample base station in each sub-period.
[0159] Wherein, for the passenger flow feature X of each sample base station in each sub-period, the embedding matrix W u is multiplied with X to map the passenger flow feature X to a high-dimensional representation . represents the high-dimensional representation of the nth sample base station in the tth sub-period. Then, another embedding matrix W m is used to convert the type feature P i of each sample base station in each sub-period to a memory vector m i . As shown in formula (5):
[0160] Formula (5)
[0161] Wherein, represents the memory vector corresponding to the ith sub-period, W m represents the embedding matrix, P i represents the type feature corresponding to the ith sub-period. The similarity between the sequence composed of the memory vector m i of each sample base station in each sub-period and the sequence composed of the type feature P of the corresponding sample base station can be compared to obtain the similarity weight w i .
[0162] S502, based on the similarity weight and the third initial parameter, weighted sum of the type feature of each sample base station in each sub-period is performed to determine the corresponding historical public opinion passenger flow feature of each sample base station.
[0163] In the embodiments of the present application, the type feature of each sample base station in each sub-period is weighted and summed based on the similarity weight of the type feature of each sample base station in each sub-period and the third initial parameter to determine the historical public opinion passenger flow feature corresponding to each sample base station.
[0164] wherein the representative public opinion passenger flow mode is weighted and summed according to the similarity weight to obtain the integrated historical public opinion passenger flow representation of each node. As shown in formula (6):
[0165] Formula (6)
[0166] wherein, represents the historical public opinion passenger flow feature corresponding to the type feature of the nth sample base station in the i th sub-period. i represents the similarity weight of the type feature of the i th sub-period. Wherein, W c represents the third initial parameter, which is a learnable parameter matrix. i represents the type feature corresponding to the i th sub-period. T represents the number of sub-periods in the sub-history period.
[0167] S503, update the first key feature based on each historical public opinion passenger flow feature.
[0168] In the embodiments of the present application, the historical public opinion passenger flow features of multiple sample base stations are accumulated and added to the first key feature to determine the latest first key feature.
[0169] wherein, represents the historical public opinion passenger flow feature corresponding to the type feature of the nth sample base station in the i th sub-period. Finally, we use the integrated representation Rt of the historical public opinion passenger flow features of N sample base stations to update the first key feature, add Rt to the original first key feature, and determine the latest first key feature.
[0170] In the embodiments of the present application, the type feature and the passenger flow feature of each sample base station in each sub-period are converted to the same dimension for similarity comparison to determine the similarity weight of the type feature of each sample base station in each sub-period. The type feature of each sample base station in each sub-period is weighted and summed based on the similarity weight and the third initial parameter to determine the historical public opinion passenger flow feature corresponding to each sample base station. The first key feature is updated based on each historical public opinion passenger flow feature. In this way, the determined first key feature fuses the type feature of the public opinion type, and further learns more feature factors during the initial detection model training. Compared with the factor considered in the model training scheme in the related art, the performance of the preset prediction model trained is more optimal, and the prediction result is more accurate.
[0171] Please refer to Figure 8This is a flowchart illustrating the prediction model training method provided in the embodiments of this application. Figure 9 , Figure 7 S204 in the above can also be implemented through S601 to S603, combining Figure 1 The steps shown are explained below:
[0172] S601. Based on the product of the second initial parameter and the second sample feature, determine the second dependency of the passenger flow of each sample base station in different sub-time periods.
[0173] In this embodiment of the application, the second initial parameters include: a second query parameter, a second key parameter, and a second value parameter; the prediction model training device can determine the second query feature based on the product of the second query parameter and the second sample feature, and determine the second key feature based on the product of the second key parameter and the second sample feature; the second dependency is determined based on the ratio of the T-th power of the product of the second query feature and the second key feature to the square root of the dimension corresponding to the second query feature.
[0174] In this embodiment, there are dependencies (e.g., periodicity, trend) among pedestrian traffic in different sub-time periods, and these dependencies vary under different circumstances. Therefore, we use a temporal self-attention module to discover dynamic temporal patterns. Formally, for sample base station n, at time step t, the second query feature, second key feature, and second value feature that our temporal self-attention mechanism focuses on can be represented as follows:
[0175] Formula (7)
[0176] Formula (8)
[0177] Formula (9)
[0178] in, Represents the characteristics of the second sample. This represents the second query parameter. Represents the second key parameter. This represents the second-valued parameter. This represents the second query feature. Represents the second bond feature. This represents the second-valued feature. , and These are learnable parameters, all of which are dimensionless. , is the dimension of the second query feature, the second key feature, and the second value feature, and d is the dimension of the input features. This way, self-attention can be applied over the time dimension to model and compute the pairwise dependencies between all sub-periods at sample base station n. The second dependency can be determined by formula (10).
[0179] Formula (10)
[0180] wherein, represents the second dependency of the nth base station, represents the second query feature, represents the second key feature. T represents the number of sub-periods. is the dimension of the second query feature, the second key feature, and the second value feature.
[0181] S602, based on the public opinion life cycle of each sample base station in each sub-period, determine a third mask matrix.
[0182] In the embodiments of the present application, the prediction model training device can determine the reconstruction error of the public opinion life cycle of each sample base station in each sub-period based on the number of comments of the public opinion of each sample base station in each sub-period; based on the size relationship between the reconstruction error and the third preset threshold, determine each element in the third mask matrix, and obtain the third mask matrix. Wherein, if the reconstruction error is greater than the third preset threshold, the corresponding element in the third mask matrix can be set to 1, otherwise set to 0, and then the third mask matrix is obtained.
[0183] In the embodiments of the present application, the time self-attention can find different dynamic spatio-temporal features between different sample base stations. In addition, the time self-attention has global perception to model the long-range spatio-temporal dependencies between all time slices. Combined with Figure 9 From the perspective of the public opinion life cycle, the regional flow distribution will present a normal distribution over time,
[0184] In addition, for the sample area, the development period, the peak period and the decline period of public opinion have the greatest impact on the flow of the scenic spot, while the germination period and the decline period have a tendency to flatten the flow of the scenic spot. The number of comments of the public opinion event in each sub-period can be obtained for each sample base station , The number of comments of the nth sample base station in the ith sub-period is represented. In this way, the number of comments of each sample base station in the historical period of the public opinion event can be converted into a set of time series data. For example, during a city sports meeting, a concert, and a ball game, the amount of public opinion discussion will increase dramatically, and the number of people flowing to the area will also increase. Conversely, for negative public opinion, the amount of public opinion discussion will also increase dramatically, but the number of people flowing to the area will decrease. However, the simple time self-attention module does not consider the influence of public opinion on people flow. During the public opinion event, the public opinion in the budding and subsiding period has little influence on people flow. At the same time, each public opinion time occurs accidentally, so it does not necessarily occur in a long time. Therefore, when processing each time slice, a third mask matrix of a public opinion life cycle is introduced. A variational autoencoder can be used to identify the reconstruction error of each sample base station in different sub-periods. The time slices with high reconstruction error may be affected by a sudden public opinion event or other factors. However, regardless of the factors, they are actually public opinion events. The third mask matrix has a dimension of N x T. The elements corresponding to the abnormal sub-periods of each two sample base stations are set to 1, and the other elements are set to 0. In this way, the normal data without public opinion events in a long time can be ignored, and more attention can be paid to the sub-periods with data changes.
[0185] In S603, a second dependent feature is determined based on a product of the third mask matrix and the second dependency.
[0186] In the embodiments of the present application, the prediction model training apparatus can determine the second dependent feature based on the product of the third mask matrix and the second dependency.
[0187] In the embodiments of the present application, the second dependency of the people flow of each sample base station in different sub-periods is determined based on the product of the second initial parameter and the second sample feature. The third mask matrix is determined based on the public opinion life cycle of each sample base station in each sub-period. The second dependent feature is determined based on the product of the third mask matrix and the second dependency. In this way, the determined second dependent feature includes the dependent features between the people flow of the sample base stations affected by the public opinion life cycle in different times. Through the training of the initial prediction model by the second dependent feature, the initial prediction model can learn the dependent features between the people flow of the sample base stations affected by the public opinion life cycle in different times, more than in the related art. Therefore, the performance of the preset prediction model is improved, and the result predicted by the preset prediction model is more accurate.
[0188] Please refer to Figure 10 The flowchart of the prediction model training method provided in the embodiments of the present application is shown in S103 of Figure 11 , Figure 1 S103 can also be implemented by S701 to S702. The details will be described in combination with Figure 11The illustrated steps are described as follows:
[0189] S701, determining a loss of an initial prediction model based on a second fusion feature fused based on the first dependency feature and the second dependency feature.
[0190] In the embodiment of the application, the prediction model training apparatus can splice the features output by the self-attention head corresponding to the first sub-dependency feature to obtain a first splicing result, splice the features output by the self-attention head corresponding to the second sub-dependency feature to obtain a second splicing result, and splice the features output by the self-attention head corresponding to the second dependency feature to obtain a third splicing result. The first splicing result, the second splicing result and the third splicing result are fused to determine the second fusion feature by using a projection matrix. The corresponding loss is determined based on the second fusion feature.
[0191] In the embodiment of the application, the initial prediction model includes three types of attention heads: a geographical attention head for determining the first sub-dependency feature, a semantic attention head for determining the second sub-dependency feature, and a time attention head for determining the second dependency feature. The output results of the three types of attention heads are spliced and pass through a learnable projection matrix W o to determine a second fusion matrix. The second fusion feature can be determined by formula (11).
[0192] Formula (11)
[0193] wherein, represents the second fusion feature, denotes a splicing operation, is the first splicing result, is the second splicing result, and is the third splicing result. , and are the number of corresponding attention heads, respectively, and W o is a dxd matrix, which is a learnable projection matrix. And is set to keep the dimension of the output feature consistent with the input feature, so as to better integrate the spatial and temporal information.
[0194] S702, iteratively updating the first initial parameter, the second initial parameter and the third initial parameter based on the loss until a predetermined training condition is reached to stop training, and obtaining a preset prediction model.
[0195] In the embodiment of the application, the prediction model training apparatus can iteratively update the first initial parameter, the second initial parameter and the third initial parameter based on the loss until a predetermined training condition is reached to stop training, and obtain a preset prediction model.
[0196] In the embodiment of the present application, the loss of the initial prediction model is determined based on the second fused feature of the first dependent feature and the second dependent feature. The first initial parameter, the second initial parameter and the third initial parameter are iteratively updated based on the loss, and the training is stopped when the predetermined training condition is reached to obtain the preset prediction model. In this way, the dependent features of the sample base station traffic under the influence of public opinion at different distances and in different time periods can be learned based on the first dependent feature and the second dependent feature, which is more comprehensive and considers more factors than the prediction model in the related art. Therefore, the traffic prediction result determined based on the trained preset prediction model is more accurate.
[0197] In the embodiment of the present application, a prediction model training method is proposed, which introduces the dynamic spatial dependence relationship of the crowd flow data in the spatial self-attention module to capture short and long distances. A public opinion perception module is designed to explicitly model the gain effect of public opinion in spatial information. A time self-attention is used to identify dynamic time patterns. A mask feature of the public opinion event is designed according to the life cycle of the public opinion to enhance the characteristics between time and public opinion. The overall architecture is as follows Figure 12 :
[0198] In the embedding layer 100, the adjacency feature and the crowd flow feature in each sub-period can be converted into a high-dimensional representation. The input features can be converted into an N×T×d matrix. In order to encode the network structure of the sample base station and the periodicity of the crowd flow, spatial graph Laplacian embedding and time periodicity embedding mechanisms can be used for conversion. The spatial graph Laplacian embedding is used to encode the adjacency feature, and the time periodicity embedding is used to model the periodicity of the crowd flow feature in each sub-period.
[0199] In the spatio-temporal encoding layer 200, the core of the encoding layer includes three components: the geographical space self-attention module 201, the semantic self-attention module 202 and the time self-attention module 203. The geographical space self-attention module 201 and the semantic self-attention module 202 are used to analyze the first dependent feature at long and short distances at the same time. The public opinion perception module 204 is also included, which extends the geographical space self-attention module 201 and the semantic self-attention module 202 to explicitly model the influence in the propagation of spatial information. In addition, the time self-attention module 203 is used to capture the second dependent feature of dynamic and long distance.
[0200] In the splicing layer 205, the features output by the geographical space self-attention module 201, the semantic self-attention module 202 and the time self-attention module 203 can be spliced and fused to determine the second fused feature.
[0201] In the output layer 300, a skip connection composed of a 1×1 convolution is used to convert the output feature into a T×N×d sk dimensional matrix. Here dsk is the final hidden state matrix. To make multi-step prediction, we directly convert the final hidden state matrix to the target dimension matrix using the output layer, which can be determined by the following equation (12):
[0202] Equation (12)
[0203] wherein, is the target dimension matrix of T x N x C, is the T-step prediction result, and are both 1 x 1 convolution. is the final hidden state matrix. Considering the cumulative error and model efficiency, the direct way is selected instead of the recursive way for multi-step prediction.
[0204] Please refer to Figure 13 , the flowchart of the people flow prediction method provided by the embodiments of the present application Figure 13 , the steps shown in Figure 14 will be described in combination with the steps shown in
[0205] S801, obtaining target road network information in a target area; wherein the target road network information is used to represent the adjacency relationship of the target base stations in the target area.
[0206] In the embodiments of the present application, the prediction device obtains the target area information that needs to be predicted, and determines the target base stations of the target area according to the target area information. The target road network information corresponding to the target base stations is obtained. Wherein, the target road network information is used to represent the adjacency relationship of the target base stations in the target area.
[0207] The target road network information includes at least one of the following: the relevant attributes of each target base station in the target area, the number of hops between each two target base stations in the target area, and the adjacency characteristics of the target base stations in the target area.
[0208] S802, inputting the target road network information into a preset prediction model to determine the people flow prediction result for the target area.
[0209] In the embodiments of the present application, the prediction device inputs the target road network information into a preset prediction model to determine the people flow prediction result for the target area.
[0210] Wherein, the people flow prediction result is used to represent the amount of people flowing in and out within the range of each target base station in the target area.
[0211] The preset prediction model is obtained by iteratively training an initial prediction model based on the first dependency feature and the second dependency feature until a predetermined training condition is reached; the sample road network information and the sample passenger flow information are input into the initial prediction model to determine the first dependency feature of the passenger flow of the sample base stations with different distances from each other under the influence of the public opinion type, and the second dependency feature of the passenger flow of the sample base stations in different time periods under the influence of the public opinion life cycle; the sample road network information includes the adjacency relationship of the sample base stations in the sample area; and the sample passenger flow information is used to represent the passenger flow in the sample base station range in a historical period.
[0212] In the embodiment of the application, because the initial prediction model learns the dependency features of the passenger flow of the sample base stations in different distances and in different time periods under the influence of public opinion based on the first dependency feature and the second dependency feature, the prediction model learns more comprehensively and considers more factors than the prediction model in the related art, and therefore the passenger flow prediction result determined based on the trained preset prediction model is more accurate.
[0213] Please refer to Figure 15 The structure schematic diagram of the prediction model training device provided in the embodiment of the application is shown in FIG. 1.
[0214] The embodiment of the application further provides a prediction model training device 600, which comprises a first information acquisition unit 601, a first determination unit 602 and an updating unit 603.
[0215] The first information acquisition unit 601 is configured to acquire sample road network information and sample passenger flow information in a sample area; wherein the sample road network information includes the adjacency relationship of sample base stations in the sample area; and the sample passenger flow information is used to represent the passenger flow in the sample base station range in a historical period;
[0216] The first determination unit 602 is configured to input the sample road network information and the sample passenger flow information into an initial prediction model to determine the first dependency feature of the passenger flow of the sample base stations with different distances from each other under the influence of the public opinion type, and the second dependency feature of the passenger flow of the sample base stations in different time periods under the influence of the public opinion life cycle.
[0217] The updating unit 603 is configured to iteratively train the initial prediction model based on the first dependency feature and the second dependency feature until a predetermined training condition is reached to stop the training and obtain a preset prediction model.
[0218] In the embodiment of the application, the sample road network information includes at least one of the following: the relevant attribute of each sample base station in the sample area, the hop number between each two sample base stations in the sample area, and the adjacency feature of the sample base stations in the sample area.
[0219] The sample human flow information comprises: human flow characteristics of each sample base station in a sample area in each sub-period; wherein, the historical period comprises: T sub-periods; T is an integer greater than 1.
[0220] In the embodiment of the application, the first determination unit 602 in the prediction model training device 600 is configured to convert the adjacency feature and the human flow feature to the same dimension for fusion to determine the first fusion feature; wherein, the first fusion feature is determined based on the dimension of the sub-period, the dimension of the sample base station and the embedding dimension;
[0221] The first sample feature is obtained by slicing the first fusion feature according to the fixed dimension of the sub-period, and the second sample feature is obtained by slicing the first fusion feature according to the fixed dimension of the sample base station;
[0222] The first dependency is determined based on the first initial parameter and the first sample feature, and the first dependency feature under the self-attention mechanism is determined by processing the first dependency based on the type of public opinion, the name attribute of each sample base station and the hop number between different sample base stations; wherein, the first dependency is used to represent the dependency of the human flow of each sample base station in the historical period in the spatial dimension;
[0223] The second sample feature is processed based on the second initial parameter and the public opinion life cycle of each sample base station in each sub-period to determine the second dependency feature under the self-attention mechanism.
[0224] In the embodiment of the application, the first determination unit 602 in the prediction model training device 600 is configured to determine the base station spatial structure feature in the sample area based on the adjacency feature;
[0225] The spatial dimension feature is obtained by decomposing the base station spatial structure feature, and the first embedding feature is determined by projecting the spatial dimension feature according to the embedding dimension;
[0226] The human flow feature is processed by the embedding features corresponding to the multiple time dimensions respectively to determine the time dimension feature under each time dimension, and the second embedding feature is determined by combining each time dimension feature; wherein, the dimension of the embedding feature is the embedding dimension;
[0227] The first embedding feature and the second embedding feature are fused to determine the first fusion feature.
[0228] In the embodiment of the application, the first determination unit 602 in the prediction model training device 600 is configured to determine the first dependency between the human flow of each sample base station in each sub-period based on the product of the first initial parameter and the first sample feature;
[0229] update the first dependency based on a similarity between a type feature of an opinion type of each sample base station in each sub-period and a people flow feature of each sample base station in each sub-period;
[0230] determine a mask feature based on a similarity between a hop count and a name attribute between each two sample base stations;
[0231] determine a first dependency feature based on a product of the mask feature and the updated first dependency,
[0232] In the embodiments of the present application, the first initial parameter includes: a first query parameter, a first key parameter and a first value parameter.
[0233] In the embodiments of the present application, the first determination unit 602 in the prediction model training apparatus 600 is configured to determine a first query feature based on a product of the first query parameter and the first sample feature, and determine a first key feature based on a product of the first key parameter and the first sample feature.
[0234] determine the first dependency based on a ratio of a Tth power of a product of the first query feature and the first key feature to a dimension corresponding to the first query feature.
[0235] In the embodiments of the present application, the first determination unit 602 in the prediction model training apparatus 600 is configured to convert the type feature and the people flow feature of each sample base station in each sub-period to the same dimension for similarity comparison, and determine a similarity weight of the type feature of each sample base station in each sub-period.
[0236] determine a historical opinion people flow feature corresponding to each sample base station based on a weighted sum of the type feature of each sample base station in each sub-period based on the similarity weight and a third initial parameter.
[0237] update the first key feature based on each historical opinion people flow feature.
[0238] In the embodiments of the present application, the first determination unit 602 in the prediction model training apparatus 600 is configured to determine each element of a first mask matrix based on a size relationship between a hop count between each two sample base stations and a first preset threshold, and obtain the first mask matrix.
[0239] determine each element of a second mask matrix based on a size relationship between a similarity of a name attribute between each two sample base stations and a second preset threshold, and obtain the second mask matrix.
[0240] In the embodiments of the present application, the first determination unit 602 in the prediction model training apparatus 600 is configured to determine a first sub-dependency feature based on a product of the first mask matrix and the first dependency, and determine a second sub-dependency feature based on a product of the second mask matrix and the first dependency.
[0241] The first sub-dependence feature is used to represent the dependence between the different sample base stations and the crowd flow under the influence of the public opinion type and the distance; and the second sub-dependence feature is used to represent the dependence between the different sample base stations and the crowd flow under the influence of the public opinion type and the name attribute.
[0242] In the embodiment of the application, the first determination unit 602 in the prediction model training device 600 is configured to determine the second dependence of the crowd flow of each sample base station in different sub-periods based on the product of the second initial parameter and the second sample feature.
[0243] The third mask matrix is determined based on the public opinion life cycle of each sample base station in each sub-period.
[0244] The second dependence feature is determined based on the product of the third mask matrix and the second dependence.
[0245] In the embodiment of the application, the first determination unit 602 in the prediction model training device 600 is configured to determine the reconstruction error of the public opinion life cycle of each sample base station in each sub-period based on the number of comments of the public opinion of each sample base station in each sub-period.
[0246] Each element in the third mask matrix is determined based on the size relationship between the reconstruction error and the third preset threshold, to obtain the third mask matrix.
[0247] In the embodiment of the application, the updating unit 603 in the prediction model training device 600 is configured to determine the loss of the initial prediction model based on the second fusion feature of the fusion of the first dependence feature and the second dependence feature.
[0248] The first initial parameter, the second initial parameter and the third initial parameter are iteratively updated based on the loss, and the training is stopped when a predetermined training condition is reached, to obtain the preset prediction model.
[0249] It should be noted that, in the embodiment of the application, if the prediction model training method described above is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions for causing a prediction model training device (which can be a personal computer, etc.) to execute all or part of the embodiments of the method of the application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and various storage medium capable of storing program codes. Thus, the embodiments of the application are not limited to any specific hardware and software combination.
[0250] Correspondingly, the embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by the first processor to realize the steps in the method on the side of the prediction model training device 600.
[0251] It should be pointed out here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects to the method embodiments. For technical details not disclosed in the storage medium and device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0252] It should be pointed out here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects to the method embodiments. For technical details not disclosed in the storage medium and device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding. Figure 15 A hardware entity diagram of the first electronic device provided by the embodiment of the present application is shown in The embodiment of the present application provides a first electronic device 700, which comprises a first memory 702 and a first processor 701. The first memory 702 stores a computer program executable on the first processor 701. The first processor 701 executes the program to realize the steps in the above method, wherein;
[0253] The first processor 701 usually controls the overall operation of the first electronic device 700.
[0254] The first memory 702 is configured to store instructions and applications executable by the first processor 701, and can also cache data to be processed or already processed by the first processor 701 and each module in the first electronic device 700 (for example, image data, audio data, voice communication data and video communication data), which can be realized by FLASH or RAM.
[0255] Correspondingly, the embodiment of the present application also provides a computer program product, which comprises a computer program executable by the first processor 701 of the first electronic device 700 to complete the steps in the method on the side of the prediction model training device 600.
[0256] Please refer to The structure diagram of the crowd flow prediction device provided by the embodiment of the present application.
[0257] The embodiment of the present application also provides a crowd flow prediction device 800, which comprises a second information acquisition unit 801 and a second determination unit 802.
[0258] The second information acquisition unit 801 is configured to acquire target road network information in a target area; wherein the target road network information is used to represent the adjacency relationship of the target base station in the target area;
[0259] The second determining unit 802 is configured to input the target road network information into a preset prediction model, and determine a people flow prediction result for the target area.
[0260] The preset prediction model is obtained by iteratively training an initial prediction model based on the first dependency feature and the second dependency feature until a predetermined training condition is reached; the sample road network information and the sample people flow information are input into the initial prediction model to determine the first dependency feature of the people flow of the sample base stations with different distances between each other under the influence of the public opinion type, and the second dependency feature of the people flow of the sample base stations in different time periods under the influence of the public opinion life cycle; the sample road network information includes the adjacency relationship of the sample base stations in the sample area; and the sample people flow information is used to represent the people flow in the sample base station range in a historical period.
[0261] Correspondingly, the embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by the second processor to realize the steps in the method of the people flow prediction device 800.
[0262] It should be pointed out that: the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects to the method embodiments. For technical details not disclosed in the storage medium and device embodiments of the present application, please refer to the description of the method embodiments of the present application for understanding.
[0263] It should be pointed out that, A hardware entity diagram of the second electronic device provided by the embodiment of the present application is shown in The embodiment of the present application provides a second electronic device 900, which includes a second memory 902 and a second processor 901, the second memory 902 stores a computer program executable on the second processor 901, and the second processor 901 executes the program to realize the steps in the above method, wherein;
[0264] The second processor 901 usually controls the overall operation of the second electronic device 900.
[0265] The second memory 902 is configured to store instructions and applications executable by the second processor 901, and can also cache data to be processed or already processed by the second processor 901 and modules in the second electronic device 900 (for example, image data, audio data, voice communication data and video communication data), which can be realized by FLASH or RAM.
[0266] Correspondingly, the embodiment of the present application further provides a computer program product, comprising a computer program, which can be executed by the second processor 901 of the second electronic device 900 to complete the steps in the method on the side of the people flow prediction device 800.
[0267] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that the size of the sequence number of each process in various embodiments of the present application does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The sequence number of the above-mentioned embodiments of the present application is only for description, not representing the advantages and disadvantages of the embodiments.
[0268] It should be noted that in this paper, the term "including", "containing" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or includes elements inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0269] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of units is only a logical function division, and actual implementation can have another division manner. For example, multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the various components shown or discussed can be indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0270] The units described above as separate components can or can not be physically separate, and the components shown as units can or can not be physical units; they can be located in one place or distributed on multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0271] In addition, each of the functional units in the embodiments of the present application can be integrated into one processing unit, each unit can be separately implemented as a single unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in the form of hardware, or in the form of hardware plus software function units.
[0272] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by relevant hardware instructed by programs. The aforementioned programs can be stored in a computer readable storage medium, and when the programs are executed, the steps of the above-mentioned method embodiments are executed. The aforementioned storage medium includes mobile storage devices, read-only memory (ROM), magnetic discs or optical discs, and various media that can store program codes.
[0273] Alternatively, when the integrated units of the present application are implemented in the form of software function modules and sold or used as independent products, they can also be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products, and the computer software products are stored in a storage medium, including a number of instructions for making a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the embodiments of the present application. The aforementioned storage medium includes mobile storage devices, ROM, magnetic discs or optical discs, and various media that can store program codes.
[0274] The above is only an implementation of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application.
Claims
1. A method for training a prediction model, characterized in that, include: Obtain sample road network information and sample pedestrian flow information within the sample area; wherein, the sample road network information includes the adjacency characteristics of sample base stations within the sample area; the sample pedestrian flow information is used to characterize the pedestrian flow characteristics within the range of the sample base stations during historical time periods; The adjacency features and the pedestrian flow features are transformed into the same dimension and fused to determine the first fused feature; wherein, the first fused feature is determined based on the dimension of the sub-time period, the dimension of the sample base station, and the embedding dimension; First sample features are obtained by slicing the first fused features according to the dimensions of a fixed sub-time period, and second sample features are obtained by slicing the first fused features according to the dimensions of the fixed sample base stations. The first dependency is determined based on the first initial parameters and the first sample features. The first dependency is then processed based on the public opinion type, the name attribute of each sample base station, and the number of hops between different sample base stations to determine the first dependency feature under the self-attention mechanism. The first dependency is used to characterize the spatial dependency of the traffic flow of each sample base station in the historical period. Based on the second initial parameters and the public opinion lifecycle of each sample base station in each sub-period, the second sample features are processed to determine the second dependent features under the self-attention mechanism. Based on the second fusion feature fused from the first dependency feature and the second dependency feature, the loss of the initial prediction model is determined, and the first initial parameter, the second initial parameter and the third initial parameter are iteratively updated based on the loss until the predetermined training conditions are met and training stops, thus obtaining the preset prediction model.
2. The prediction model training method according to claim 1, characterized in that, The sample road network information includes at least one of the following: the relevant attributes of each sample base station in the sample area, the hop count between every two sample base stations in the sample area, and the adjacency characteristics of the sample base stations in the sample area; The sample pedestrian flow information includes: pedestrian flow characteristics of each sample base station within the sample area in each sub-time period; wherein, the historical time period includes: T sub-time periods; T is an integer greater than 1.
3. The prediction model training method according to claim 2, characterized in that, The step of transforming the adjacency features and the pedestrian flow features to the same dimension for fusion to determine the first fused feature includes: Based on the adjacency features, the spatial structure features of the base stations within the sample area are determined; The spatial structure features of the base station are decomposed to obtain spatial dimension features, and the spatial dimension features are projected according to the embedding dimension to determine the first embedding feature; The pedestrian flow feature is processed by embedding features corresponding to multiple time dimensions to determine the time dimension feature under each time dimension, and the second embedding feature is determined by combining each time dimension feature; wherein, the dimension of the embedding feature is the embedding dimension. The first embedded feature and the second embedded feature are fused together to determine the first fused feature.
4. The prediction model training method according to claim 2, characterized in that, The process of determining the first dependency based on the first initial parameters and the first sample features, and processing the first dependency based on the public opinion type, the name attribute of each sample base station, and the number of hops between different sample base stations, to determine the first dependency feature under the self-attention mechanism includes: Based on the product of the first initial parameter and the first sample feature, the first dependency between the pedestrian traffic of each sample base station in each sub-time period is determined; The first dependency is updated based on the similarity between the type characteristics of the public opinion type of each sample base station in each sub-time period and the traffic flow characteristics of each sample base station in each sub-time period. Mask features are determined based on the similarity of the hop count and the name attribute between every two sample base stations; The first dependency feature is determined based on the product of the mask feature and the updated first dependency.
5. The prediction model training method according to claim 4, characterized in that, The first initial parameters include: a first query parameter and a first key parameter; The step of determining the first dependency between the pedestrian traffic of each sample base station within each sub-time period based on the product of the first initial parameter and the first sample feature includes: The first query feature is determined based on the product of the first query parameter and the first sample feature, and the first key feature is determined based on the product of the first key parameter and the first sample feature. The first dependency is determined by the ratio of the T-th power of the product of the first query feature and the first key feature to the square root of the dimension corresponding to the first query feature.
6. The prediction model training method according to claim 5, characterized in that, The first dependency is updated by comparing the similarity between the type characteristics of the public opinion type of each sample base station in each sub-time period and the traffic flow characteristics of each sample base station in each sub-time period, including: The type features and the pedestrian flow features of each sample base station in each sub-time period are transformed into the same dimension for similarity comparison, and the similarity weight of the type features of each sample base station in each sub-time period is determined. Based on the similarity weight and the third initial parameter, the type features of each sample base station in each sub-time period are weighted and summed to determine the historical public opinion traffic features corresponding to each sample base station. The first key feature is updated based on each of the historical public opinion traffic features.
7. The prediction model training method according to claim 4, characterized in that, The masking features include: a first masking matrix and a second masking matrix; determining the masking features based on the similarity of the hop count and the name attribute between every two sample base stations includes: Based on the relationship between the number of hops between every two sample base stations and the first preset threshold, each element of the first mask matrix is determined to obtain the first mask matrix; Based on the similarity between the name attributes of each pair of sample base stations and the second preset threshold, each element of the second mask matrix is determined to obtain the second mask matrix.
8. The prediction model training method according to claim 7, characterized in that, The first dependency feature includes: a first sub-dependency feature and a second sub-dependency feature; determining the first dependency feature based on the product of the mask feature and the updated first dependency includes: The first sub-dependency feature is determined based on the product of the first mask matrix and the first dependency, and the second sub-dependency feature is determined based on the product of the second mask matrix and the first dependency. The first sub-dependency feature is used to characterize the dependence of different sample base stations on pedestrian traffic under the influence of public opinion type and distance; the second sub-dependency feature is used to characterize the dependence of different sample base stations on pedestrian traffic under the influence of public opinion type and name attribute.
9. The prediction model training method according to claim 1, characterized in that, The process of processing the second sample features based on the second initial parameters and the public opinion lifecycle of each sample base station in each sub-time period to determine the second dependent features under the self-attention mechanism includes: Based on the product of the second initial parameter and the second sample feature, the second dependence of the traffic flow of each sample base station in different sub-time periods is determined; A third mask matrix is determined based on the public opinion lifecycle of each sample base station in each sub-time period. The second dependency feature is determined based on the product of the third mask matrix and the second dependency.
10. The prediction model training method according to claim 9, characterized in that, The determination of the third mask matrix based on the public opinion lifecycle of each sample base station in each sub-time period includes: Based on the number of comments on public opinion for each of the sample base stations in each sub-period, the reconstruction error of the public opinion lifecycle for each of the sample base stations in each sub-period is determined. Based on the relationship between the reconstruction error and the third preset threshold, each element in the third mask matrix is determined to obtain the third mask matrix.
11. A method for predicting pedestrian flow, characterized in that, include: Obtain target road network information within the target area; wherein, the target road network information is used to characterize the adjacency relationship of target base stations within the target area; Input the target road network information into a preset prediction model to determine the predicted pedestrian flow for the target area; The preset prediction model is based on a second fusion feature derived from the fusion of a first dependency feature and a second dependency feature. The loss of the initial prediction model is determined, and the first, second, and third initial parameters are iteratively updated based on this loss until a predetermined training condition is met, at which point training stops. Adjacency features and pedestrian flow features are transformed to the same dimension and fused to determine a first fusion feature. This first fusion feature is determined based on the dimensions of the sub-time period, the sample base stations, and the embedding dimension. First sample features are obtained by slicing the first fusion feature according to the dimensions of the fixed sub-time period, and second sample features are obtained by slicing the first fusion feature according to the dimensions of the fixed sample base stations. Based on the first initial... The initial parameters and the first sample features determine the first dependency, and the first dependency is processed based on the public opinion type, the name attribute of each sample base station, and the number of hops between different sample base stations to determine the first dependency feature under the self-attention mechanism; wherein, the first dependency is used to characterize the spatial dependency of the pedestrian flow of each sample base station in the historical period; the second sample features are processed based on the second initial parameters and the public opinion lifecycle of each sample base station in each sub-period to determine the second dependency feature under the self-attention mechanism; the sample road network information includes the adjacency features of the sample base stations in the sample area; the sample pedestrian flow information is used to characterize the pedestrian flow features within the range of the sample base stations in the historical period.
12. A predictive model training device, characterized in that, include: The first information acquisition unit is used to acquire sample road network information and sample pedestrian flow information within the sample area; wherein, the sample road network information includes the adjacency characteristics of sample base stations within the sample area; and the sample pedestrian flow information is used to characterize the pedestrian flow characteristics within the range of the sample base stations during historical time periods. The first determining unit is used to transform the adjacency features and the pedestrian flow features into the same dimension for fusion to determine the first fusion feature; wherein, the first fusion feature is determined based on the dimension of the sub-time period, the dimension of the sample base station, and the embedding dimension; The first determining unit is configured to obtain a first sample feature by slicing the first fusion feature according to the dimension of a fixed sub-time period, and to obtain a second sample feature by slicing the first fusion feature according to the dimension of the fixed sample base station. The first determining unit is configured to determine a first dependency based on a first initial parameter and the first sample feature, and process the first dependency based on the public opinion type, the name attribute of each sample base station, and the number of hops between different sample base stations to determine the first dependency feature under the self-attention mechanism; wherein, the first dependency is used to characterize the spatial dependency of the traffic flow of each sample base station in the historical period. The first determining unit is used to process the second sample features based on the second initial parameters and the public opinion lifecycle of each sample base station in each sub-period to determine the second dependent features under the self-attention mechanism. The update unit is used to determine the loss of the initial prediction model based on the second fusion feature fused from the first dependency feature and the second dependency feature, and to iteratively update the first initial parameter, the second initial parameter and the third initial parameter based on the loss until the predetermined training conditions are met and training is stopped to obtain the preset prediction model.
13. A pedestrian flow prediction device, characterized in that, include: The second information acquisition unit is used to acquire target road network information within the target area; wherein, the target road network information is used to characterize the adjacency relationship of target base stations within the target area; The second determining unit is used to input the target road network information into a preset prediction model and determine the predicted pedestrian flow for the target area. The preset prediction model is based on a second fusion feature derived from the fusion of a first dependency feature and a second dependency feature. The loss of the initial prediction model is determined, and the first, second, and third initial parameters are iteratively updated based on this loss until a predetermined training condition is met, at which point training stops. Adjacency features and pedestrian flow features are transformed to the same dimension and fused to determine a first fusion feature. This first fusion feature is determined based on the dimensions of the sub-time period, the sample base stations, and the embedding dimension. First sample features are obtained by slicing the first fusion feature according to the dimensions of the fixed sub-time period, and second sample features are obtained by slicing the first fusion feature according to the dimensions of the fixed sample base stations. Based on the first initial... The initial parameters and the first sample features determine the first dependency, and the first dependency is processed based on the public opinion type, the name attribute of each sample base station, and the number of hops between different sample base stations to determine the first dependency feature under the self-attention mechanism; wherein, the first dependency is used to characterize the spatial dependency of the pedestrian flow of each sample base station in the historical period; the second sample features are processed based on the second initial parameters and the public opinion lifecycle of each sample base station in each sub-period to determine the second dependency feature under the self-attention mechanism; the sample road network information includes the adjacency features of the sample base stations in the sample area; the sample pedestrian flow information is used to characterize the pedestrian flow features within the range of the sample base stations in the historical period.
14. An electronic device, characterized in that, The method includes a memory and a processor, the memory storing a computer program that can run on the processor, the processor executing the computer program to implement the steps of the method of any one of claims 1 to 10, or to implement the steps of the method of claim 11.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10, or the steps of the method according to claim 11.
16. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10, or the steps of the method according to claim 11.
Citation Information
Patent Citations
Model training method and device, parameter prediction method and device, electronic equipment and storage medium
CN111860763A
Pedestrian flow prediction method and device, computer equipment and storage medium
CN112418567A