Target crowd determination method, apparatus and device, and computer program product
The bitmap represents user tags and performs logical operations, which solves the problem of inefficiency in traditional methods when processing massive data, and achieves more efficient target population selection, reducing resource consumption and hardware costs.
Patent Information
- Application Number
- CN202411981345.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-02
AI Technical Summary
The traditional target population determination method is inefficient when processing massive data, cannot meet the business needs of rapid iteration, and is highly resource-consuming and hardware costs are high.
User tags are represented through bitmaps, which reduces the space requirements for data storage, and directly performs logical operations on the tag bitmaps to avoid performance bottlenecks and improves the speed and efficiency of target crowd selection.
It significantly reduces the space requirement for data storage, reduces resource consumption, improves the speed and efficiency of target population selection, and can easily cope with target user selection needs of different sizes and complexities.
Smart Images

Figure CN119919198A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, equipment and computer program product for determining a target population. Background Art
[0002] In modern Internet applications, target group selection is the key to precision marketing and personalized services.
[0003] Traditional methods of determining the target population usually rely on a technical architecture with ElasticSearch as the core. With its search and indexing functions, ElasticSearch can meet the needs of building user portraits to a certain extent. However, with the continuous growth of user data and the increasing complexity of business scenarios, this traditional method has gradually exposed many limitations, such as slow and long user tag import speed, high throughput and easy memory overflow, serious resource consumption, high-specification CPU / MEM, large demand for storage space, high hardware costs, etc. It is inefficient when processing massive data and cannot meet the business needs of rapid iteration. Summary of the invention
[0004] In view of this, the embodiments of the present application are committed to providing a method, apparatus, device and computer program product for determining a target population, which can reduce the space requirements for data storage, reduce resource consumption, and improve the speed and efficiency of target population selection.
[0005] According to a first aspect of an embodiment of the present application, a method for determining a target population is provided, comprising:
[0006] Acquire a target population selection instruction, wherein the target population selection instruction includes a target user tag and a first logical relationship between each target user tag, wherein the target user tag includes a single attribute user tag and / or a multi-attribute user tag, and the first logical relationship represents a combination mode between each target user tag;
[0007] According to the first logical relationship, a first logical operation is performed on the label bitmap of each target user label to obtain a first bitmap, wherein the value of each bit in the label bitmap indicates whether the user corresponding to the bit satisfies the target user label corresponding to the label bitmap, the first logical operation matches the first logical relationship, and the value of each bit in the first bitmap indicates whether the user corresponding to the bit satisfies the target group selection instruction;
[0008] According to the first bitmap, a crowd package object corresponding to the target crowd selection instruction is determined.
[0009] Optionally, before obtaining the target group selection instruction, the method further includes:
[0010] Acquire tag data for each user tag, the tag data including a user identifier that satisfies the user tag;
[0011] According to a preset label bitmap generation strategy, the label data of each user label is converted into a label bitmap of the user label;
[0012] The tag bitmap of each user tag is stored in the first database.
[0013] Optionally, converting the tag data of each user tag into a tag bitmap corresponding to the user tag according to a preset tag bitmap generation strategy includes:
[0014] For each user tag, do the following:
[0015] Assign an initial bitmap to the i-th user tag, map the user IDs of all users to different bits of the initial bitmap, the length of the initial bitmap is greater than or equal to the total number of users, and i is a positive integer;
[0016] Traversing the tag data of the i-th user tag, setting the bit of the user identifier that meets the i-th user tag in the initial bitmap to a first preset value, and setting the bit of the user identifier that does not meet the i-th user tag in the initial bitmap to a second preset value, to obtain a tag bitmap of the i-th user tag.
[0017] Optionally, the first database is a ClickHouse database;
[0018] The step of converting the tag data of each user tag into a tag bitmap of the user tag according to a preset tag bitmap generation strategy includes:
[0019] Call the bitmap function in the ClickHouse database to convert the label data of each user label into the label bitmap of the user label.
[0020] Optionally, performing a first logical operation on the label bitmap of each target user label according to the first logical relationship to obtain a first bitmap includes:
[0021] According to the user identifier of the j-th user, determine the bit corresponding to the j-th user in the label bitmap of each target user label, where j is a positive integer;
[0022] The first logical operation is performed on the bit corresponding to the j-th user in the label bitmap of each target user label to obtain the bit corresponding to the j-th user in the first bitmap.
[0023] Optionally, the method further includes:
[0024] Storing a tag bitmap of a first user tag set in a memory, wherein the usage frequency of each user tag in the first user tag set is greater than a first preset frequency;
[0025] When the target user tag includes the first target user tag in the first user tag set, a tag bitmap of the first target user tag is read from a memory, and the tag bitmap of the first target user tag is used to participate in the first logical operation.
[0026] Optionally, the storage database of the label bitmap of each user label is a ClickHouse database;
[0027] The step of storing the tag bitmap of the first user tag set in the memory includes:
[0028] Using the Join table engine of the ClickHouse database, the label bitmap of the first user label set is loaded into the memory for caching.
[0029] According to a second aspect of an embodiment of the present application, a target population determination device is provided, including:
[0030] A first unit is used to obtain a target group selection instruction, wherein the target group selection instruction includes a target user tag and a first logical relationship between each target user tag, wherein the target user tag includes a single attribute user tag and / or a multi-attribute user tag, and the first logical relationship represents a combination mode between each target user tag;
[0031] A second unit is configured to perform a first logic operation on a label bitmap of each target user label according to the first logic relationship to obtain a first bitmap, wherein a value of each bit in the label bitmap indicates whether a user corresponding to the bit satisfies the target user label corresponding to the label bitmap, the first logic operation matches the first logic relationship, and a value of each bit in the first bitmap indicates whether a user corresponding to the bit satisfies the target group selection instruction;
[0032] The third unit is used to determine the crowd package object corresponding to the target crowd selection instruction according to the first bitmap.
[0033] According to a third aspect of an embodiment of the present application, an electronic device is provided, wherein the memory is connected to the processor and is used to store a program;
[0034] The processor is used to implement the target population determination method as described in any one of the first aspects of the embodiments of the present application by running the program in the memory.
[0035] According to a fourth aspect of an embodiment of the present application, a computer program product is provided, comprising computer program instructions, which, when executed by a processor, enable the processor to implement a target population determination method as described in any one of the first aspects of the embodiments of the present application.
[0036] The target population determination method provided in the embodiment of the present application, on the one hand, represents user tags through bitmaps, which greatly reduces the space requirements for data storage; on the other hand, by directly performing logical operations on the tag bitmaps, it avoids the performance bottleneck caused by large amounts of data indexing and search operations in traditional methods, and can quickly process large amounts of data, thereby significantly improving the speed and efficiency of target population selection, and can easily cope with target user selection needs of different scales and complexities. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0038] Figure 1 A schematic flow chart of the first target population determination method provided in an embodiment of the present application.
[0039] Figure 2 A flowchart of a second target population determination method provided in an embodiment of the present application.
[0040] Figure 3 A flowchart of a third method for determining a target population provided in an embodiment of the present application.
[0041] Figure 4 A schematic diagram of the structure of a target population determination device provided in an embodiment of the present application.
[0042] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The technical solution of the embodiment of the present application is applicable to various scenarios that require accurate determination of the target population, and is applicable to various fields such as marketing, user portrait analysis, advertising, product recommendation, etc. In the application scenario, the user has submitted a target population selection instruction according to business needs, or the system has generated a target population selection instruction based on the business needs submitted by the user or self-generated, and the system needs to determine the corresponding target population based on the instruction to perform subsequent operations. The technical solution of the embodiment of the present application can parse the target user labels in the target population selection instruction and the logical relationship between the labels, and use efficient bitmap operations to quickly and accurately select the target population that meets the conditions, thereby improving the accuracy and processing efficiency of population determination, and optimizing resource allocation and business decision-making effects.
[0044] The technical solution provided in the embodiments of the present application can be exemplarily applied to hardware devices such as processors, electronic devices, servers (including cloud servers), or packaged into software programs to be run. When the hardware device executes the processing of the technical solution of the embodiments of the present application, or the above-mentioned software program is run, the automatic splitting of the target task and the automatic calling of the application program interface required for the task can be achieved to complete the purpose of the target task. The embodiments of the present application only exemplarily introduce the specific processing of the technical solution of the present application, and do not limit the specific implementation form of the technical solution of the present application. Any technical implementation form that can execute the processing of the technical solution of the present application can be adopted by the embodiments of the present application.
[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0046] Before introducing this application solution, the relevant technologies are first introduced:
[0047] In modern Internet applications, target group selection is the key to precision marketing and personalized services.
[0048] Traditional methods of determining the target population usually rely on a technical architecture with ElasticSearch as the core. With its search and indexing functions, ElasticSearch can meet the needs of building user portraits to a certain extent. However, with the continuous growth of user data and the increasing complexity of business scenarios, this traditional method has gradually exposed many limitations, such as slow and long user tag import speed, high throughput and easy memory overflow, serious resource consumption, high-specification CPU / MEM, large demand for storage space, high hardware costs, etc. It is inefficient when processing massive data and cannot meet the business needs of rapid iteration.
[0049] In view of this, the embodiments of the present application are committed to providing a method, device, equipment and computer program product for determining a target population, which can reduce the space requirements for data storage, reduce resource consumption, and improve the speed and efficiency of target population selection, which are described in detail one by one in the following embodiments.
[0050] Exemplary Methods
[0051] Figure 1 A flow chart of a method for determining a target population provided in an embodiment of the present application. Figure 1 As shown, the method includes steps S101-S103:
[0052] S101. Obtain a target population selection instruction, wherein the target population selection instruction includes a target user tag and a first logical relationship between each target user tag, wherein the target user tag includes a single-attribute user tag and / or a multi-attribute user tag, and the first logical relationship represents a combination method between each target user tag.
[0053] The target user tag can be understood as an identifier or attribute used to describe and define the characteristics of the target population. The target user tag can be the user's basic information (such as age, gender, region), behavior data (such as purchase history, browsing history), interest preferences (such as favorite music types, movie styles), etc. The target user tag is the basis for constructing the target population selection instruction. By combining different target population tags, the characteristics of the target population can be accurately described.
[0054] The first logical relationship between the target user tags can be understood as the combination method or association relationship between the target user tags, which determines which conditions the user needs to meet to be included in the target population, such as an "and" relationship, an "or" relationship, a "not" relationship, or a more complex nested relationship, an exclusion relationship, a logical expression, etc.
[0055] The single attribute tag can be understood as a tag that describes a user based on a single feature or attribute, and each single attribute tag only covers one aspect of user information. For example, "age: 30-40 years old" is a single attribute tag that only describes the age range of the user.
[0056] The multi-attribute label can be understood as a label that combines multiple attributes to describe the user and can capture more complex and comprehensive features. The multiple attributes it contains can be interrelated or independent, for example, "males between the ages of 25 and 35 and living in Beijing" and "users who use iOS devices and are active for more than 2 hours a day."
[0057] Optionally, the multi-attribute labels are obtained in advance by performing a crowd selection operation based on single-attribute labels.
[0058] The target population selection instruction can be understood as an instruction for selecting a target population, which includes a series of user tags (i.e., target user tags) for describing the target population and the logical relationship between these tags (i.e., the first logical relationship). Through the target population selection instruction, the system can filter out user groups that meet specific conditions from the user database.
[0059] The target population selection instructions can be obtained in a variety of ways, and this application does not limit this.
[0060] Optionally, the user can directly input the target population selection instruction into the system through a user interaction interface (such as a web form, an application program interface) or a programming interface (API), and the system can obtain the target population selection instruction. The target population selection instruction is input into the system by the user through a user interaction interface or a programming interface (API) and other methods. The target population selection instruction can be in a structured data form, such as JSON, XML or other formats, or can be the result of selection and configuration through a graphical interface.
[0061] Optionally, the user inputs a specific description or feature of the target population into the system, and the system analyzes the description or feature input by the user and the user data and attributes in the system to generate a target population selection instruction. For example, if the user inputs "Please circle the middle-aged unemployed male", the system can analyze and match the description input by the user in combination with the user's age, employment status, gender and other attribute data in the system to generate a target population selection instruction for middle-aged unemployed males.
[0062] Optionally, the system can also automatically judge and generate target group selection instructions based on machine learning models or data mining algorithms, as well as existing user data and business data in the system. For example, the system can automatically infer that a certain user group is more interested in a specific type of product or service based on the effectiveness data of historical marketing activities, and thus generate target group selection instructions for this type of user.
[0063] S102. According to the first logical relationship, a first logical operation is performed on the label bitmap of each target user label to obtain a first bitmap, wherein the value of each bit in the label bitmap represents whether the user corresponding to the bit satisfies the target user label corresponding to the label bitmap, the first logical operation matches the first logical relationship, and the value of each bit in the first bitmap represents whether the user corresponding to the bit satisfies the target population selection instruction.
[0064] Optionally, before executing step S102, the tag data of each user tag needs to be converted into a tag bitmap corresponding to the user tag and stored in advance.
[0065] The specific implementation method of converting the tag data of each user tag into the tag bitmap corresponding to the user tag will be described in subsequent embodiments and will not be elaborated in detail here.
[0066] The label bitmap is an efficient data structure used to represent a large number of binary values (such as 0 and 1). In the label bitmap of the user label, each user corresponds to a specific bit, and the value of the bit represents whether the specific attribute of the user corresponding to the bit satisfies the label condition of the corresponding user. For example, if the bit value is 1, it means that the jth user meets the label condition; if the bit value is 0, it means that the jth user does not meet the label condition.
[0067] The bitmap can be a simple Bitmap or a more efficient implementation, such as Roaring Bitmap.
[0068] Furthermore, after obtaining the target group selection instruction, the system will retrieve the label bitmap of the target user label from all pre-stored label bitmaps corresponding to user labels based on the target user label in the target group selection instruction.
[0069] Optionally, based on the tag identifier of the target user tag, the corresponding tag bitmap is quickly located in a pre-built tag bitmap index to improve retrieval efficiency.
[0070] Further, after obtaining the label bitmap of the target user label, according to the first logical relationship indicated by the target group selection instruction, a corresponding first logical operation is performed on the label bitmap of each target user label to obtain an operation result, namely, the first bitmap.
[0071] Wherein, the first logical operation matches the first logical relationship in the target group selection instruction. Exemplarily, when the target group selection instruction requires the user to meet multiple label conditions at the same time (i.e., an "and" relationship), the first logical operation adopts a bitwise AND (AND) operation; when the target group selection instruction requires the user to meet only one label condition (i.e., an "or" relationship), the first logical operation adopts a bitwise OR (OR) operation; when the target group selection instruction requires the user not to meet a specific label condition (i.e., a "not" relationship), the first logical operation adopts a bitwise NOT (NOT) operation.
[0072] Optionally, a corresponding first logical operation is performed on the label bitmap of each target user label, including: traversing all users, and for each user, finding the bit corresponding to the user in the label bitmap of each target user label, and then performing a first logical operation on these bits to obtain a corresponding operation result.
[0073] Next, step S102 will be described by taking the jth user as an example, wherein the jth user is each user in the target label bitmap, and for each user in the target label bitmap, steps A1-A2 need to be executed to determine its value in the first bitmap.
[0074] A1. According to the user identifier of the jth user, determine the bit corresponding to the jth user in the label bitmap of each target user label, where j is a positive integer.
[0075] According to the above content, in the label bitmap of the user label, each user corresponds to a specific bit, and the value of the bit is used to indicate whether the user meets the user label condition corresponding to the label bitmap.
[0076] Optionally, in this implementation, the tag bitmap is indexed by user ID, that is, each user ID corresponds to a specific bit in the tag bitmap. Therefore, through the user ID of the jth user, we can quickly locate the bit corresponding to the jth user in the tag bitmap of each target user tag and determine the specific value.
[0077] A2. Perform the first logical operation on the bit corresponding to the j-th user in the label bitmap of each target user label to obtain the bit corresponding to the j-th user in the first bitmap.
[0078] After obtaining the bit value corresponding to the j-th user in the label bitmap of each target user label, a first logical operation is performed on these positions, and the operation result is a new binary number, which is determined as the bit value corresponding to the j-th user in the first bitmap, indicating whether the j-th user meets the target population selection instruction, that is, whether the j-th user belongs to the target population.
[0079] The operations in steps A1-A2 are performed for each user to obtain the bit value corresponding to each user in the first bitmap, and finally the first bitmap is obtained by summarizing.
[0080] S103: Determine, according to the first bitmap, a group package object corresponding to the target group selection instruction.
[0081] The crowd package object can be understood as a collection of all users who meet the target crowd selection instructions. The crowd package object can be used in subsequent marketing activities, user analysis, personalized recommendations and other scenarios. In these scenarios, the target population can be more accurately located through the crowd package object.
[0082] According to the above content, the value of the corresponding bit of each user in the first bitmap represents whether the user meets the target population selection instruction. Therefore, by analyzing the first bitmap, all users who meet the target population selection instruction can be determined, and the population package object corresponding to the target population selection instruction can be obtained.
[0083] Specifically, after obtaining the first bitmap, traverse each bit in the bitmap, and determine whether the corresponding user meets the target group selection instruction according to the bit value. Optionally, determine the user corresponding to each bit according to the index (such as user ID) of the first bitmap.
[0084] The target population determination method provided in the embodiment of the present application, on the one hand, compresses the original user labels into the form of label bitmaps for storage, thereby greatly reducing the space requirements for data storage; on the other hand, by directly performing logical operations on the label bitmaps, it avoids the performance bottleneck caused by large amounts of data indexing and search operations in traditional methods, and can quickly process large amounts of data, thereby significantly improving the speed and efficiency of target population selection, and can easily cope with target user selection needs of different scales and complexities.
[0085] Figure 2 A flow chart of another method for determining a target population is provided for the embodiment of the present application, such as Figure 2 As shown, the target population determination method provided in this embodiment further includes steps S201-S203:
[0086] S201. Obtain tag data of each user tag, where the tag data includes a user identifier that satisfies the user tag.
[0087] The tag data of the user tag can be understood as the data of the user set that meets the user tag condition, and is used to indicate the users that meet the user tag condition.
[0088] The tag data of a user tag includes the user identification (e.g., user ID) of all users that meet the user tag, and the user identification is used to uniquely identify the user in the system. For example, for a user tag of "age: 30-40 years old", the tag data will include the user IDs of all users between the ages of 30 and 40.
[0089] S202: According to a preset label bitmap generation strategy, the label data of each user label is converted into a label bitmap of the user label.
[0090] The tag bitmap generation strategy can be understood as a method or rule for converting the tag data of the user tag into a binary bitmap. The purpose of this conversion is to more efficiently store and query user tag information and improve system processing speed.
[0091] The label bitmap generation strategy is pre-set and stored in the system configuration file or database. After obtaining the label data of each user label, the system calls the label bitmap generation strategy and converts each user's label data into a corresponding label bitmap according to the rules and methods defined in the label bitmap generation strategy.
[0092] S203: Store the tag bitmap of each user tag in the first database.
[0093] The first database is a data storage system specifically used to store user tag bitmaps, which can be a relational database, a NoSQL database, or other types of data storage systems. The specific choice depends on the system requirements, performance considerations, and technical architecture. The design of the first database should support operations such as storage, query, and analysis of bitmaps to quickly respond to storage and query requests for user tags.
[0094] Optionally, the first database may be a database such as ClickHouse database, Redis, MongoDB, etc. that supports bitmap storage, query, and analysis.
[0095] As an optional implementation, step S202 "converting the tag data of each user tag into a tag bitmap corresponding to the user tag according to a preset tag bitmap generation strategy" includes the following steps:
[0096] B1. Allocate an initial bitmap for the i-th user tag, and map the user identifiers of all users to different bits of the initial bitmap respectively. The length of the initial bitmap is greater than or equal to the total number of users, and i is a positive integer.
[0097] In the process of generating the user tag bitmap, it is first necessary to allocate an initial binary bitmap to each user tag. The initial bitmap will serve as a basic data structure indicating whether each user meets the user tag condition.
[0098] Specifically, an initial bitmap is created for the i-th user tag, and the length of the initial bitmap is greater than or equal to the total number of users in the system to ensure that there are enough bits in the initial bitmap to correspond to each user. If the number of users in the system is likely to grow, the length of the bitmap can be appropriately increased to reserve space for future expansion and avoid frequent adjustments to the bitmap size.
[0099] Then, the user identifications of all users are mapped to different bits of the initial bitmap, so that each user corresponds to a unique bit in the bitmap. The mapping can be implemented based on a certain rule, function or mapping algorithm of the user identification, so that each user can be uniquely and consistently mapped to a bit in the bitmap, and the user can be reversely searched from the bit in the bitmap. For example, a hash function or other mapping algorithm is used to convert the user identification into an index position in the bitmap.
[0100] B2. Traverse the tag data of the i-th user tag, set the bits of the user identifiers that meet the i-th user tag in the initial bitmap to the first preset value, and set the bits of the user identifiers that do not meet the i-th user tag in the initial bitmap to the second preset value, to obtain a tag bitmap of the i-th user tag.
[0101] After the user identifications of all users are mapped to different bits of the initial bitmap, the initial bitmap needs to be updated according to the tag data of the i-th user tag.
[0102] According to the foregoing content, it can be known that the i-th user tag data contains all user identifiers that meet the i-th user tag condition. Therefore, by traversing the tag data of the i-th user tag, all user identifiers that meet the i-th user tag condition can be obtained. For each user identifier that meets the i-th user tag condition, find its corresponding bit in the initial bitmap based on the mapping relationship in step B1, and set the value of the bit to a first preset value (such as 1), indicating that the user corresponding to the bit meets the i-th tag condition. For users who do not meet the i-th tag condition (for example, users who are not in the i-th tag data or the i-th tag data clearly indicates that the user does not meet the i-th tag condition), set the value of the corresponding bit in the i-th tag bitmap to a second preset value (such as 0), indicating that the user corresponding to the bit does not meet the i-th tag condition.
[0103] After processing in steps B1 and B2, a label bitmap of the i-th user label is obtained, and the label bitmap accurately reflects the users who meet the i-th user label condition and the users who do not meet the i-th user label condition.
[0104] It should be noted that the i-th user tag is any one of all user tags, and the above steps B1 and B2 are performed for each user tag to obtain a tag bitmap of each user tag.
[0105] Compared with the ordinary user tag storage method, converting the traditional user tag number into the tag bitmap of the user tag will reduce the demand for storage space. However, in some scenarios, the number of users is extremely large, and the tag bitmap of all user tags may still take up a lot of storage space. In particular, when there are a large number of repetitions or certain regularities in the user tag data, directly storing the bitmap data will lead to a waste of storage space.
[0106] As an optional implementation method, step S202 "converting the label data of each user label into a label bitmap corresponding to the user label according to a preset label bitmap generation strategy" also includes: selecting a suitable compression algorithm according to the data characteristics and storage requirements of the label bitmap (for example, run-length encoding is suitable for a large amount of continuous identical data, and Huffman encoding is suitable for situations where the frequency of data occurrence varies greatly), and using the compression algorithm to compress the label bitmap of each user label to obtain a compressed label bitmap.
[0107] This implementation method can further reduce the storage space occupied by the label bitmap by introducing a compression algorithm, especially when the number of users is large and there is a large amount of duplication or regularity in the label bitmap data. It helps to reduce storage costs, improve system processing speed, and enhance system scalability. At the same time, when the label bitmap needs to be queried or used, the system can quickly decompress the compressed label bitmap to meet real-time requirements.
[0108] As an optional implementation method, the first database is a ClickHouse database; in this implementation method, step S202 "converts the label data of each user label into the label bitmap of the user label according to the preset label bitmap generation strategy" includes: calling the bitmap function in the ClickHouse database to convert the label data of each user label into the label bitmap of the user label.
[0109] ClickHouse is a column-based database management system designed for online analytical processing (OLAP). It has high performance, high concurrent processing capability and low storage, and is particularly suitable for processing large-scale data sets and real-time analysis tasks, especially in bitmap storage, query and operation. The ClickHouse database provides a wealth of bitmap functions, such as groupBitmap, bitmapToArray, bitmapAnd, bitmapOr, etc., which can be directly used for bitmap construction, query and operation. Further, the ClickHouse database has good integration with other systems (such as data warehouses, data lakes, etc.), and can easily exchange and share data with other data sources, and the ClickHouse database supports horizontal expansion, which can expand storage and computing capabilities as the amount of data increases to meet growing business needs. Therefore, in an embodiment of the present application, selecting the ClickHouse database as the first database for storing user label bitmaps is an efficient and feasible solution, which can make full use of the bitmap functions provided to efficiently complete the conversion and storage of user label bitmaps, which not only improves the processing speed of the system, but also reduces storage costs and enhances the scalability and reliability of the system.
[0110] In the embodiment of the present application, the bitmap function in the ClickHouse database can be directly called to convert the label data of each user label into the label bitmap of the user label. Specifically, the groupBitmap function in the ClickHouse database and other functions for creating bitmaps are called, and the label data of the user label is used as the input of the function. The function will create a binary bitmap based on the label data of the input user label. In the bitmap, each bit corresponds to a possible user, and the value of the bit indicates whether the user meets the label condition. The bitmap is the label bitmap of the user label.
[0111] The created bitmap can be stored in a table in the ClickHouse database for subsequent query and analysis. Since ClickHouse has an optimized storage and query mechanism for bitmap data, storing bitmap data is usually more efficient than storing the original set of user identifiers. After storing the bitmap data in the database, you can use the bitmap query functions provided by ClickHouse to perform complex user tag queries and analysis.
[0112] In this implementation, on the one hand, the bitmap function of the ClickHouse database is optimized to efficiently process and operate large amounts of bitmap data to meet real-time or quasi-real-time data processing requirements; on the other hand, by calling ready-made bitmap functions, manual implementation of complex bitmap operation logic can be avoided, thereby simplifying the development process and reducing the risk of errors.
[0113] In the process of determining the target population, in order to further optimize the processing efficiency and reduce the delay of database query, improve the processing efficiency and response speed, this embodiment introduces a memory cache mechanism for user tags that need to be used frequently. Figure 3 As shown, the target population determination method provided in this embodiment further includes steps S301-S302:
[0114] S301: Store a tag bitmap of a first user tag set in a memory, wherein a usage frequency of each user tag in the first user tag set is greater than a first preset frequency.
[0115] In actual applications, some user tags may be used for selecting target groups more frequently than other tags due to their characteristics and application scenarios. These frequently used tags together constitute the first user tag set.
[0116] In step S301, the system identifies the first user tag set and stores the tag bitmap of the first user tag set in the system memory. Memory is a faster storage medium than traditional disks or solid-state drives. Storing the tag bitmap in memory can significantly speed up data access, thereby improving the processing efficiency of the entire system.
[0117] Furthermore, the system can identify the first user tag set by analyzing historical data, user behavior or business logic.
[0118] Optionally, the system determines which user tags belong to the first user tag set according to a preset first frequency threshold. When the usage frequency of a user tag is greater than the first preset frequency, the user tag is determined to be a high-frequency tag and added to the first user tag set. This process ensures that only tag bitmaps that really need to be quickly accessed will occupy valuable memory resources, while also avoiding unnecessary memory waste.
[0119] S302: When the target user tag includes a first target user tag in the first user tag set, read a tag bitmap of the first target user tag from a memory, where the tag bitmap of the first target user tag is used to participate in the first logical operation.
[0120] When the target user tag in the target group selection instruction includes a user tag in the first user tag set (i.e., the first target user tag), the tag bitmap of the first target user tag can be directly read from the memory without searching the database. In this way, the high-speed reading and writing capability of the memory can be used to quickly obtain the required tag bitmap data.
[0121] Subsequently, the tag bitmap of the first target user tag read from the memory will be used to participate in subsequent logical operations (such as the first logical operation in step S102) to determine a set of users that meet the target group selection instruction.
[0122] This implementation method improves the processing efficiency and response speed of the target population determination process by pre-storing the tag bitmap of frequently used user tags in memory and reading it directly from memory when needed. This optimization strategy is particularly important for processing large-scale user data and scenarios with high real-time requirements.
[0123] As an optional implementation method, the storage database of the label bitmap of each user label is the ClickHouse database;
[0124] Step S301 "storing the tag bitmap of the first user tag set into the memory" includes:
[0125] Using the Join table engine of the ClickHouse database, the label bitmap of the first user label set is loaded into the memory for caching.
[0126] The Join table engine provided by ClickHouse allows users to create temporary or persistent tables that can be efficiently joined with other tables during querying. In addition, the Join table engine supports loading table data directly into memory, which significantly speeds up queries.
[0127] For each user tag in the first user tag set, the system will define a table based on the Join table engine in ClickHouse, which will contain all the bitmap information of the corresponding user tag and set to memory mode. When the table is created, its data will be automatically loaded into the server's memory instead of being saved on disk.
[0128] When executing the target population selection instruction, if the target user tag in the target population selection instruction includes a tag in the first user tag set (ie, the first target user tag), the system can directly obtain the corresponding bitmap data from the Join table in the memory without accessing the database on the disk again.
[0129] The Join table engine of ClickHouse database is used to load the tag bitmap of the first user tag set into memory for caching, which not only improves the processing efficiency and response speed of the target population determination process, but also ensures that the system can maintain efficient performance even in the face of a large number of concurrent requests. In addition, since the Join table engine itself supports multiple types of join operations, this method also provides flexible support for subsequent complex queries that may be involved.
[0130] Exemplary Devices
[0131] Corresponding to the above-mentioned target population determination method, the embodiment of the present application also provides a target population determination device. Figure 4 is a schematic diagram of the structure of a target population determination device provided in an embodiment of the present application, such as Figure 4 As shown, the target population determination device provided in the embodiment of the present application includes:
[0132] The first unit 401 is used to obtain a target group selection instruction, wherein the target group selection instruction includes a target user tag and a first logical relationship between each target user tag, wherein the target user tag includes a single attribute user tag and / or a multi-attribute user tag, and the first logical relationship represents a combination mode between each target user tag;
[0133] The second unit 402 is used to perform a first logical operation on the label bitmap of each target user label according to the first logical relationship to obtain a first bitmap, wherein the value of each bit in the label bitmap indicates whether the user corresponding to the bit satisfies the target user label corresponding to the label bitmap, the first logical operation matches the first logical relationship, and the value of each bit in the first bitmap indicates whether the user corresponding to the bit satisfies the target group selection instruction;
[0134] The third unit 403 is used to determine the crowd package object corresponding to the target crowd selection instruction according to the first bitmap.
[0135] The target population determination device provided in the embodiment of the present application, on the one hand, represents user tags through bitmaps, thereby greatly reducing the space requirements for data storage; on the other hand, by directly performing logical operations on the tag bitmaps, it avoids the performance bottleneck caused by large amounts of data indexing and search operations in traditional methods, and can quickly process large amounts of data, thereby significantly improving the speed and efficiency of target population selection, and can easily cope with target user selection needs of different scales and complexities.
[0136] Optionally, the device further comprises:
[0137] A fourth unit is used to obtain tag data of each user tag, wherein the tag data includes a user identifier that satisfies the user tag;
[0138] A fifth unit, configured to convert the tag data of each user tag into a tag bitmap of the user tag according to a preset tag bitmap generation strategy;
[0139] The sixth unit is used to store the tag bitmap of each user tag in the first database.
[0140] Optionally, the fifth unit may be specifically used for:
[0141] For each user tag, do the following:
[0142] Assign an initial bitmap to the i-th user tag, map the user IDs of all users to different bits of the initial bitmap, the length of the initial bitmap is greater than or equal to the total number of users, and i is a positive integer;
[0143] Traversing the tag data of the i-th user tag, setting the bit of the user identifier that meets the i-th user tag in the initial bitmap to a first preset value, and setting the bit of the user identifier that does not meet the i-th user tag in the initial bitmap to a second preset value, to obtain a tag bitmap of the i-th user tag.
[0144] Optionally, the first database is a ClickHouse database; and the fifth unit can be specifically used for:
[0145] Call the bitmap function in the ClickHouse database to convert the label data of each user label into the label bitmap of the user label.
[0146] Optionally, the second unit 402 may be specifically configured to:
[0147] According to the user identifier of the j-th user, determine the bit corresponding to the j-th user in the label bitmap of each target user label, where j is a positive integer;
[0148] The first logical operation is performed on the bit corresponding to the j-th user in the label bitmap of each target user label to obtain the bit corresponding to the j-th user in the first bitmap.
[0149] Optionally, the device further comprises:
[0150] A seventh unit is used to store a tag bitmap of a first user tag set in a memory, wherein a usage frequency of each user tag in the first user tag set is greater than a first preset frequency;
[0151] The eighth unit is configured to read a tag bitmap of the first target user tag from a memory when the target user tag includes the first target user tag in the first user tag set, wherein the tag bitmap of the first target user tag is used to participate in the first logical operation.
[0152] Optionally, the storage database of the label bitmap of each user label is a ClickHouse database; the seventh unit can be specifically used for:
[0153] Using the Join table engine of the ClickHouse database, the label bitmap of the first user label set is loaded into the memory for caching.
[0154] The target population determination device provided in this embodiment belongs to the same application concept as the target population determination method provided in the above embodiments of this application, and can execute the target population determination method provided in any of the above embodiments of this application, and has the corresponding functional modules and beneficial effects of executing the target population determination method. For technical details not fully described in this embodiment, please refer to the specific processing content of the target population determination method provided in the above embodiments of this application, and will not be repeated here.
[0155] The functions implemented by the above first unit 401, second unit 402 and third unit 403 may be implemented by the same or different processors, respectively, and are not limited in the embodiment of the present application.
[0156] It should be understood that the units in the above devices can be implemented in the form of a processor calling software. For example, the device includes a processor, the processor is connected to a memory, and instructions are stored in the memory. The processor calls the instructions stored in the memory to implement any of the above methods or realize the functions of each unit of the device, wherein the processor can be a general-purpose processor, such as a CPU or a microprocessor, etc., and the memory can be a memory in the device or a memory outside the device. Alternatively, the units in the device can be implemented in the form of hardware circuits, and the functions of some or all units can be realized by designing the hardware circuits. The hardware circuit can be understood as one or more processors; for example, in one implementation, the hardware circuit is an ASIC, and the functions of some or all of the above units are realized by designing the logical relationship of the components in the circuit; for another example, in another implementation, the hardware circuit can be implemented by PLD, taking FPGA as an example, which can include a large number of logic gate circuits, and the connection relationship between the logic gate circuits is configured by the configuration file, so as to realize the functions of some or all of the above units. All units of the above devices can be implemented in the form of a processor calling software, or in the form of hardware circuits, or in part by a processor calling software, and the remaining part is implemented in the form of hardware circuits.
[0157] In an embodiment of the present application, a processor is a circuit with the ability to process signals. In one implementation, the processor may be a circuit with the ability to read and run instructions, such as a CPU, a microprocessor, a GPU, or a DSP; in another implementation, the processor may implement certain functions through the logical relationship of a hardware circuit, and the logical relationship of the hardware circuit is fixed or reconfigurable, such as a hardware circuit implemented by an ASIC or PLD, such as an FPGA. In a reconfigurable hardware circuit, the process of the processor loading a configuration document to implement the hardware circuit configuration can be understood as the process of the processor loading instructions to implement the functions of some or all of the above units. In addition, it can also be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as an NPU, TPU, DPU, etc.
[0158] It can be seen that each unit in the above device can be one or more processors (or processing circuits) configured to implement the above method, such as: CPU, GPU, NPU, TPU, DPU, microprocessor, DSP, ASIC, FPGA, or a combination of at least two of these processor forms.
[0159] In addition, all or part of the units in the above device can be integrated together, or can be implemented independently. In one implementation, these units are integrated together and implemented in the form of a SOC. The SOC may include at least one processor for implementing any of the above methods or implementing the functions of each unit of the device. The type of the at least one processor may be different, for example, including a CPU and an FPGA, a CPU and an artificial intelligence processor, a CPU and a GPU, etc.
[0160] Exemplary Electronic Devices
[0161] Another embodiment of the present application also provides an electronic device, see Figure 5 As shown, the device includes:
[0162] Memory 200 and processor 210;
[0163] The memory 200 is connected to the processor 210 and is used to store programs;
[0164] The processor 210 is used to implement the target population determination method disclosed in any of the above embodiments by running the program stored in the memory 200.
[0165] Specifically, the electronic device may further include: a bus, a communication interface 220 , an input device 230 and an output device 240 .
[0166] The processor 210, the memory 200, the communication interface 220, the input device 230 and the output device 240 are connected to each other via a bus.
[0167] A bus may include a pathway that transfers information between components of a computer system.
[0168] The processor 210 may be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the scheme of the present invention. It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0169] The processor 210 may include a main processor, and may also include a baseband chip, a modem, and the like.
[0170] The memory 200 stores a program for executing the technical solution of the present invention, and may also store an operating system and other key services. Specifically, the program may include a program code, and the program code includes a computer operation instruction. More specifically, the memory 200 may include a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM), other types of dynamic storage devices that can store information and instructions, a disk storage, a flash, and the like.
[0171] The input device 230 may include a device for receiving data and information input by a user, such as a keyboard, a mouse, a camera, a scanner, a light pen, a voice input device, a touch screen, a pedometer, or a gravity sensor.
[0172] Output device 240 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.
[0173] The communication interface 220 may include any transceiver or the like to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.
[0174] The processor 210 executes the program stored in the memory 200 and calls other devices, which can be used to implement each step of any target population determination method provided in the above embodiments of the present application.
[0175] An embodiment of the present application also proposes a chip, which includes a processor and a data interface. The processor reads and runs a program stored in a memory through the data interface to execute the target population determination method introduced in any of the above embodiments. The specific processing process and its beneficial effects can be found in the above-mentioned embodiment introduction of the target population determination method.
[0176] Exemplary computer program products and storage media
[0177] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the target population determination method according to various embodiments of the present application described in any of the above embodiments of this specification.
[0178] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0179] In addition, the embodiment of the present application may also be a storage medium on which a computer program is stored. The computer program is executed by a processor to execute the steps of the target population determination method according to various embodiments of the present application described in any of the above embodiments of this specification, and specifically the following steps may be implemented:
[0180] S101. Obtain a target population selection instruction, wherein the target population selection instruction includes a target user tag and a first logical relationship between each target user tag, wherein the target user tag includes a single-attribute user tag and / or a multi-attribute user tag, and the first logical relationship represents a combination method between each target user tag.
[0181] S102. According to the first logical relationship, a first logical operation is performed on the label bitmap of each target user label to obtain a first bitmap, wherein the value of each bit in the label bitmap represents whether the user corresponding to the bit satisfies the target user label corresponding to the label bitmap, the first logical operation matches the first logical relationship, and the value of each bit in the first bitmap represents whether the user corresponding to the bit satisfies the target population selection instruction.
[0182] S103: Determine, according to the first bitmap, a group package object corresponding to the target group selection instruction.
[0183] For the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0184] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0185] The steps in the methods of each embodiment of the present application can be adjusted in order, combined and deleted according to actual needs, and the technical features recorded in each embodiment can be replaced or combined.
[0186] The modules and sub-modules in the devices and terminals in the various embodiments of the present application can be combined, divided and deleted according to actual needs.
[0187] In the several embodiments provided in the present application, it should be understood that the disclosed terminals, devices and methods can be implemented in other ways. For example, the terminal embodiments described above are only schematic, for example, the division of modules or submodules is only a logical function division, and there may be other division methods in actual implementation, for example, multiple submodules or modules can be combined or integrated into another module, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0188] The modules or submodules described as separate components may or may not be physically separated, and the components of the modules or submodules may or may not be physical modules or submodules, that is, they may be located in one place, or they may be distributed on multiple network modules or submodules. Some or all of the modules or submodules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0189] In addition, each functional module or submodule in each embodiment of the present application may be integrated into one processing module, or each module or submodule may exist physically separately, or two or more modules or submodules may be integrated into one module. The above-mentioned integrated modules or submodules may be implemented in the form of hardware or in the form of software functional modules or submodules.
[0190] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0191] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly by hardware, software units executed by a processor, or a combination of the two. The software units may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0192] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0193] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for determining a target population, characterized in that: include: Acquire a target population selection instruction, wherein the target population selection instruction includes a target user tag and a first logical relationship between each target user tag, wherein the target user tag includes a single attribute user tag and / or a multi-attribute user tag, and the first logical relationship represents a combination mode between each target user tag; According to the first logical relationship, a first logical operation is performed on the label bitmap of each target user label to obtain a first bitmap, wherein the value of each bit in the label bitmap indicates whether the user corresponding to the bit satisfies the target user label corresponding to the label bitmap, the first logical operation matches the first logical relationship, and the value of each bit in the first bitmap indicates whether the user corresponding to the bit satisfies the target group selection instruction; According to the first bitmap, a crowd package object corresponding to the target crowd selection instruction is determined.
2. The method according to claim 1, characterized in that Before obtaining the target group selection instruction, the method further includes: Acquire tag data for each user tag, the tag data including a user identifier that satisfies the user tag; According to a preset label bitmap generation strategy, the label data of each user label is converted into a label bitmap of the user label; The tag bitmap of each user tag is stored in the first database.
3. The method according to claim 2, wherein the step of converting the tag data of each user tag into a tag bitmap corresponding to the user tag according to a preset tag bitmap generation strategy comprises: For each user tag, do the following: Assign an initial bitmap to the i-th user tag, map the user IDs of all users to different bits of the initial bitmap, the length of the initial bitmap is greater than or equal to the total number of users, and i is a positive integer; Traversing the tag data of the i-th user tag, setting the bit of the user identifier that meets the i-th user tag in the initial bitmap to a first preset value, and setting the bit of the user identifier that does not meet the i-th user tag in the initial bitmap to a second preset value, to obtain a tag bitmap of the i-th user tag.
4. The method according to claim 2, characterized in that: The first database is a ClickHouse database; The step of converting the tag data of each user tag into a tag bitmap of the user tag according to a preset tag bitmap generation strategy includes: Call the bitmap function of the ClickHouse database to convert the label data of each user label into the label bitmap of the user label.
5. The method according to claim 1, characterized in that The step of performing a first logical operation on the label bitmap of each target user label according to the first logical relationship to obtain a first bitmap includes: According to the user identifier of the j-th user, determine the bit corresponding to the j-th user in the label bitmap of each target user label, where j is a positive integer; The first logical operation is performed on the bit corresponding to the j-th user in the label bitmap of each target user label to obtain the bit corresponding to the j-th user in the first bitmap.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Storing a tag bitmap of a first user tag set in a memory, wherein the usage frequency of each user tag in the first user tag set is greater than a first preset frequency; When the target user tag includes the first target user tag in the first user tag set, a tag bitmap of the first target user tag is read from a memory, and the tag bitmap of the first target user tag is used to participate in the first logical operation.
7. The method according to claim 6, characterized in that The storage database of the label bitmap of each user label is the ClickHouse database; The step of storing the tag bitmap of the first user tag set in the memory includes: Using the Join table engine of the ClickHouse database, the label bitmap of the first user label set is loaded into the memory for caching.
8. A target population determination device, characterized in that: include: A first unit is used to obtain a target group selection instruction, wherein the target group selection instruction includes a target user tag and a first logical relationship between each target user tag, wherein the target user tag includes a single attribute user tag and / or a multi-attribute user tag, and the first logical relationship represents a combination method between each target user tag; A second unit is configured to perform a first logic operation on a label bitmap of each target user label according to the first logic relationship to obtain a first bitmap, wherein a value of each bit in the label bitmap indicates whether a user corresponding to the bit satisfies the target user label corresponding to the label bitmap, the first logic operation matches the first logic relationship, and a value of each bit in the first bitmap indicates whether a user corresponding to the bit satisfies the target group selection instruction; The third unit is used to determine the crowd package object corresponding to the target crowd selection instruction according to the first bitmap.
9. An electronic device, characterized in that: include: Memory and processor; The memory is connected to the processor and is used to store programs; The processor is used to implement the target population determination method as described in any one of claims 1 to 7 by running the program in the memory.
10. A computer program product, characterized in that The method comprises computer program instructions, which, when executed by a processor, enable the processor to implement the target population determination method according to any one of claims 1 to 7.