Bitmap-based user behavior statistics method, device, equipment and medium
By adopting the Bitmap method in user behavior data statistics, using slice period storage and deduplication processing to generate the target user behavior bitmap, the problems of large computing resource consumption and low efficiency in the existing technology are solved, and efficient user behavior data statistics are achieved.
Patent Information
- Application Number
- CN202210492900.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-07
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-05-07
AI Technical Summary
The existing technology consumes a lot of computing resources and has low efficiency in user behavior data statistics, especially when the cycle changes, resources are tight, resulting in low statistical efficiency.
A Bitmap-based method is used to store user behavior data in a distributed file system through slicing cycles, and then store it in the partition table of the data warehouse tool Hive. Deduplication processing and full association are performed to generate the target user behavior bitmap, and data is extracted from the bitmap based on statistical requests.
It improves the statistical efficiency of user behavior data, saves storage space and computing resources, reduces the amount of data calculation, and realizes fast and convenient statistical analysis.
Smart Images

Figure CN114791914B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a method, device, equipment and medium for user behavior statistics based on Bitmap. Background Art
[0002] In the era of big data, users generate massive amounts of behavioral data across various platforms. User behavior statistics require collecting data based on a specific type or multiple types of user behavior within any given period. Based on these statistical results, users can be further divided or clustered into different groups, and personalized marketing services can be provided to these groups. To address this, user behavior statistics solutions tailored to this massive amount of data are needed to quickly, conveniently, and flexibly collect statistics on any behavior within any period.
[0003] The existing statistical method for collecting massive amounts of user behavior data is to collect user behavior data through tracking points, store the collected user behavior data in a distributed file system, and then perform statistical analysis on the user behavior data. However, this statistical analysis method requires a large amount of computing and storage resources, and the statistical calculation wait time is long. Changes in the calculation cycle further increase resource constraints, resulting in low statistical efficiency of user behavior data. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to propose a user behavior statistics method, device, equipment and medium based on Bitmap to improve the statistical efficiency of user behavior data.
[0005] In order to solve the above technical problems, the present invention provides a method for collecting user behavior statistics based on a bitmap, including:
[0006] Collect user behavior data and store the user behavior data in a periodic file of a distributed file system in a slice periodic manner;
[0007] According to the slicing period, the periodic files of the distributed file system are stored in the partition table of the data warehouse tool Hive, wherein one partition in the partition table corresponds to the user behavior data of one slicing period;
[0008] Obtaining user behavior data of the current slicing period from the partition table, and performing deduplication processing on the user behavior data of the current slicing period to obtain an intermediate table of user behavior events;
[0009] Obtaining a user behavior bitmap for the previous slicing period, and fully associating the user behavior bitmap for the previous slicing period with the user behavior event intermediate table to generate a target user behavior bitmap;
[0010] If a user behavior statistics request is received, user behavior data is counted from the target user behavior bitmap according to the user behavior statistics request to obtain target data.
[0011] In order to solve the above technical problems, the embodiment of the present application provides a user behavior statistics device based on a bitmap, comprising:
[0012] The primary user behavior data collection module is used to collect user behavior data and store the user behavior data in a periodic file of the distributed file system in a slice period manner;
[0013] A user behavior data storage module is used to store the periodic files of the distributed file system into a partition table of the data warehouse tool Hive according to the slicing period, wherein one partition in the partition table corresponds to the user behavior data of one slicing period;
[0014] A user behavior data deduplication module is used to obtain user behavior data of the current slicing period from the partition table, and perform deduplication processing on the user behavior data of the current slicing period to obtain an intermediate table of user behavior events;
[0015] A target user behavior bitmap generation module is used to obtain a user behavior bitmap of the previous slicing period, and fully associate the user behavior bitmap of the previous slicing period with the user behavior event intermediate table to generate a target user behavior bitmap;
[0016] The target data generating module is configured to, upon receiving a user behavior statistics request, collect user behavior data from the target user behavior bitmap according to the user behavior statistics request to obtain target data.
[0017] To solve the above technical problems, a technical solution adopted by the present invention is: to provide a computer device, including one or more processors; a memory for storing one or more programs, so that the one or more processors can implement any of the above-mentioned user behavior statistics methods based on bitmaps.
[0018] To solve the above technical problems, the present invention adopts a technical solution: a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements any of the above-mentioned user behavior statistics methods based on bitmaps.
[0019] The embodiment of the present invention provides a method, device, equipment and medium for user behavior statistics based on Bitmap. The method includes: collecting user behavior data and storing the user behavior data in a periodic file of a distributed file system in a slicing period manner; storing the periodic file of the distributed file system in a partition table of a data warehouse tool hive in a slicing period manner, wherein one partition in the partition table corresponds to the user behavior data of one slicing period; obtaining the user behavior data of the current slicing period from the partition table, and performing deduplication processing on the user behavior data of the current slicing period to obtain a user behavior event intermediate table; obtaining the user behavior bitmap of the previous slicing period, and fully associating the user behavior bitmap of the previous slicing period with the user behavior event intermediate table to generate a target user behavior bitmap; if a user behavior statistics request is received, then according to the user behavior statistics request, counting the user behavior data from the target user behavior bitmap to obtain the target data. The embodiment of the present invention stores user behavior data in a partition table of the data reference tool hive in a slicing periodic manner, which is conducive to the subsequent processing of user behavior data in a slicing periodic manner, thereby improving processing efficiency. At the same time, the embodiment of the present application also converts user behavior data into a bitmap format in a slicing periodic manner, which is conducive to periodic statistics of user behavior data, saving storage space and reducing the amount of data calculation, thereby helping to improve the statistical efficiency of user behavior data. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0021] Figure 1 This is a flowchart of a method for calculating user behavior statistics based on a Bitmap provided in an embodiment of the present application;
[0022] Figure 2 This is another implementation flowchart of a sub-process in the Bitmap-based user behavior statistics method provided in an embodiment of the present application;
[0023] Figure 3 This is another implementation flowchart of a sub-process in the Bitmap-based user behavior statistics method provided in an embodiment of the present application;
[0024] Figure 4 This is another implementation flowchart of a sub-process in the Bitmap-based user behavior statistics method provided in an embodiment of the present application;
[0025] Figure 5This is another implementation flowchart of a sub-process in the Bitmap-based user behavior statistics method provided in an embodiment of the present application;
[0026] Figure 6 This is another implementation flowchart of a sub-process in the Bitmap-based user behavior statistics method provided in an embodiment of the present application;
[0027] Figure 7 This is a schematic diagram of a user behavior statistics device based on a Bitmap provided in an embodiment of the present application;
[0028] Figure 8 It is a schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0030] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0031] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0032] The present invention will be described in detail below with reference to the accompanying drawings and embodiments.
[0033] It should be noted that the Bitmap-based user behavior statistics method provided in the embodiment of the present application is generally executed by a server, and accordingly, the Bitmap-based user behavior statistics device is generally configured in the server.
[0034] See also Figure 1 , Figure 1 A specific implementation of a Bitmap-based user behavior statistics method is shown.
[0035] It should be noted that the method of the present invention is not limited to the method of Figure 1 The process sequence shown is limited to the following steps:
[0036] S1: Collect user behavior data and store it in a periodic file of the distributed file system in a slice periodic manner.
[0037] Specifically, user behavior data is collected in real time and stored in the corresponding periodic files of the distributed file system in the form of slice cycles. The slice cycle refers to a preset time as a cycle, within which the collected user behavior data is segmented to achieve storage of user behavior data according to time periods. The distributed file system is Hadoop Distributed File System (HDFS), which refers to a distributed file system designed to run on commodity hardware.
[0038] See also Figure 2 , Figure 2 A specific implementation of step S1 is shown, which is described in detail as follows:
[0039] S11: Collect user behavior data through embedding methods.
[0040] S12: Slice the user behavior data according to the slicing period to obtain user behavior data for each slicing period.
[0041] S13: Storing the user behavior data of each slicing period in the corresponding period file of the distributed file system.
[0042] Specifically, by setting up tracking points at each application end, user behavior data can be collected in real time through the tracking points. Furthermore, user behavior data can also be obtained by transmitting user behavior data through other databases. Since user behavior data is collected in chronological order, the user behavior data is divided according to the slicing period to obtain the user behavior data of each slicing period, and then the user behavior data of each slicing period is stored in the corresponding period file of the distributed file system. For example, taking seven days as a slicing period, the user behavior data collected within each seven days is regarded as the user behavior data of a slicing period, and this part of the data is stored as a whole in the corresponding period file of the distributed file system.
[0043] In this embodiment, user behavior data is collected by embedding points, and the user behavior data is segmented according to the slicing period to obtain user behavior data for each slicing period. The user behavior data for each slicing period is then stored in the corresponding period file of the distributed file system, which is conducive to the subsequent processing of user behavior data in the slicing period and improves the processing efficiency of user behavior data.
[0044] S2: According to the slicing period, the periodic files of the distributed file system are stored in the partition table of the data warehouse tool Hive. Among them, one partition in the partition table corresponds to the user behavior data of one slicing period.
[0045] Specifically, since user behavior data is stored in the periodic files of the distributed file system in the form of slicing periods, a partition table is established in the data warehouse tool Hive in advance. One partition in the partition table corresponds to the user behavior data of one slicing period, so that the periodic files of the distributed file system can be stored in the partition table of the data warehouse tool Hive according to the slicing period.
[0046] S3: Obtain the user behavior data of the current slicing period from the partition table, and perform deduplication processing on the user behavior data of the current slicing period to obtain the user behavior event intermediate table.
[0047] See also Figure 3 , Figure 3 A specific implementation of step S3 is shown, which is described in detail as follows:
[0048] S31: Obtain user behavior data of the current slicing period from the partition table.
[0049] S32: Deduplication processing is performed on the user behavior data of the current slicing period according to the user name and the behavior event name to obtain deduplication user behavior data.
[0050] S33: Construct a data table corresponding to the deduplicated user behavior data to obtain an intermediate table of user behavior events.
[0051] Specifically, user behavior data for the current slice period is obtained from the partition table. This user behavior data includes each user's operations on various behavioral events. To remove redundant data, deduplication is performed on the user behavior data for the current slice period based on user name and behavioral event name, resulting in deduplicated user behavior data. A data table corresponding to the deduplicated user behavior data is then constructed based on user name and behavioral event name, resulting in an intermediate user behavior event table. This intermediate user behavior event table includes each user's operations on various behavioral events.
[0052] S4: Obtain the user behavior bitmap of the previous slice period, and fully associate the user behavior bitmap of the previous slice period with the user behavior event intermediate table to generate a target user behavior bitmap.
[0053] Specifically, the user behavior bitmap of the previous slicing period refers to a bitmap converted from the user behavior data of the previous slicing period. If the user behavior data of the current slicing period is the user behavior data of the first slicing period, then the user behavior bitmap of the previous slicing period is obtained as an empty table. The method of converting the user behavior bitmap of the previous slicing period can be found in the process of steps S1 to S4. To avoid repetition, it will not be repeated here.
[0054] See also Figure 4 , Figure 4 A specific implementation of step S4 is shown, which is described in detail as follows:
[0055] S41: Obtain a user behavior bitmap of the previous slicing period as a comparison user behavior bitmap.
[0056] S42: Fully correlate the user behavior event intermediate table with the comparison user behavior bitmap to obtain full correlation information.
[0057] S43: Based on the full correlation information, generate a target user behavior bitmap, wherein, in the full correlation information, if the user behavior event intermediate table is associated with the left side of the comparison user behavior bitmap, then a 1 is incorporated into the left side of the comparison user behavior bitmap; if the user behavior event intermediate table is not associated with the left side of the comparison user behavior bitmap, then a 0 is incorporated into the left side of the comparison user behavior bitmap; if the comparison user behavior bitmap does not have data, then generate a new bitmap. Figure 1 .
[0058] Specifically, the bitmap compresses the entire behavior cycle of the user into a 0 / 1 bitmap, where each digit represents whether the user has had the behavior in a slice cycle, and the entire bitmap length represents how many cycles the behavior has been from the first time it started to the present. In an embodiment of the present application, the user behavior bitmap of the previous slice cycle is obtained as a comparison user behavior bitmap, and the user behavior event intermediate table is fully associated with the comparison user behavior bitmap to obtain full association information. Among them, full association refers to comparing whether the same user operates on different behavior events in the user behavior data of the previous slice cycle and the current slice cycle. For example, user A logged into website B in both the previous slice cycle and the current slice cycle, that is, the user behavior bitmap of user A in the previous slice cycle is associated with the user behavior event intermediate table. Therefore, in the full association information, if the user behavior event intermediate table is associated with the left side of the comparison user behavior bitmap (that is, the two are associated), then a 1 is added to the left side of the comparison user behavior bitmap. If the user behavior event intermediate table is not associated with the left side of the comparison user behavior bitmap (that is, the two are not associated), then a 0 is added to the left side of the comparison user behavior bitmap. If there is no data in the comparison user behavior bitmap (the user has operated a new behavior event in the current slicing period), a new bitmap is generated. Figure 1 Therefore, based on the full correlation information, a target user behavior bitmap is generated.
[0059] In this embodiment, converting the user behavior data into a bitmap in a slicing periodic manner is beneficial for periodic statistics of the user behavior data, saving storage space and reducing the amount of data calculation, thereby improving the statistical efficiency of the user behavior data.
[0060] Furthermore, step S4 further includes:
[0061] If the user behavior bitmap of the previous slice period is an empty table, the corresponding bitmaps of the user behavior event intermediate table are all set to 1 to obtain the target user behavior bitmap.
[0062] Specifically, if the user behavior bit obtained in the previous slice period is an empty table, that is, the user behavior data of the current slice period is the user behavior data of the first slice period, so all the behavior data performed by the user in this slice period appear for the first time, so the corresponding bitmaps of the user behavior event intermediate table are set to 1 to obtain the target user behavior bitmap.
[0063] S5: If a user behavior statistics request is received, the user behavior data is counted from the target user behavior bitmap according to the user behavior statistics request to obtain target data.
[0064] Specifically, if a user behavior statistics request is received, the user behavior statistics request is parsed to obtain the statistical requirements corresponding to the user behavior statistics request, and then a preset period character string is intercepted from the target user behavior bitmap according to the statistical requirements, and the user behavior data is counted to obtain the target data.
[0065] See also Figure 5 , Figure 5 A specific implementation of step S5 is shown, which is described in detail as follows:
[0066] S51: If a user behavior statistics request is received, the user behavior statistics request is parsed to obtain a statistics requirement corresponding to the user behavior statistics request.
[0067] S52: If the statistical requirement is to count the user scale of a preset period, obtain a user behavior bitmap of the preset period from the target user behavior bitmap, and count the number of users from the user behavior bitmap of the preset period to obtain target data.
[0068] Specifically, user scale is defined as the number of users who have engaged in a specific behavior over the past n cycles. The calculation formula involves extracting an n-digit string from the target user behavior bitmap from left to right, using this string as the user behavior bitmap for a preset cycle. A "1" indicates that the behavior occurred during a sliced cycle, while all "1s" indicate that the behavior did not occur during that cycle. The target data is obtained by counting the number of "1s."
[0069] In a specific embodiment, statistics can be calculated as the number of registered users, accumulated users, new users, weekly active users, or monthly active users within a preset period. Registered users: The number of users who have registered. Registered users can be obtained by directly taking the corresponding registration event for the corresponding period and calculating the number of records. Cumulative users: The number of users who have logged in. Accumulated users can be obtained by directly taking the corresponding login event for the corresponding period and calculating the number of records. Generally, users register first and then log in, so registration and login have a sequential relationship. New users: The number of users who trigger a login event for the first time within a period. New users can be obtained by directly taking the login event and calculating the number of records whose bitmap length is less than the period. Weekly active users (the number of users who have logged in within seven days) can be obtained by taking the login behavior event bitmap corresponding to the target user behavior bitmap, extracting 7 bits from left to right, and if there is a 1, it indicates weekly activity. The number of records is then calculated to obtain the number of weekly active users. Monthly active users: Taking the login behavior event bitmap corresponding to the target user behavior bitmap, extracting 30 bits from left to right, and if there is a 1, it indicates monthly activity. The number of records is then calculated. The number of users who have a certain behavior in any week: Take the behavior event bitmap, take n bits from left to right, and if there is 1, it means there is activity in any period. Then calculate the number of records, and you can get the number of users who have a certain behavior in any week.
[0070] S53: If the statistical requirement is to count the user life cycle data, the user life cycle data is counted according to the order of the cycles of the target user behavior bitmap to obtain the target number.
[0071] Specifically, the user lifecycle is the entire process from the time a user first engages with a product to the time they leave it, encompassing all user behavior from the moment they register. Leveraging the sequential relationship between the target user behavior bitmap cycles, the user lifecycle is defined according to the business: Introduction Period: New users added in the last n cycles; Growth Period: Active in the last n cycles and new users in the previous n cycles; Maturity Period: Active in the last two n cycles, with an active period greater than 2n; Dormancy Period: Active in the last n cycles and no activity in the previous n cycles; Churn Period: No activity in the last n cycles. The characteristics of the b-graph facilitate rule-based calculation of user size across different lifecycles. Introduction Period: Directly retrieve the user bitmap with login events, extract the number of records with a bitmap length less than or equal to n, and simply calculate the number of records. Dormancy Period: Directly retrieve the user bitmap with login events, extract the number of records with a bitmap length greater than or equal to 2n, select n bits from left to right where a 1 is present, then select n bits where no 1 is present, and simply sum the results.
[0072] S54: If the statistical requirement is to count the frequency distribution of events within a preset period, the number of events within the preset period is counted from the target user behavior bitmap to obtain target data.
[0073] Specifically, a 0 / 1 bit in the bitmap represents a slice period. For any period, this corresponds to a certain number of slice periods. A 1 indicates that the user has engaged in that behavior during that slice period, and a 0 indicates no behavior during that slice period. This allows the frequency distribution of user behaviors within any period to be calculated. For example, to calculate the monthly active days distribution: take the login behavior event bitmap, select 30 bits from left to right, and remove all strings containing 0s from the bitmap. After this removal, all remaining bits are 1s. The length of the corresponding string is the user's active days, and the number of records can be calculated by day.
[0074] See also Figure 6 , Figure 6 A specific implementation of step S54 is shown, which is described in detail as follows:
[0075] S541: If the statistical requirement is to calculate the frequency distribution of events within a preset period, a character string of the preset period is intercepted from the target user behavior bitmap to obtain a basic user behavior bitmap.
[0076] S542: Count active data from the basic user behavior bitmap to obtain target data by counting event frequency distribution, where 1 represents active data and 0 represents inactive data.
[0077] Specifically, since the target user behavior bitmap exists in the form of a character string, when it is necessary to obtain the event frequency distribution within a preset period, the character string of the preset period is intercepted from the target user behavior bitmap to obtain the basic user behavior bitmap, and then the active data is counted from the basic user behavior bitmap to obtain the target data by counting the event frequency distribution, where 1 represents active data and 0 represents inactive data.
[0078] In this embodiment, user behavior data is collected and stored in a periodic file of a distributed file system in a slicing period manner; the periodic file of the distributed file system is stored in a partition table of a data warehouse tool hive in a slicing period manner, wherein one partition in the partition table corresponds to the user behavior data of one slicing period; the user behavior data of the current slicing period is obtained from the partition table, and deduplication processing is performed on the user behavior data of the current slicing period to obtain a user behavior event intermediate table; the user behavior bitmap of the previous slicing period is obtained, and the user behavior bitmap of the previous slicing period is fully associated with the user behavior event intermediate table to generate a target user behavior bitmap; if a user behavior statistics request is received, the user behavior data is counted from the target user behavior bitmap according to the user behavior statistics request to obtain the target data. In this embodiment of the present invention, by storing the user behavior data in a partition table of a data reference tool hive in a slicing period manner, it is beneficial to subsequently process the user behavior data in a slicing period manner, thereby improving processing efficiency. At the same time, the embodiment of the present application also converts the user behavior data into a bitmap in a slicing period manner, thereby facilitating periodic statistics of the user behavior data, saving storage space and reducing the amount of data calculation, thereby improving the statistical efficiency of the user behavior data.
[0079] Please refer to Figure 7 , as a response to the above Figure 1 The present application provides an embodiment of a user behavior statistics device based on a Bitmap. Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0080] like Figure 7 As shown, the user behavior statistics device based on Bitmap in this embodiment includes: a user behavior data collection module 61, a user behavior data storage module 62, a user behavior data deduplication module 63, a target user behavior bitmap generation module 64, and a target data generation module 65, wherein:
[0081] The user behavior data collection module 61 is used to collect user behavior data and store the user behavior data in a periodic file of the distributed file system in a slice periodic manner;
[0082] The user behavior data storage module 62 is used to store the periodic files of the distributed file system into the partition table of the data warehouse tool Hive according to the slicing period, wherein one partition in the partition table corresponds to the user behavior data of one slicing period;
[0083] The user behavior data deduplication module 63 is used to obtain the user behavior data of the current slicing period from the partition table, and perform deduplication processing on the user behavior data of the current slicing period to obtain the user behavior event intermediate table;
[0084] The target user behavior bitmap generation module 64 is used to obtain the user behavior bitmap of the previous slicing period and fully associate the user behavior bitmap of the previous slicing period with the user behavior event intermediate table to generate a target user behavior bitmap;
[0085] The target data generating module 65 is configured to, upon receiving a user behavior statistics request, collect user behavior data from the target user behavior bitmap according to the user behavior statistics request to obtain target data.
[0086] Furthermore, the target user behavior bitmap generation module 64 includes:
[0087] A comparison user behavior bitmap acquisition unit is used to acquire a user behavior bitmap of a previous slicing period as a comparison user behavior bitmap;
[0088] A full correlation information generating unit, configured to fully correlate the user behavior event intermediate table with the comparison user behavior bitmap to obtain full correlation information;
[0089] The current cycle bitmap generation unit is used to generate a target user behavior bitmap based on the full correlation information, wherein, in the full correlation information, if the user behavior event intermediate table is associated with the left side of the comparison user behavior bitmap, then a 1 is incorporated into the left side of the comparison user behavior bitmap; if the user behavior event intermediate table is not associated with the left side of the comparison user behavior bitmap, then a 0 is incorporated into the left side of the comparison user behavior bitmap; if the comparison user behavior bitmap does not have data, a new bitmap is generated. Figure 1 .
[0090] Furthermore, the target user behavior bitmap generation module 64 further includes:
[0091] The bitmap setting unit is used to set the corresponding bitmaps in the user behavior event intermediate table to 1 if the user behavior bitmap of the previous slicing period is an empty table, so as to obtain the target user behavior bitmap.
[0092] Furthermore, the user behavior data deduplication module 63 includes:
[0093] The current data acquisition unit is used to obtain the user behavior data of the current slice period from the partition table;
[0094] A deduplication processing unit is used to perform deduplication processing on the user behavior data of the current slice period according to the user name and the behavior event name to obtain the deduplicated user behavior data;
[0095] The data table construction unit is used to construct a data table corresponding to the deduplicated user behavior data to obtain an intermediate table of user behavior events.
[0096] Furthermore, the user behavior data collection module 61 includes:
[0097] The data collection unit is used to collect user behavior data through embedding methods;
[0098] A data segmentation unit is used to segment the user behavior data according to the slicing period to obtain the user behavior data of each slicing period;
[0099] The data storage unit is used to store the user behavior data of each slicing period in the corresponding period file of the distributed file system.
[0100] Furthermore, the target data generating module 65 includes:
[0101] A statistical request parsing unit, configured to parse a user behavior statistical request upon receipt of the user behavior statistical request to obtain statistical requirements corresponding to the user behavior statistical request;
[0102] A first requirement processing unit is configured to, if the statistical requirement is to count the user scale of a preset period, obtain a user behavior bitmap of the preset period from the target user behavior bitmap, and count the number of users from the user behavior bitmap of the preset period to obtain target data;
[0103] The second request processing unit is configured to, if the statistical requirement is to collect statistics on user life cycle data, collect statistics on the user life cycle data according to the order of the cycles of the target user behavior bitmap to obtain target data;
[0104] The third requirement processing unit is configured to, if the statistical requirement is to calculate the frequency distribution of events within a preset period, calculate the number of events within the preset period from the target user behavior bitmap to obtain target data.
[0105] Furthermore, the third requirement processing unit includes:
[0106] The basic user behavior bitmap generation subunit is used to extract the character string of the preset period from the target user behavior bitmap to obtain the basic user behavior bitmap if the statistical requirement is to calculate the frequency distribution of events within a preset period;
[0107] The active data statistics sub-unit is used to count active data from the basic user behavior bitmap, to calculate the event frequency distribution, and obtain target data, where 1 represents active data and 0 represents inactive data.
[0108] To solve the above technical problems, the present application also provides a computer device. Figure 8 , Figure 8 This is a basic structural block diagram of the computer device in this embodiment.
[0109] The computer device 7 includes a memory 71, a processor 72, and a network interface 73 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 7 having three components: a memory 71, a processor 72, and a network interface 73. However, it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead. Among them, those skilled in the art will understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc.
[0110] Computer devices can be desktop computers, laptops, PDAs, cloud servers, etc. Computer devices can interact with users through keyboards, mice, remote controls, touchpads, or voice-activated devices.
[0111] The memory 71 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, magnetic disk, optical disk, etc. In some embodiments, the memory 71 may be an internal storage unit of the computer device 7, such as the hard disk or memory of the computer device 7. In other embodiments, the memory 71 may also be an external storage device of the computer device 7, such as a plug-in hard disk equipped on the computer device 7, a smart memory card (SMC), a secure digital (SD) card, a flash memory card, etc. Of course, the memory 71 may also include both the internal storage unit of the computer device 7 and its external storage device. In this embodiment, the memory 71 is generally used to store the operating system and various application software installed on the computer device 7, such as the program code of the bitmap-based user behavior statistics method. In addition, the memory 71 can also be used to temporarily store various types of data that have been output or are to be output.
[0112] In some embodiments, the processor 72 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 72 is generally used to control the overall operation of the computer device 7. In this embodiment, the processor 72 is used to execute program code stored in the memory 71 or process data, such as executing the program code of the above-mentioned bitmap-based user behavior statistics method to implement various embodiments of the bitmap-based user behavior statistics method.
[0113] The network interface 73 may include a wireless network interface or a wired network interface. The network interface 73 is generally used to establish a communication connection between the computer device 7 and other electronic devices.
[0114] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores a computer program, and the computer program can be executed by at least one processor to enable the at least one processor to perform the steps of the above-mentioned user behavior statistics method based on Bitmap.
[0115] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course 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 application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a computer device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods of each embodiment of the present application.
[0116] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present application.
Claims
1. A user behavior statistics method based on Bitmap, characterized in that: include: Collect user behavior data and store the user behavior data in a periodic file of a distributed file system in a slice periodic manner; According to the slicing period, the periodic files of the distributed file system are stored in the partition table of the data warehouse tool Hive, wherein one partition in the partition table corresponds to the user behavior data of one slicing period; Obtaining user behavior data of the current slicing period from the partition table, and performing deduplication processing on the user behavior data of the current slicing period to obtain an intermediate table of user behavior events; Obtaining a user behavior bitmap for the previous slicing period, and fully associating the user behavior bitmap for the previous slicing period with the user behavior event intermediate table to generate a target user behavior bitmap; If the user behavior bitmap of the previous slicing period is an empty table, then the corresponding bitmaps of the user behavior event intermediate table are all set to 1 to obtain the target user behavior bitmap; If a user behavior statistics request is received, then according to the user behavior statistics request, the user behavior data is counted from the target user behavior bitmap to obtain target data; The step of obtaining a user behavior bitmap for a previous slicing period and fully associating the user behavior bitmap for the previous slicing period with the user behavior event intermediate table to generate a target user behavior bitmap includes: Obtaining a user behavior bitmap of the previous slicing period as a comparison user behavior bitmap; Fully associating the user behavior event intermediate table with the comparison user behavior bitmap to obtain full association information; Based on the full association information, the target user behavior bitmap is generated, wherein, in the full association information, if the user behavior event intermediate table is associated with the left side of the comparison user behavior bitmap, a 1 is incorporated into the left side of the comparison user behavior bitmap; if the user behavior event intermediate table is not associated with the left side of the comparison user behavior bitmap, a 0 is incorporated into the left side of the comparison user behavior bitmap; if the comparison user behavior bitmap does not contain data, a new bitmap 1 is generated; The step of obtaining user behavior data of the current slicing period from the partition table and performing deduplication processing on the user behavior data of the current slicing period to obtain an intermediate table of user behavior events includes: Obtain user behavior data for the current slicing period from the partition table; Deduplication is performed on the user behavior data of the current slicing period according to the user name and the behavior event name to obtain deduplication-free user behavior data; A data table corresponding to the deduplicated user behavior data is constructed to obtain the user behavior event intermediate table.
2. The user behavior statistics method based on Bitmap according to claim 1 is characterized in that: The step of obtaining a user behavior bitmap for a previous slicing period and fully associating the user behavior bitmap for the previous slicing period with the user behavior event intermediate table to generate a target user behavior bitmap further includes: If the user behavior bitmap of the previous slicing period is an empty table, the corresponding bitmaps of the user behavior event intermediate table are all set to 1 to obtain the target user behavior bitmap.
3. The user behavior statistics method based on Bitmap according to claim 1 is characterized in that: The collecting of user behavior data and storing the user behavior data in a periodic file of a distributed file system in a slicing periodic manner includes: Collect the user behavior data by embedding points; Slice the user behavior data according to the slicing period to obtain the user behavior data for each slicing period; The user behavior data of each slicing period is stored in the corresponding period file of the distributed file system.
4. The method for user behavior statistics based on Bitmap according to any one of claims 1 to 3, characterized in that: If a user behavior statistics request is received, then according to the user behavior statistics request, user behavior data is collected from the target user behavior bitmap to obtain target data, including: If the user behavior statistics request is received, the user behavior statistics request is parsed to obtain the statistical requirements corresponding to the user behavior statistics request; If the statistical requirement is to count the user scale of a preset period, obtaining a user behavior bitmap of the preset period from the target user behavior bitmap, and counting the number of users from the user behavior bitmap of the preset period to obtain the target data; If the statistical requirement is to collect user life cycle data, the user life cycle data is collected according to the order of the cycles of the target user behavior bitmap to obtain the target data; If the statistical requirement is to count the frequency distribution of events within a preset period, the number of events within the preset period is counted from the target user behavior bitmap to obtain the target data.
5. The user behavior statistics method based on Bitmap according to claim 4 is characterized in that: If the statistical requirement is to calculate the frequency distribution of events within a preset period, then the number of events within the preset period is calculated from the target user behavior bitmap to obtain the target data, including: If the statistical requirement is to calculate the frequency distribution of events within a preset period, then extracting the character string of the preset period from the target user behavior bitmap to obtain a basic user behavior bitmap; Active data is counted from the basic user behavior bitmap to obtain the target data by counting the event frequency distribution, where 1 represents active data and 0 represents inactive data.
6. A user behavior statistics device based on Bitmap, characterized in that: include: A user behavior data collection module is used to collect user behavior data and store the user behavior data in a periodic file of a distributed file system in a slice period manner; A user behavior data storage module is used to store the periodic files of the distributed file system into a partition table of the data warehouse tool Hive according to the slicing period, wherein one partition in the partition table corresponds to the user behavior data of one slicing period; A user behavior data deduplication module is used to obtain user behavior data of the current slicing period from the partition table, and perform deduplication processing on the user behavior data of the current slicing period to obtain an intermediate table of user behavior events; A target user behavior bitmap generation module is configured to obtain a user behavior bitmap for the previous slicing period and fully associate the user behavior bitmap for the previous slicing period with the user behavior event intermediate table to generate a target user behavior bitmap. If the user behavior bitmap for the previous slicing period is an empty table, the corresponding bitmaps in the user behavior event intermediate table are all set to 1 to obtain the target user behavior bitmap. a target data generating module configured to, upon receiving a user behavior statistics request, collect user behavior data from the target user behavior bitmap according to the user behavior statistics request to obtain target data; The target user behavior bitmap generation module includes: a comparison user behavior bitmap acquiring unit, configured to acquire the user behavior bitmap of the previous slicing period as a comparison user behavior bitmap; a full correlation information generating unit, configured to fully correlate the user behavior event intermediate table with the comparison user behavior bitmap to obtain full correlation information; a current period bitmap generating unit, configured to generate the target user behavior bitmap based on the full association information, wherein, in the full association information, if the user behavior event intermediate table is associated with the left side of the comparison user behavior bitmap, a 1 is incorporated into the left side of the comparison user behavior bitmap; if the user behavior event intermediate table is not associated with the left side of the comparison user behavior bitmap, a 0 is incorporated into the left side of the comparison user behavior bitmap; and if no data exists in the comparison user behavior bitmap, a new bitmap 1 is generated; The user behavior data deduplication module includes: A current data acquisition unit, configured to acquire user behavior data of a current slicing period from the partition table; a deduplication processing unit, configured to perform deduplication processing on the user behavior data of the current slicing period according to the user name and the behavior event name, to obtain deduplicated user behavior data; The data table construction unit is used to construct a data table corresponding to the deduplicated user behavior data to obtain the user behavior event intermediate table.
7. A computer device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method for user behavior statistics based on a bitmap according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for counting user behaviors based on a bitmap according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
User behavior data statistics device and method
CN106682167A
Information processing method and device and electronic equipment
CN109828970A
Data processing method and device
CN112269726A