Item collaborative filtering recommendation method and system based on user behavior analysis
By constructing category lifecycle profiles and dynamic rating matrices, and combining them with user behavior analysis, the problems of dynamic user interests and category differences in collaborative filtering recommendations were solved, resulting in more accurate product recommendations.
Patent Information
- Application Number
- CN202511447353.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-11
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2045-10-11
AI Technical Summary
Existing collaborative filtering recommendation methods fail to effectively consider the dynamic evolution of user interests over time and the differences between different product categories, resulting in poor timeliness and low accuracy of recommendation results.
A category lifecycle profile is constructed. By preprocessing user behavior data and product attributes, a dynamic scoring matrix is generated. Combined with category awareness, item similarity is calculated, and a candidate recommended product list is generated, which is then sorted, filtered, and truncated.
It achieves accurate recommendations based on a dynamic decay mode according to the user's current interests, improving the timeliness and accuracy of recommendations and solving the problem of inaccurate recommendations caused by category differences.
Smart Images

Figure CN120929682B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of commodity recommendation, and more specifically, to a commodity collaborative filtering recommendation method and system based on user behavior analysis. BACKGROUND
[0002] With the rapid development of e-commerce platforms, the number of commodities has exploded, and users are facing a serious information overload problem. In order to help users quickly find interesting content in the vast number of commodities, personalized recommendation systems have emerged and become one of the core technologies of major platforms. Among them, the collaborative filtering recommendation method based on user behavior analysis is widely used due to its simple principle and significant effect. It mainly analyzes the user's historical behavior data (such as clicks, collections, purchases, etc.) to mine user preferences and recommend commodities that may be of interest to them.
[0003] However, existing collaborative filtering recommendation methods have significant limitations in practical applications. These methods mostly treat user historical behavior data as a static set, failing to fully consider the dynamic evolution of user interest over time. For example, a user's behavior of purchasing newborn supplies a few months ago and browsing toys for young children recently may be given similar weights in traditional models, which obviously does not conform to the objective law that user needs change over time, resulting in poor timeliness and low accuracy of the recommendation results. More importantly, the consumption patterns of different commodity categories and the life cycle of user interest are completely different. The interest in electronic products such as mobile phones will quickly decay after purchase, while the consumption of daily necessities such as paper towels and rice shows obvious periodicity. Existing methods often use a single, global time decay function to process all types of behavior data, which cannot finely capture the differences between categories and accurately capture the user's real needs at a specific time point. The root cause lies in the fact that existing technologies have failed to effectively establish an internal link between commodity category attributes and dynamic decay patterns of user interest. They generally lack a mechanism to identify and quantify different interest life cycle models corresponding to different commodity categories (such as task-based, consumable, or interest-based commodities), and cannot dynamically calculate the effective value of user historical behavior at the current time point based on these differentiated models.
[0004] Therefore, how to build a method that can perceive the life cycle characteristics of categories, dynamically evaluate the intensity of user interest, and thus improve the accuracy and timeliness of recommendations, has become a technical bottleneck that needs to be solved in the current collaborative filtering recommendation field. SUMMARY
[0005] To solve the problems in the prior art, according to an aspect of the present application, a commodity collaborative filtering recommendation method based on user behavior analysis is provided, which comprises: preprocessing original user behavior logs and commodity metadata to obtain preprocessed user behavior data and category life cycle archives; performing dynamic user-item interaction based on category perception on the preprocessed user behavior data and the category life cycle archives to obtain a dynamic rating matrix; performing dynamic similarity calculation between items on the dynamic rating matrix to obtain an item similarity matrix; generating a candidate recommended commodity list based on a target user ID, the dynamic rating matrix and the item similarity matrix; and sorting, filtering and truncating the candidate recommended commodity list to obtain a final recommended list.
[0006] According to another aspect of the present application, a commodity collaborative filtering recommendation system based on user behavior analysis is provided, which comprises: a user commodity data preprocessing module configured to preprocess original user behavior logs and commodity metadata to obtain preprocessed user behavior data and category life cycle archives; a user-item interaction module configured to perform dynamic user-item interaction based on category perception on the preprocessed user behavior data and the category life cycle archives to obtain a dynamic rating matrix; an item similarity calculation module configured to perform dynamic similarity calculation between items on the dynamic rating matrix to obtain an item similarity matrix; a candidate commodity recommendation module configured to generate a candidate recommended commodity list based on a target user ID, the dynamic rating matrix and the item similarity matrix; and a final commodity recommendation module configured to sort, filter and truncate the candidate recommended commodity list to obtain a final recommended list.
[0007] Compared with the prior art, the commodity collaborative filtering recommendation method and system based on user behavior analysis provided by the present application overcomes the static defect of the traditional collaborative filtering recommendation method by constructing a category life cycle archive and deeply coupling the internal attributes of commodity categories with the dynamic decay mode of user interest. Specifically, first, the commodities are classified, and a life cycle archive with differentiated decay parameters is established for different categories (such as task type, consumption type and interest type). When performing recommendation calculation, instead of using static historical behavior ratings, a dynamic and time-effective rating is calculated for each user-item interaction according to the interval between the time of the behavior and the current time in combination with the category life cycle archive, forming a dynamic rating matrix. Based on this matrix, subsequent item similarity calculation and recommended list generation are performed. In this way, the decay speed and mode of different commodity interests can be effectively distinguished, so that the recommendation result can more accurately capture the current core needs of the user, solving the problem of inaccurate recommendation in the background art due to the inability to handle the dynamicity, periodicity and category difference of user interest. BRIEF DESCRIPTION OF DRAWINGS
[0008] The above and other objects, features and advantages of the present application will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings in which:
[0009] Figure 1 A flow chart of a method for product collaborative filtering recommendation based on user behavior analysis according to an embodiment of the present application.
[0010] Figure 2 A data flow diagram of a method for product collaborative filtering recommendation based on user behavior analysis according to an embodiment of the present application.
[0011] Figure 3 A flow chart of step S2 in a method for product collaborative filtering recommendation based on user behavior analysis according to an embodiment of the present application.
[0012] Figure 4 A flow chart of step S3 in a method for product collaborative filtering recommendation based on user behavior analysis according to an embodiment of the present application.
[0013] Figure 5 A block diagram of a system for product collaborative filtering recommendation based on user behavior analysis according to an embodiment of the present application. DETAILED DESCRIPTION
[0014] Embodiments of the present disclosure will be described in more detail by referring to the drawings. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes, and are not intended to limit the scope of protection of the present disclosure.
[0015] To solve the technical problems in the background art described above, the present application proposes a method for product collaborative filtering recommendation based on user behavior analysis. Figure 1 A flow chart of a method for product collaborative filtering recommendation based on user behavior analysis according to an embodiment of the present application. Figure 2 A data flow diagram of a method for product collaborative filtering recommendation based on user behavior analysis according to an embodiment of the present application. As shown in Figure 1 and Figure 2 As shown in the method for product collaborative filtering recommendation based on user behavior analysis according to an embodiment of the present application, it includes: S1, preprocessing original user behavior logs and product metadata to obtain preprocessed user behavior data and product category life cycle archives; S2, performing dynamic user-item interaction based on product category awareness on the preprocessed user behavior data and product category life cycle archives to obtain a dynamic rating matrix; S3, performing dynamic similarity calculation between items on the dynamic rating matrix to obtain an item similarity matrix; S4, generating a candidate recommended product list based on a target user ID, the dynamic rating matrix and the item similarity matrix; and S5, sorting, filtering and truncating the candidate recommended product list to obtain a final recommended list.
[0016] In step S1, the original user behavior logs and commodity metadata are preprocessed to obtain preprocessed user behavior data and category life cycle profiles. It should be understood that the original user behavior logs and commodity metadata are usually heterogeneous and unstructured, lacking key information for quantifying the dynamic evolution of user interest and category difference. Therefore, it is necessary to transform these original and discrete data into a structured and computable format to provide two core inputs for subsequent category-aware dynamic scoring calculation: preprocessed user behavior data containing basic interaction intensity, and category life cycle profiles defining different category decay patterns, thereby laying a data foundation for solving the problem in the prior art that cannot distinguish category difference and interest timeliness.
[0017] In an optional embodiment, step S1 is implemented as follows: first, the original user behavior logs and commodity metadata as processing inputs are obtained. The original user behavior logs are usually recorded and collected by the front-end application or back-end server of the e-commerce platform, stored in a streaming or batch form, and record each atomic operation of user interaction with the platform. A typical original log record can include user identifier, behavior type, interaction object identifier, and time stamp of behavior occurrence. For example, a log can be {user identifier: u_token_xyz, behavior: add to cart, commodity uniform code: spu_12345, time stamp: 1678886400}. The commodity metadata is derived from the commodity information management database of the platform, which stores the static description attributes of all commodities. A typical metadata record can include commodity uniform code, commodity name, belonging category identifier, brand information, etc. For example, a metadata can be {commodity uniform code: spu_12345, commodity name: certain brand A type smart phone, category identifier: cate_001, brand: certain brand}.
[0018] After obtaining the above two original data sources, the processing is started to generate preprocessed user behavior data. The process traverses each original user behavior log. Optionally, in an embodiment of the present application, each interaction record in the preprocessed user behavior data includes user ID, commodity ID, category ID, time stamp, and basic score; and each record in the category life cycle profile includes category ID, life cycle type, and decay parameter. Specifically, for the user identifier in the log, it is converted to a unique user ID in the system through a mapping relationship or directly used. For the commodity uniform code in the log, it is directly used as the commodity ID. For the time stamp in the log, its original value is retained as the time stamp field. Then, the commodity ID in the log is used to query and match in the commodity metadata, so as to obtain the category ID corresponding to the commodity. Thus, the user ID, commodity ID, category ID, and time stamp in an interaction record are obtained.
[0019] Optionally, in one embodiment of the present application, the step S1 of preprocessing the original user behavior log and the commodity metadata to obtain the preprocessed user behavior data and the product category life cycle profile further comprises: S11, extracting the behavior type from the original user behavior log; and S12, mapping the behavior type to a basic score based on a behavior score mapping table. Specifically, in order to quantify the interest intensity represented by different user behaviors, a basic score needs to be generated. This process first performs S11 to extract the behavior field from the original user behavior log, such as browsing, clicking, collecting, adding to the shopping cart, or purchasing. Then, S12 is performed to convert the textually described behavior type into a numerically basic score according to a pre-set behavior score mapping table. The mapping table is set by domain experts according to business understanding, aiming to reflect the strength of the user's intention behind different behaviors. For example, a mapping table can be set as: {browse: 1.0, collect: 3.0, add to shopping cart: 5.0, purchase: 10.0}. When a log with the behavior of adding to the shopping cart is processed, the corresponding basic score is assigned as 5.0. Through the above processing, an original log is finally converted into a structured preprocessed user behavior data record, and the format is {user ID: U001, commodity ID: spu_12345, product category ID: cate_001, timestamp: 1678886400, basic score: 5.0}.
[0020] Meanwhile, the construction of the product category life cycle profile is carried out. The profile is a static or semi-static configuration table, and the purpose is to define the consumption characteristics of each product category. The construction of the profile mainly relies on the knowledge of domain experts and statistical analysis of historical sales data. For each record in the profile, the product category ID needs to be determined first, which corresponds one-to-one with the product category identifier in the product metadata. Then, a life cycle type is specified for the product category ID. The type is divided according to the consumption characteristics of the product category, for example, task type, consumption type and interest type. Task type refers to product categories with long purchase decision cycle and low repeat purchase rate, such as mobile phones and home appliances; consumption type refers to product categories that need to be purchased periodically, such as milk and paper towels; interest type refers to product categories that may last for a long time based on personal interests, such as books and musical instruments. Finally, according to the determined life cycle type, the corresponding decay parameters are configured for the product category. These parameters will be used for subsequent dynamic score calculation. For example, for product category ID cate_001, such as a smart phone category, its life cycle type can be defined as task type, and its decay parameter can be set as a task decay coefficient, such as 0.1, indicating that the interest decreases rapidly after purchase. For product category ID cate_088, such as a milk category, its type can be defined as consumption type, and its decay parameter includes a consumption decay coefficient, such as 0.5, and a consumption cycle, such as an average repeat purchase cycle of 30 days obtained through statistical analysis. For product category ID cate_150, such as a classical music record category, its type can be defined as interest type, and its decay parameter is an interest decay coefficient, such as 0.02, indicating that the interest decay is very slow. The finally generated product category life cycle profile is a collection of records, for example: {product category ID: cate_001, life cycle type: task type, decay parameter: 0.1}, {product category ID: cate_088, life cycle type: consumption type, decay parameter: 0.5, consumption cycle: 30}, {product category ID: cate_150, life cycle type: interest type, decay parameter: 0.02}.
[0021] In step S2, the dynamic user-item interaction based on product category perception is performed on the pre-processed user behavior data and the product category life cycle profile to obtain a dynamic score matrix. Accordingly, although the user behavior data obtained after preprocessing is structured, the underlying scores contained therein are essentially static and cannot reflect the natural decay or periodic changes of user interest over time. At the same time, the life cycle patterns of user interest corresponding to different product categories differ significantly. Therefore, in order to dynamize the static underlying scores, the present application introduces a time decay function closely coupled with the product category to calculate a dynamic score with time effectiveness for each historical interaction behavior, thereby constructing a dynamic score matrix that can truly reflect the current interest state of the user and providing a basis for subsequent accurate similarity calculation and recommendation generation.
[0022] Optionally, in an embodiment of the present application, Figure 3 is a flow chart of step S2 in the commodity collaborative filtering recommendation method based on user behavior analysis according to an embodiment of the present application. As shown in the figure, Figure 3 S2, based on the pre-processed user behavior data and the category life cycle profile, a dynamic user-item interaction based on category perception is performed to obtain a dynamic score matrix, including: S21, extracting a first interaction record from the pre-processed user behavior data; S22, extracting a commodity ID based on the first interaction record; S23, taking the commodity ID as a query condition, searching the category life cycle profile for a corresponding life cycle type and decay parameter; S24, based on the life cycle type and the decay parameter, calculating the dynamic score of the first interaction record.
[0023] In the above optional embodiment, step S2 is implemented as follows: first, step S21 is performed to extract a first interaction record from the pre-processed user behavior data. The first here is only for convenience of description, and in actual processing, all records are traversed one by one. Taking one record in the above embodiment as an example, the extracted interaction record is {user ID: U001, commodity ID: spu_12345, category ID: cate_001, timestamp: 1678886400, base score: 5.0}.
[0024] Next, step S22 is performed. From the above record, the commodity ID spu_12345 can be clearly extracted. At the same time, in order to query later, the category ID cate_001 is also extracted.
[0025] Then, step S23 is performed. The category ID cate_001 is used to search in the category life cycle profile. According to the profile constructed in the above embodiment, the query result is {category ID: cate_001, life cycle type: task type, decay parameter: 0.1}. It can be known that the life cycle type of the category to which the commodity belongs is task type, and the corresponding decay parameter is task decay parameter 0.1.
[0026] Finally, step S24 is performed. Optionally, in an embodiment of the present application, step S24, based on the life cycle type and the decay parameter, calculates the dynamic score of the first interaction record, including: based on the life cycle type and the decay parameter, calculating the dynamic score of the first interaction record by the following formula, wherein the formula is: ; wherein, the base score is the base score, the time difference between the behavior occurrence time and the current time is the time difference between the behavior occurrence time and the current time, the decay parameter is the decay parameter, the decay function is the decay function, is the dynamic score. In the formula, is the base score, which is directly obtained from the interaction record, and is 5.0 here. is the time difference between the behavior occurrence time and the current time. For example, if the timestamp of the current recommendation calculation is 1681564800, then seconds. For ease of understanding and parameter setting, is converted into days, i.e., days, is the decay parameter, is the decay function, the specific form of which is determined by the life cycle type. In particular, if the life cycle type is task-based, , is the task decay parameter, is the natural exponential function; if the life cycle type is consumable, , is the modulo operation, is the consumable decay parameter, is the consumption cycle; if the life cycle type is interest-based, , is the interest-based decay parameter.
[0027] Since the life cycle type obtained in this application is task-based, the corresponding decay function is selected: . Substituting the known values, the value of the decay function is . Finally, the dynamic score of this interaction record is . This calculation result is significantly smaller than the original base score of 5.0, accurately reflecting that the user's interest in the task-based product such as the mobile phone has greatly decayed at the current time. To further illustrate the impact of different life cycle types, two other cases are listed. If another record processed by the user U001 is the purchase of milk, the category ID is cate_088, the life cycle type is consumable, the decay parameter is 0.5, the consumption cycle is 30, the base score is 10.0, and the behavior occurred 40 days ago, i.e. . At this time, the decay function is . The calculation process is: . The decay function value is exp(-0.5x10²)=exp(-50). The dynamic score is 10.0xexp(-50)≈0. This indicates that the user has not repurchased for more than a consumption cycle (30 days), and his purchase demand may have weakened or been met through other channels. Conversely, if the behavior occurred 31 days ago, i.e. , then , the decay function value is exp(-0.5x1^2)=exp(-0.5), and the dynamic score will be relatively high, indicating that the repurchase demand is at a peak. For example, if the record processed is the user U001 buying classical music records, the category ID is cate_150, the life cycle type is interest type, the decay parameter is 0.02, the base score is 10.0, and the behavior occurs 100 days ago, that is, . At this time, the decay function is . The decay function value is exp(-0.02x100)=exp(-2)≈0.135. The dynamic score is 10.0xexp(-2). Since the interest type decay coefficient is set to be small, even if a long time has passed, the dynamic score remains at a relatively high level, which is consistent with the long-term persistence characteristics of interest.
[0028] By repeatedly performing the steps of S21 to S24 on each record in the preprocessed user behavior data, the corresponding dynamic scores for all historical user-item interactions can be calculated. All these sets of (user ID, item ID, dynamic score) triples form a dynamic rating matrix. The matrix is sparse, only in the positions where the user and the item have interacted, and the value is a category-aware, time-effective dynamic rating.
[0029] In particular, the current assumption is that the interest decay patterns of all users in the same category are the same, which obviously has optimization space. For example, in the photography equipment interest category, user A is a photography enthusiast who frequently buys and browses photography equipment, and his interest is long-term and stable. For him, it is still appropriate to recommend lenses or accessories even if he bought a camera a year ago, and his interest decay should be very slow. User B is a travel experimenter who only bought an entry-level camera before a long trip and has no related behavior afterwards. His interest is short-term and event-driven. Therefore, if the same decay coefficient is used for A and B, it will inevitably lead to too fast interest decay for user A (missing the opportunity for recommendation) or too slow interest decay for user B (pushing irrelevant and annoying information). Therefore, the present application introduces a dynamic personalized decay function to optimize the original static decay coefficient determined only by the category into a dynamic personalized decay coefficient combining the category-based decay characteristics and the user's activity level in the category, so that the more active and focused the user's historical behavior is, the slower the interest decay in the category will be, thereby achieving fine and personalized modeling of different user interest evolution patterns.
[0030] Preferably, in one embodiment of this application, the setting of the decay function includes: obtaining the product category from the category lifecycle archive. It should be understood that directly learning the decay parameter from zero for each user in each category leads to data sparsity and computational complexity problems, especially for new users or users with limited activity in a particular category, where the decay pattern will be difficult to estimate accurately. Therefore, it is necessary to first obtain the macro-level characteristics of the category as a benchmark to provide a stable and business-meaning initial value for subsequent personalized adjustments. By obtaining the basic decay coefficient and lifecycle type of the category, it is ensured that personalized adjustments are carried out within a reasonable framework, preserving both category commonalities and reserving space for modeling individual differences. Specifically, for a specific user-category pair (user u, category c), the category ID is first used as the query key to search in the pre-built category lifecycle archive. This archive stores the static attributes of each category. The search operation will return two key pieces of information corresponding to the category: first, the lifecycle type (task-based, consumption-based, or interest-based), which determines the basic mathematical form of the subsequent decay function; and second, the basic decay coefficient of the category. This coefficient is a benchmark value set by domain experts or based on the historical behavior statistics of all users in the category, representing the inherent and universal decay attribute of the category.
[0031] Calculate the normalized number of purchases made by a user within the most recent time window W, i.e.: ;in, For user u, the number of times they purchase product category c. This represents the average number of purchases made by all users for category c. This represents the average number of purchases made by user u across all product categories. To normalize purchase counts, directly using raw purchase counts as a metric for user activity is susceptible to interference from differences in overall user purchasing power and category popularity. For example, a user who frequently purchases across all categories may not fully represent their focus on a particular category due to high purchase counts within that category. Therefore, to quantify user activity within a specific category, normalization is necessary to calculate a metric that fairly reflects a user's focus or activity relative to their own average level and the global average, resulting in a robust and comparable activity measure. This provides reliable input for subsequently generating personalized adjustment factors through function mapping. It helps determine the personalized adjustment factors for user u in category c. First, it's necessary to quantify user u's activity level within this product category. Specifically, define a recent time window W, such as the past 365 days. Count the number of times user u made purchases of product category c within this window. To achieve normalization, the number of purchases... Multiply by the average number of purchases of category c by all users , and divide by the average number of purchases of all categories by user u , to obtain the normalized number of purchases . This achieves global Bayesian normalization of different users with respect to different categories, effectively smoothing the data noise.
[0032] Perform a translation and scaling-based inverse Sigmoid function calculation on the normalized number of purchases to obtain a dynamically personalized decay coefficient, i.e. ; where is a scaling coefficient used to control the value range of , for example, set to 2 to make the value range roughly between (0, 2), is a shape parameter that controls the steepness of the curve, The larger , the more sensitive is to changes in is a center translation parameter representing the average or baseline activity, when , , for example can be set according to the median or average of all user activity, is a dynamically personalized decay coefficient. It should be understood that a linear mapping relationship cannot meet complex business requirements, for example, when the activity is extremely high or extremely low, the coefficient should tend to be stable, rather than increasing or decreasing without limit. Therefore, in order to convert the quantified user activity into a coefficient with actual regulatory effect, the present application uses an inverse Sigmoid function to achieve a non-linear smooth mapping. That is, through this function, the activity is mapped to an adjustment factor that conforms to the pre-set business logic, so that when the user activity is at the average level, the adjustment factor is close to 1, basically maintaining the basic decay; when the activity is high, the factor is less than 1, significantly slowing down the decay; when the activity is low, the factor is greater than 1, significantly accelerating the decay, achieving smooth and effective dynamic adjustment. This non-linear mapping mechanism, through the configuration of function parameters, can flexibly control the strength and sensitivity of personalized adjustment, for example, by adjusting the scaling coefficient S to limit the upper and lower bounds of the adjustment factor, preventing extreme values and ensuring the stability of the model.
[0033] Based on the dynamically personalized decay coefficient and the decay coefficient, construct task-based, consumption-based, and interest-based decay functions, i.e. the task-based decay function: ; the consumption-based decay function: ; the interest-based decay function: In other words, by organically combining the commonalities of the category (the basic decay coefficient and function form) with the individual characteristics of the user (the adjustment factor), a final decay function tailored to each user can be generated. For the same category of historical behavior, users with different activity levels will have different interest decay curves. For example, for the aforementioned photography enthusiast user A, their high activity level will result in a smaller adjustment factor, making their interest decay curve flatter; while for travel enthusiast user B, their low activity level will result in a larger adjustment factor, making their interest decay curve steeper. This differentiated approach can provide more persistent related recommendations for heavy users, while allowing light users to switch recommended topics more quickly. This accurately solves the problem of inaccurate recommendations caused by the inability to distinguish individual user differences in background technology, ultimately significantly improving the accuracy of recommendations and user experience.
[0034] In step S3, dynamic similarity calculations are performed on the dynamic rating matrix to obtain an item similarity matrix. It is understandable that while the dynamic rating matrix generated in the previous step quantifies the timeliness and category differences of user interests in each user-item interaction, it only describes the independent relationship between users and items. The core logic of collaborative filtering recommendation is to recommend other items similar to the user's historical preferences. Therefore, a standard for measuring the strength of association between items needs to be established. Based on this, in the technical solution of this application, in order to calculate the similarity between items based on the dynamic ratings that reflect the user's current interests, a timeliness-sensitive item similarity matrix is generated, providing crucial item relationship information for subsequently generating accurate and novel recommendation lists.
[0035] Optionally, in one embodiment of this application, Figure 4 This is a flowchart of step S3 in the product collaborative filtering recommendation method based on user behavior analysis according to an embodiment of this application. Figure 4 As shown, step S3, which calculates the dynamic similarity between items in the dynamic rating matrix to obtain the item similarity matrix, includes: S31, constructing an inverted index of item-user-score based on the dynamic rating matrix; S32, obtaining the first item rating list and the second item rating list of the first item pair from the inverted index of item-user-score; S33, calculating the item similarity of the first item pair based on the first item rating list and the second item rating list.
[0036] In the above optional embodiment, step S3 is implemented as follows: first, step S31 is performed. The inverted index is a data structure whose key is item ID and value is a list containing all user IDs and their corresponding dynamic scores that have interacted with the item. The purpose of building this index is to greatly improve the subsequent calculation efficiency and avoid global scanning in the huge dynamic score matrix. The construction process will traverse each record (user ID, item ID, dynamic score) in the dynamic score matrix. For each record, take its item ID as the key, and append (user ID, dynamic score) as a tuple to the value list corresponding to the key. For example, the dynamic score matrix contains the following records: {user ID: U001, item ID: i, dynamic score: 4.5}, {user ID: U002, item ID: i, dynamic score: 3.0}, {user ID: U001, item ID: j, dynamic score: 4.0}, {user ID: U002, item ID: j, dynamic score: 3.5}, {user ID: U003, item ID: j, dynamic score: 2.0}, {user ID: U002, item ID: k, dynamic score: 1.5}, {user ID: U003, item ID: k, dynamic score: 2.5}. After step S31, the generated item-user-score inverted index is as follows: item i -> [{user ID: U001, dynamic score: 4.5}, {user ID: U002, dynamic score: 3.0}]; item j -> [{user ID: U001, dynamic score: 4.0}, {user ID: U002, dynamic score: 3.5}, {user ID: U003, dynamic score: 2.0}]; item k -> [{user ID: U002, dynamic score: 1.5}, {user ID: U003, dynamic score: 2.5}].
[0037] Next, step S32 is performed. The first item pair here refers to any two items whose similarity needs to be calculated. The process traverses all possible item pairs, for example, the similarity between item i and item j needs to be calculated. By querying the inverted index constructed in the previous step, the score lists of the two items can be directly obtained. For item i, its score list, i.e., the first item score list, is denoted as N(i) and is: [{user ID: U001, dynamic score: 4.5}, {user ID: U002, dynamic score: 3.0}]. For item j, its score list, i.e., the second item score list, is denoted as N(j) and is: [{user ID: U001, dynamic score: 4.0}, {user ID: U002, dynamic score: 3.5}, {user ID: U003, dynamic score: 2.0}].
[0038] Then, step S33 is performed. In this embodiment, the improved cosine similarity formula is used for the calculation. Alternatively, in one embodiment of the present application, step S33, based on the first item rating list and the second item rating list, calculates the item similarity of the first item pair, comprises: based on the first item rating list and the second item rating list, calculating the item similarity of the first item pair with the following formula: .
[0039] wherein, is each dynamic score in the first item rating list, is each dynamic score in the second item rating list, and are the first item rating list and the second item rating list, respectively, is the item similarity of the first item and the second item. The calculation process is decomposed as follows: first, the numerator part of the formula is calculated . This part calculates the sum of the product of the dynamic scores of the users who have interacted with both item i and item j. First, find the user intersection of the two rating lists . In this example, the users who appear in both and are U001 and U002. Next, for each user in the intersection, extract its dynamic scores for item i and item j and multiply them. For user U001, its dynamic score for item i is 4.5, and its dynamic score for item j is 4.0. The product is 4.5x4.0=18.0. For user U002, its dynamic score for item i is 3.0, and its dynamic score for item j is 3.5. The product is 3.0x3.5=10.5. Add all the products to get the numerator . Second, calculate the denominator part of the formula . This part is the product of the lengths of the rating vectors of the two items. First, calculate the sum of the squares of all dynamic scores for item i. Go through all the records in : (4.5)^2+(3.0)^2=29.25. So, . Next, calculate the sum of the squares of all dynamic scores for item j. Go through all the records in : (4.0)^2+(3.5)^2+(2.0)^2==32.25. So, . Calculate the denominator =sqrt(29.25)*sqrt(32.25). Finally, calculate the final similarity of item i and item j = 28.5 / (sqrt(29.25)*sqrt(32.25)) ~ 0.928. The result of the calculation is the dynamic similarity between item i and item j.
[0040] By repeating the steps of S32 and S33 for all item pairs that need to be calculated, a complete item similarity matrix can be obtained. The rows and columns of the matrix are item IDs, and the value at position (i, j) in the matrix is sim(i, j). Each similarity value in this matrix is calculated based on dynamic scores, so it can reflect the strength of the association between items at the current time point due to their common attention by users, providing high-quality and timely data support for subsequent recommendation generation. It should be noted that the items i, j, and k used for description in the above embodiments are only illustrative identifiers for convenience, and in actual execution, they correspond to real product IDs with unique identifiers, such as the specific identifiers spu_12345 mentioned in the foregoing embodiments.
[0041] In step S4, a candidate recommended item list is generated based on the target user ID, the dynamic score matrix, and the item similarity matrix. It should be understood that the data in the item similarity matrix is only a quantitative description of historical behavior and item relationships, and has not yet directly formed a prediction of unknown items that the user may be interested in the future. In order to achieve the ultimate goal of personalized recommendation, i.e., actively discovering new items for the user, a fusion process is needed. Therefore, the present application effectively combines the target user's dynamic preference history with the strength of the association between items to predict the user's potential interest in items that he has not interacted with, thereby generating a candidate list containing specific items and their predicted interest scores, providing a quantitative basis for the final recommendation decision.
[0042] In an optional embodiment, step S4 is implemented as follows: First, according to the input target user ID such as U001, all historical interaction records of the user are retrieved from the dynamic score matrix. These records constitute the user's preference history. Continuing the foregoing embodiment, the retrieved preference history of user U001 may include two records: {item ID: spu_12345, dynamic score: 4.5} and {item ID: spu_67890, dynamic score: 4.0}. This indicates that at the current time point, the user U001's interest in item spu_12345 is 4.5, and the user's interest in item spu_67890 is 4.0.
[0043] Next, determine the candidate item set for which a prediction score needs to be calculated for the target user UOOl. This set is the full set of items excluding the items that the user UOOl has already interacted with, i.e. spu_12345 and spu_67890. For example, the candidate item set contains an item spu_abcde that the user has never interacted with.
[0044] Then, iterate through each candidate item in the candidate item set and calculate a prediction score for it. Take the calculation of the prediction score for the candidate item spu_abcde for the user UOOl as an example. The core idea of this calculation is that the degree of interest of a user for a candidate item can be weightedly predicted by the similarity of other items that the user has liked in the past to the candidate item. The specific calculation process is as follows: 1. For the candidate item spu_abcde, the similarity of it to each item in the user UOOl's preference history, i.e. spu_12345 and spu_67890, needs to be obtained. These similarity values are queried from the item similarity matrix generated in step S3. For example, the query result is that the similarity of the item spu_abcde to the item spu_12345 is sim(spu_abcde, spu_12345) = 0.8. The similarity of the item spu_abcde to the item spu_67890 is sim(spu_abcde, spu_67890) = 0.6. 2. Calculate the numerator part of the prediction score, i.e. the weighted sum. Multiply the dynamic score of the user for each historical item by the similarity of the historical item to the current candidate item, and then add all these products together. The contribution from the historical item spu_12345: dynamic score x similarity = 4.5 x 0.8 = 3.6. The contribution from the historical item spu_67890: dynamic score x similarity = 4.0 x 0.6 = 2.4. The sum of the numerator part is: 3.6 + 2.4 = 6.0. 3. Calculate the denominator part of the prediction score, i.e. the sum of the absolute values of the similarities, for normalization. The sum of the denominator part is: |0.8| + |0.6| = 1.4. 4. Calculate the final prediction score. Divide the numerator part by the denominator part. The prediction score of the candidate item spu_abcde for the user UOOl = 6.0 / 1.4 = 4.286.
[0045] In practical applications, in order to improve the calculation efficiency and the recommendation effect, all items in the user preference history are not usually used. A common optimization is that for each candidate item, only the K most similar user historical items are selected for weighted calculation. For example, set K = 20, then for the candidate item spu_abcde, find the 20 items with the highest similarity to spu_abcde from the entire preference history of the user UOOl, and then only use the dynamic scores and corresponding similarities of these 20 items to calculate the prediction score.
[0046] The above calculation process is extended to each item in the candidate item set to perform the calculation of the predicted score. For example, another candidate item spu_fghij is calculated, and its predicted score is 3.512.
[0047] After traversing all candidate items, a series of (item ID, predicted score) tuples are obtained, for example: {(spu_abcde, 4.286), (spu_fghij, 3.512), (spu_lmnop, 4.950)…}.
[0048] This list consisting of all candidate items and their corresponding predicted scores is the final generated candidate recommendation item list. The predicted scores in the list take into account the current value of the user's historical preferences (dynamic score) and the timeliness correlation between items (dynamic similarity).
[0049] In step S5, the candidate recommendation item list is sorted, filtered, and truncated to obtain the final recommendation list. That is, the candidate recommendation item list, although containing a quantitative prediction of user interest, is essentially a raw and lengthy set that may contain a large number of weakly related items with low predicted scores or items that are not suitable for direct display due to business reasons. In order to convert the prediction results into high-quality recommendation content that can be directly presented to the user, the raw list needs to be refined and constrained. To this end, the present application performs a series of post-processing operations such as sorting, filtering, and truncation to ensure that the final recommendation list presented to the user is of high quality, strongly related, and of appropriate length, thereby completing the key conversion from prediction to final decision.
[0050] In an optional embodiment, step S5 is implemented as follows: First, a sorting operation is performed. The input candidate recommendation item list is sorted in descending order according to the predicted score field. The purpose of this operation is to place the items that the user is most likely interested in at the front of the list. Continuing the previous embodiment, the candidate recommendation item list generated in step S4 contains the following content: {(spu_lmnop, 4.950), (spu_abcde, 4.286), (spu_vwxyz, 4.800), (spu_fghij, 3.512), (spu_11223, 4.750), (spu_qrstu, 2.100)}. After descending sorting, the order of the list becomes: {(spu_lmnop, 4.950), (spu_vwxyz, 4.800), (spu_11223, 4.750), (spu_abcde, 4.286), (spu_fghij, 3.512), (spu_qrstu, 2.100)}.
[0051] Next, a filtering operation is performed on the sorted list. The filtering operation aims to remove items that are not suitable for recommendation to the user, and it contains a series of rule checks. First, a prediction score threshold filter is applied. A minimum prediction score threshold is set, for example, 3.0. The threshold can be determined through offline evaluation or online A / B testing to balance the accuracy and recall rate of the recommendations. The list is traversed, and all items with a prediction score lower than 3.0 are removed. In the above example, the prediction score of item spu_qrstu is 2.100, which is lower than the threshold 3.0, so the item is removed from the list. Second, a business rule filter is applied. This includes but is not limited to: purchased filter: check if the item ID in the list appears in the target user's historical purchase record. If a non-consumable item has been purchased by the user recently, it should be removed from the recommendation list to avoid repeated recommendations. For example, it is verified that user U001 purchased item spu_11223 last week, so the item is removed. status filter: query the item database to check the real-time status of each item in the list. Remove items that are in an unavailable state such as being out of stock, having zero inventory, or not being sold in the region. For example, it is queried that item spu_vwxyz is currently out of stock, so the item is removed. negative feedback filter: check if the item has explicit negative feedback behavior such as deleting recommendations in the user's list of uninterested items or history, and remove it if so. After the above sorting and filtering operations, the candidate recommendation item list is refined to: {(spu_lmnop, 4.950), (spu_abcde, 4.286), (spu_fghij, 3.512)}.
[0052] Finally, a truncation operation is performed on the filtered list. Since the front-end display interface (such as the recommendation bar on the home page, the push notification of the APP) can only accommodate a limited number of items, the list needs to be truncated to a preset length N. The value of N is determined according to the specific business scenario, for example, if the recommendation bar can display 5 items, then N is set to 5. The truncation operation is to take the first N items in the list. In the current example, the length of the filtered list is 3, which is less than the preset N=5, so all items are retained. If the length of the filtered list is greater than N, only the top N items with the highest prediction score are retained.
[0053] After the truncation operation is completed, the item IDs of the remaining items in the list are extracted and arranged in the current order to form the final recommendation list. In this embodiment, the final generated recommendation list is: [spu_lmnop, spu_abcde, spu_fghij]. The items in this list are not only predicted based on the user's dynamic interest, but also subjected to strict business rule verification to ensure the effectiveness, relevance, and high quality of the recommendation results, which can be directly used for display on the front-end interface.
[0054] In summary, the commodity collaborative filtering recommendation method based on user behavior analysis according to the embodiments of the present application is illustrated, which overcomes the static defect of the traditional collaborative filtering recommendation method by constructing the product category life cycle profile and deeply coupling the internal attributes of the product category and the dynamic decay mode of the user interest. Specifically, first, the commodities are classified, and the life cycle profile with differentiated decay parameters is established for different categories (such as task type, consumption type, and interest type). When performing the recommendation calculation, instead of using the static historical behavior score, a dynamic and time-effective score is calculated for each user-item interaction according to the interval between the time of the behavior and the current time in combination with the category life cycle profile, and a dynamic score matrix is formed. Based on the matrix, the subsequent item similarity calculation and the generation of the recommendation list are performed. In this way, the decay speed and mode of different commodity interests can be effectively distinguished, the core needs of the user at present can be more accurately captured by the recommendation result, and the problem of inaccurate recommendation caused by the inability to handle the dynamicity, periodicity, and category difference of the user interest in the background technology is solved.
[0055] Figure 5 The figure is a block diagram of the commodity collaborative filtering recommendation system based on user behavior analysis according to the embodiments of the present application. As shown in the figure, Figure 5 The commodity collaborative filtering recommendation system based on user behavior analysis according to the embodiments of the present application 100 includes: a user commodity data preprocessing module 110 for preprocessing the original user behavior log and commodity metadata to obtain preprocessed user behavior data and a category life cycle profile; a user-item interaction module 120 for performing dynamic user-item interaction based on category perception on the preprocessed user behavior data and the category life cycle profile to obtain a dynamic score matrix; an item similarity calculation module 130 for performing dynamic similarity calculation between items on the dynamic score matrix to obtain an item similarity matrix; a candidate commodity recommendation module 140 for generating a candidate recommendation commodity list based on the target user ID, the dynamic score matrix, and the item similarity matrix; and a final commodity recommendation module 150 for sorting, filtering, and truncating the candidate recommendation commodity list to obtain a final recommendation list.
[0056] As described above, the item collaborative filtering recommendation system 100 based on user behavior analysis according to embodiments of the present disclosure can be implemented in various wireless terminals, such as a server having an item collaborative filtering recommendation algorithm based on user behavior analysis, etc. In one possible implementation, the item collaborative filtering recommendation system 100 based on user behavior analysis according to embodiments of the present disclosure can be integrated into a wireless terminal as a software module and / or a hardware module. For example, the item collaborative filtering recommendation system 100 based on user behavior analysis can be a software module in the operating system of the wireless terminal, or can be an application program developed for the wireless terminal; of course, the item collaborative filtering recommendation system 100 based on user behavior analysis can also be one of the many hardware modules of the wireless terminal.
[0057] Alternatively, in another example, the item collaborative filtering recommendation system 100 based on user behavior analysis and the wireless terminal can also be separate devices, and the item collaborative filtering recommendation system 100 based on user behavior analysis can be connected to the wireless terminal through a wired and / or wireless network, and transmit interaction information in an agreed data format.
[0058] Here, those skilled in the art can understand that the specific operations of each step in the above-described item collaborative filtering recommendation system based on user behavior analysis have been described in detail above with reference to the description of the item collaborative filtering recommendation method based on user behavior analysis of Figures 1 to 4 , and therefore repeated descriptions thereof will be omitted.
Claims
1. A collaborative filtering recommendation method for products based on user behavior analysis, characterized in that, include: The original user behavior logs and product metadata are preprocessed to obtain preprocessed user behavior data and category lifecycle profiles. Each record in the category lifecycle profile includes the category ID, lifecycle type, and decay parameter. To obtain a dynamic scoring matrix, dynamic user-item interaction based on category awareness is performed on preprocessed user behavior data and category lifecycle profiles. This includes: extracting a first interaction record from the preprocessed user behavior data; extracting a product ID based on the first interaction record; using the product ID as a query condition to find the corresponding lifecycle type and decay parameter in the category lifecycle profile; and calculating the dynamic score of the first interaction record based on the lifecycle type and decay parameter, including: calculating the dynamic score of the first interaction record based on the lifecycle type and decay parameter using the following formula, wherein the formula is: ;in, Based on scores, The time difference between the time the action occurred and the current time. For attenuation parameters, It is a decay function; For dynamic scores; If the lifecycle type is task-based, , For task decay parameters, It is a natural exponential function; where, if the lifecycle type is consumable, , For the modulo operation, For consumption decay parameters, It is the consumption cycle; among which, if the life cycle type is interest-based, , For interest-based decay parameters; The dynamic similarity between items is calculated from the dynamic rating matrix to obtain the item similarity matrix; A candidate list of recommended products is generated based on the target user ID, dynamic rating matrix, and item similarity matrix. The candidate recommended product list is sorted, filtered, and truncated to obtain the final recommended list.
2. The product collaborative filtering recommendation method based on user behavior analysis according to claim 1, characterized in that, Each interaction record in the preprocessed user behavior data includes user ID, product ID, category ID, timestamp, and basic score.
3. The product collaborative filtering recommendation method based on user behavior analysis according to claim 2, characterized in that, The original user behavior logs and product metadata are preprocessed to obtain preprocessed user behavior data and category lifecycle profiles, including: extracting behavior types from the original user behavior logs; and mapping behavior types to base scores based on a behavior score mapping table.
4. The product collaborative filtering recommendation method based on user behavior analysis according to claim 1, characterized in that, The dynamic similarity calculation between items in the dynamic rating matrix is used to obtain the item similarity matrix, including: constructing an item-user-score inverted index based on the dynamic rating matrix; obtaining the first item rating list and the second item rating list of the first item pair from the item-user-score inverted index; and calculating the item similarity of the first item pair based on the first item rating list and the second item rating list.
5. The product collaborative filtering recommendation method based on user behavior analysis according to claim 4, characterized in that, Calculating the item similarity of a first item pair based on a first item rating list and a second item rating list includes: calculating the item similarity of the first item pair based on the first item rating list and the second item rating list using the following formula, wherein the formula is: ;in, For each dynamic score in the first item rating list. For each dynamic score in the second item rating list and These are the first item rating list and the second item rating list, respectively. The similarity between the first item and the second item.
6. A collaborative filtering recommendation system for products based on user behavior analysis, characterized in that, include: The user product data preprocessing module is used to preprocess the original user behavior logs and product metadata to obtain preprocessed user behavior data and category lifecycle profiles. Each record in the category lifecycle profile includes the category ID, lifecycle type, and decay parameters. The user-item interaction module is used to perform category-aware dynamic user-item interactions on preprocessed user behavior data and category lifecycle archives to obtain a dynamic scoring matrix. This includes: extracting a first interaction record from the preprocessed user behavior data; extracting a product ID based on the first interaction record; using the product ID as a query condition to find the corresponding lifecycle type and decay parameter in the category lifecycle archive; and calculating the dynamic score of the first interaction record based on the lifecycle type and decay parameter, including: calculating the dynamic score of the first interaction record based on the lifecycle type and decay parameter using the following formula, wherein the formula is: ;in, Based on scores, The time difference between the time the action occurred and the current time. For attenuation parameters, The decay function, For dynamic scores; If the lifecycle type is task-based, , For task decay parameters, It is a natural exponential function; where, if the lifecycle type is consumable, , For the modulo operation, For consumption decay parameters, It is the consumption cycle; among which, if the life cycle type is interest-based, , For interest-based decay parameters; The item similarity calculation module is used to perform dynamic similarity calculation between items on the dynamic rating matrix to obtain the item similarity matrix; The candidate product recommendation module is used to generate a list of candidate recommended products based on the target user ID, dynamic rating matrix, and item similarity matrix. The final product recommendation module is used to sort, filter, and truncate the candidate recommended product list to obtain the final recommendation list.
Citation Information
Patent Citations
Hybrid recommendation system in online education scene
CN111831918A
Matrix decomposition recommendation algorithm fusing multi-dimensional social information
CN114862505A