A method for association mining based on spatiotemporal network, terminal device and storage medium
Through the correlation mining method of spatiotemporal network, using hash table storage and validity judgment, the problem of low efficiency and redundancy in traditional methods is solved, and fast and real-time correlation analysis of spatiotemporal trajectory data is realized.
Patent Information
- Application Number
- CN202111368529.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-18
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2041-11-18
AI Technical Summary
Traditional spatiotemporal trajectory data association analysis methods have low efficiency, redundant storage, large time and space complexity, only support offline methods, and cannot meet the needs of fast data association and data mining.
The association mining method based on spatio-temporal network is used to quickly find the associated data through data spatio-temporal gridding and hash table storage, and remove redundant information through validity judgment to support real-time association analysis.
It greatly reduces the time and space complexity, quickly retrieves relevant information that satisfies spatio-temporal constraints, eliminates redundant data, supports real-time correlation analysis, and avoids boundary data discontinuity problems.
Smart Images

Figure CN114064791B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data processing, and in particular to an association mining method based on a spatiotemporal network, a terminal device and a storage medium. Background Art
[0002] With the development of big data, various analysis methods have been widely used in data statistics, data mining and other fields. Although the traditional spatiotemporal trajectory data association analysis method has relatively simple logic, it is extremely inefficient, consumes a lot of computing power and memory storage, and basically uses offline analysis. The main traditional analysis techniques are as follows:
[0003] The first method is to extract a type of data that needs to be managed from the data, loop through the list of this type of data, and then compare them one by one to see if they meet the association conditions. Therefore, when there are many types of data to be compared and the amount of data is huge, the calculation efficiency of this method is extremely low, and it also stores a lot of redundant information data.
[0004] The second method is the method used in the Chinese invention patent "A spatiotemporal relationship analysis system based on multi-source Internet of Things location perception" with application number CN201710016325.2, which analyzes the correlation of data through apriori or FP-growth association rule algorithm. This type of method uses a recursive method, so before obtaining the complete set of frequent patterns, it is necessary to scan the database multiple times to generate a large number of candidate frequent sets. This method has large time and space complexity, and there are also many redundant information data.
[0005] The third method is the method used in the Chinese invention patent "A method for mining spatiotemporal companion objects based on geohash" with application number CN201910601962.5 and the Chinese invention patent "Vehicle code fitting method and system based on geohash matching" with application number CN201911172980.2. Although it uses geohash for storage, it is not convenient to quickly filter out the required data types for correlation comparison. It can only sort by time and compare all types of data within the actual range at one time, resulting in a large number of unnecessary and irrelevant types of data being associated. The proposed trajectory similarity calculation method is relatively violent, and it is just a pure statistical frequency of appearing in different grids at the same time.
[0006] The traditional spatiotemporal trajectory data association method has the following shortcomings: storing a large amount of redundant data, and the final data mined still contains a lot of extremely unreliable information data; the association comparison efficiency is slow, the time and space complexity is large, and a lot of computing power is consumed; it only supports offline methods and has shortcomings such as discontinuous boundary data. Therefore, it cannot meet people's needs for fast data association and data mining. Summary of the invention
[0007] In order to solve the above problems, the present invention proposes an association mining method based on spatiotemporal network, a terminal device and a storage medium.
[0008] The specific plan is as follows:
[0009] A method for association mining based on spatiotemporal network comprises the following steps:
[0010] S1: Collect data for association analysis, convert the data into spatiotemporal grids and store them in a hash table structure;
[0011] S2: when receiving the data to be analyzed with a correlation to be analyzed, searching the hash table for the related data according to the data type, timestamp, and longitude and latitude of the data to be analyzed;
[0012] S3: Perform validity judgment on all the found related data to obtain valid related data of the data to be analyzed.
[0013] Furthermore, the content corresponding to the keyword field in the hash table in step S1 is a concatenation of the data type and the spatiotemporal grid code.
[0014] Furthermore, the spatiotemporal grid encoding is specifically: timeSlot|longitudeSlot|latitudeSlot, where: "|" represents a separator, timeSlot represents a time slot, longitudeSlot represents a longitude slot, and latitudeSlot represents a latitude slot. The calculation formulas are:
[0015] timeSlot=(timestamp–timestamp%timeSlotSize) / timeSlotSize
[0016] longitudeSlot=(longitude–longitude%longitudeSlotSize) / longitudeSlotSize
[0017] latitudeSlot=(latitude–latitude%latitudeSlotSize) / latitudeSlotSize
[0018] longitude=int(longitude*100000)
[0019] latitude=int(latitude*100000)
[0020] Among them, timestamp represents the timestamp, timeSlotSize represents the timestamp unit, longitude represents the longitude value, latitude represents the latitude value, longitudeSlotSize represents the longitude slot unit, latitudeSlotSize represents the latitude slot unit, and int(.) represents rounding.
[0021] Furthermore, in step S2, the process of searching for associated data from the hash table according to the data type, timestamp, and longitude and latitude of the data to be analyzed includes the following steps:
[0022] S21: Determine the data type of the data to be searched according to the data type of the data to be analyzed;
[0023] S22: determining the time information in the space-time grid code of the data to be searched according to the timestamp of the data to be analyzed;
[0024] S23: Determine the longitude and latitude information in the spatiotemporal grid code of the data to be searched according to the longitude and latitude of the data to be analyzed;
[0025] S24: According to the data type and spatiotemporal grid code of the data to be searched, the content of the keyword field of the data to be searched in the hash table is obtained, and then the data of the corresponding value field is searched from the hash table as the associated data according to the content of the keyword field.
[0026] Furthermore, in step S22, the method for determining the time information in the space-time grid code of the data to be searched according to the timestamp of the data to be analyzed is: determine the corresponding time slot according to the timestamp of the data to be analyzed, and use the time slot and the time slots before and after it as the time information in the space-time grid code of the data to be searched.
[0027] Furthermore, the longitude and latitude information in the spatiotemporal grid code of the data to be searched in step S23 is: the longitude and latitude information corresponding to 9 grid locations centered on the grid location corresponding to the longitude and latitude of the data to be analyzed.
[0028] Furthermore, step S24 also includes: first, sorting all data found in the hash table in order of time difference, and extracting all data whose time difference is less than a first time difference threshold; then sorting all remaining data in order of space difference, and extracting all data whose space difference is less than a first space difference threshold; and treating all extracted data as associated data.
[0029] Furthermore, the associated data to be judged for validity is used as the associated data to be analyzed, and the specific process of judging the validity for each associated data to be analyzed in step S3 includes the following steps:
[0030] S101: Determine whether there is any associated data to be analyzed in the effective associated cache log of Redis. If yes, perform validity judgment on the associated data to be analyzed according to the effective associated cache time and space validity judgment algorithm; otherwise, proceed to S102;
[0031] S102: Determine whether there is any association data to be analyzed in the latest valid association log of Redis. If yes, perform validity judgment on the association data to be analyzed according to the latest valid association spatiotemporal validity judgment algorithm; otherwise, proceed to S103;
[0032] S103: Determine whether there is any association data to be analyzed in the recent association cache log of Redis. If yes, perform validity judgment on the association data to be analyzed according to the recent association cache time and space validity judgment algorithm; otherwise, proceed to S104;
[0033] S104: writing the association to be analyzed into the most recent association cache log, writing the valid association to be analyzed into the valid association cache log, and updating the most recent valid association log with the valid association to be analyzed.
[0034] Furthermore, the effective association cache time and space validity judgment algorithm includes:
[0035] When the associated data to be analyzed is the first data in the valid associated cache log, the temporal and spatial dispersion calculation is performed on the associated data to be analyzed and the next data in the valid associated cache log, and whether the associated data to be analyzed is valid is determined according to the temporal and spatial dispersion calculation result;
[0036] When the associated data to be analyzed is the last piece of data in the valid associated cache log, the temporal and spatial dispersion calculation is performed on the associated data to be analyzed and the previous piece of data in the valid associated cache log, and whether the associated data to be analyzed is valid is determined according to the temporal and spatial dispersion calculation result;
[0037] When the associated data to be analyzed is data other than the first and last data in the valid associated cache log, firstly, the temporal and spatial discreteness calculation is performed on the associated data to be analyzed and the previous data in the valid associated cache log, and whether the associated data to be analyzed is valid is judged according to the temporal and spatial discreteness calculation result; when it is judged to be valid, the temporal and spatial discreteness calculation is performed on the associated data to be analyzed and the next data in the valid associated cache log, and whether the associated data to be analyzed is valid is judged according to the temporal and spatial discreteness calculation result.
[0038] Furthermore, the latest valid association time-space validity judgment algorithm includes: calculating the time-space dispersion of the association data to be analyzed and the data in the latest valid association log, and judging whether the association data to be analyzed is valid according to the time-space dispersion calculation result.
[0039] Furthermore, the recent associated cache time and space validity judgment algorithm includes:
[0040] S201: Determine whether the associated data to be analyzed is the first data in the most recently associated cache log. If so, calculate the time difference between the associated data to be analyzed and the last data in the most recently associated cache log, and enter S202; otherwise, calculate the time difference between the associated data to be analyzed and the first data in the most recently associated cache log, and enter S202;
[0041] S202: Determine whether the absolute value of the time difference calculated in step S201 is greater than or equal to a second time difference threshold. If so, determine that the associated data to be analyzed is valid; otherwise, proceed to S203;
[0042] S203: traverse each data in the most recently associated cache log in sequence, and calculate the spatial difference between the associated data to be analyzed and the data in the most recently associated cache log;
[0043] S204: Determine whether the absolute value of the spatial difference calculated in step S203 is greater than or equal to the second spatial difference threshold. If so, determine that the associated data to be analyzed is valid; otherwise, proceed to S205;
[0044] S205: Determine whether the data in the most recently associated cache log has been traversed. If yes, end; otherwise, return to step S204 to calculate the space difference between the associated data to be analyzed and the next data.
[0045] Furthermore, the process of calculating the spatiotemporal discreteness is:
[0046] S301: Determine whether the absolute value of the time difference between the associated data to be analyzed and the data in the valid associated cache log is greater than or equal to a second time difference threshold. If so, determine that the associated data to be analyzed is valid; otherwise, proceed to S302;
[0047] S302: Determine whether the absolute value of the space difference between the associated data to be analyzed and the data in the valid associated cache log is greater than or equal to a second space difference threshold; if so, determine that the associated data to be analyzed is valid; otherwise, determine that the associated data to be analyzed is invalid.
[0048] A spatiotemporal network-based association mining terminal device comprises a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above-mentioned method of the embodiment of the present invention are implemented.
[0049] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described above in an embodiment of the present invention are implemented.
[0050] The present invention adopts the above technical solution and has the following beneficial effects:
[0051] (1) A spatial-temporal grid-based association mining method is proposed. The hash table is searched based on data type and spatial-temporal information. This method can quickly compare associations and greatly reduce the time and space complexity. It can effectively retrieve association information that meets spatial-temporal constraints.
[0052] (2) It is proposed to make further effective judgments on the information that meets the constrained spatiotemporal associations, refine the information value, and eliminate redundant and low-value associated data.
[0053] (3) Supports real-time association and eliminates the problem of time boundary data. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 Shown is a flow chart of Embodiment 1 of the present invention.
[0055] Figure 2 Shown is a schematic diagram of the hash table storage structure in this embodiment. DETAILED DESCRIPTION
[0056] To further illustrate various embodiments, the present invention provides drawings. These drawings are part of the disclosure of the present invention, which are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in this field should be able to understand other possible implementations and advantages of the present invention.
[0057] The present invention will now be further described with reference to the accompanying drawings and specific implementation methods.
[0058] Embodiment 1:
[0059] The embodiment of the present invention provides a method for association mining based on spatiotemporal network. Figure 1 As shown, the method comprises the following steps:
[0060] S1: Collect data for association analysis, convert the data into spatiotemporal grids and store them in a hash table structure.
[0061] By storing all data used for association analysis through a hash table structure, data belonging to the same keyword field can be stored together in the hash table, which facilitates fast retrieval and the processing of spatiotemporal associations and spatiotemporal contradictions.
[0062] The data collected for association analysis in this embodiment is the log in Redis, and the log content is as follows:
[0063] key = 'MD123456'
[0064] type=VECO
[0065] timestamp=220
[0066] longitude = '115.35221'
[0067] latitude = '26.33086'
[0068] The type field indicates that the data type corresponding to the log is VECO.
[0069] In other embodiments, association analysis may also be performed on other types of data, which is not limited here.
[0070] In this embodiment, the content corresponding to the keyword (KEY) field of the hash table is the concatenation of the data type (dataType) and the spatiotemporal grid code, such as Figure 2 As shown, the spatiotemporal grid code set in this embodiment is specifically: timeSlot|longitudeSlot|latitudeSlot, where: "|" represents a separator, timeSlot represents a time slot, longitudeSlot represents a longitude slot, and latitudeSlot represents a latitude slot. The calculation formulas are:
[0071] timeSlot=(timestamp–timestamp%timeSlotSize) / timeSlotSize
[0072] longitudeSlot=(longitude–longitude%longitudeSlotSize) / longitudeSlotSize
[0073] latitudeSlot=(latitude–latitude%latitudeSlotSize) / latitudeSlotSize
[0074] longitude=int(longitude*100000)
[0075] latitude=int(latitude*100000)
[0076] Among them, timestamp represents the timestamp, timeSlotSize represents the timestamp unit, longitude represents the longitude value, latitude represents the latitude value, longitudeSlotSize represents the longitude slot unit, latitudeSlotSize represents the latitude slot unit, and int(.) represents rounding.
[0077] The value1 and value2 in the value (VALUE) field are specific data information under the spatiotemporal grid.
[0078] S2: When the data to be analyzed with the association to be analyzed is received, the associated data of the data to be analyzed is searched from the hash table according to the data type, timestamp, and longitude and latitude of the data to be analyzed.
[0079] The process of searching for associated data from the hash table in this embodiment includes the following steps:
[0080] S21: determining the data type of the data to be searched according to the data type of the data to be analyzed, such as determining the data type of the data to be searched to be VECO and OID according to the data type VECO;
[0081] S22: determining the time information in the space-time grid code of the data to be searched according to the timestamp of the data to be analyzed;
[0082] S23: Determine the longitude and latitude information in the spatiotemporal grid code of the data to be searched according to the longitude and latitude of the data to be analyzed;
[0083] S24: According to the data type and spatiotemporal grid code of the data to be searched, the content of the keyword field of the data to be searched in the hash table is obtained, and then the data of the corresponding value field is searched from the hash table as the associated data according to the content of the keyword field.
[0084] In step S22, the method for determining the time information in the space-time grid code of the data to be searched according to the timestamp of the data to be analyzed is: determine the corresponding time slot according to the timestamp of the data to be analyzed, and use the time slot and the time slots before and after it as the time information in the space-time grid code of the data to be searched.
[0085] In step S23, the longitude and latitude information in the spatiotemporal grid code of the data to be searched is: the longitude and latitude information corresponding to 9 grid locations centered on the grid location corresponding to the longitude and latitude of the data to be analyzed.
[0086] In step S24, in the specific process of obtaining the content of the keyword field of the data to be searched in the hash table according to the data type and the spatiotemporal grid code of the data to be searched, the data type obtained in step S21, the time information obtained in step S22, and the longitude and latitude information obtained in step S23 are combined one by one to obtain the content of different keyword fields. For example, if the data type includes 2 types, the time information includes 3 time slots, and the longitude and latitude information includes the longitude and latitude of 9 grids, then the content of 2*3*9 keyword fields (KEY) is obtained accordingly.
[0087] Step S24 also includes: first, sorting all data found in the hash table in order of time difference, extracting all data whose time difference is less than a first time difference threshold; then sorting all remaining data in order of space difference, extracting all data whose space difference is less than a second space difference threshold; and treating all extracted data as associated data.
[0088] Those skilled in the art can set the values of the first time difference threshold and the first space difference threshold as needed, which are not limited here.
[0089] S3: Perform validity judgment on all the found related data to obtain valid related data of the data to be analyzed.
[0090] Through validity judgment, redundant and low-value associated data can be filtered. In this embodiment, the associated data to be judged for validity is used as the associated data to be analyzed, and the validity judgment is implemented through Redis. The specific process of performing validity judgment on each associated data to be analyzed includes the following steps:
[0091] S101: Determine whether there is any associated data to be analyzed in the valid cache log of Redis. If yes, perform validity judgment on the associated data to be analyzed according to the valid cache time-space validity judgment algorithm; otherwise, proceed to S102;
[0092] S102: Determine whether there is any association data to be analyzed in the latest valid association (lastValid) log of Redis. If yes, perform validity judgment on the association data to be analyzed according to the latest valid association time-space validity judgment algorithm; otherwise, proceed to S103;
[0093] S103: Determine whether there is any associated data to be analyzed in the RecentCache log of Redis. If yes, perform validity judgment on the associated data to be analyzed according to the recent cache time-space validity judgment algorithm; otherwise, proceed to S104;
[0094] S104: writing the association to be analyzed into the most recent association cache log, writing the valid association to be analyzed into the valid association cache log, and updating the most recent valid association log with the valid association to be analyzed.
[0095] The specific implementation process of some of the sub-algorithms is as follows:
[0096] (1) The effective associative cache time and space validity judgment algorithm includes:
[0097] When the associated data to be analyzed is the first data in the valid associated cache log, the temporal and spatial dispersion calculation is performed on the associated data to be analyzed and the next data in the valid associated cache log, and whether the associated data to be analyzed is valid is determined according to the temporal and spatial dispersion calculation result;
[0098] When the associated data to be analyzed is the last piece of data in the valid associated cache log, the temporal and spatial dispersion calculation is performed on the associated data to be analyzed and the previous piece of data in the valid associated cache log, and whether the associated data to be analyzed is valid is determined according to the temporal and spatial dispersion calculation result;
[0099] When the associated data to be analyzed is data other than the first and last data in the valid associated cache log, firstly, the temporal and spatial discreteness calculation is performed on the associated data to be analyzed and the previous data in the valid associated cache log, and whether the associated data to be analyzed is valid is judged according to the temporal and spatial discreteness calculation result; when it is judged to be valid, the temporal and spatial discreteness calculation is performed on the associated data to be analyzed and the next data in the valid associated cache log, and whether the associated data to be analyzed is valid is judged according to the temporal and spatial discreteness calculation result.
[0100] It should be noted that the order of data in the effective associated cache log is sorted according to the order of data generation time.
[0101] (2) The latest valid association time and space validity judgment algorithm includes: calculating the time and space dispersion of the association data to be analyzed and the data in the latest valid association log, and judging whether the association data to be analyzed is valid according to the time and space dispersion calculation result.
[0102] (3) The recent associative cache time and space validity judgment algorithm includes:
[0103] S201: Determine whether the associated data to be analyzed is the first data in the most recently associated cache log. If so, calculate the time difference between the associated data to be analyzed and the last data in the most recently associated cache log, and enter S202; otherwise, calculate the time difference between the associated data to be analyzed and the first data in the most recently associated cache log, and enter S202;
[0104] S202: Determine whether the absolute value of the time difference calculated in step S201 is greater than or equal to a second time difference threshold. If so, determine that the associated data to be analyzed is valid; otherwise, proceed to S203;
[0105] S203: traverse each data in the most recently associated cache log in sequence, and calculate the spatial difference between the associated data to be analyzed and the data in the most recently associated cache log;
[0106] S204: Determine whether the absolute value of the spatial difference calculated in step S203 is greater than or equal to the second spatial difference threshold. If so, determine that the associated data to be analyzed is valid; otherwise, proceed to S205;
[0107] S205: Determine whether the data in the most recently associated cache log has been traversed. If yes, end; otherwise, return to step S204 to calculate the space difference between the associated data to be analyzed and the next data.
[0108] (4) The process of calculating the spatiotemporal discreteness is:
[0109] S301: Determine whether the absolute value of the time difference between the associated data to be analyzed and the data in the valid associated cache log is greater than or equal to a second time difference threshold. If so, determine that the associated data to be analyzed is valid; otherwise, proceed to S302;
[0110] S302: Determine whether the absolute value of the space difference between the associated data to be analyzed and the data in the valid associated cache log is greater than or equal to a second space difference threshold; if so, determine that the associated data to be analyzed is valid; otherwise, determine that the associated data to be analyzed is invalid.
[0111] Those skilled in the art can set the values of the second time difference threshold and the second space difference threshold as needed, which are not limited here.
[0112] The embodiment of the present invention performs spatiotemporal gridding on the data, and performs spatiotemporal association and effective association judgment based on the gridding. On the premise of being able to effectively mine reliable association information, it also reduces a large number of redundant basic collection logs and redundant association information storage, improves the efficiency of association analysis, and further refines the value of information. It is real-time and iterative, and it iterates and feeds back the latest mined reliable association information in real time, providing users with the latest clues in a timely manner, so that they can quickly track the latest multi-dimensional trends of the target.
[0113] The embodiments of the present invention can mine and iteratively update more valuable related information in real time at low storage cost and low computing cost. It can be applied to fields such as security to discover trajectories and track targets through mining related information.
[0114] Embodiment 2:
[0115] The present invention also provides an association mining terminal device based on a spatiotemporal network, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above-mentioned method embodiment of the first embodiment of the present invention when executing the computer program.
[0116] Further, as an executable solution, the spatiotemporal network-based association mining terminal device can be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The spatiotemporal network-based association mining terminal device can include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the composition structure of the spatiotemporal network-based association mining terminal device is only an example of a spatiotemporal network-based association mining terminal device, and does not constitute a limitation on the spatiotemporal network-based association mining terminal device. It can include more or less components than the above, or combine certain components, or different components. For example, the spatiotemporal network-based association mining terminal device can also include input and output devices, network access devices, buses, etc., and the embodiments of the present invention do not limit this.
[0117] Further, as an executable solution, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the spatiotemporal network-based association mining terminal device, and uses various interfaces and lines to connect the various parts of the entire spatiotemporal network-based association mining terminal device.
[0118] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the spatiotemporal network-based association mining terminal device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required for a function; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0119] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method in the embodiment of the present invention are implemented.
[0120] If the module / unit integrated in the terminal device for associative mining based on the spatiotemporal network is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory) and software distribution medium, etc.
[0121] Although the present invention has been specifically shown and described in conjunction with the preferred embodiments, it should be understood by those skilled in the art that various changes may be made to the present invention in form and details without departing from the spirit and scope of the present invention as defined by the appended claims, all of which are within the scope of protection of the present invention.
Claims
1. A method for association mining based on spatiotemporal networks, characterized in that: The following steps are involved: S1: Collect data for association analysis, convert the data into space-time grid codes, and store them in a hash table structure; the content corresponding to the keyword field in the hash table is the concatenation of the data type and the space-time grid code; the space-time grid code is specifically: timeSlot|longitudeSlot|latitudeSlot, where "|" represents a separator, timeSlot represents a time slot, longitudeSlot represents a longitude slot, and latitudeSlot represents a latitude slot. The calculation formulas are: timeSlot=(timestamp–timestamp%timeSlotSize) / timeSlotSize longitudeSlot=(longitude–longitude%longitudeSlotSize) / longitudeSlotSize latitudeSlot=(latitude–latitude%latitudeSlotSize) / latitudeSlotSize longitude=int(longitude*100000) latitude=int(latitude*100000) Among them, timestamp represents the timestamp, timeSlotSize represents the timestamp unit, longitude represents the longitude value, latitude represents the latitude value, longitudeSlotSize represents the longitude slot unit, latitudeSlotSize represents the latitude slot unit, and int(.) represents rounding; S2: When the data to be analyzed with the correlation to be analyzed is received, the related data is searched from the hash table according to the data type, timestamp, longitude and latitude of the data to be analyzed; specifically, the following steps are included: S21: Determine the data type of the data to be searched according to the data type of the data to be analyzed; S22: determining the time information in the space-time grid code of the data to be searched according to the timestamp of the data to be analyzed; S23: Determine the longitude and latitude information in the spatiotemporal grid code of the data to be searched according to the longitude and latitude of the data to be analyzed; S24: according to the data type and spatiotemporal grid code of the data to be searched, the content of the keyword field of the data to be searched in the hash table is obtained, and then according to the content of the keyword field, the data of the corresponding value field is searched from the hash table as the associated data; S3: Perform validity judgment on all the found related data to obtain valid related data of the data to be analyzed; the related data to be judged for validity is used as the related data to be analyzed, and the specific process of judging the validity of each related data to be analyzed includes the following steps: S101: Determine whether there is any associated data to be analyzed in the effective associated cache log of Redis. If yes, perform validity judgment on the associated data to be analyzed according to the effective associated cache time and space validity judgment algorithm; otherwise, proceed to S102; S102: Determine whether there is any association data to be analyzed in the latest valid association log of Redis. If yes, perform validity judgment on the association data to be analyzed according to the latest valid association spatiotemporal validity judgment algorithm; otherwise, proceed to S103; S103: Determine whether there is any association data to be analyzed in the recent association cache log of Redis. If yes, perform validity judgment on the association data to be analyzed according to the recent association cache time and space validity judgment algorithm; otherwise, proceed to S104; S104: writing the association to be analyzed into the most recent association cache log, writing the valid association to be analyzed into the valid association cache log, and updating the most recent valid association log with the valid association to be analyzed; The effective associative cache time and space validity judgment algorithm includes: When the associated data to be analyzed is the first data in the valid associated cache log, the temporal and spatial dispersion calculation is performed on the associated data to be analyzed and the next data in the valid associated cache log, and whether the associated data to be analyzed is valid is determined according to the temporal and spatial dispersion calculation result; When the associated data to be analyzed is the last piece of data in the valid associated cache log, the temporal and spatial dispersion calculation is performed on the associated data to be analyzed and the previous piece of data in the valid associated cache log, and whether the associated data to be analyzed is valid is determined according to the temporal and spatial dispersion calculation result; When the associated data to be analyzed is data other than the first and last data in the valid associated cache log, firstly, the associated data to be analyzed and the previous data in the valid associated cache log are calculated for time and space dispersion, and whether the associated data to be analyzed is valid is determined according to the result of the time and space dispersion calculation; if it is determined to be valid, the associated data to be analyzed and the next data in the valid associated cache log are calculated for time and space dispersion, and whether the associated data to be analyzed is valid is determined according to the result of the time and space dispersion calculation; The latest valid association time and space validity judgment algorithm includes: calculating the time and space dispersion of the association data to be analyzed and the data in the latest valid association log, and judging whether the association data to be analyzed is valid according to the time and space dispersion calculation result; The most recent associated cache time and space validity judgment algorithm includes: S201: Determine whether the associated data to be analyzed is the first data in the most recently associated cache log. If so, calculate the time difference between the associated data to be analyzed and the last data in the most recently associated cache log, and enter S202; otherwise, calculate the time difference between the associated data to be analyzed and the first data in the most recently associated cache log, and enter S202; S202: Determine whether the absolute value of the time difference calculated in step S201 is greater than or equal to a second time difference threshold. If so, determine that the associated data to be analyzed is valid; otherwise, proceed to S203; S203: traverse each data in the most recently associated cache log in sequence, and calculate the spatial difference between the associated data to be analyzed and the data in the most recently associated cache log; S204: Determine whether the absolute value of the spatial difference calculated in step S203 is greater than or equal to the second spatial difference threshold. If so, determine that the associated data to be analyzed is valid; otherwise, proceed to S205; S205: Determine whether the data in the most recently associated cache log has been traversed. If yes, end; otherwise, return to step S204 to calculate the spatial difference between the associated data to be analyzed and the next data; The process of calculating time-space discreteness is: S301: Determine whether the absolute value of the time difference between the associated data to be analyzed and the data in the valid associated cache log is greater than or equal to a second time difference threshold. If so, determine that the associated data to be analyzed is valid; otherwise, proceed to S302; S302: Determine whether the absolute value of the space difference between the associated data to be analyzed and the data in the valid associated cache log is greater than or equal to a second space difference threshold; if so, determine that the associated data to be analyzed is valid; otherwise, determine that the associated data to be analyzed is invalid.
2. The association mining method based on spatiotemporal network according to claim 1, characterized in that: The method for determining the time information in the space-time grid code of the data to be searched according to the timestamp of the data to be analyzed in step S22 is: determine the corresponding time slot according to the timestamp of the data to be analyzed, and use the time slot and the time slots before and after it as the time information in the space-time grid code of the data to be searched.
3. The association mining method based on spatiotemporal network according to claim 1, characterized in that: The longitude and latitude information in the spatiotemporal grid code of the data to be searched in step S23 is: the longitude and latitude information corresponding to 9 grid locations centered on the grid location corresponding to the longitude and latitude of the data to be analyzed.
4. The association mining method based on spatiotemporal network according to claim 1, characterized in that: Step S24 also includes: first, sorting all data found in the hash table in order of time difference, and extracting all data whose time difference is less than a first time difference threshold; then sorting all remaining data in order of space difference, and extracting all data whose space difference is less than a first space difference threshold; and treating all extracted data as associated data.
5. A terminal device for association mining based on spatiotemporal network, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 4 when executing the computer program.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Time-space relationship analysis system based on multi-source Internet-of-things location sensing
CN106844585A
Space-time accompanying object mining method based on Geohash
CN110334171A
Geohash matching-based vehicle code fitting method and system
CN110888884A
Efficient spatial nearest neighbor query method for highway networks
CN103559213A
Spatio-temporal trajectory indexing and retrieving method oriented to periodic retrieving
CN108920499A
