Method for mining hot spot area and hot spot route based on space-time gridding coding
The user's motion record data is processed through the spatio-temporal grid coding method, which solves the abnormal points and missing problems in the data, realizes effective mining of hot spot areas and hot spot routes, provides more accurate running route recommendations, and meets users' Actual demand.
Patent Information
- Application Number
- CN202411100860.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-06-14
- Filing Date
- 2024-08-12
- Publication Date
- 2025-01-03
AI Technical Summary
Existing user trajectory data analysis methods are difficult to effectively mine hot spot areas and hot spot routes, especially when dealing with abnormal drift points, positioning errors and data missing problems, resulting in inaccurate recommendations.
The user's motion record data is processed using spatiotemporal grid coding method, including data access, cleaning and completion. Through spatial grid coding and time grid coding, efficient analysis algorithm is designed to explore hot spot areas and hot spot routes. . Specific steps include: data splitting and sorting, removing exception points, filling in missing data, spatial and time encoding, and finally counting the number of users visits in different time and space divisions to form hot spot areas and routes.
Through intelligent analysis, hot spots and hot spot routes are discovered, and running route recommendations are provided that are more in line with real life, which improves the use value of data and the accuracy of recommendations, and meets the needs of running enthusiasts.
Smart Images

Figure CN119249307A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of spatiotemporal data mining, and in particular to a method for mining hotspot areas and hotspot routes based on spatiotemporal grid coding. Background Art
[0002] With the development and popularization of mobile Internet technology, analysis methods based on user trajectories play an important role in many mobile applications. For example, in the "Internet + Sports" mobile application, selecting or recommending a suitable running route has significant application value for running users. Analysis of user trajectories is an important means of mobile application services such as popular running route recommendations.
[0003] Therefore, analyzing the trajectory big data shared by users in mobile applications through intelligent algorithms, discovering hot areas and hot routes, and providing effective recommendations for relevant users has broad application prospects. Summary of the invention
[0004] The present invention proposes a method for mining hot spots and hot routes based on spatiotemporal grid coding. The user trajectory data is obtained by performing multiple processing flows on the user motion record data in the location service related mobile application. Then, a spatiotemporal grid representation method is designed to efficiently compress and represent the user trajectory data. The spatial grid coding and temporal grid coding are obtained after processing, and finally an efficient analysis algorithm is designed to realize the mining of hot spots and hot routes in the region.
[0005] The present invention provides a method for mining hotspot areas and hotspot routes based on spatiotemporal grid coding, comprising:
[0006] Obtain user motion record data, split it and sort it by time to get the user's original trajectory data;
[0007] According to different situations of the original trajectory data of the user, data access, data cleaning, and data completion are selected for hierarchical data processing to obtain user trajectory data; the data access is used to filter out users who do not meet the processable conditions, the data cleaning is used to remove abnormal drift points and solve the problem of frequent switching between multiple points caused by positioning errors, and the data completion is used to fill in the missing data;
[0008] Performing spatiotemporal grid coding on the original user trajectory data or the user trajectory data to obtain a spatial grid coding and a temporal grid coding;
[0009] Hot spots and hot spots routes are mined based on the spatial grid coding and temporal grid coding.
[0010] Preferably, the user motion record data includes: a user unique identifier, coordinate information, time information and user motion behavior information, and the user motion behavior information includes motion start coordinates, motion stop coordinates, motion end coordinates and timing coordinates.
[0011] Preferably, the process of sorting by time after splitting includes: mapping the user unique identifier to a string as a new user unique identifier to complete the anonymization of the user motion record data, and then splitting the user motion record data according to the new user unique identifier to form trajectory segments of multiple users, and sorting each of the trajectory segments according to time to form the user's original trajectory data.
[0012] Preferably, the data access method includes: reading the original trajectory data of the user, and filtering and recording the users with serious data missing fields and the users with missing data volume to obtain the user trajectory sequence; wherein, the standard of the serious missing fields is that the filling rate of any one value of the coordinate information, time information and user motion behavior information is less than 50%, and the standard of the missing data volume is that the number of coordinate information per hour is less than 30 times.
[0013] Preferably, the data cleaning method includes: time-layered data cleaning and geographic division layer data cleaning; the time-layered data cleaning method is: stratify the user trajectory sequence according to the set time interval, determine whether the moving speed between two adjacent coordinates in each layer of data is greater than the set threshold, and then determine whether there is a drift phenomenon to remove abnormal drift points; the geographic division layer data cleaning method is: stratify the user trajectory sequence according to administrative boundaries, determine whether there is frequent switching between multiple coordinates in each layer of data, and on the basis of the existence of the situation, select the coordinate with the smallest information entropy as the best position of the current user. The information entropy formula is as follows:
[0014] H(X)=-∑P(x)*log2(P(x))
[0015] Among them, H(X) is the entropy of coordinate X, and P(x) is the probability of connecting to coordinate X, that is, the ratio of the number of times the user is at coordinate X to the total number of coordinates.
[0016] Preferably, the data completion method includes: reading the previous coordinate and the next coordinate of the missing coordinate, calculating the best matching path from the previous coordinate to the next coordinate, and extracting the coordinate information therein to fill in the missing coordinate. The specific method is as follows: reading the previous coordinate F and the next coordinate L of the missing coordinate M, using the geographic location knowledge base to obtain all reachable paths from F to L, calculating the best matching path through the DTW algorithm, and extracting the coordinate information of the path as missing data filling.
[0017] The process of calculating the best matching path by using the DTW algorithm includes:
[0018] 1) Randomly select a reachable path, denoted as A, and the user trajectory in the coordinate information is denoted as B;
[0019] 2) For each point in path A, traverse each point in user trajectory B, calculate its distance, exclude points where the distance between two points is greater than a certain threshold, and form a cumulative distance matrix D;
[0020] 3) According to the principle of minimum distance, find a minimum path in matrix D as the distance between paths A and B;
[0021] 4) Repeat 1)-3) to find the path A with the minimum distance as the best matching path.
[0022] Preferably, the process of the spatiotemporal gridding coding includes:
[0023] 1) Convert the coordinates (lng, lat) in the user motion record data into a point (x, y, z) on a three-dimensional sphere, where lng is longitude and lat is latitude;
[0024] 2) transform the point (x, y, z) to a face of the circumscribed cube so that it corresponds to the number HID of the face, establish a coordinate system with the midpoint of the face, and obtain a three-dimensional coordinate (HID, a, b), where a and b are the two-dimensional coordinates of the point in the plane;
[0025] 3) Divide the plane where the coordinates (HID, a, b) are located into four square areas according to the coordinate system, encode different quadrants, select the sub-square where the coordinates (HID, a, b) are located, repeat the above operation to form a code, and then splice the code with the code of the HID to obtain a spatial grid code;
[0026] 4) Decompose the time information into multiple integers of a specified time scale, and concatenate the integers to obtain a time grid code. The specific method is as follows:
[0027] 1) Convert the coordinates (lng, lat) into a three-dimensional point (x, y, z) on the sphere according to the following formula:
[0028]
[0029] Where R is the radius of the earth;
[0030] 2) Transform the three-dimensional space point (x, y, z) to a face of the circumscribed cube so that it corresponds to the number HID of the face, where HID takes the value of [0,5],
[0031] The conversion step is: determining the plane where the three-dimensional space point (x, y, z) is located by comparing the absolute values of x, y, z;
[0032] When |x| is the largest absolute value among x, y, and z, when x>0, the point is on the plane perpendicular to the positive semi-axis of x, and when x<0, the point is on the plane perpendicular to the negative semi-axis of x;
[0033] When |y| is the largest absolute value among x, y, and z, when y>0, the point is on the plane perpendicular to the positive semi-axis of y, and when y<0, the point is on the plane perpendicular to the negative semi-axis of y;
[0034] When |z| is the largest absolute value among x, y, and z, when z>0, the point is on the plane perpendicular to the positive semi-axis of z, and when z<0, the point is on the plane perpendicular to the negative semi-axis of z;
[0035] 3) Divide the plane where the three-dimensional space point (x, y, z) is located into four square areas, the coordinates in the first quadrant are marked as 11, the second quadrant is marked as 01, the third quadrant is marked as 00, and the fourth quadrant is marked as 10. Select the sub-square where the three-dimensional space point (x, y, z) is located and repeat the above operation 15 times to form a 32-bit code, and the 3-bit HID is spliced with it to obtain a spatial grid code;
[0036] 4) decomposing the time information into a plurality of integers of a specified time scale, wherein the year is set as a 6-bit binary number;
[0037] The month is set to a 4-bit binary number; the day is set to a 5-bit binary number; the hour is set to a 5-bit binary number; the minute is set to a 6-bit binary number; and the second is set to a 6-bit binary number, which are concatenated to form a 32-bit code to obtain a time grid code.
[0038] Preferably, the method for mining hot spots and hot routes includes: using the spatial grid coding and temporal grid coding to count the number of user visits in different time and space divisions to form hot spots, wherein the hot spots are spaces where the number of user visits exceeds a set threshold, obtaining the user movement pattern in the hot spots based on the temporal grid coding, connecting the hot spots with the movement pattern in order of the movement start coordinates, the movement stop coordinates and the movement end coordinates, thereby forming hot routes.
[0039] The beneficial effects of the present invention are as follows:
[0040] It comprehensively considers static geographic information and dynamic environmental factors, makes full use of the data generated by users in the application, makes it more valuable, discovers hot spots and hot routes through intelligent analysis, provides effective recommendations for relevant users, and provides safe and comfortable running route recommendations for running enthusiasts, which has broad application prospects. Because hot spots and hot routes are derived from real-time data generated by users, the discovered hot spots and hot routes are more in line with real life and more practical than manual planning. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 .A flow chart of a method for mining hotspot areas and hotspot routes based on spatiotemporal grid coding provided by the present invention.
[0042] Figure 2 .It is a flowchart of the hierarchical data processing of the present invention.
[0043] Figure 3 . is a schematic diagram of data completion of the present invention.
[0044] Figure 4 .It is a schematic diagram of the spatial grid coding of the present invention.
[0045] Figure 5 .It is a schematic diagram of the method for mining hotspot routes of the present invention. DETAILED DESCRIPTION
[0046] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below through specific embodiments and drawings.
[0047] See also Figure 1 An embodiment of the present invention provides a user trajectory analysis method based on spatiotemporal grid coding, which may include the following steps:
[0048] Obtain user motion record data, split it and sort it by time to get the user's original trajectory data;
[0049] According to different situations of the original trajectory data of the user, data access, data cleaning, and data completion are selected for hierarchical data processing to obtain user trajectory data; the data access is used to filter out users who do not meet the processable conditions, the data cleaning is used to remove abnormal drift points and solve the problem of frequent switching between multiple points caused by positioning errors, and the data completion is used to fill in the missing data;
[0050] Performing spatiotemporal grid coding on the original user trajectory data or the user trajectory data to obtain a spatial grid coding and a temporal grid coding;
[0051] Mining hot spots and hot routes based on the spatial grid coding and the temporal grid coding;
[0052] The user motion record data includes: a user unique identifier, coordinate information, time information and user motion behavior information, wherein the user motion behavior information includes motion start coordinates, motion stop coordinates, motion end coordinates and timing coordinates.
[0053] Obtain user motion record data recorded within a specified period of time, map the user's unique ID in the user log to a 32-bit string as a new user's unique ID through hashing, and record all used ID values, and check when a new value is generated to ensure that there is no duplication. In this way, the user data is anonymized. Then, it is split according to the user's unique ID to form multiple user's trajectory segments, and each of the trajectory segments is sorted by time to form the user's original trajectory data.
[0054] Secondly, the user's original trajectory data is processed in a hierarchical manner, which includes: data access; data cleaning; data completion. Figure 2 The flowchart of hierarchical data processing provided by the present invention,
[0055] Data access: Read the user's original trajectory data, and filter and record the fields with serious data missing (the filling rate of any value of the coordinate information of the collection location, the collection time information and the user's motion behavior information is less than 50%) and the users with insufficient data volume (the number of coordinate information per hour is less than 30 times) to obtain the user trajectory sequence S.
[0056] Data cleaning:
[0057] Data cleaning is performed in layers according to time and geographical divisions, and data cleaning is mainly aimed at effectively processing coordinate information. Among them, the data is layered according to a time interval of ten minutes, and each layer is cleaned separately, including: judging whether the moving speed between the two previous and next position points in the trajectory data is abnormal, specifically including: for each trajectory point in the user trajectory sequence S, judging the time difference T and the straight-line distance D between the two previous and next coordinates, and using D / T to calculate the moving speed. If the obtained speed is greater than the set threshold (for running scenes, it should be less than 2 minutes / kilometer), it is determined that the user has drift between the two coordinates, and the abnormal drift points caused by positioning errors are removed. After data is layered according to administrative boundaries such as districts, counties, and streets, the situation in which users frequently switch between two or more coordinates due to positioning errors is cleaned, and the information entropy method can be used to calculate and select the position with the smallest information entropy as the best position of the current user. Information entropy can be calculated using the following formula:
[0058] H(X)=-∑P(x)*log2(P(x))
[0059] Where H(X) is the entropy of location X, and P(x) is the probability of connecting to location X, that is, the ratio of the number of times the user is at location X to the total number of locations.
[0060] Data completion:
[0061] See also Figure 3 The schematic diagram of data completion provided by the present invention,
[0062] Read the previous trajectory point F and the next trajectory point L of the missing trajectory point M, use the road network data recorded in the geographic location knowledge base to obtain all the reachable path information between F and L, calculate the best matching path through the DTW algorithm, and extract the location information passed by the path as the missing data filling.
[0063] Preferably, the process of calculating the best matching section using the DTW algorithm includes:
[0064] 1) Randomly select a reachable path, denoted as A, and the user trajectory is denoted as B.
[0065] 2) For each point in path A, traverse each point in trajectory B, calculate its distance, exclude points where the distance between two points is greater than a certain threshold, and form a cumulative distance matrix D.
[0066] 3) According to the principle of minimum distance, find a minimum path in matrix D as the distance between paths A and B.
[0067] 4) Repeat 1)-3) to find the path A with the minimum distance as the best matching path.
[0068] by Figure 3 Take the similar trajectory matching as an example, where the sequence of white points {U 1 ,…,U n} is the trajectory sequence composed of the user's location, and the sequence of black points {R 1 ,…,R n} is the location information of a selected route R, and the missing point threshold is set to 5km.
[0069] The following cumulative distance matrix is formed:
[0070] U1 U2 U3 R1 1.6 12 17 R2 4.3 8.4 13.6 R3 7.8 5.4 10.2 R4 12.5 0.7 5.4 R5 15.7 2.7 2.0 R6 17.9 4.8 0.8
[0071] The matrix D after removing points greater than the threshold:
[0072] U1 U2 U3 R1 1.6 0 0 R2 0 0 0 R3 0 0 0 R4 0 0.7 0 R5 0 2.7 2.0 R6 0 0 0.8
[0073] Then the distance of route R is 1.6+0.7+2+0.8=5.1.
[0074] Secondly, the coordinate information is encoded in space-time grids, see Figure 4 A schematic diagram of the spatial grid coding provided by the present invention.
[0075] The longitude and latitude coordinates are spatially gridded to form a code that can be represented in one dimension. The method:
[0076] 1) Convert geographic coordinates (lng, lat) into three-dimensional spatial point coordinates (x, y, z) on the sphere. The conversion formula is:
[0077]
[0078] Where R is the radius of the earth, and its average value is 6371 kilometers.
[0079] 2) Convert the coordinates of the three-dimensional space point (x, y, z) into coordinates on the circumscribed cube (HID, a, b), and correspond the six faces of the circumscribed cube to the HID numbers, that is, the value of HID is [0, 5], where a and b are the two-dimensional coordinates of the point in the plane.
[0080] The specific conversion method is:
[0081] First, determine which face of the cube the point (x,y,z) lies in. This can be done by comparing the absolute values of x,y,z.
[0082] When |x| is the largest absolute value among x, y, and z, when x>0, the point is on the plane perpendicular to the positive semi-axis of x, and when x<0, the point is on the plane perpendicular to the negative semi-axis of x;
[0083] When |y| is the largest absolute value among x, y, and z, when y>0, the point is on the plane perpendicular to the positive semi-axis of y, and when y<0, the point is on the plane perpendicular to the negative semi-axis of y;
[0084] When |z| is the largest among the absolute values of x, y, and z, when z>0, the point is on the plane perpendicular to the positive semi-axis of z, and when z<0, the point is on the plane perpendicular to the negative semi-axis of z.
[0085] 3) Map the coordinates of the circumscribed cube (HID, a, b) to the one-dimensional representation GEOID. Split a quadrilateral plane into four parts of equal area. If the coordinate is in the first quadrant, mark it as 11, the second quadrant is marked as 01, the third quadrant is marked as 00, and the fourth quadrant is marked as 10. Select the sub-quadrilateral where the coordinate is located and repeat the above operation 15 times. A 32-bit code is formed. The 3-bit HID is concatenated with it to obtain the user's final spatial one-dimensional code.
[0086] The method of time grid coding is: decompose the time into multiple integers of specified time scales, encode the integers on each specified time scale into a binary number of set bits, and obtain the time code. Among them, the year is set to 6 binary digits; the month is set to 4 binary digits; the day is set to 5 binary digits; the hour is set to 5 binary digits; the minute is set to 6 binary digits; the second is set to 6 binary digits. Splicing forms a 32-bit binary representation. Taking the time of 12:30:20 on May 1, 2024 as an example, the year is 011000, the month is 0101, the day is 00001, the hour is 1100, the minute is 011110, and the second is 010100. The 32-bit binary number is 0110000101000011100011110010100. Taking the coordinate point (116.61, 40.07) as an example, it is in the first quadrilateral, that is, the HID is 000.
[0087] According to actual needs, the user trajectory points are represented in a spatiotemporal grid. Position codes with different value lengths are selected as the user space range division method. Time codes with different lengths are selected as the user time period division method. For example, if you want to screen out users who exercise between 20:00 and 21:00 at night, you can select data with the 16th to 21st bits of the time code as 10100.
[0088] Finally, to explore hot spots and hot routes, see Figure 5 Schematic diagram of a hotspot route mining method.
[0089] Using user motion record data, through hierarchical data processing and spatiotemporal grid coding, we get the user's spatial grid code and temporal grid code, combined with the behavior type at different locations, such as the user's active start and end of recording action type, as the route start or end point; the user actively clicks to pause or recognizes that the position of the same area has not changed for multiple cycles as a stay point; the rest of the user's automatic check-in type during the movement is a moving point, that is, Figure 5 The Z axis represents time, and the quadrilateral in the plane composed of the XY axis represents the user location distribution at a certain moment. The real location is represented by black and white points. The hotspot route mining uses spatiotemporal grid coding to count the number of user visits in different spatiotemporal divisions and form hotspot areas, where the hotspot area is the space where the calculation exceeds the set threshold, that is, Figure 5 The quadrilateral regions in are recorded as a set of hotspot region examples. Based on the time grid coding, the user movement pattern in the hotspot region is obtained, and the hotspot regions with movement patterns are connected in sequence according to the movement start coordinates, movement stop coordinates and movement end coordinates, thereby forming a hotspot route, that is, Figure 5 The gray track in .
[0090] The specific embodiments of the present invention disclosed above are intended to help understand the content of the present invention and implement it accordingly. It can be understood by those skilled in the art that various replacements, changes and modifications are possible without departing from the spirit and scope of the present invention. The present invention should not be limited to the contents disclosed in the embodiments of this specification, and the scope of protection of the present invention shall be subject to the scope defined in the claims.
Claims
1. A method for mining hotspot areas and hotspot routes based on spatiotemporal grid coding, comprising: Obtain user motion record data, split it and sort it by time to get the user's original trajectory data; According to different situations of the original trajectory data of the user, data access, data cleaning, and data completion are selected for hierarchical data processing to obtain user trajectory data; the data access is used to filter out users who do not meet the processable conditions, the data cleaning is used to remove abnormal drift points and solve the problem of frequent switching between multiple points caused by positioning errors, and the data completion is used to fill in the missing data; Performing spatiotemporal grid coding on the original user trajectory data or the user trajectory data to obtain a spatial grid coding and a temporal grid coding; Hot spots and hot spots routes are mined based on the spatial grid coding and temporal grid coding.
2. The method according to claim 1, characterized in that The user motion record data includes: The user's unique identification, coordinate information, time information and user's motion behavior information, wherein the user's motion behavior information includes motion start coordinates, motion stop coordinates, motion end coordinates and timing coordinates.
3. The method according to claim 2, characterized in that The process of sorting by time after splitting includes: The user unique identifier is mapped to a string as a new user unique identifier to complete the anonymization of the user's motion record data, and then the user motion record data is split according to the new user unique identifier to form trajectory segments of multiple users, and each of the trajectory segments is sorted by time to form the user's original trajectory data.
4. The method according to claim 1, characterized in that The data access method comprises: The original trajectory data of the user is read, and the users with serious missing fields and missing data are filtered and recorded to obtain a user trajectory sequence; wherein the standard for the serious missing fields is that the filling rate of any value of the coordinate information, time information and user motion behavior information is less than 50%, and the standard for the missing data volume is that the number of coordinate information per hour is less than 30 times.
5. The method according to claim 4, characterized in that The data cleaning method includes: time-layered data cleaning and geographical-region-layered data cleaning; The method for cleaning time-layered data is as follows: the user trajectory sequence is layered according to a set time interval, and whether the moving speed between two adjacent coordinates in each layer of data is greater than a set threshold is determined, and then whether there is a drift phenomenon, so as to remove abnormal drift points; The method for cleaning the geographic region layer data is as follows: stratifying the user trajectory sequence according to administrative boundaries, determining whether there is frequent switching between multiple coordinates in each layer of data, and based on the existence of the situation, selecting the coordinate with the smallest information entropy as the optimal location of the current user.
6. The method according to claim 1, characterized in that The data completion method includes: The previous coordinate and the next coordinate of the missing coordinate are read, the best matching path from the previous coordinate to the next coordinate is calculated, and the coordinate information therein is extracted to fill in the missing coordinate.
7. The method according to claim 1, characterized in that The process of spatiotemporal gridding coding includes: 1) Convert the coordinates (lng, lat) in the user motion record data into a point (x, y, z) on a three-dimensional sphere, where lng is longitude and lat is latitude; 2) transform the point (x, y, z) to a face of the circumscribed cube so that it corresponds to the number HID of the face, establish a coordinate system with the midpoint of the face, and obtain a three-dimensional coordinate (HID, a, b), where a and b are the two-dimensional coordinates of the point in the plane; 3) Divide the plane where the coordinates (HID, a, b) are located into four square areas according to the coordinate system, encode different quadrants, select the sub-square where the coordinates (HID, a, b) are located, repeat the above operation to form a code, and then splice the code with the code of the HID to obtain a spatial grid code; 4) Decomposing the time information into a plurality of integers of a specified time scale, and concatenating the integers to obtain a time grid code.
8. The method according to claim 1, characterized in that: The method for mining hotspot areas and hotspot routes comprises: The spatial grid coding and the temporal grid coding are used to count the number of user visits in different time and space divisions to form a hot spot area, wherein the hot spot area is a space where the number of user visits exceeds a set threshold. The user movement pattern in the hot spot area is obtained based on the temporal grid coding, and the hot spot areas with the movement pattern are connected in order of the movement start coordinates, the movement stop coordinates and the movement end coordinates to form a hot spot route.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, the computer program is configured to be executed by the processor, and the computer program comprises instructions for executing the method according to any one of claims 1 to 8.
10. A storage medium storing a computer program, wherein when the computer program is executed by a computer, the method according to any one of claims 1 to 8 is implemented.
