Space-time behavior data compression method, device and equipment and readable storage medium
Patent Information
- Application Number
- CN202311667512.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2026-09-29
- Estimated Expiration
- 2043-12-06
AI Technical Summary
[0004]本发明的主要目的在于提供一种时空行为数据压缩方法、装置、设备及可读存储介质,旨在解决时空行为数据信息的原始结构改变的技术问题
[0045]在本申请提供的一个技术方案中,在数据压缩阶段,按预先定义的时间、空间粒度,首先将一天24小时从最小时间粒度开始,以二进制形式划分为多个时间段,然后对用户时空行为进行汇总计算,映射为对应空间粒度、时间段的用户位图组,其中,每个空间粒度,每个时间段对应一个位图,表示所有用户在该空间粒度、该时间段的位置停留情况,多个时间段的位图组合为时间位图组,从而实现以较少的存储空间保存用户的时空行为特征。本申请无需对原始数据进行裁剪或保留,故不会改变原有结构,而且方式简便,即便是面对大规模数据,也不会影响处理效率。
Smart Images

Figure CN117473126B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of big data technology, and in particular to a method, apparatus, device, and readable storage medium for compressing spatiotemporal behavioral data. Background Technology
[0002] User spatiotemporal behavioral data refers to user behavior data at different times and locations. With the popularization of mobile devices and the widespread application of the Global Positioning System (GPS), the scale and complexity of user spatiotemporal behavioral data are gradually increasing, making efficient compression a significant challenge.
[0003] In related technologies, lossless compression algorithms are used to compress original data while preserving its precise information. For example, the Douglas-Peucker algorithm and line segment fitting algorithms are used to compress data by identifying and retaining important trajectory points or approximating trajectories using line segments. However, when using the Douglas-Peucker algorithm to compress data, it alters the original data structure by pruning or retaining continuous spatiotemporal coordinates. This may cause the original spatiotemporal behavioral data to lose its original structural characteristics, making it difficult to perform rapid indexing and analysis. Summary of the Invention
[0004] The main objective of this invention is to provide a method, apparatus, device, and readable storage medium for compressing spatiotemporal behavioral data, aiming to solve the technical problem of altering the original structure of spatiotemporal behavioral data information.
[0005] To achieve the above objectives, the present invention provides a spatiotemporal behavior data compression method, which includes the following steps:
[0006] Based on the user's original spatiotemporal behavior data, determine the user's dwell time information at each location spatial granularity;
[0007] Based on the dwell time information corresponding to the spatial granularity of the location, a time period bitmap group is generated;
[0008] Based on the time period bitmap group, compressed data corresponding to the original spatiotemporal behavior data is generated.
[0009] Optionally, the dwell time information includes dwell duration, and the step of determining the user's dwell time information at each location spatial granularity based on the user's original spatiotemporal behavior data includes:
[0010] Based on the original spatiotemporal behavior data, determine the current user's dwell time within a day and at the spatial granularity of location.
[0011] The step of generating a time-segment bitmap group based on the dwell time information corresponding to the location spatial granularity includes:
[0012] Based on the dwell time and the location spatial granularity, a time period bitmap number is generated, and the time period bitmap number represents the existence of spatiotemporal behavioral data corresponding to each time period bitmap.
[0013] The time-period bitmap numbers for all users on all dates are aggregated to obtain the time-period bitmap group.
[0014] Optionally, the step of generating a time-segment bitmap number based on the dwell time and the spatial granularity of the location includes:
[0015] Based on the rounding function results corresponding to the number of minutes in the time period and the number of minutes in the time granularity within the day, the bitmap number of the time period to be updated is obtained;
[0016] When the dwell time is greater than or equal to the time granularity, the time period bitmap number is updated according to the binary function result corresponding to the number of minutes of the dwell time and the number of minutes of the time granularity;
[0017] When the dwell time is less than the time granularity but greater than zero, the first digit of the time period bitmap number is updated;
[0018] When the dwell time is zero, the bitmap number of the time period is not updated.
[0019] Optionally, after the step of generating compressed data corresponding to the original spatiotemporal behavioral data based on the time-segment bitmap group, the method further includes:
[0020] Obtain several bitmap groups to be merged, and pre-generate the merged result bitmap to be updated;
[0021] Starting from the first digit of the time period bitmap number, perform binary addition on the merged result bitmap and the bitmap group to be merged, and take the result of the user bit of the time period bitmap number, traversing to the last bit of the time period bitmap number;
[0022] The merged result bitmap is updated based on the results of the user bits.
[0023] Optionally, the step of performing binary addition on the merged bitmap and the bitmap group to be merged, starting from the first digit of the time period bitmap number, and taking the result of the user bit of the time period bitmap number, and traversing to the last digit of the time period bitmap number includes:
[0024] Starting from the first digit of the time period bitmap number, perform a binary AND operation on the current bit of the merged result bitmap and the bitmap group to be merged, perform a binary addition operation on the current bit of the merged result bitmap and the bitmap group to be merged, and take the result of the user bit of the time period bitmap number, and update the merged result bitmap according to the result of the user bit.
[0025] If the result of the binary AND operation is not all zeros, then switch to the next bit of the time period bitmap number and jump to execute the step of performing a binary AND operation on the current bit of the merged result bitmap and the bitmap group to be merged.
[0026] Optionally, after the step of generating compressed data corresponding to the original spatiotemporal behavioral data based on the time-segment bitmap group, the method further includes:
[0027] Get the bitmap group to be filtered, minimum dwell time and maximum dwell time, and pre-generate the bitmap of the filtered results to be updated;
[0028] Based on the rounding function results corresponding to the minimum and maximum dwell times in minutes, the minimum step size and the maximum step size are obtained.
[0029] Based on the binary function results corresponding to the minimum step size and the maximum step size, generate the corresponding binary number of the filtering conditions, and initialize the bitmap of the filtering conditions corresponding to the binary number of the filtering conditions;
[0030] Starting from the first bit of the filtered binary number, if the value of the current bit is 1, then a binary AND operation is performed on the filtered condition bitmap and the bitmap group to be filtered.
[0031] If the value of the current bit is not 1, then switch to the next bit of the filtered binary number and execute the step of performing a binary AND operation on the filtered condition bitmap and the bitmap group to be filtered if the value of the current bit is 1.
[0032] Perform a binary OR operation between the filtered condition bitmap and the filtered result bitmap after traversal, and update the filtered result bitmap according to the result of the OR operation.
[0033] Filter out user IDs with a value of 1 from the updated filter result bitmap, and generate a set of user IDs that meet the filter criteria.
[0034] Optionally, after the step of generating compressed data corresponding to the original spatiotemporal behavioral data based on the time-segment bitmap group, the method further includes:
[0035] Obtain the spatial granularity of several target locations contained in the selected region, and pre-generate a bitmap of analysis results to be updated;
[0036] From the time period bitmap group, filter out the target time period bitmap group that is associated with the spatial granularity of the target location;
[0037] The target time period bitmaps in the target time period bitmap group are traversed sequentially. The duration of the target time period bitmap is added in binary. The result of the user bit of the time period bitmap number is obtained. The analysis result bitmap is updated according to the result of the user bit.
[0038] From the updated analysis result bitmap, user IDs with a value of 1 are selected and aggregated to generate a set of user IDs that meet the analysis criteria.
[0039] Furthermore, to achieve the above objectives, the present invention also provides a spatiotemporal behavioral data compression device, the device comprising:
[0040] The determination module is used to determine the user's dwell time information at each location spatial granularity based on the user's original spatiotemporal behavior data;
[0041] The time-segment bitmap group generation module is used to generate a time-segment bitmap group based on the dwell time information corresponding to the spatial granularity of the location.
[0042] The compressed data generation module is used to generate compressed data corresponding to the original spatiotemporal behavior data based on the time period bitmap group.
[0043] In addition, to achieve the above objectives, the present invention also provides a spatiotemporal behavior data compression device, the spatiotemporal behavior data compression device comprising: a memory, a processor, and a spatiotemporal behavior data compression program stored in the memory and executable on the processor, the spatiotemporal behavior data compression program being configured to implement the steps of the spatiotemporal behavior data compression method described above.
[0044] In addition, to achieve the above objectives, the present invention also provides a readable storage medium storing a spatiotemporal behavior data compression program, which, when executed by a processor, implements the steps of the spatiotemporal behavior data compression method.
[0045] In one technical solution provided in this application, during the data compression stage, the 24 hours of a day are first divided into multiple time periods in binary form, starting from the smallest time granularity, according to predefined time and spatial granularity. Then, user spatiotemporal behavior is summarized and calculated, mapped to user bitmap groups corresponding to the spatial granularity and time period. Each spatial granularity and each time period corresponds to a bitmap, representing the location and dwell time of all users within that spatial granularity and time period. Bitmaps from multiple time periods are combined into a time bitmap group, thereby achieving the storage of user spatiotemporal behavior characteristics with less storage space. This application does not require pruning or retaining the original data, so it does not change the original structure, and the method is simple, without affecting processing efficiency even when dealing with large-scale data. Attached Figure Description
[0046] Figure 1 This is a flowchart illustrating the first embodiment of the spatiotemporal behavior data compression method of the present invention;
[0047] Figure 2 This is a detailed flowchart of steps S11 and S12 in the first embodiment of the spatiotemporal behavior data compression method of the present invention;
[0048] Figure 3 This is a schematic diagram of a time period bitmap group in the first embodiment of the spatiotemporal behavior data compression method of the present invention;
[0049] Figure 4 This is a flowchart illustrating the second embodiment of the spatiotemporal behavior data compression method of the present invention;
[0050] Figure 5 This is a schematic diagram of the calculation process in the second embodiment of the spatiotemporal behavior data compression method of the present invention;
[0051] Figure 6 This is a flowchart illustrating the third embodiment of the spatiotemporal behavior data compression method of the present invention;
[0052] Figure 7 This is a schematic diagram of the calculation process in the third embodiment of the spatiotemporal behavior data compression method of the present invention;
[0053] Figure 8 This is a flowchart illustrating the fourth embodiment of the spatiotemporal behavior data compression method of the present invention;
[0054] Figure 9 This is a schematic diagram of the spatiotemporal behavior data compression device for the hardware operating environment involved in the embodiments of the present invention.
[0055] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0056] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0057] Based on lossless compression algorithms, the original data is compressed while retaining its precise information. For example, the Douglas-Peucker algorithm and line segment fitting algorithm are used to achieve compression by identifying and retaining important trajectory points or using line segments to approximate the trajectory.
[0058] However, when using the Douglas-Peucker algorithm to compress data, it changes the original structure of the data by pruning or retaining continuous spatiotemporal coordinates. This may cause the original spatiotemporal behavioral data to lose its original structural features, making it difficult to index and analyze quickly.
[0059] Furthermore, due to the high complexity of the Douglas-Peucker algorithm, processing large-scale spatiotemporal behavioral data increases computational complexity, thus impacting the efficiency of fast indexing and analysis.
[0060] This application proposes a spatiotemporal behavior data compression method. Based on temporal and location-space granularity, the original spatiotemporal behavior data of users is divided, and then the data is aggregated to generate corresponding compressed data. This application does not require pruning or preservation of the original data, so it does not change the original structure. Moreover, the method is simple and does not affect the processing efficiency even when dealing with large-scale data.
[0061] To better understand the above technical solutions, exemplary embodiments of this application will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.
[0062] This invention provides a method for compressing spatiotemporal behavioral data, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of a spatiotemporal behavioral data compression method according to the present invention.
[0063] In this embodiment, the spatiotemporal behavior data compression method includes:
[0064] Step S11: Based on the user's original spatiotemporal behavior data, determine the user's dwell time information at each location spatial granularity;
[0065] Assume a user set US, a user count UN, and each user has a unique ID i.
[0066]
[0067] The spatial granularity of the analysis (Space-Grid-based Analysis, SGRA) refers to the minimum spatial size of the analysis, not limited to a fixed-size grid or region. SGRA is also the minimum user location granularity that the device can analyze; therefore, any region... r Can
[0068] Set the time granularity of user dwell time in the device analysis (Space-Time Grid-based Analysis, ST_GRA), which is the minimum time for device analysis. For example, if a 5-minute time granularity is defined, user behavior that stays in a certain space for less than 5 minutes can be rounded up or down to 5 minutes.
[0069] A day-time slot (DT_SLOT) is the period of time that the device needs to analyze. A 24-hour day can be considered as a set of T day-time slots (DT_SLOT). For example, if DT_SLOT is set to 1 hour, then a day can be considered as a set of 24 DT_SLOT, i.e., T = 24.
[0070] Time periods TS on different dates d d ={DT_SLOT d,1 ,DT_SLOT d,2 ,…,DT_SLOT d,T},Right now
[0071] minuteF(TS d )
[0072] =minuteF(DT_SLOT1)+minuteF(DT_SLOT2)+…
[0073] +minuteF(DT_SLOT T ) = 24 * 60 (H)
[0074] The above `minuteF` represents the function to retrieve the number of minutes in a time period `DT_SLOT` within a day. Each `minuteF(DT_SLOT)` function... T They are not necessarily equal.
[0075] Let BIN_SLOT be the binary bits corresponding to the smallest granular time period to be analyzed by the system. For each DT_SLOT, it can be regarded as consisting of K time slots (Space-Time Slot, GRA_SLOT) with the same time interval.
[0076]
[0077] Among them, K t The number of GRA_SLOTs is represented by ceilF, which is the rounding function, and minuteF is the function for minutes.
[0078] For example, if DT_SLOT is set to 1 hour and ST_GRA is set to 1 minute, then a DT_SLOT can be regarded as a set of 7 GRA_SLOTs with the same time interval, i.e., K=7.
[0079] It is understandable that raw spatiotemporal behavior data of users refers to all spatiotemporal behaviors of users at various times, without processing; dwell time information refers to the dwell time, dwell start time, dwell end time, etc. of a specific user within a specific time period and at a specific spatial granularity.
[0080] Alternatively, machine learning and deep learning methods can be used to build models to predict the duration of a user's stay at each location. These models can be trained using historical user behavior data.
[0081] Or, refer to Figure 2 Step S11 includes:
[0082] Step S111: Based on the original spatiotemporal behavior data, determine the current user's dwell time within a day and at the location spatial granularity.
[0083] Understandably, based on the relationship between the user's original spatiotemporal data, user location identifier (loc), and SGRA, the duration of the user's stay at each location spatial granularity SGRA can be aggregated to generate time-segment bitmap group data.
[0084] Optionally, a time period within a day, DT_SLOT t Corresponding generation K t Each user bitmap is selected from the raw spatiotemporal behavioral data to identify each user. i In DT_SLOT t During the time period, location SGRA j Duration of stay (ST) t,j,i .
[0085] Unlike machine learning and deep learning methods, this solution uses actual user behavior data for calculations directly, without relying on the prediction results of black-box models. This not only provides greater transparency but also enables real-time calculation of user dwell time, eliminating the need to wait for model training and inference processes. Therefore, it is more suitable for application scenarios that require real-time responses.
[0086] Step S12: Generate a time period bitmap group based on the dwell time information corresponding to the spatial granularity of the location;
[0087] Understandably, time-segment bitmap groups are used to represent the activity or events occurring at a specific location within different time periods. A time-segment bitmap group typically consists of multiple bitmaps, each representing a specific time period. In each bitmap, the pixels and cells at a location indicate whether activity occurred at that location within the corresponding time period, such as user dwell time or movement trajectory.
[0088] Optionally, the day can be divided into multiple time periods, such as morning, forenoon, afternoon, and evening, or even more finely divided. Then, based on the previously calculated location spatial granularity dwell time information, the dwell time data for each location in each time period can be obtained.
[0089] Furthermore, a bitmap is defined to correspond to each time period, and each pixel in the bitmap represents whether a user stayed at that location during that time period. For each location, a time period bitmap group is generated based on the time spent at that location in different time periods, that is, the bitmaps of each time period are combined together to form a set of data.
[0090] Alternatively, define multiple bitmaps corresponding to each time period, as shown in the reference. Figure 2 Step S12 includes:
[0091] Step S121: Generate a time period bitmap number based on the dwell time and the location spatial granularity. The time period bitmap number represents the existence of spatiotemporal behavioral data corresponding to each time period bitmap.
[0092] Step S122: Summarize the bitmap numbers of all users on all dates to obtain the bitmap group for each time period.
[0093] In this solution, a day is divided into multiple time periods, and each time period corresponds to multiple bitmap groups with spatial granularity. Furthermore, each bitmap group contains multiple bitmaps, and each bitmap contains information about the user's dwell time within each time period at the time granularity level.
[0094] Optionally, the time period bitmap number is calculated according to the following formula, wherein the time period bitmap number represents the existence of spatiotemporal behavioral data corresponding to each time period bitmap.
[0095]
[0096] Among them, bin t,j,i For each time period, the bitmap number is used. Indicates the Kth t Each user bitmap, binaryF is the decimal to binary conversion function, minuteF represents the minute quantity function, ST t,j,i ST_GRA represents the dwell time and the spatial granularity of the location.
[0097] Repeat the above steps to obtain the binaries of all users. t,j,i .
[0098] Furthermore, an index is built based on d, t, and j to generate date d and time period DT_SLOT. t Location SGRA j The corresponding bitmap group umaps d,t,j
[0099]
[0100] This completes the aggregation of all users' time-period bitmap numbers across all dates, resulting in a time-period bitmap group.
[0101] As shown above, a bitmap group consists of individual user bitmaps (umap), representing user bitmaps that satisfy the dwell time requirement. For example, if ST_GRA is set to 1 minute and k=7, it represents a bitmap of users whose dwell time behavior is represented by a 7-bit binary number, preserving the user dwell time characteristics of ST_GRA (temporal granularity) and SGRA (locational spatial granularity). The specific form is as follows... Figure 3 As shown.
[0102] Additionally, step S121 may include:
[0103] Step A: Based on the rounding function results corresponding to the number of minutes in the time period and the number of minutes in the time granularity within the day, obtain the bitmap number of the time period to be updated;
[0104] It is understandable that the number of digits in the time-segment bitmap number is the same as the number of GRA_SLOTs. Therefore, the number of digits in the time-segment bitmap number can be calculated using the following formula:
[0105]
[0106] Among them, K t The number of GRA_SLOTs is represented by ceilF, which is the rounding function, and minuteF is the function for minutes.
[0107] Furthermore, according to K t Generate bitmap numbers for the time periods to be updated, 0, 0, ..., 0.
[0108] Step B: when the stay duration is greater than or equal to the time granularity, updating the time period bitmap number according to the minute value of the stay duration and the binary function result corresponding to the minute value of the time granularity;
[0109] Step C: when the stay duration is less than the time granularity and greater than zero, updating the first bit of the time period bitmap number;
[0110] Step D: when the stay duration is equal to zero, not updating the time period bitmap number.
[0111] Optionally, whether to update the time period bitmap number is determined according to the following formula:
[0112]
[0113]
[0114] ST t,j,i ≥ST_GRA, calculating directly according to the binary function, and updating the time period bitmap number according to the calculation result;
[0115] 0<ST t,j,i <ST_GRA, updating the first bit of the time period bitmap number;
[0116] ST t,j,i =0, no update is performed on the time period bitmap number.
[0117] Calculating the time period bitmap number in three cases can effectively distinguish the user's behavioral data at the time level, especially for the situation where the stay duration is less than the time granularity and greater than zero, it can effectively record the user's short-time stay behavior, making the overall data more complete.
[0118] In the present solution, a plurality of bitmaps corresponding to each time period can provide finer time resolution, allow more flexible time division, and can more accurately capture the user's behavior changes and stay durations. Moreover, a plurality of bitmaps can provide better spatial resolution, allow finer analysis of the user's stay durations at different positions, and better capture the user's stay situations at different locations.
[0119] Step S13: generating compressed data corresponding to the original spatiotemporal behavior data according to the time period bitmap group.
[0120] Optionally, the time period bitmap group represents the occurrence of activities or events at a specific position in different time periods, therefore, the compressed data corresponding to the original spatiotemporal behavior data can be directly generated according to the time period bitmap group.
[0121] In one technical solution provided in this embodiment, during the data compression stage, according to predefined time and spatial granularity, a 24-hour day is first divided into multiple time periods in binary form, starting from the smallest time granularity. Then, user spatiotemporal behavior is summarized and calculated, mapped to user bitmap groups corresponding to the spatial granularity and time period. Each spatial granularity and each time period corresponds to a bitmap, representing the location and dwell time of all users within that spatial granularity and time period. Bitmaps from multiple time periods are combined into a time bitmap group, thereby achieving the goal of saving user spatiotemporal behavior characteristics with less storage space. This application does not require pruning or retaining the original data, so it does not change the original structure, and the method is simple, without affecting processing efficiency even when dealing with large-scale data.
[0122] Furthermore, refer to Figure 4 A second embodiment of the spatiotemporal behavior data compression method of the present invention is proposed. Based on the above... Figure 1 In the illustrated embodiment, after the step of generating compressed data corresponding to the original spatiotemporal behavioral data based on the time-segment bitmap group, the method includes:
[0123] Step S21: Obtain several bitmap groups to be merged, and pre-generate the merged result bitmap to be updated;
[0124] Step S22: Starting from the first digit of the time period bitmap number, perform binary addition on the merged result bitmap and the bitmap group to be merged, and take the result of the user bit of the time period bitmap number, traversing to the last bit of the time period bitmap number;
[0125] Step S23: Update the merged result bitmap based on the result of the user bit.
[0126] It is understandable that each bitmap group compresses user spatiotemporal behavior data at the spatial location and time period granularities defined by the device, preserving the dwell time information of each user at that location and time period granularities. In some analysis scenarios, we need to analyze users over a larger area or time range, therefore, we need to define a bitmap combination and merging algorithm to merge bitmaps at different granularities.
[0127] This solution uses two bitmap groups to be merged as an example for illustration.
[0128] The bitmap merging algorithm is defined as mPlusF(umaps1,umaps2), where umaps1 and umaps2 are two bitmap groups that need to be merged and added. The bitmap merging algorithm mPlusF(umaps1,umaps2) merges umaps1 and umaps2 and outputs the resulting bitmap rmaps.
[0129] Get two bitmap groups to be merged:
[0130]
[0131]
[0132] The algorithm has the following steps:
[0133] Step 1: Pre-generate the bitmaps (rmaps) of the merged results to be updated:
[0134]
[0135] Step 2: Set k to the number of bits in the time period bitmap number. Initially, k = 1. Starting from the first digit of the time period bitmap number, perform binary addition on the merged bitmap and the bitmap group to be merged, and take the result of the user bits of the time period bitmap number. Based on k, perform binary addition from 1 to K. t Traversal, that is, traversing to the last bitmap number of the time period, continuously updates rmaps through this process, generating the final bitmap rmaps after combining the bitmaps.
[0136] Step 2.1: When k=1, calculate umapAND. d,t,(r,j)
[0137] rmapAND k =binAndF(rmap) k ,umap k )
[0138] rmap k =binPlusF(rmap) k ,umap k )
[0139] above rmapAND k The binary AND operation is represented by binPlusF, which represents binary addition and the operation of taking the user bits.
[0140] Step 2.2: k = k + 1, rmap k+ki =binPlusF(rmap) k+ki ,rmapAND k )
[0141] It is important to note that before performing step 2.2, you can first determine whether the data is blank to reduce unnecessary calculations, as follows:
[0142] Step 2.1: Calculate umapAND d,t,(r,j)
[0143] rmapAND k =binAndF(rmap) k,umap k )
[0144] rmap k =binPlusF(rmap) k ,umap k )
[0145] The above binAndF represents binary AND operation, and binPlusF represents binary addition and UN bit removal operation.
[0146] Step 2.2: If rmapAND k If not all values are 0, then the initial value ki = 1, and the traversal is performed based on ki. Step 2.2.1: Calculate rmapAND. k+ki
[0147] rmapAND k+ki =binAndF(rmap) k+ki ,rmapAND k )
[0148] Configure rmap k+1 :
[0149] rmap k+ki =binPlusF(rmap) k+ki ,rmapAND k )
[0150] Step 2.2.2 If rmapAND k+ki If not all values are 0, continue with step 2.2 of the traversal.
[0151] The calculation process is as follows Figure 5 As shown.
[0152] In one technical solution provided in this embodiment, the merged bitmap is continuously updated by traversing from the first to the last bit of the time period bitmap number, generating the final merged bitmap. This setup enables the merging of bitmap groups across a larger geographical area and time range, supporting spatiotemporal analysis based on time and spatial granularity, thereby better understanding user behavior patterns and providing more valuable information for business decisions.
[0153] Furthermore, refer to Figure 6 A third embodiment of the spatiotemporal behavior data compression method of the present invention is proposed. Based on the above... Figure 1 In the illustrated embodiment, after the step of generating compressed data corresponding to the original spatiotemporal behavioral data based on the time-segment bitmap group, the method includes:
[0154] Step S31: Obtain the bitmap group to be filtered, the minimum dwell time and the maximum dwell time, and pre-generate the bitmap of the filtered results to be updated;
[0155] Understandably, when it is necessary to filter users within a certain spatial area who meet certain behavioral conditions, such as entering or leaving a certain area, or staying or residing in a certain area, the time bitmap group of all spatial granularities within the area is selected, and the user bitmap of the time bitmap group is calculated according to the residence time requirement, so as to quickly calculate and determine the users who meet the special behavioral conditions.
[0156] The algorithm for adding the duration of bitmap groups is defined as UI = timeSelectF(umaps, stayMin, stayMax), where UI is the set of user IDs that meet the duration filtering criteria, and umaps is the bitmap group to be filtered.
[0157] Optionally, obtain the umaps of the bitmap group to be filtered:
[0158]
[0159] Get the minimum stay time (stayMin) and the maximum stay time (stayMax) to filter users who meet the stay time range [stayMin, stayMax].
[0160] The algorithm steps are as follows:
[0161] Step 1 Initial Result User Bitmap rmap = 0,0,…,0
[0162] Step S32: Based on the rounding function results corresponding to the minimum dwell time in minutes and the maximum dwell time in minutes, obtain the minimum step size and the maximum step size;
[0163] Step 2: Determine the minimum and maximum step sizes to be calculated based on stayMin and stayMax, and let...
[0164]
[0165]
[0166] Where vmin is the minimum step size, vmax is the maximum step size, ceilF represents the round-up function, minuteF represents the minute function, stayMin is the minimum dwell time, stayMax is the maximum dwell time, and ST_GRA is the time granularity.
[0167] Step S33: Generate the corresponding filtering condition binary number based on the binary function results corresponding to the minimum step size and the maximum step size, and initialize the filtering condition bitmap corresponding to the filtering binary number;
[0168] Step 3: Iterate through v from vmin to vmax:
[0169] Step 3.1 Convert v to a binary number vbin, which is the binary number of the filtering criteria. Let v be the binary number of the filtering criteria. For a K t A binary number of bits. Values 0 or 1
[0170] Step 3.2 Initialize the filter condition bitmap vmap = 1, 1, ..., 1 corresponding to the filter binary number. vmap is an UN-bit binary number with all 1s. After traversal, vmap represents the bitmap of users who meet the current v stay duration.
[0171] Step S34: Starting from the first bit of the filtered binary number, if the value of the current bit is 1, then perform a binary AND operation on the filtered condition bitmap and the bitmap group to be filtered;
[0172] Step S35: If the value of the current bit is not 1, switch to the next bit of the filtered binary number and execute the step of performing a binary AND operation on the filtered condition bitmap and the bitmap group to be filtered if the value of the current bit is 1.
[0173] Step S36: Perform a binary OR operation between the filtered condition bitmap and the filtered result bitmap after the traversal is completed, and update the filtered result bitmap according to the OR operation result;
[0174] Step S37: Filter out user IDs with a value of 1 from the updated filter result bitmap, and summarize to generate a set of user IDs that meet the filter criteria.
[0175] Step 3.3 Initially k = 1, perform the process from 1 to K based on k. t Traversal
[0176] Step 3.3.1 If b v,k =1, then let vmap = binAndF(vmap, umap k )
[0177] Step 3.3.2 If b v,k If ≠1, then continue the loop.
[0178] Step 3.4 Let rmap = binOrF(rmap, vmap), and continue step 3 to iterate over v.
[0179] Step 4 filters the set UI of IDs i with rmap = 1. Then UI is the set of user IDs that meet the specified duration.
[0180] The calculation process is as follows Figure 7 As shown.
[0181] In one technical solution provided in this embodiment, a bitmap group is filtered based on the bitmap group to be filtered, the minimum dwell time, and the maximum dwell time. This allows bitmaps to be filtered according to specific conditions, resulting in more refined and demand-specific data results. This facilitates accurate analysis and understanding of data characteristics, helps in understanding user behavior patterns, and provides more valuable information for business decisions.
[0182] Furthermore, refer to Figure 8 A fourth embodiment of the spatiotemporal behavior data compression method of the present invention is proposed. Based on the above... Figure 1 In the illustrated embodiment, after the step of generating compressed data corresponding to the original spatiotemporal behavioral data based on the time-segment bitmap group, the method includes:
[0183] Step S41: Obtain the spatial granularity of several target locations contained in the selected region, and pre-generate the bitmap of analysis results to be updated;
[0184] Step S42: From the time period bitmap group, filter out the target time period bitmap group that is associated with the spatial granularity of the target location;
[0185] Step S43: Iterate through the target time period bitmaps in the target time period bitmap group, perform binary addition on the duration of the target time period bitmap, take the result of the user bit of the time period bitmap number, and update the analysis result bitmap according to the result of the user bit.
[0186] Step S43: Filter out user IDs with a value of 1 from the updated analysis result bitmap, and summarize them to generate a set of user IDs that meet the analysis conditions.
[0187] This solution uses residency behavior analysis as an example to analyze any region on any date d. r Any set of time periods SLOTs = {DT_SLOT} t ,DT_SLOT t+1 ,..,DT_SLOT t+TS For users whose stay time range is [stayMin, stayMax], the steps are as follows:
[0188] Step 1: Determine the selected region r Includes several target location spatial granularities (SGRA).
[0189] Region t ={SGRA r,1 SGRA r,2 ,…,SGRA r,RJ}
[0190] Step 2: Pre-generate the bitmap (rmap) of the analysis results to be updated.
[0191]
[0192] Step 3: Iterate through the target time period bitmaps in the target time period bitmap group, perform binary addition on the duration of the target time period bitmap, take the result of the user bit of the time period bitmap number, and update the analysis result bitmap according to the result of the user bit.
[0193] Specifically, it involves iterating through t and j to obtain the corresponding time-segment bitmap group umaps. d,t,j For user bitmaps within a bitmap group The calculation of bitmap group duration summation can be divided into two aspects:
[0194] Step 3.1 Initialize (r,j) = (r,1), traverse based on (r,j), and calculate the sum of bitmap group durations.
[0195] rmaps = mPlusF(rmaps, umaps) d,t,(r,j) )
[0196] Step 3.2 Initialize t=1, and iterate based on t, sequentially traversing DT_SLOT. t ,DT_SLOT t+1 ,..,DT_SLOT t+TS Perform bitmap group duration summation calculation:
[0197] rmaps = mPlusF(rmaps, umaps) d,t,(r,j) )
[0198] Step 4 calculates the user result set (UI) that meets the conditions.
[0199] UI=timeSelectF(rmaps,stayMin,stayMax)
[0200] above rmapAND k This indicates a binary AND operation, and timeSelectF indicates a time interval filtering operation.
[0201] In one technical solution provided in this embodiment, during the analysis phase, a user filtering algorithm for a specified duration is used through bitmap group data to support the retrieval of users with a specified dwell time from the bitmap group data, thereby realizing spatiotemporal analysis models such as dwell behavior analysis.
[0202] This invention provides a spatiotemporal behavioral data compression device, the device comprising:
[0203] The determination module is used to determine the user's dwell time information at each location spatial granularity based on the user's original spatiotemporal behavior data;
[0204] The time-segment bitmap group generation module is used to generate a time-segment bitmap group based on the dwell time information corresponding to the spatial granularity of the location.
[0205] The compressed data generation module is used to generate compressed data corresponding to the original spatiotemporal behavior data based on the time period bitmap group.
[0206] Since the embodiments of the apparatus section correspond to the embodiments of the method section, please refer to the description of the embodiments of the method section for the embodiments of the apparatus section, and they will not be repeated here.
[0207] Reference Figure 9 , Figure 9 This is a schematic diagram of the spatiotemporal behavior data compression device structure of the hardware operating environment involved in the embodiments of the present invention.
[0208] like Figure 9 As shown, the spatiotemporal behavior data compression device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.
[0209] Those skilled in the art will understand that Figure 9 The structure shown does not constitute a limitation on the spatiotemporal behavioral data compression device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0210] like Figure 9As shown, the memory 1005, which serves as a storage medium, may include an operating system, a data storage module, a network communication module, a user interface module, and a spatiotemporal behavior data compression program.
[0211] exist Figure 9 In the spatiotemporal behavior data compression device shown, the network interface 1004 is mainly used for data communication with other devices; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the spatiotemporal behavior data compression device of the present invention can be set in the spatiotemporal behavior data compression device, and the spatiotemporal behavior data compression device calls the spatiotemporal behavior data compression program stored in the memory 1005 through the processor 1001 and executes the spatiotemporal behavior data compression method provided in the embodiment of the present invention.
[0212] This invention provides a readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the above embodiments of the spatiotemporal behavior data compression method.
[0213] Since the embodiments of the readable storage medium portion correspond to the embodiments of the method portion, please refer to the description of the embodiments of the method portion for the embodiments of the readable storage medium portion, and will not be repeated here.
[0214] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0215] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0216] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0217] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for compressing spatiotemporal behavioral data, characterized in that, The spatiotemporal behavior data compression method includes the following steps: Based on the user's original spatiotemporal behavior data, determine the user's dwell time information at each location spatial granularity; Based on the dwell time information corresponding to the spatial granularity of the location, a time period bitmap group is generated; Based on the time period bitmap group, generate compressed data corresponding to the original spatiotemporal behavior data; Get the bitmap group to be filtered, minimum dwell time and maximum dwell time, and pre-generate the bitmap of the filtered results to be updated; Based on the rounding function results corresponding to the minimum and maximum dwell times in minutes, the minimum step size and the maximum step size are obtained. Based on the binary function results corresponding to the minimum step size and the maximum step size, generate the corresponding binary number of the filtering conditions, and initialize the bitmap of the filtering conditions corresponding to the binary number of the filtering conditions; Starting from the first bit of the filtered binary number, if the value of the current bit is 1, then a binary AND operation is performed on the filtered condition bitmap and the bitmap group to be filtered. If the value of the current bit is not 1, then switch to the next bit of the filtered binary number and execute the step of performing a binary AND operation on the filtered condition bitmap and the bitmap group to be filtered if the value of the current bit is 1. Perform a binary OR operation between the filtered condition bitmap and the filtered result bitmap after traversal, and update the filtered result bitmap according to the result of the OR operation. Filter out user IDs with a value of 1 from the updated filter result bitmap, and generate a set of user IDs that meet the filter criteria.
2. The spatiotemporal behavioral data compression method as described in claim 1, characterized in that, The dwell time information includes dwell duration. The step of determining the user's dwell time information at each location spatial granularity based on the user's original spatiotemporal behavior data includes: Based on the original spatiotemporal behavior data, determine the current user's dwell time within a day and at the spatial granularity of location. The step of generating a time-segment bitmap group based on the dwell time information corresponding to the location spatial granularity includes: Based on the dwell time and the location spatial granularity, a time period bitmap number is generated, and the time period bitmap number represents the existence of spatiotemporal behavioral data corresponding to each time period bitmap. The time-period bitmap numbers for all users on all dates are aggregated to obtain the time-period bitmap group.
3. The spatiotemporal behavioral data compression method as described in claim 2, characterized in that, The step of generating a time-segment bitmap number based on the dwell time and the spatial granularity of the location includes: Based on the rounding function results corresponding to the number of minutes in the time period and the number of minutes in the time granularity within the day, the bitmap number of the time period to be updated is obtained; When the dwell time is greater than or equal to the time granularity, the time period bitmap number is updated according to the binary function result corresponding to the number of minutes of the dwell time and the number of minutes of the time granularity; When the dwell time is less than the time granularity but greater than zero, the first digit of the time period bitmap number is updated; When the dwell time is zero, the bitmap number of the time period is not updated.
4. The spatiotemporal behavioral data compression method as described in claim 1, characterized in that, After the step of generating compressed data corresponding to the original spatiotemporal behavioral data based on the time period bitmap group, the following steps are included: Obtain several bitmap groups to be merged, and pre-generate the merged result bitmap to be updated; Starting from the first digit of the time period bitmap number, perform binary addition on the merged result bitmap and the bitmap group to be merged, and take the result of the user bit of the time period bitmap number, traversing to the last bit of the time period bitmap number; The merged result bitmap is updated based on the results of the user bits.
5. The spatiotemporal behavioral data compression method as described in claim 4, characterized in that, The step of performing binary addition on the merged bitmap and the bitmap group to be merged, starting from the first digit of the time period bitmap number, and taking the result of the user bit of the time period bitmap number, and traversing to the last digit of the time period bitmap number includes: Starting from the first digit of the time period bitmap number, perform a binary AND operation on the current bit of the merged result bitmap and the bitmap group to be merged, perform a binary addition operation on the current bit of the merged result bitmap and the bitmap group to be merged, and take the result of the user bit of the time period bitmap number, and update the merged result bitmap according to the result of the user bit. If the result of the binary AND operation is not all zeros, then switch to the next bit of the time period bitmap number and jump to execute the step of performing a binary AND operation on the current bit of the merged result bitmap and the bitmap group to be merged.
6. The spatiotemporal behavioral data compression method as described in claim 1, characterized in that, After the step of generating compressed data corresponding to the original spatiotemporal behavioral data based on the time period bitmap group, the following steps are included: Obtain the spatial granularity of several target locations contained in the selected region, and pre-generate a bitmap of analysis results to be updated; From the time period bitmap group, filter out the target time period bitmap group that is associated with the spatial granularity of the target location; The target time period bitmaps in the target time period bitmap group are traversed sequentially. The duration of the target time period bitmap is added in binary. The result of the user bit of the target time period bitmap number is obtained. The analysis result bitmap is updated according to the result of the user bit. From the updated analysis result bitmap, user IDs with a value of 1 are selected and aggregated to generate a set of user IDs that meet the analysis criteria.
7. A spatiotemporal behavioral data compression device, characterized in that, The device includes: The determination module is used to determine the user's dwell time information at each location spatial granularity based on the user's original spatiotemporal behavior data; The time-segment bitmap group generation module is used to generate a time-segment bitmap group based on the dwell time information corresponding to the spatial granularity of the location. The compressed data generation module is used to generate compressed data corresponding to the original spatiotemporal behavior data based on the time period bitmap group; obtain the bitmap group to be filtered, the minimum dwell time, and the maximum dwell time, and pre-generate the filtered result bitmap to be updated; obtain the minimum step size and the maximum step size based on the rounding function results corresponding to the minutes of the minimum dwell time and the minutes of the maximum dwell time; generate the corresponding filtering condition binary number based on the binary function results corresponding to the minimum step size and the maximum step size, and initialize the filtering condition bitmap corresponding to the filtering binary number; starting from the first digit of the filtering binary number, ... If the current bit value is 1, perform a binary AND operation on the filter condition bitmap and the bitmap group to be filtered; if the current bit value is not 1, switch to the next bit of the filter binary number and execute the step of performing a binary AND operation on the filter condition bitmap and the bitmap group to be filtered if the current bit value is 1; perform a binary OR operation on the filter condition bitmap and the filter result bitmap after traversal, and update the filter result bitmap according to the OR operation result; filter out user IDs with a value of 1 from the updated filter result bitmap, and summarize to generate a set of user IDs that meet the filter conditions.
8. A spatiotemporal behavioral data compression device, characterized in that, The spatiotemporal behavior data compression device includes: a memory, a processor, and a spatiotemporal behavior data compression program stored in the memory and executable on the processor, the spatiotemporal behavior data compression program being configured to implement the steps of the spatiotemporal behavior data compression method as described in any one of claims 1 to 6.
9. A readable storage medium, characterized in that, The readable storage medium stores a spatiotemporal behavior data compression program, which, when executed by a processor, implements the steps of the spatiotemporal behavior data compression method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Space migration information processing method, system and device
CN114328443A