A user portrait construction method, device, equipment and storage medium
By obtaining user behavior data from the most recent N days from the behavior decay table and performing decay processing, the problems of low efficiency and insufficient accuracy in user profile construction in existing technologies are solved, and efficient and accurate user profile construction is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MIGU CO LTD
- Filing Date
- 2023-07-07
- Publication Date
- 2026-07-03
AI Technical Summary
Existing technologies for building user profiles suffer from low computational efficiency and high resource consumption due to excessively long historical behavior time periods, failing to meet business needs. Furthermore, the processing of backlogged users results in insufficient user coverage, and historical preferences are given too much weight in user profiles, making it impossible to obtain accurate user profiles.
By obtaining the target user's behavior data for the most recent N days from the behavior decay table, a target user profile is constructed. User behavior is distributed using decay processing and windowing, historical preference decay is performed based on user activity, and historical behavior data is merged and backtracked.
It improved the efficiency and accuracy of user profile building, shortened the total time, ensured the efficiency and user coverage of historical full-volume behavior processing, and solved the problems of returning users and historical preference decay.
Smart Images

Figure CN117009654B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and more specifically, to a method, apparatus, device, and storage medium for constructing user profiles. Background Technology
[0002] User profiles are virtual representations of real users. They are tagged information built on a series of attribute data and can be used to optimize service products and make personalized service recommendations.
[0003] Existing technologies typically calculate user profiles based on user behavior within a preset number of historical days. If the historical behavior period is too long, it will result in low calculation efficiency and high resource consumption, leading to excessive calculation time and failure to meet business needs. Furthermore, this approach may result in insufficient user coverage or excessive weighting of historical preferences in the user profile, making it impossible to obtain an accurate user profile. Summary of the Invention
[0004] Based on this, the present invention provides a user profile construction method, apparatus, device and storage medium, which can obtain target behavior data from a behavior decay table of user behavior spread over N time periods in response to a user profile construction instruction, so as to construct a target user profile, ensuring efficiency in processing all historical behaviors, shortening the total time of user profile construction and improving the accuracy of the constructed user profile.
[0005] To achieve the above objectives, embodiments of the present invention provide a user profile construction method, including:
[0006] In response to user profile building instructions, target behavior data is obtained based on the target user identifier;
[0007] A target user profile is constructed based on the target behavior data; wherein, the target behavior data is data obtained from the most recent N-day partition of the behavior decay table according to the target user identifier, the partition of the behavior decay table for a set date records the full user behavior data of the active users on the set date and the user historical behavior data obtained after decay processing for the full user data to be calculated on the set date; in the partition of the behavior decay table for a set date, the access date of the full user data to be calculated on the set date is set to the set date; in the partition of the behavior decay table for a set date, the full user data to be calculated on the set date includes the active users on the set date and users whose original access date was N days before the set date.
[0008] As an improvement to the above scheme, the behavior decay table is constructed in the following way:
[0009] Obtain the active users of the set date and the inactive users within N days, and merge them to obtain the total number of users to be calculated on the same day; wherein, the inactive users within N days are users whose access date is N days before the set date;
[0010] Obtain the full user behavior data of the active users of the day;
[0011] Based on the access date of each user in the total number of users to be calculated on that day, query the behavior attenuation table to obtain the total historical behavior of the total number of users to be calculated on that day, and perform attenuation processing on the total historical behavior to obtain user historical behavior data.
[0012] The full user behavior data for the day and the user historical behavior data are combined to obtain the full behavior data to be calculated for the day.
[0013] Set the access date of all users to be calculated on that day to the set date;
[0014] Write the full amount of behavior data to be calculated on the current day into the behavior decay table in the current day partition of the set date.
[0015] As an improvement to the above scheme, the number of inactive users within N days is obtained in the following way:
[0016] Query the partition data of the user mapping table for the day before the set date to obtain users whose access date is N days before the set date, and obtain users who have been inactive for N days; wherein, the user mapping table records user identification information and access dates associated with the user identification information;
[0017] The process of attenuating the full historical behavior data to obtain user historical behavior data includes: calculating the attenuation coefficient of each historical behavior in the full historical behavior based on the date difference between the access date and the current date, so as to obtain user historical behavior data.
[0018] The method further includes:
[0019] The data of all users to be calculated on the current day is merged with the data of the previous day's partition in the user mapping table for the set date, and then written into the current day's partition of the user mapping table for the set date.
[0020] As an improvement to the above solution, the step of obtaining target behavior data based on the target user identifier includes:
[0021] Based on the target user identifier, query the partitions of the behavior decay table for the most recent N days, determine the partitions that contain the behavior data of the target user identifier and have the closest date, and filter out the behavior data associated with the target user identifier from these partitions to use as the target behavior data.
[0022] As an improvement to the above scheme, the calculation of the attenuation coefficient for each historical behavior in the full historical data based on the date difference between the access date and the current day includes:
[0023] The attenuation coefficient for each historical behavior in the full historical data is calculated using the following formula:
[0024] decay_ratio 当日 = f(x) * decay_ratio 上次 ;
[0025] f(x)=exp(-1*decayRatio*x);
[0026] Among them, decay_ratio 当日 Decay_ratio represents the coefficient index for the day. 上次 The coefficient index represents the most recent one, f(x) represents the decay index, decayRatio represents the preset constant, and x represents the difference between the access date associated with the historical behavior and the current date.
[0027] As an improvement to the above solution, obtaining the full daily user behavior data of the active users of that day includes:
[0028] Obtain the raw user behavior data of the current active user for the day from the behavior details table; wherein, each raw behavior data in the raw user behavior data for the day includes at least the user identification information, behavior event type and behavior event source identifier;
[0029] Based on the user identification information, the behavior event type, and the behavior event source identifier, each behavior raw data in the daily user behavior raw data is classified and merged to obtain the daily full user behavior data of the daily active users.
[0030] As an improvement to the above scheme, the user identification information includes the user's mobile phone number and the user's device number;
[0031] After classifying and merging each behavior's raw data in the daily user behavior raw data according to the user identification information, the behavior event type, and the behavior event source identifier to obtain the daily full user behavior data of the daily active users, the process further includes:
[0032] By associating the user mapping table, information is supplemented for user behaviors that lack the user's mobile phone number in the total user behavior of the day, based on the user's device number;
[0033] Each behavior data point in the complete daily user behavior data is categorized and merged to update the daily user behavior data.
[0034] As an improvement to the above scheme, when there is behavior data in the decay coefficient of the full amount of user behavior data on the same day with a value greater than a preset threshold, an exponential function is used to constrain it so that the decay coefficient falls within the preset threshold.
[0035] As an improvement to the above scheme, the user identification information includes the user's mobile phone number and user device number, and the user mapping table also records the access type associated with the user identification information; the access type is regular login, anonymous, copy, or first login;
[0036] When the historical behavior of a user whose access type is regular login or copy is obtained from the behavior decay table, the historical behavior is obtained based on the user's mobile phone number.
[0037] When the historical behavior of a user whose access type is anonymous or who is logging in for the first time is obtained from the behavior decay table, the historical behavior is obtained based on the user device number.
[0038] To achieve the above objectives, embodiments of the present invention also provide a user profile building apparatus, comprising:
[0039] The behavior data acquisition module is used to obtain target behavior data based on the target user identifier in response to user profile building instructions;
[0040] The user profile building module is used to build a target user profile based on the target behavior data. The target behavior data is data obtained from the most recent N-day partition of the behavior decay table based on the target user identifier. The partition of the behavior decay table for a set date records the full user behavior data of the active users on the set date and the user historical behavior data of the full users to be calculated on the set date after decay processing. In the partition of the behavior decay table for a set date, the access date of the full users to be calculated on the set date is set to the set date. In the partition of the behavior decay table for a set date, the full users to be calculated on the set date include the active users on the set date and users whose original access date was N days before the set date.
[0041] To achieve the above objectives, embodiments of the present invention also provide a user profile building device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the user profile building method as described in any of the above embodiments.
[0042] To achieve the above objectives, embodiments of the present invention also provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the user profile construction method as described in any of the above embodiments.
[0043] Compared with existing technologies, the user profile construction method, apparatus, device, and storage medium disclosed in this invention, in response to a user profile construction instruction, obtains target behavior data based on a target user identifier for constructing a target user profile. The target behavior data is obtained from the most recent N-day partition of a behavior decay table based on the target user identifier. The partition of the behavior decay table for a set date records the full user behavior data of active users on the set date and the user historical behavior data of all users to be calculated on that day after decay processing. In the partition of the behavior decay table for a set date, the access date of all users to be calculated on that day is set to the set date. In the partition of the behavior decay table for a set date, the all users to be calculated on that day include active users on the set date and users whose original access date was N days before the set date. Therefore, this invention distributes user behavior evenly over N time periods using a windowing approach and performs historical preference decay based on user activity, ensuring efficiency in processing all historical behavior, shortening the total time for user profile construction, and improving the accuracy of the constructed user profile. Attached Figure Description
[0044] To more clearly illustrate the technical solution of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0045] Figure 1 This is a flowchart illustrating a user profile construction method according to an embodiment of the present invention;
[0046] Figure 2 This is a schematic diagram of a user profile construction process provided in an embodiment of the present invention;
[0047] Figure 3 This is a schematic diagram of a user mapping table update provided in an embodiment of the present invention;
[0048] Figure 4 This is a schematic diagram of user history behavior processing provided in an embodiment of the present invention;
[0049] Figure 5This is a schematic diagram of daily user behavior processing provided by an embodiment of the present invention;
[0050] Figure 6 This is a schematic diagram of a user profile calculation table provided in an embodiment of the present invention. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] See Figure 1 This is a flowchart illustrating a user profile construction method provided in an embodiment of the present invention.
[0053] Specifically, the user profile construction method includes steps S1 to S2:
[0054] S1. Responding to the user profile building instruction, obtain target behavior data based on the target user identifier;
[0055] S2. Construct a target user profile based on the target behavior data; wherein, the target behavior data is data obtained from the most recent N-day partition of the behavior decay table based on the target user identifier, the partition of the behavior decay table for a set date records the full user behavior data of the active users on the set date and the user historical behavior data obtained after decay processing for the full user data to be calculated on the set date; in the partition of the behavior decay table for a set date, the access date of the full user data to be calculated on the set date is set to the set date; in the partition of the behavior decay table for a set date, the full user data to be calculated on the set date includes the active users on the set date and users whose original access date was N days before the set date.
[0056] This invention distributes user behavior across N time periods using a windowing approach and decays historical preferences based on user activity levels, ensuring efficiency in processing all historical behaviors, shortening the total time for building user profiles, and improving the accuracy of the resulting user profiles.
[0057] In a preferred embodiment, the behavior decay table is constructed in the following manner:
[0058] Obtain the active users of the set date and the inactive users within N days, and merge them to obtain the total number of users to be calculated on the same day; wherein, the inactive users within N days are users whose access date is N days before the set date;
[0059] Obtain the full user behavior data of the active users of the day;
[0060] Based on the access date of each user in the total number of users to be calculated on that day, query the behavior attenuation table to obtain the total historical behavior of the total number of users to be calculated on that day, and perform attenuation processing on the total historical behavior to obtain user historical behavior data.
[0061] The full user behavior data for the day and the user historical behavior data are combined to obtain the full behavior data to be calculated for the day.
[0062] Set the access date of all users to be calculated on that day to the set date;
[0063] Write the full amount of behavior data to be calculated on the current day into the behavior decay table in the current day partition of the set date.
[0064] The embodiments of the present invention can merge, associate, decay, and backtrack user behavior, distribute user behavior evenly over N time periods through a windowing approach, and decay historical preferences based on user activity, thereby ensuring efficiency in processing all historical behaviors, shortening the total time for building user profiles, and improving the accuracy of the user profiles built.
[0065] In a preferred embodiment, the number of inactive users within the past N days is obtained through the following method:
[0066] Query the partition data of the user mapping table for the day before the set date to obtain users whose access date is N days before the set date, and obtain users who have been inactive for N days; wherein, the user mapping table records user identification information and access dates associated with the user identification information;
[0067] The process of attenuating the full historical behavior data to obtain user historical behavior data includes: calculating the attenuation coefficient of each historical behavior in the full historical behavior based on the date difference between the access date and the current date, so as to obtain user historical behavior data.
[0068] The method further includes:
[0069] The data of all users to be calculated on the current day is merged with the data of the previous day's partition in the user mapping table for the set date, and then written into the current day's partition of the user mapping table for the set date.
[0070] Specifically, this embodiment of the invention involves data interaction across multiple data tables, which mainly include a content profile table, a behavior detail table, a user mapping table, a behavior decay table, and a user profile table. A brief introduction to each data table follows:
[0071] Content profile table: Records the tag information corresponding to each piece of content. The primary key ID is the content ID, and other fields are the tag information of the content, such as author, style, etc., which are generated by other systems.
[0072] Behavior Details Table: Records raw user behavior data. This table is partitioned by day, and each partition records all user behavior for that day, including date, user information, behavior type, content ID, and other behavioral data. It is generated through the event tracking system.
[0073] User mapping table: Partitioned by day, it records the updated full mapping information every day. Important fields include dayid (e.g., 20220629, 20220630, which is the partition field of this table), user mobile phone number (phone_num), user device number (client_id), user access date (visit_day), etc.
[0074] Behavior decay table: Partitioned by day, it records all behaviors of active users on that day. Important fields include dayid (e.g., 20220629, 20220630, which are the partition fields of this table), user mobile phone number, user device number, behavior type, content ID, behavior coefficient, etc.
[0075] The user profile table is partitioned by day, recording the profile of the user corresponding to that day. Important fields include dayid (e.g., 20220629, 20220630, which is the partition field of this table), user device number, user preference information, etc.
[0076] For example, see Figure 2 The diagram shown illustrates a user profile building process, which is as follows:
[0077] The first step is to query the behavior details table by date to obtain the active users of that day, including information such as user mobile phone number, device number, and access time.
[0078] The second step is to query the user mapping table for yesterday's partition data, retrieve users whose access date was N days ago, and obtain the inactive users within the past N days. If the first N days are calculated, the result of this step will be empty.
[0079] The main purpose of this step is to evenly distribute all users across N days using N as the period, and to establish an index relationship for the partitions where users' historical behavior is located. When querying users' historical behavior later, it is only necessary to search within the partitions of the behavior decay table for the most recent N days, without performing a full table scan, which greatly improves query efficiency.
[0080] The third step is to merge the calculation results of the first and second steps to obtain the total number of users to be calculated for the day. During the merging process, users will be identified and distinguished by type to differentiate the way they query historical behavior.
[0081] The fourth step is to record the date of access of all users to be calculated on the current day as the current day, and merge it with the total number of users from yesterday in the mapping table, and write it to the current day partition. At this point, the update of the user mapping table is completed.
[0082] For example, see Figure 3 The diagram shown illustrates a user mapping table update. The main fields of the table are as follows:
[0083] phone_num: User's mobile phone number. This field has a value after the user logs in and is used to identify the logged-in user.
[0084] client_id: Device ID, has a value regardless of whether the user is logged in, and is used to identify anonymous users;
[0085] visit_day: The date of the user's last visit, mainly used to query the user's historical behavior;
[0086] user_ffag: Access type, marking various types of users each day: 1. Non-first-time login (regular login), 2. Anonymous, 3. Copy, 4. First-time login.
[0087] from Figure 3 As can be seen from the data, the date is 20220630. The full mapping of the 20220629 partition in the user mapping table is merged with the daily active user mapping obtained from the behavior details table. Figure 3 In the sample data shown, the data for the current day and historical data are merged during the calculation. The basic rules for merging are: only one mapping relationship for the same phone_num and client_id is kept, and the maximum value of visit_day is taken.
[0088] Examples of detailed rules:
[0089] The user clientid0001 can be found in the behavior details table, that is, they visited on 20220630. There is no historical access information, but a mobile phone number exists. Therefore, visit_day is 20220630 and user_ffag is 1.
[0090] The user clientid0002 can be found in the behavior details table, that is, he visited on 20220630. He also exists in the historical data and his mobile phone number exists. Therefore, visit_day is the maximum value of 20220630 and user_ffag is 1.
[0091] The user clientid0003 can be found in the behavior details table, which shows that they visited on 20220630. Since there is no mobile phone number in the historical data, it indicates that they logged in for the first time on 20220630. Therefore, visit_day is the maximum value of 20220630, and user_ffag is 4.
[0092] The user clientid0004 can be found in the behavior details table, that is, he visited on 20220630. There is no historical data and no mobile phone number. Therefore, visit_day is the maximum value of 20220630 and user_ffag is 2.
[0093] The users clientid0005 and clientid0006 do not exist in the behavior details table, which means they did not access the data on 20220630. You can simply copy the historical data.
[0094] The user clientid0007 has been inactive for 30 days. In this example, the time period N is 30 days, so when copying this data, visit_day is marked as 20220630, and user_ffag is recorded as 3. When calculating historical behavior on the same day (i.e., 20220630), the behavior of this type of user is slightly decayed and recorded in the 20220630 partition of the behavior decay table. The visit_day in this table represents which partition the user's latest behavior is in. Therefore, when calculating the user's related data again, the user's historical behavior can be directly found based on visit_day. In this way, users who have been inactive for 30 days are copied and decayed again during daily calculations, ensuring that the historical behavior of all users is definitely within the 30-day partition of the behavior decay table, thus avoiding a full table scan.
[0095] Through the above processing, the following functions were achieved:
[0096] A full user mapping relationship has been established. For anonymous behavior without a mobile phone number, the user mapping table can be referenced to complete the mobile phone number.
[0097] Record the user's last access date on or before the current day for historical behavior tracking;
[0098] For users who have been inactive for more than N days, update their access date to the current day to control the scope of historical data retrieval;
[0099] Different logic is applied when processing historical behavior and attenuation based on user identifiers; see User Behavior Processing for details.
[0100] The fifth step is to query the behavior details table by date to obtain the full user behavior data for that day, and then merge the behavior data according to information such as user, program, and behavior type. For behaviors without a mobile phone number, it is necessary to associate with the user mapping table to fill in the mobile phone number and obtain the "user behavior data for that day".
[0101] This step merged data across user, program, and behavior dimensions, and then performed a second merge after supplementing the phone number information by associating user mapping data, which greatly reduced the amount of user behavior data involved in the calculation each day.
[0102] Step 6: Using the full set of users to be calculated on the day obtained in Step 3, query the behavior decay table and obtain the full set of users' historical behavior according to the user's last access date; and calculate the decay coefficient according to the date difference between the user's last access date and the current day to obtain the final user historical behavior data to be included in the calculation.
[0103] This step differentiates between highly active and inactive users by specifying different attenuation coefficients based on access time differences, thus preserving historical preferences for inactive users as much as possible.
[0104] For example, see Figure 4 , Figure 4 This is a schematic diagram of user history behavior processing provided by an embodiment of the present invention. The main fields of the behavior decay table are as follows:
[0105] phone_num: User's mobile phone number, which records the mobile phone number for each behavior event; it can be empty.
[0106] client_id: User device ID, records the device ID for each action event, and cannot be empty;
[0107] event_id: Behavior event type, records the type of this behavior event, used to assign different weights;
[0108] source_id: Records the resource ID at the time each behavioral event occurs; cannot be empty.
[0109] decay_ratio: decay coefficient, which records the coefficient for each behavior. The older the behavior, the lower the coefficient.
[0110] The following example illustrates the attenuation logic:
[0111] In the full mapping relationship of user mapping table 20220630, the data with visit_day set to 20220630 is linked with the full mapping relationship data of user mapping table 20220629 to obtain its last access date. Because after a user visits each day, their behavior is recorded in the partition for that day during calculation, their historical behavior can be obtained by querying the corresponding partition of the behavior decay table based on their last access date.
[0112] First, for users whose access date is today (including copy users) in the full mapping of the day, query the full mapping of yesterday to obtain the mapping relationship and the last access time;
[0113] Then, based on the access time, the user's history for that day can be retrieved:
[0114] For users with user_ffag values of 1 and 3, use phone_num to retrieve historical behavior.
[0115] For users with user_ffag=2, historical behavior is retrieved using client_id;
[0116] For users with user_ffag of 4, use client_id to retrieve historical behavior and associate the behavior with phone_num;
[0117] Finally, the retrieved historical behaviors are attenuated to varying degrees based on the difference between the current date and the previous date. The larger the difference, the less active the user, and the smaller the attenuation.
[0118] Decay function: f(x) = exp(-1 * decayRatio * x)
[0119] Here, decayRatio is a configurable item that adjusts the rate of decay; x represents the number of days of difference.
[0120] Figure 4 Users with a `user_ffag` value of 3 have not visited the site in the past 30 days (i.e., they haven't participated in any calculations within the past 30 days). We recorded `visit_day` as 20220630 in the user mapping table 20220630, creating a "false visit". Therefore, during the calculation, we need to copy the behavioral data of these users from 30 days ago (i.e., 20220531), perform a slight attenuation, and then record it in the 20220630 partition. After this processing, the user mapping table's `visit_day` will be 20220630, and their historical behavioral data will also be in the 20220630 partition of the behavior attenuation table. So, if the user visits the site within the next 30 days, querying the data in the 30-day partition will definitely reveal their historical behavior; if the user hasn't visited the site in 30 days, we can continue copying and attenuating.
[0121] This applies to all users as well, ensuring that when querying user history behavior each day, only the historical behavior within the N-day interval (30 in this example) needs to be performed to cover all users within the client, without performing a full table scan, which greatly improves computational efficiency.
[0122] Step 7: Combine the calculation results of steps 5 and 6 to obtain the full amount of behavioral data to be calculated for the day, and impose appropriate constraints on the coefficients that are too large after merging.
[0123] For example, the user's current day behavior is merged with the user's historical behavior to obtain the total behavior to be calculated for the current day. This merged behavior is then constrained using an exponential function to ensure it remains within a reasonable range for any merged behavior with excessively large coefficients. The merged behavior for the current day is then recorded in the current day's partition of the behavior decay table (e.g., partition 20220630 in this example). This write-back process ensures that in subsequent daily calculations, for a user with visit_day 20220630, querying this partition will retrieve their historical behavior. Up to this step, by using the user mapping table and the behavior decay table, the behavior of all users within the client is constrained to the N-day partition of the behavior decay table. Furthermore, similar behaviors for the same program by a user are merged into a single record. This solves the problem of excessive data partitions and large data volume when querying historical data, greatly improving query efficiency.
[0124] Step 8: Write all the full behavioral data to be calculated for the day from Step 7 into the partition for that day. For a given user, if they are not active for the next N days, all their historical behaviors can be queried in the partition written to this data when they participate in the calculation N days later. At this point, the querying, merging, and writing back of user's daily and historical behaviors are complete. It should be noted that "yesterday" and "N days ago" here are relative to "today." For example, when constructing the partition for 20220630, "today" refers to 20220630, and "yesterday" refers to 20220629.
[0125] The above steps, working in conjunction with steps two and four, distribute all user behavior over a time period of N days. Within the N-day partitioned data, the user's historical behavior can definitely be queried, avoiding a full table scan and improving execution efficiency.
[0126] Step 9: Using the full set of behavioral data to be calculated for the day from Step 7, link it to the content profile table to calculate a user profile for each user based on their behavior.
[0127] In a preferred embodiment, obtaining target behavior data based on the target user identifier includes:
[0128] Based on the target user identifier, query the partitions of the behavior decay table for the most recent N days, determine the partitions that contain the behavior data of the target user identifier and have the closest date, and filter out the behavior data associated with the target user identifier from these partitions to use as the target behavior data.
[0129] This is understandable. The user mapping table is queried daily to determine inactive users from the previous day's partitions. This data is then combined with the current day's active users to generate behavioral data for each day's partition in the relevant data table. This distributes all user behavior across the N-day timeframe, resulting in a smaller total data volume but higher user coverage. Furthermore, during the data update process, historical data undergoes attenuation processing. As time progresses, the weight of historical data in user profile construction gradually decreases to prevent excessive weighting of historical data in user profiles, which could lead to inaccurate user profiles. Therefore, when generating user profile emails, the historical behavioral data obtained should be from the partition closest to the current day.
[0130] In a preferred embodiment, calculating the attenuation coefficient for each historical behavior in the full historical data based on the date difference between the access date and the current day includes:
[0131] The attenuation coefficient for each historical behavior in the full historical data is calculated using the following formula:
[0132] decay_ratio 当日 = f(x) * decay_ratio 上次 ;
[0133] f(x)=exp(-1*decayRatio*x);
[0134] Among them, decay_ratio 当日 Decay_ratio represents the coefficient index for the day. 上次 The coefficient index represents the most recent one, f(x) represents the decay index, decayRatio represents the preset constant, and x represents the difference between the access date associated with the historical behavior and the current date.
[0135] In a preferred embodiment, obtaining the full daily user behavior data of the active users of the day includes:
[0136] Obtain the raw user behavior data of the current active user for the day from the behavior details table; wherein, each raw behavior data in the raw user behavior data for the day includes at least the user identification information, behavior event type and behavior event source identifier;
[0137] Based on the user identification information, the behavior event type, and the behavior event source identifier, each behavior data in the original user behavior data of the day is classified and merged to obtain the full user behavior data of the active users of the day.
[0138] In a preferred embodiment, the user identification information includes the user's mobile phone number and user device number; after classifying and merging each original behavior data in the original user behavior data of the day according to the user identification information, the behavior event type, and the behavior event source identifier to obtain the full user behavior data of the active users of the day, the method further includes:
[0139] By associating the user mapping table, information is supplemented for user behaviors that lack the user's mobile phone number in the total user behavior of the day, based on the user's device number;
[0140] Each behavior data point in the complete daily user behavior data is categorized and merged to update the daily user behavior data.
[0141] For example, see Figure 5 , Figure 5 This is a schematic diagram of daily user behavior processing provided by an embodiment of the present invention. Taking user clientid0002 as an example, all behaviors of active users on the same day are categorized by phone_num, client_id, event_id (behavior event type), and source_id (behavior event source identifier), and associated with mobile phone numbers. Only one behavior is ultimately retained. Then, an initial decay coefficient, decay_ratio, is calculated. The initial decay coefficient varies depending on the behavior type.
[0142] Playback behavior: The basic coefficient for playback behavior is the completion rate, which is "playtime / total duration". The total duration is a basic attribute of the content. Other behaviors can be directly queried in the content attribute table by source_id. The basic coefficient is 1, such as the user_share behavior in the example.
[0143] Through the above merging, association, and secondary merging, the daily behavior data of clientid0002 is finally obtained, including phone_num, client_id, event_id, source_id, and decay_ratio information. This data is temporarily reserved. In the process of merging the user's daily behavior and the user's historical behavior, it will be merged with the decayed historical behavior of clientid0002 to obtain the full behavior data of clientid0002 within the client.
[0144] In a preferred embodiment, when there is behavioral data in the attenuation coefficient that has a value greater than a preset threshold, an exponential function is used to constrain it so that each behavioral data of the attenuation coefficient falls within the preset threshold.
[0145] In a preferred embodiment, the user identification information includes the user's mobile phone number and user device number, and the user mapping table also records the access type associated with the user identification information; the access type is regular login, anonymous, copy, or first login;
[0146] When the historical behavior of a user whose access type is regular login or copy is obtained from the behavior decay table, the historical behavior is obtained based on the user's mobile phone number.
[0147] When the historical behavior of a user whose access type is anonymous or who is logging in for the first time is obtained from the behavior decay table, the historical behavior is obtained based on the user device number.
[0148] Further, see Figure 6 , Figure 6 This is a schematic diagram of a user profile calculation table provided in an embodiment of the present invention. The behavior decay table is queried for the current day's partition to obtain the user behaviors to be calculated that day. Then, it is associated with the content profile table. Based on the tags corresponding to each content ID of the user behavior, the user profile is colored to finally obtain the user profile. Here, the content ID corresponds to the behavior event source identifier. Each content ID in the content profile table is associated with tags such as category (level 1), type (level 2), actor (level 3), and keyword (level 3). Each level has a corresponding weight: level 1 tag weight is 0.25, level 2 tag weight is 0.5, and level 3 tag weight is 1. Different behavior event types contain different behavior weights; for example, the behavior weight of user_play is 1, and the behavior weight of user_share is 1.5. The score of a single tag is equal to the decay coefficient multiplied by the behavior weight multiplied by the tag level weight.
[0149] Compared with existing technologies, this technology merges, correlates, decays, and backtracks user behaviors at the user behavior level. By using a windowing approach, user behaviors are evenly distributed over N time periods, which solves the shortcomings of existing technologies in handling returning users and historical preference decay. This greatly improves user coverage and perfectly solves the problem of backtracking and correlated historical behaviors after anonymous users log in, ensuring efficiency in processing all historical behaviors and achieving accurate calculation of the full user profile within the app.
[0150] This invention also provides a user profile building apparatus, comprising:
[0151] The behavior data acquisition module is used to obtain target behavior data based on the target user identifier in response to user profile building instructions;
[0152] The user profile building module is used to build a target user profile based on the target behavior data. The target behavior data is data obtained from the most recent N-day partition of the behavior decay table based on the target user identifier. The partition of the behavior decay table for a set date records the full user behavior data of the active users on the set date and the user historical behavior data of the full users to be calculated on the set date after decay processing. In the partition of the behavior decay table for a set date, the access date of the full users to be calculated on the set date is set to the set date. In the partition of the behavior decay table for a set date, the full users to be calculated on the set date include the active users on the set date and users whose original access date was N days before the set date.
[0153] It is worth noting that the specific working process of the user profile building device can be referred to the working process of the user profile building method described in the above embodiments, and will not be repeated here.
[0154] Compared with existing technologies, the user profile construction apparatus disclosed in this invention, in response to a user profile construction instruction, obtains target behavior data based on a target user identifier for constructing a target user profile. The target behavior data is obtained from the most recent N-day partition of a behavior decay table based on the target user identifier. The partition of the behavior decay table for a set date records the full user behavior data of active users on the set date and the user historical behavior data of all users to be calculated on that day after decay processing. In the partition of the behavior decay table for a set date, the access date of all users to be calculated on that day is set to the set date. In the partition of the behavior decay table for a set date, the all users to be calculated on that day include active users on the set date and users whose original access date was N days before the set date. Therefore, this invention distributes user behavior evenly over N time periods using a windowing approach and performs historical preference decay based on user activity, ensuring efficiency in processing all historical behavior, shortening the total time for user profile construction, and improving the accuracy of the constructed user profile.
[0155] This invention also provides a user profile building device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the steps described in the user profile building method embodiments above, for example... Figure 1 The steps S1 to S2 described above; or, when the processor executes the computer program, it implements the functions of each module in the above-described device embodiments.
[0156] For example, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the user profile building device. For example, the computer program can be divided into a behavioral data acquisition module and a user profile building module, with the specific functions of each module as follows:
[0157] The behavior data acquisition module is used to obtain target behavior data based on the target user identifier in response to user profile building instructions;
[0158] The user profile building module is used to build a target user profile based on the target behavior data. The target behavior data is data obtained from the most recent N-day partition of the behavior decay table based on the target user identifier. The partition of the behavior decay table for a set date records the full user behavior data of the active users on the set date and the user historical behavior data of the full users to be calculated on the set date after decay processing. In the partition of the behavior decay table for a set date, the access date of the full users to be calculated on the set date is set to the set date. In the partition of the behavior decay table for a set date, the full users to be calculated on the set date include the active users on the set date and users whose original access date was N days before the set date.
[0159] The specific working process of each module can be referred to the working process of the user profile building device described in the above embodiments, and will not be repeated here.
[0160] The user profile building device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The user profile building device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the user profile building device may also include input / output devices, network access devices, buses, etc.
[0161] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the user profile building device, connecting all parts of the device via various interfaces and lines.
[0162] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the user profile building device by running or executing the computer programs and / or modules stored in the memory and by calling the data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as image playback function), etc.; the data storage area may store data created based on the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0163] If the modules integrated into the user profile building device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0164] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for constructing user profiles, characterized in that, include: In response to user profile building instructions, target behavior data is obtained based on the target user identifier; A target user profile is constructed based on the target behavior data; wherein, the target behavior data is data obtained from the most recent N-day partition of the behavior decay table according to the target user identifier, the set date partition of the behavior decay table records the full user behavior data of the active users on the set date and the user historical behavior data obtained after decay processing for the full users to be calculated on the set date; in the set date partition of the behavior decay table, the access date of the full users to be calculated on the set date is set to the set date; in the set date partition of the behavior decay table, the full users to be calculated on the set date include the active users on the set date and users whose original access date was N days before the set date; The behavior decay table is constructed in the following manner: Obtain the active users of the set date and the inactive users within N days, and merge them to obtain the total number of users to be calculated on the same day; wherein, the inactive users within N days are users whose access date is N days before the set date; Obtain the full user behavior data of the active users of the day; Based on the access date of each user in the total number of users to be calculated on that day, query the behavior attenuation table to obtain the total historical behavior of the total number of users to be calculated on that day, and perform attenuation processing on the total historical behavior to obtain user historical behavior data. The full user behavior data for the day and the user historical behavior data are combined to obtain the full behavior data to be calculated for the day. Set the access date of all users to be calculated on that day to the set date; Write the full amount of behavior data to be calculated on the current day into the behavior decay table in the current day partition of the set date.
2. The user profile construction method as described in claim 1, characterized in that, The number of inactive users within the past N days was obtained through the following method: Query the partition data of the user mapping table for the day before the set date to obtain users whose access date is N days before the set date, and obtain users who have been inactive for N days; wherein, the user mapping table records user identification information and access dates associated with the user identification information; The step of attenuating the full historical behavior to obtain user historical behavior data includes: calculating the attenuation coefficient of each historical behavior in the full historical behavior based on the date difference between the access date and the current day, so as to obtain the user historical behavior data. The method further includes: The data of all users to be calculated on the current day is merged with the data of the previous day's partition in the user mapping table for the set date, and then written into the current day's partition of the user mapping table for the set date.
3. The user profile construction method as described in claim 1, characterized in that, The step of obtaining target behavior data based on the target user identifier includes: Based on the target user identifier, query the partitions of the behavior decay table for the most recent N days, determine the partitions that contain the behavior data of the target user identifier and have the closest date, and filter out the behavior data associated with the target user identifier from these partitions to use as the target behavior data.
4. The user profile construction method as described in claim 2, characterized in that, The calculation of the attenuation coefficient for each historical behavior in the full historical data based on the date difference between the access date and the current day includes: The attenuation coefficient for each historical behavior in the full historical data is calculated using the following formula: decay_ratio 当日 = f(x)* decay_ratio 上次 ; f(x)=exp(-1*decayRatio*x); Among them, decay_ratio 当日 Decay_ratio represents the coefficient index for the day. 上次 The coefficient index represents the most recent one, f(x) represents the decay index, decayRatio represents the preset constant, and x represents the difference between the access date associated with the historical behavior and the current date.
5. The user profile construction method as described in claim 2, characterized in that, The acquisition of the full user behavior data of the active users of the day includes: Obtain the raw user behavior data of the current active user for the day from the behavior details table; wherein, each raw behavior data in the raw user behavior data for the day includes at least the user identification information, behavior event type and behavior event source identifier; Based on the user identification information, the behavior event type, and the behavior event source identifier, each behavior raw data in the daily user behavior raw data is classified and merged to obtain the daily full user behavior data of the daily active users.
6. The user profile construction method as described in claim 5, characterized in that, The user identification information includes the user's mobile phone number and the user's device number; After classifying and merging each behavior's raw data in the daily user behavior raw data according to the user identification information, the behavior event type, and the behavior event source identifier to obtain the daily full user behavior data of the daily active users, the process further includes: By associating the user mapping table, information is supplemented for user behaviors that lack the user's mobile phone number in the total user behavior of the day, based on the user's device number; Each behavior data point in the complete daily user behavior data is categorized and merged to update the daily user behavior data.
7. The user profile construction method as described in claim 5 or 6, characterized in that, When there is behavior data in the decay coefficient of the full user behavior data of the day that has a value greater than a preset threshold, an exponential function is used to constrain it so that the decay coefficient falls within the preset threshold.
8. The user profile construction method as described in claim 2, characterized in that, The user identification information includes the user's mobile phone number and user device number. The user mapping table also records the access type associated with the user identification information. The access type is regular login, anonymous, copy, or first login. When the historical behavior of a user whose access type is regular login or copy is obtained from the behavior decay table, the historical behavior is obtained based on the user's mobile phone number. When the historical behavior of a user whose access type is anonymous or who is logging in for the first time is obtained from the behavior decay table, the historical behavior is obtained based on the user device number.
9. A user profile building device, characterized in that, include: The behavior data acquisition module is used to obtain target behavior data based on the target user identifier in response to user profile building instructions; The user profile building module is used to build a target user profile based on the target behavior data. The target behavior data is data obtained from the most recent N-day partition of the behavior decay table based on the target user identifier. The partition of the behavior decay table for a set date records the full user behavior data of the active users on the set date and the user historical behavior data of the full users to be calculated on the set date after decay processing. In the partition of the behavior decay table for a set date, the access date of the full users to be calculated on the set date is set to the set date. In the partition of the behavior decay table for a set date, the full users to be calculated on the set date include the active users on the set date and users whose original access date was N days before the set date. The behavior decay table is constructed in the following manner: Obtain the active users of the set date and the inactive users within N days, and merge them to obtain the total number of users to be calculated on the same day; wherein, the inactive users within N days are users whose access date is N days before the set date; Obtain the full user behavior data of the active users of the day; Based on the access date of each user in the total number of users to be calculated on that day, query the behavior attenuation table to obtain the total historical behavior of the total number of users to be calculated on that day, and perform attenuation processing on the total historical behavior to obtain user historical behavior data. The full user behavior data for the day and the user historical behavior data are combined to obtain the full behavior data to be calculated for the day. Set the access date of all users to be calculated on that day to the set date; Write the full amount of behavior data to be calculated on the current day into the behavior decay table in the current day partition of the set date.
10. A user profile building device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the user profile construction method as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the user profile construction method as described in any one of claims 1 to 8.