Space-time K function graph generation method and system based on distribution and aggregation, terminal and storage medium
By constructing multiple matrices and performing allocation and aggregation methods for data point access, range query, element allocation and numerical calculation, the problem of low efficiency in spatiotemporal K function graph generation in the prior art is solved, and a more efficient spatiotemporal K function graph generation is achieved.
Patent Information
- Application Number
- CN202510733555.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-04
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-06-04
AI Technical Summary
The prior art cannot effectively reduce the time complexity when generating space-time K function graphs, resulting in low generation efficiency.
Using the method based on allocation and aggregation, multiple matrices are constructed and data point access, range query, element allocation and numerical calculation are performed, and the space-time K function diagram is finally generated.
While maintaining the precise solution and the same spatial complexity, the time complexity of generating space-time K function graphs is significantly reduced.
Smart Images

Figure CN120256495A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and particularly to a method, system, terminal and computer-readable storage medium for generating a spatio-temporal K-function graph based on allocation and aggregation. Background Art
[0002] The spatio-temporal K-function is an important tool in geographic information systems and has been used in many fields, such as geography, transportation science, urban planning, etc. The definition of the spatio-temporal K-function is that given a spatial threshold and a time threshold, all data points within the spatial threshold and the time threshold (i.e., the spatio-temporal threshold pair) are statistically obtained from each spatio-temporal data point in the location data set; by calculating the spatio-temporal K-function, a corresponding spatio-temporal K-function graph is generated. The spatio-temporal K-function graph is an analysis tool that combines the time and space dimensions and is mainly used to detect and study the aggregation or dispersion patterns in spatio-temporal data; it is suitable for detecting spatio-temporal anomalies. By calculating the spatial distribution and time variation of point patterns, abnormal phenomena or patterns can be identified, and it has important significance in geographical research and can provide an in-depth understanding of the spatio-temporal characteristics and abnormal detection of geographical flows (such as population flow, climate change, etc.). Since generating the spatio-temporal K-function graph requires calculating L +1 spatio-temporal K-functions for each spatio-temporal threshold pair (spatial threshold - time threshold pair), and the time complexity of each spatio-temporal K-function is Therefore, when considering a pair of spatial threshold - time threshold, its time complexity is Because generating the spatio-temporal K-function graph needs to consider a total of ST ( S is the total number of spatial thresholds, T is the total number of time thresholds) spatio-temporal threshold pairs, so its total time complexity is Due to its huge time complexity, when generating the spatio-temporal K-function graph, a large computational bottleneck is encountered in large-scale data sets and a large number of spatio-temporal threshold pairs, resulting in low efficiency in generating the spatio-temporal K-function graph.
[0003] Currently, in view of the above problems, although the prior art has proposed various methods, such as methods related to fast functions, methods related to fast kernel density visualization, and fast indexing methods, etc., the methods related to fast K-functions combine parallel / distributed methods or modern hardware methods with existing methods and cannot reduce the time complexity of solving K-function related problems; the methods related to fast kernel density visualization are based on calculating the kernel aggregation of data points and cannot reduce the time complexity or can only provide approximate results for solving the kernel density visualization problem; and the indexing structures of the fast indexing methods cannot reduce the time complexity of generating the spatio-temporal K-function graph.
[0004] Therefore, the prior art still needs to be improved and developed. Summary of the Invention
[0005] The main object of the present invention is to provide a method, system, terminal and storage medium for generating a spatio-temporal K-function graph based on allocation and aggregation, aiming to solve the problem in the prior art that when generating a spatio-temporal K-function graph, the time complexity during generation cannot be reduced, resulting in a low generation efficiency of the spatio-temporal K-function graph.
[0006] To achieve the above object, the present invention provides a method for generating a spatio-temporal K-function graph based on allocation and aggregation. The method for generating a spatio-temporal K-function graph based on allocation and aggregation includes the following steps: Obtain the position data set of the target area, construct a first matrix according to the position data set, access the data points of the position data set to obtain an access result, and perform a range query according to the access result to obtain a first range query set; Construct a second matrix according to the position data set, and perform element allocation on the second matrix according to the first range query set to obtain a target second matrix; Construct a third matrix according to the position data set, perform numerical calculation on all elements in the third matrix according to the target second matrix to obtain a target calculation result, and perform optimization processing on the first matrix according to the target calculation result to obtain a target first matrix; Obtain a randomly generated data set, and generate a corresponding spatio-temporal K-function graph according to the spatio-temporal K-function minimum value and spatio-temporal K-function maximum value of the target first matrix and the randomly generated data set.
[0007] Optionally, in the method for generating a spatio-temporal K-function graph based on allocation and aggregation, where the obtaining the position data set of the target area, constructing a first matrix according to the position data set, accessing the data points of the position data set to obtain an access result, and performing a range query according to the access result to obtain a first range query set specifically includes: Obtain the user's requirement for generating a spatio-temporal K-function graph, determine the target area according to the requirement for generating a spatio-temporal K-function graph, and obtain the position data set of the target area; Construct a first matrix according to the position data set, and initialize all elements of the first matrix; Access the target data points of the initialized position data set to obtain an access result, and perform a range query on the target data points according to the access result to obtain a first range query set.
[0008] Optionally, in the method for generating a spatio-temporal K-function graph based on allocation and aggregation, where the constructing a second matrix according to the position data set, performing element allocation on the second matrix according to the first range query set to obtain a target second matrix specifically includes: Obtain the total number of spatial thresholds and the total number of temporal thresholds of the position data set, construct a second matrix according to the total number of spatial thresholds and the total number of temporal thresholds, and initialize all elements of the second matrix; Perform access processing on all data points of the first range query set to obtain a target access result, and obtain the maximum spatial threshold and the maximum temporal threshold of the target access result; Obtain a maximum range query set according to the maximum spatial threshold and the maximum temporal threshold, and allocate elements of the maximum range query set to the initialized second matrix to obtain a target second matrix.
[0009] Optionally, in the method for generating a spatio-temporal K-function graph based on assignment and aggregation, wherein constructing a third matrix according to the position data set, and performing numerical calculation on all elements in the third matrix according to the target second matrix to obtain a target calculation result, specifically includes: Determine the matrix specification according to the total number of spatial thresholds and the total number of temporal thresholds, and construct a third matrix according to the matrix specification; Perform numerical calculation on all elements in the third matrix according to the target second matrix according to the calculation formula to obtain a target calculation result.
[0010] Optionally, in the method for generating a spatio-temporal K-function graph based on assignment and aggregation, wherein performing numerical calculation on all elements in the third matrix according to the target second matrix to obtain a target calculation result, specifically is: ; Wherein, is the data point at the th row and the th column of the third matrix, is the data point at the th row and the th column of the target second matrix, is the data point at the th row and the th column of the third matrix, is the data point at the th row and the th column of the third matrix, is the data point at the th row and the th column of the third matrix, is the number of rows of the matrix, is the number of columns of the matrix.
[0011] Optionally, for the spatio-temporal K-function graph generation method based on assignment and aggregation, the step of optimizing the first matrix according to the target calculation result to obtain a target first matrix specifically includes: Obtain all target elements of the first matrix, and respectively add all the target elements to the target calculation result to obtain a processing result; Optimize the first matrix according to the processing result to obtain a target first matrix.
[0012] Optionally, for the spatio-temporal K-function graph generation method based on assignment and aggregation, the step of obtaining a randomly generated data set and generating a corresponding spatio-temporal K-function graph according to the minimum and maximum values of the spatio-temporal K-function of the target first matrix and the randomly generated data set specifically includes: Obtain a randomly generated data set, calculate the minimum and maximum values of the spatio-temporal K-function of the randomly generated data set to obtain the minimum value of the spatio-temporal K-function and the maximum value of the spatio-temporal K-function; Generate a function graph according to the target first matrix, the minimum value of the spatio-temporal K-function, and the maximum value of the spatio-temporal K-function to obtain a spatio-temporal K-function graph.
[0013] Optionally, for the spatio-temporal K-function graph generation method based on assignment and aggregation, the spatio-temporal K-function graph generation system based on assignment and aggregation includes: A data query module, configured to construct a first matrix, obtain a position data set of a target area, access data points of the position data set to obtain an access result, and perform a range query according to the access result to obtain a first range query set; A data assignment module, configured to construct a second matrix according to the position data set, and perform element assignment on the second matrix according to the first range query set to obtain a target second matrix; A data aggregation module, configured to construct a third matrix according to the position data set, perform numerical calculation on all elements in the third matrix according to the target second matrix to obtain a target calculation result, and optimize the first matrix according to the target calculation result to obtain a target first matrix; A function graph generation module, configured to obtain a randomly generated data set, and generate a corresponding spatio-temporal K-function graph according to the minimum and maximum values of the spatio-temporal K-function of the target first matrix and the randomly generated data set.
[0014] In addition, to achieve the above object, the present invention further provides a terminal, wherein the terminal includes: a memory, a processor, and a spatio-temporal K-function graph generation program based on allocation and aggregation stored on the memory and executable on the processor. When the spatio-temporal K-function graph generation program based on allocation and aggregation is executed by the processor, the steps of the spatio-temporal K-function graph generation method based on allocation and aggregation as described above are implemented.
[0015] In addition, to achieve the above object, the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a spatio-temporal K-function graph generation program based on allocation and aggregation. When the spatio-temporal K-function graph generation program based on allocation and aggregation is executed by a processor, the steps of the spatio-temporal K-function graph generation method based on allocation and aggregation as described above are implemented.
[0016] In the present invention, a position data set of a target area is obtained, a first matrix is constructed according to the position data set, data points of the position data set are accessed to obtain an access result, and a range query is performed according to the access result to obtain a first range query set; a second matrix is constructed according to the position data set, element allocation is performed on the second matrix according to the first range query set to obtain a target second matrix; a third matrix is constructed according to the position data set, numerical calculations are performed on all elements in the third matrix according to the target second matrix to obtain a target calculation result, and the first matrix is optimized according to the target calculation result to obtain a target first matrix; a randomly generated data set is obtained, and a corresponding spatio-temporal K-function graph is generated according to the spatio-temporal K-function minimum value and the spatio-temporal K-function maximum value of the target first matrix and the randomly generated data set. The present invention reduces the time complexity of generating the spatio-temporal function graph while maintaining the exact solution and the same space complexity. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a schematic diagram of the calculation method of the spatio-temporal K-function in the prior art; Figure 2 is a schematic diagram of the spatio-temporal K-function graph in the prior art; Figure 3 is a schematic diagram of the range query set in an embodiment of the present invention; Figure 4 is a flowchart of a preferred embodiment of the spatio-temporal K-function graph generation method based on allocation and aggregation of the present invention; Figure 5 is a schematic diagram of the allocation method in an embodiment of the present invention; Figure 6 is a schematic diagram of the second matrix in an embodiment of the present invention; Figure 7 is a schematic diagram of generating a third matrix based on the target first matrix in an embodiment of the present invention; Figure 8 It is a schematic diagram of the time required to generate a spatio-temporal K-function graph when changing the size of the data set in an embodiment of the present invention; Figure 9 It is a schematic diagram of the time required to generate a spatio-temporal K-function graph when changing the number of spatial thresholds in an embodiment of the present invention; Figure 10 It is a schematic diagram of the time required to generate a spatio-temporal K-function graph when changing the number of temporal thresholds in an embodiment of the present invention; Figure 11 It is a schematic diagram of the time required to generate a spatio-temporal K-function graph when changing the number of randomly generated data sets in an embodiment of the present invention; Figure 12 It is a structural diagram of a preferred embodiment of a spatio-temporal K-function graph generation system based on allocation and aggregation of the present invention; Figure 13 It is a schematic diagram of the operating environment of a preferred embodiment of the terminal of the present invention. Detailed implementation manners
[0018] To make the objectives, technical solutions and advantages of the present invention clearer and more definite, the following further describes the present invention in detail with reference to the accompanying drawings and by way of examples. It should be understood that the specific examples described herein are only used to explain the present invention and are not used to limit the present invention.
[0019] It should be noted that if there are directional indications (such as up, down, left, right, front, back,...) involved in the embodiments of the present invention, then such directional indications are only used to explain the relative positional relationship and movement conditions between components in a specific posture (as shown in the drawings). If this specific posture changes, then the directional indications will also change accordingly.
[0020] In addition, if there are descriptions such as "first", "second", etc. involved in the embodiments of the present invention, then such descriptions of "first", "second", etc. are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, features defined with "first", "second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions between various embodiments can be combined with each other, but it must be based on the fact that those skilled in the art can implement them. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present invention.
[0021] The definition of the spatio-temporal K-function is: Given a spatial threshold and a temporal threshold , all data points within the spatial threshold and temporal threshold are statistically obtained from each spatio-temporal data point in the position data set. Thus, a position data set of size is given , where is the first spatial point, is the time of the first spatial point, is the second spatial point, is the time of the second spatial point, is the th spatial point, is the th spatial point's time, and the corresponding spatio-temporal K function is: ; where is the spatio-temporal K function of the position data set , is the th spatial point, is the th spatial point's time, is the j th spatial point, is the j th spatial point's time, is the Euclidean distance function, is the indicator function, that is, it is 1 as long as and are both satisfied, and 0 otherwise. As shown in part (b) of Figure 1 , since the point sets , and are respectively within the spatial threshold and temporal threshold of , and , so the value of the spatio-temporal Figure 1 function in part (b) is 2 + 2 + 2 = 6. In contrast, in part (a) of Figure 1 , none of the data points are within the spatial threshold and temporal threshold of each data point, so the value of its spatio-temporal K function is 0. Usually, under the same spatial threshold and temporal threshold, the larger the value of the spatio-temporal K function, the more clustered the data set will be. On the contrary, the smaller the value of the spatio-temporal K function, the more dispersed the data set will be.
[0022] To verify whether the position data set has the characteristics of clustering or dispersion within those spatial thresholds and temporal thresholds, the user selects spatial thresholds ( ) and temporal thresholds ( ), and generates A randomly generated dataset of size (the same as the original position dataset), that is and at each spatio-temporal threshold pair where and , is the number of rows of the matrix, is the number of columns of the matrix, calculate , and , where and respectively refer to the minimum and maximum values of the spatio-temporal K function, and the corresponding formulas are: ; ; where is the spatio-temporal K function of the randomly generated dataset , is the spatio-temporal K function of the randomly generated dataset , is the spatio-temporal K function of the randomly generated dataset ; finally, under different spatio-temporal threshold pairs, the user generates a spatio-temporal K function graph based on , and values, as shown in Figure 2 , Figure 2 as long as the plane referred to by is higher than the plane referred to by , this position dataset will have an aggregated characteristic at the corresponding spatial threshold and time threshold. On the other hand, if the plane referred to is lower than the plane representing , this position dataset will have a dispersed characteristic at the corresponding spatial threshold and time threshold.
[0023] Since generating a spatio-temporal K function graph requires calculating spatio-temporal K functions for each spatio-temporal threshold pair, and the time complexity of each spatio-temporal K function is . Therefore, when considering a pair of spatio-temporal threshold pairs, the corresponding time complexity is . Because generating a spatio-temporal K function graph needs to consider spatio-temporal threshold pairs in total, so its total time complexity is . Due to its huge time complexity, generating a spatio-temporal K function graph encounters a large computational bottleneck in large-scale datasets and a large number of spatio-temporal threshold pairs, and it is impossible to reduce the time complexity during generation, resulting in a low generation efficiency of the spatio-temporal K function graph.
[0024] After that, the spatio-temporal K function can be expressed as: ; wherein, is 's range query set, and the corresponding expression is: .
[0025] Therefore, the present invention proposes a DNA (Distribution aNd Aggregation) method to reduce the time complexity of generating the spatio-temporal K function graph. As Figure 2 can be known, generating the spatio-temporal K function graph requires considering the values of the spatio-temporal K function for each data set for the maximum spatial threshold and the maximum temporal threshold when the range query set is completely contained in and for other spatial threshold - temporal threshold pairs (for example: and ), as shown in Figure 3 : ; therefore, as long as is found (for example, Figure 3 of ), there is enough information to obtain other (for example, Figure 3 of ), without having to recalculate different .
[0026] The spatio-temporal K function graph generation method based on distribution and aggregation according to the preferred embodiment of the present invention, as Figure 4 shown, the spatio-temporal K function graph generation method based on distribution and aggregation includes the following steps: Step S10, obtain the position data set of the target area, construct a first matrix according to the position data set, access the data points of the position data set to obtain an access result, and perform a range query according to the access result to obtain a first range query set.
[0027] The step S10 includes: Step S11, obtain the user's spatio-temporal K function graph generation requirement, determine the target area according to the spatio-temporal K function graph generation requirement, and obtain the position data set of the target area; Step S12: Construct a first matrix based on the position data set and initialize all elements of the first matrix; Step S13: Access the target data points in the initialized position data set to obtain an access result, and perform a range query on the target data points according to the access result to obtain a first range query set.
[0028] Specifically, in the embodiment of the present invention, obtain the generation requirement of the spatio-temporal K function graph of the user, determine the target area according to the generation requirement of the spatio-temporal K function graph, and obtain the position data set of the target area. For example, for the position data set, construct a first matrix according to the position data set, that is , and initialize all elements of the first matrix to 0; then, it is necessary to access the th data point in the position data set , that is, access the target data points in the initialized position data set to obtain an access result, and perform a range query on the target data points according to the access result to obtain a first range query set, that is . The query method used is the RQS (Range-Query-based Solution) method, and these data points are searched by combining different tree index structures.
[0029] Step S20: Construct a second matrix according to the position data set, and perform element assignment on the second matrix according to the first range query set to obtain a target second matrix.
[0030] The step S20 includes: Step S21: Obtain the total number of spatial thresholds and the total number of temporal thresholds of the position data set, construct a second matrix according to the total number of spatial thresholds and the total number of temporal thresholds, and initialize all elements of the second matrix; Step S22: Perform access processing on all data points in the first range query set to obtain a target access result, and obtain the maximum spatial threshold and the maximum temporal threshold of the target access result; Step S23: Obtain a maximum range query set according to the maximum spatial threshold and the maximum temporal threshold, and perform element assignment on the initialized second matrix with the data points in the maximum range query set to obtain a target second matrix.
[0031] Specifically, after obtaining , only need to establish a matrix with a size of (that is, the second matrix), and assign each point of to the corresponding and , in the embodiments of the present invention, it is implemented by the allocation method. As Figure 5 shown, specifically, obtain the total number of spatial thresholds (i.e., ) and the total number of time thresholds (i.e., ) of the position data set, construct a second matrix according to the total number of spatial thresholds and the total number of time thresholds, and initialize all elements of the second matrix (i.e., ) to 0, where, and ); then, access and process all data points (i.e., ) of the first range query set to obtain a target access result, and obtain the maximum spatial threshold (for example, Figure 5 in ) and the maximum time threshold (for example, Figure 5 in ) of the target access result; obtain a maximum range query set according to the maximum spatial threshold and the maximum time threshold (for example, Figure 5 in ), and allocate the data point pairs of the maximum range query set to the initialized second matrix to obtain a target second matrix, where, and , and then increase the value of by 1. When this step is completed, it can be obtained that: ; The purpose is that the existing method calculates and in different , which will generate a lot of repeated calculations. The allocation method of the present invention is to first calculate the largest , and then allocate each data point in the set of to the corresponding data point, so as to avoid repeated calculations. As Figure 6 shown in the matrix , where the result of is Figure 6 because there are only 2 data points that satisfy both and in Figure 3 . As shown in , since both the spatial threshold and the time threshold have regularities (for example: ), so it only takes time to allocate each data point, that is, it takes at most to allocate all points inThe time, so the time required for this process is .
[0032] Step S30: Construct a third matrix according to the position data set, perform numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result, and optimize the first matrix according to the target calculation result to obtain a target first matrix.
[0033] The step S30 includes: Step S31: Determine the matrix specification according to the total number of spatial thresholds and the total number of time thresholds, and construct a third matrix according to the matrix specification; Step S32: Perform numerical calculations on all elements in the third matrix according to the target second matrix according to the calculation formula to obtain a target calculation result; Step S33: Obtain all target elements of the first matrix, and add all the target elements to the target calculation result respectively to obtain a processing result; Step S34: Perform a removal process on the second matrix and the third matrix according to the processing result to obtain a target processing result, and obtain a target first matrix according to the target processing result.
[0034] Specifically, after obtaining the target second matrix, generate a third matrix based on the target second matrix (i.e., matrix ), and calculate the corresponding aggregation value. In the embodiment of the present invention, it is implemented by the aggregation method. Specifically, determine the matrix specification according to the total number of spatial thresholds and the total number of time thresholds, and construct a third matrix according to the matrix specification according to the position data set, represents the aggregation value in; perform numerical calculations on all elements in the third matrix according to the target second matrix according to the calculation formula to obtain a target calculation result; wherein, the performing numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result is specifically: ; Wherein, is the data point in the th row and th column of the third matrix, is the data point in the th row and th column of the target second matrix, is the data point in the th row and th column of the third matrix, is the data point in the th row and The data points of the column, is the data point of the th row and th column in the third matrix, is the number of rows of the matrix, is the number of columns of the matrix; when is obtained, this is the value of, that is, , as shown in Figure 7 , 8 represents the aggregation value of the dark area in the target second matrix in Figure 6 , and 17 represents the aggregation value of the dark area and the light area in the target second matrix in Figure 6 .
[0035] After that, all target elements of the first matrix are obtained, and all the target elements are respectively added to the target calculation result to obtain a processing result; the first matrix is optimized according to the processing result. For example, the second matrix and the third matrix are removed to obtain a target first matrix until all data points in the position data set are accessed. When this algorithm is completed, (where and ) is the value of the spatio-temporal K function of the spatio-temporal threshold pair, and the corresponding time complexity is . Therefore, the time complexity of processing a data point is , so the time complexity of processing a data set ( data points) is . Since generating a spatio-temporal K function graph requires processing data sets, the time complexity is , which is much lower than the time complexity of the existing method.
[0036] Step S40: Obtain a randomly generated data set, and generate a corresponding spatio-temporal K function graph according to the minimum value and the maximum value of the spatio-temporal K function of the target first matrix and the randomly generated data set.
[0037] The step S40 includes: Step S41: Obtain a randomly generated data set, calculate the maximum and minimum values of the spatio-temporal K function of the randomly generated data set to obtain the minimum value of the spatio-temporal K function and the maximum value of the spatio-temporal K function; Step S42: Generate a function graph according to the target first matrix, the minimum value of the spatio-temporal K function and the maximum value of the spatio-temporal K function to obtain a spatio-temporal K function graph.
[0038] Specifically, in the embodiment of the present invention, a randomly generated data set is obtained. For example, ; Calculate the minimum and maximum values of the spatio-temporal K function for the randomly generated dataset to obtain the minimum value of the spatio-temporal K function (denoted by ) and the maximum value of the spatio-temporal K function (denoted by ); Among them, the formula for calculating the minimum value of the spatio-temporal K function is: ; The formula for calculating the maximum value of the spatio-temporal K function is: ; Among them, is the spatio-temporal K function of the randomly generated dataset , is the spatio-temporal K function of the randomly generated dataset , is the spatio-temporal K function of the randomly generated dataset ; Subsequently, generate a function graph according to the target first matrix, the minimum value of the spatio-temporal K function, and the maximum value of the spatio-temporal K function to obtain a spatio-temporal K function graph.
[0039] Furthermore, in order to test whether the present invention reduces the time complexity of generating a spatio-temporal function graph, generate an accurate spatio-temporal function graph by different methods when changing different parameter values. As Figures 8 to 11 shown, where DNA (Distribution aNd Aggregation) is the present invention, and RQS kd (Range-Query-based Solution K-Dimension) and RQS ball (Range-Query-based Solution Ball) are existing index structures; Figure 8 is the time required to generate a spatio-temporal K function graph when changing the size of the dataset, where the number of spatial thresholds is 5, the number of time thresholds is 5, and the number of randomly generated datasets is 1; Figure 9 is the time required to generate a spatio-temporal K function graph when changing the number of spatial thresholds, where the number of time thresholds is 5 and the number of randomly generated datasets is 1; Figure 10 is the time required to generate a spatio-temporal K function graph when changing the number of time thresholds, where the number of spatial thresholds is 5 and the number of randomly generated datasets is 1; Figure 11 is the time required to generate a spatio-temporal K function graph when changing the number of randomly generated datasets, where the number of spatial thresholds is 5 and the number of time thresholds is 5. As known from Figures 8 to 11 , the present invention not only reduces the time complexity of generating a spatio-temporal K function graph, but also maintains the same spatial complexity and maintains an accurate solution.
[0040] Further, as Figure 12 shown, based on the above-mentioned spatio-temporal K-function graph generation method based on allocation and aggregation, the present invention also correspondingly provides a spatio-temporal K-function graph generation system based on allocation and aggregation, wherein the spatio-temporal K-function graph generation system based on allocation and aggregation includes: A data query module 51, configured to construct a first matrix, obtain a position data set of a target area, access data points of the position data set to obtain an access result, and perform a range query according to the access result to obtain a first range query set; A data allocation module 52, configured to construct a second matrix according to the position data set, and perform element allocation on the second matrix according to the first range query set to obtain a target second matrix; A data aggregation module 53, configured to construct a third matrix according to the position data set, perform numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result, and perform optimization processing on the first matrix according to the target calculation result to obtain a target first matrix; A function graph generation module 54, configured to obtain a randomly generated data set, and generate a corresponding spatio-temporal K-function graph according to the spatio-temporal K-function minimum value and the spatio-temporal K-function maximum value of the target first matrix and the randomly generated data set.
[0041] Further, as Figure 13 shown, based on the above-mentioned spatio-temporal K-function graph generation method based on allocation and aggregation, the present invention also correspondingly provides a terminal, and the terminal includes a processor 10, a memory 20, and a display 30. Figure 13 Only some components of the terminal are shown, but it should be understood that it is not required to implement all the shown components, and more or fewer components can be alternatively implemented.
[0042] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as the hard disk or memory of the terminal. In some other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc., equipped on the terminal. Further, the memory 20 may also include both the internal storage unit and the external storage device of the terminal. The memory 20 is used to store application software installed on the terminal and various types of data, such as the program code of the installed terminal, etc. The memory 20 may also be used to temporarily store data that has been output or will be output. In one embodiment, a spatio-temporal K-function graph generation program 40 based on distribution and aggregation is stored on the memory 20, and the spatio-temporal K-function graph generation program 40 based on distribution and aggregation can be executed by the processor 10, so as to implement the spatio-temporal K-function graph generation method based on distribution and aggregation in the present application.
[0043] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chips, and is used to run the program code stored in the memory 20 or process data, such as executing the spatio-temporal K-function graph generation method based on distribution and aggregation, etc.
[0044] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) toucher, etc. The display 30 is used to display information on the terminal and to display a visual user interface. Components of the terminal communicate with each other through a system bus.
[0045] In one embodiment, when the processor 10 executes the spatio-temporal K-function graph generation program 40 in the memory 20, the following steps are implemented: Obtain a position data set of a target area, construct a first matrix according to the position data set, perform data point access on the position data set to obtain an access result, and perform a range query according to the access result to obtain a first range query set; Construct a second matrix according to the position data set, and perform element allocation on the second matrix according to the first range query set to obtain a target second matrix; Construct a third matrix based on the position data set, perform numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result, and optimize the first matrix according to the target calculation result to obtain a target first matrix; Obtain a randomly generated data set, and generate a corresponding spatio-temporal K-function graph according to the minimum and maximum values of the spatio-temporal K-function of the target first matrix and the randomly generated data set.
[0046] Among them, the obtaining the position data set of the target area, constructing a first matrix according to the position data set, accessing data points of the position data set to obtain an access result, and performing a range query according to the access result to obtain a first range query set specifically includes: Obtain the user's spatio-temporal K-function graph generation requirement, determine the target area according to the spatio-temporal K-function graph generation requirement, and obtain the position data set of the target area; Construct a first matrix according to the position data set, and initialize all elements of the first matrix; Access the target data points of the initialized position data set to obtain an access result, and perform a range query on the target data points according to the access result to obtain a first range query set.
[0047] Among them, the constructing a second matrix according to the position data set, and allocating elements to the second matrix according to the first range query set to obtain a target second matrix specifically includes: Obtain the total number of spatial thresholds and the total number of temporal thresholds of the position data set, construct a second matrix according to the total number of spatial thresholds and the total number of temporal thresholds, and initialize all elements of the second matrix; Perform access processing on all data points of the first range query set to obtain a target access result, and obtain the maximum spatial threshold and the maximum temporal threshold of the target access result; Obtain a maximum range query set according to the maximum spatial threshold and the maximum temporal threshold, and allocate elements of the data points in the maximum range query set to the initialized second matrix to obtain a target second matrix.
[0048] Among them, the constructing a third matrix according to the position data set, and performing numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result specifically includes: Determine the matrix specification according to the total number of spatial thresholds and the total number of temporal thresholds, and construct a third matrix according to the matrix specification; Perform numerical calculations on all elements in the third matrix according to the target second matrix according to the calculation formula to obtain a target calculation result.
[0049] Among them, performing numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result specifically includes: ; Among them, is the data point at the th row and the th column in the third matrix, is the data point at the th row and the th column in the target second matrix, is the data point at the th row and the th column in the third matrix, is the data point at the th row and the th column in the third matrix, is the data point at the th row and the th column in the third matrix, is the number of rows of the matrix, is the number of columns of the matrix.
[0050] Among them, optimizing the first matrix according to the target calculation result to obtain a target first matrix specifically includes: Obtaining all target elements of the first matrix, and respectively adding all the target elements to the target calculation result to obtain a processing result; Optimizing the first matrix according to the processing result to obtain a target first matrix.
[0051] Among them, obtaining a randomly generated data set, and generating a corresponding spatio-temporal K-function graph according to the spatio-temporal K-function minimum value and spatio-temporal K-function maximum value of the target first matrix and the randomly generated data set specifically includes: Obtaining a randomly generated data set, calculating the minimum and maximum values of the spatio-temporal K-function of the randomly generated data set to obtain the spatio-temporal K-function minimum value and spatio-temporal K-function maximum value; Generating a function graph according to the target first matrix, the spatio-temporal K-function minimum value, and the spatio-temporal K-function maximum value to obtain a spatio-temporal K-function graph.
[0052] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a spatio-temporal K-function graph generation program based on allocation and aggregation. When the spatio-temporal K-function graph generation program based on allocation and aggregation is executed by a processor, the steps of the spatio-temporal K-function graph generation method based on allocation and aggregation described above are implemented.
[0053] In summary, the present invention provides a method, system, terminal, and storage medium for generating a spatio-temporal K-function graph based on allocation and aggregation. The method includes: obtaining a position data set of a target area, constructing a first matrix according to the position data set, accessing data points of the position data set to obtain an access result, and performing a range query according to the access result to obtain a first range query set; constructing a second matrix according to the position data set, allocating elements to the second matrix according to the first range query set to obtain a target second matrix; constructing a third matrix according to the position data set, performing numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result, and performing optimization processing on the first matrix according to the target calculation result to obtain a target first matrix; obtaining a randomly generated data set, and generating a corresponding spatio-temporal K-function graph according to the spatio-temporal K-function minimum value and spatio-temporal K-function maximum value of the target first matrix and the randomly generated data set. The present invention reduces the time complexity of generating a spatio-temporal function graph while maintaining an exact solution and the same spatial complexity.
[0054] It should be noted that in this article, the term "including", "comprising", or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article, or terminal including a series of elements not only includes those elements but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article, or terminal. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or terminal including that element.
[0055] Of course, those of ordinary skill in the art can understand that all or part of the processes of implementing the above method embodiments can be completed by instructing relevant hardware (such as a processor, a controller, etc.) through a computer program. The program can be stored in a computer-readable storage medium readable by a computer. When the program is executed, it can include the processes of the above method embodiments. The computer-readable storage medium can be a memory, a magnetic disk, an optical disc, etc.
[0056] It should be understood that the application of the present invention is not limited to the above examples. For those of ordinary skill in the art, improvements or transformations can be made according to the above description, and all such improvements and transformations should fall within the protection scope of the appended claims of the present invention.
Claims
1. A method for generating a spatio-temporal K-function graph based on allocation and aggregation, characterized in that, The spatio-temporal K-function graph generation method based on distribution and aggregation includes: Obtain the position data set of the target area, construct a first matrix according to the position data set, access the data points of the position data set to obtain an access result, and perform a range query according to the access result to obtain a first range query set; Construct a second matrix according to the position data set, and perform element allocation on the second matrix according to the first range query set to obtain a target second matrix; Construct a third matrix according to the position data set, perform numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result, and perform optimization processing on the first matrix according to the target calculation result to obtain a target first matrix; Obtain a randomly generated data set, and generate a corresponding spatio-temporal K-function graph according to the spatio-temporal K-function minimum value and spatio-temporal K-function maximum value of the target first matrix and the randomly generated data set.
2. The spatio-temporal K-function graph generation method based on distribution and aggregation according to claim 1, wherein The obtaining the position data set of the target area, constructing a first matrix according to the position data set, accessing the data points of the position data set to obtain an access result, and performing a range query according to the access result to obtain a first range query set specifically includes: Obtain the spatio-temporal K-function graph generation requirement of the user, determine the target area according to the spatio-temporal K-function graph generation requirement, and obtain the position data set of the target area; Construct a first matrix according to the position data set, and initialize all elements of the first matrix; Access the target data points of the initialized position data set to obtain an access result, and perform a range query on the target data points according to the access result to obtain a first range query set.
3. The spatio-temporal K-function graph generation method based on distribution and aggregation according to claim 1, wherein The constructing a second matrix according to the position data set, performing element allocation on the second matrix according to the first range query set to obtain a target second matrix specifically includes: Obtain the total number of spatial thresholds and the total number of temporal thresholds of the position data set, construct a second matrix according to the total number of spatial thresholds and the total number of temporal thresholds, and initialize all elements of the second matrix; Perform access processing on all data points of the first range query set to obtain a target access result, and obtain the maximum spatial threshold and the maximum temporal threshold of the target access result; Obtain a maximum range query set according to the maximum spatial threshold and the maximum temporal threshold, and perform element allocation on the initialized second matrix with the data points of the maximum range query set to obtain a target second matrix.
4. The method for generating a spatio-temporal K-function graph based on distribution and aggregation according to claim 3, wherein The constructing a third matrix according to the position data set, performing numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result specifically includes: Determine the matrix specification according to the total number of spatial thresholds and the total number of temporal thresholds, and construct a third matrix according to the matrix specification; Perform numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result.
5. The method for generating a spatio-temporal K function graph based on distribution and aggregation according to claim 4, wherein The performing numerical calculations on all elements in the third matrix according to the target second matrix to obtain a target calculation result is specifically: ; Among them, is the data point at the -th row and -th column in the third matrix, is the data point at the -th row and -th column in the target second matrix, is the data point at the -th row and -th column in the third matrix, is the data point at the -th row and -th column in the third matrix, is the data point at the -th row and -th column in the third matrix, is the number of rows of the matrix, is the number of columns of the matrix.
6. The method for generating a spatio-temporal K-function graph based on distribution and aggregation according to claim 1, wherein Performing an optimization process on the first matrix according to the target calculation result to obtain a target first matrix, specifically including: Obtaining all target elements of the first matrix, and respectively adding all the target elements to the target calculation result to obtain a processing result; Performing an optimization process on the first matrix according to the processing result to obtain a target first matrix.
7. The method for generating a spatio-temporal K-function graph based on distribution and aggregation according to claim 1, wherein Obtaining a randomly generated data set, and generating a corresponding spatio-temporal K-function graph according to the minimum value and the maximum value of the spatio-temporal K-function of the target first matrix and the randomly generated data set, specifically including: Obtaining a randomly generated data set, calculating the minimum and maximum values of the spatio-temporal K-function of the randomly generated data set to obtain the minimum value of the spatio-temporal K-function and the maximum value of the spatio-temporal K-function; Generating a function graph according to the target first matrix, the minimum value of the spatio-temporal K-function, and the maximum value of the spatio-temporal K-function to obtain a spatio-temporal K-function graph.
8. A spatio-temporal K-function graph generation system based on distribution and aggregation, characterized in that, The spatio-temporal K-function graph generation system based on allocation and aggregation includes: A data query module, configured to construct a first matrix, obtain a position data set of a target area, access data points of the position data set to obtain an access result, and perform a range query according to the access result to obtain a first range query set; A data allocation module, configured to construct a second matrix according to the position data set, and perform element allocation on the second matrix according to the first range query set to obtain a target second matrix; A data aggregation module, configured to construct a third matrix according to the position data set, perform numerical calculation on all elements in the third matrix according to the target second matrix to obtain a target calculation result, and perform an optimization process on the first matrix according to the target calculation result to obtain a target first matrix; A function graph generation module, configured to obtain a randomly generated data set, and generate a corresponding spatio-temporal K-function graph according to the minimum value and the maximum value of the spatio-temporal K-function of the target first matrix and the randomly generated data set.
9. A terminal, characterized in that, The terminal includes: a memory, a processor, and a spatio-temporal K-function graph generation program based on allocation and aggregation stored on the memory and executable on the processor. When the spatio-temporal K-function graph generation program based on allocation and aggregation is executed by the processor, the steps of the spatio-temporal K-function graph generation method according to any one of claims 1-7 are implemented.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a spatio-temporal K-function graph generation program based on allocation and aggregation. When the spatio-temporal K-function graph generation program based on allocation and aggregation is executed by a processor, the steps of the spatio-temporal K-function graph generation method according to any one of claims 1-7 are implemented.
Citation Information
Patent Citations
Space-time POI data point mode analysis method based on Ripley's K function in distributed environment
CN110765130A
Method for reproducibility of deep learning classifiers using ensembles
US20210374500A1
Cited By
Rapid space-time road network K function graph generation method and system based on range tree and prefix counting array, terminal and storage medium
CN120950620A