Commodity collaborative filtering recommendation method and system based on user behavior analysis
By constructing category lifecycle profiles and dynamic scoring matrices, the problems of dynamic user interests and category differences in collaborative filtering recommendations are solved, enabling accurate product recommendations based on user behavior analysis.
Patent Information
- Application Number
- CN202511447353.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-11
- Publication Date
- 2025-11-11
- 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 the original user behavior logs and product metadata, a dynamic rating matrix is generated. Combined with category-aware dynamic user-item interactions, the similarity between items is calculated, a candidate recommended product list is generated, and then sorted, filtered, and truncated.
It enables accurate recommendations based on the user's current interest status, solving the problem of inaccurate recommendations caused by the inability to handle the dynamics of user interests and the differences in product categories, and improving the timeliness and accuracy of recommendations.
Smart Images

Figure CN120929682A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of product recommendation, and more specifically, to a product collaborative filtering recommendation method and system based on user behavior analysis. Background Technology
[0002] With the rapid development of e-commerce platforms, the number of goods has exploded, leading to severe information overload for users. To help users quickly discover content of interest amidst a vast sea of products, personalized recommendation systems have emerged and become a core technology for major platforms. Among these, collaborative filtering recommendation methods based on user behavior analysis are widely used due to their simplicity and effectiveness. They primarily analyze users' historical behavioral data (such as clicks, favorites, and purchases) to uncover user preferences and recommend potentially interesting products.
[0003] However, existing collaborative filtering recommendation methods have significant limitations in practical applications. Most of these methods treat users' historical behavioral data as a static set, failing to fully consider the dynamic evolution of user interests over time. For example, a user's purchase of newborn supplies months ago might be given similar weight to their recent browsing of toddler toys in a traditional model. This clearly does not conform to the objective law of user needs changing over time, resulting in poor timeliness and accuracy of recommendation results. More importantly, the consumption patterns and lifecycles of user interests differ drastically across different product categories. Interest in electronic products like mobile phones decays rapidly after purchase, while daily necessities like tissues and rice exhibit clear cyclical consumption characteristics. Existing methods often use a single, global time decay function to process all types of behavioral data, failing to finely characterize these differences between categories and making it difficult to accurately capture users' true needs at specific points in time. The fundamental reason for this is that existing technologies have failed to effectively establish the intrinsic link between product category attributes and the dynamic decay pattern of user interests. They generally lack a mechanism to identify and quantify the different interest lifecycle models corresponding to different categories of goods (such as task-oriented, consumable, or interest-oriented goods), and are also unable to dynamically calculate the effective value of users' historical behavior at the current point in time based on these differentiated models.
[0004] Therefore, how to construct a method that can perceive the characteristics of the product category lifecycle, dynamically assess the intensity of user interests, and thus improve the accuracy and timeliness of recommendations has become a technical bottleneck that urgently needs to be solved in the field of collaborative filtering recommendation. Summary of the Invention
[0005] To address the problems in the prior art, according to one aspect of this application, a collaborative filtering recommendation method for products based on user behavior analysis is provided, comprising: preprocessing raw user behavior logs and product metadata to obtain preprocessed user behavior data and category lifecycle profiles; performing category-aware dynamic user-item interactions on the preprocessed user behavior data and category lifecycle profiles to obtain a dynamic rating matrix; calculating dynamic similarity between items on the dynamic rating matrix to obtain an item similarity matrix; generating a candidate recommended product list based on the target user ID, the dynamic rating matrix, and the item similarity matrix; and sorting, filtering, and truncating the candidate recommended product list to obtain a final recommendation list.
[0006] According to another aspect of this application, a collaborative filtering recommendation system for products based on user behavior analysis is provided, comprising: a user-product data preprocessing module for preprocessing raw user behavior logs and product metadata to obtain preprocessed user behavior data and category lifecycle profiles; a user-item interaction module for performing category-aware dynamic user-item interactions on the preprocessed user behavior data and category lifecycle profiles to obtain a dynamic rating matrix; an item similarity calculation module for performing dynamic similarity calculations between items on the dynamic rating matrix to obtain an item similarity matrix; a candidate product recommendation module for generating a list of candidate recommended products based on the target user ID, the dynamic rating matrix, and the item similarity matrix; and a final product recommendation module for sorting, filtering, and truncating the list of candidate recommended products to obtain a final recommendation list.
[0007] Compared with existing technologies, this application provides a product collaborative filtering recommendation method and system based on user behavior analysis. By constructing a category lifecycle profile, it deeply couples the inherent attributes of product categories with the dynamic decay patterns of user interests, thereby overcoming the static nature of traditional collaborative filtering recommendation methods. Specifically, products are first classified, and lifecycle profiles with differentiated decay parameters are established for different categories (such as task-oriented, consumption-oriented, and interest-oriented). During recommendation calculation, instead of using static historical behavior scores, a dynamic and time-sensitive score is calculated for each user-item interaction based on the category lifecycle profile and the interval between the time the behavior occurred and the current time, forming a dynamic score matrix. Subsequent item similarity calculations and recommendation list generation are based on this matrix. This effectively distinguishes the decay rates and patterns of different product interests, enabling the recommendation results to more accurately capture the user's current core needs, solving the inaccurate recommendation problem caused by the inability to handle the dynamic, periodic, and category-specific differences of user interests in the background technology. Attached Figure Description
[0008] The above and other objects, features and advantages of this application will become more apparent from the more detailed description of the embodiments of this application in conjunction with the accompanying drawings.
[0009] Figure 1 This is a flowchart of a product collaborative filtering recommendation method based on user behavior analysis according to an embodiment of this application.
[0010] Figure 2 This is a schematic diagram of the data flow of a product collaborative filtering recommendation method based on user behavior analysis according to an embodiment of this application.
[0011] Figure 3 This is a flowchart of step S2 in the product collaborative filtering recommendation method based on user behavior analysis according to an embodiment of this application.
[0012] 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.
[0013] Figure 5 This is a block diagram of a product collaborative filtering recommendation system based on user behavior analysis according to an embodiment of this application. Detailed Implementation
[0014] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. It should be understood that the drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0015] To address the technical challenges mentioned above, this application proposes a collaborative filtering recommendation method for products based on user behavior analysis. Figure 1 This is a flowchart of a product collaborative filtering recommendation method based on user behavior analysis according to an embodiment of this application. Figure 2 This is a schematic diagram illustrating the data flow of a collaborative filtering recommendation method for products based on user behavior analysis according to an embodiment of this application. Figure 1 and Figure 2 As shown, the product collaborative filtering recommendation method based on user behavior analysis according to an embodiment of this application includes: S1, preprocessing the original user behavior logs and product metadata to obtain preprocessed user behavior data and category lifecycle profiles; S2, performing category-aware dynamic user-item interaction on the preprocessed user behavior data and category lifecycle profiles to obtain a dynamic rating matrix; S3, calculating the dynamic similarity between items on the dynamic rating matrix to obtain an item similarity matrix; S4, generating a candidate recommended product list based on the target user ID, the dynamic rating matrix, and the item similarity matrix; S5, sorting, filtering, and truncating the candidate recommended product list to obtain a final recommendation list.
[0016] In step S1, the raw user behavior logs and product metadata are preprocessed to obtain preprocessed user behavior data and category lifecycle profiles. It should be understood that raw user behavior logs and product metadata are typically heterogeneous and unstructured, lacking key information directly used to quantify the dynamic evolution of user interests and category differences. Therefore, it is necessary to transform this raw, discrete data into a structured, computable format, providing two core inputs for subsequent category-aware dynamic scoring calculations: preprocessed user behavior data containing basic interaction intensity, and category lifecycle profiles defining different category decay patterns. This lays the data foundation for solving the problem of existing technologies being unable to distinguish between category differences and the timeliness of interests.
[0017] In an optional embodiment, step S1 is implemented as follows: First, the raw user behavior logs and product metadata are obtained as processing inputs. Raw user behavior logs are typically recorded and aggregated by the front-end application or back-end server of the e-commerce platform. They are stored in streaming or batch format and record every atomic operation of the user's interaction with the platform. A typical raw log record may contain fields such as user identifier, behavior type, interaction object identifier, and timestamp of the behavior. For example, a log record could be {User Identifier: u_token_xyz, Behavior: Add to Cart, Product Uniform Code: spu_12345, Timestamp: 1678886400}. Product metadata originates from the platform's product information management database and stores the static descriptive attributes of all products. A typical metadata record may contain the product uniform code, product name, category identifier, brand information, etc. For example, a metadata record could be {Product Uniform Code: spu_12345, Product Name: A Type A Smartphone of a Certain Brand, Category Identifier: cate_001, Brand: A Certain Brand}.
[0018] After obtaining the two original data sources mentioned above, processing begins to generate preprocessed user behavior data. This process iterates through each original user behavior log. Optionally, in one embodiment of this application, each interaction record in the preprocessed user behavior data includes a user ID, product ID, category ID, timestamp, and basic score; each record in the category lifecycle archive includes a category ID, lifecycle type, and decay parameter. Specifically, for the user identifier in the log, it is converted into a unique user ID within the system through a mapping relationship or direct use. For the unified product code in the log, it is directly used as the product ID. For the timestamp in the log, its original value is retained as the timestamp field. Then, using the product ID in the log, a query and matching is performed in the product metadata to obtain the category ID corresponding to the product. At this point, the user ID, product ID, category ID, and timestamp of an interaction record have all been obtained.
[0019] Optionally, in one embodiment of this application, step S1, preprocessing the original user behavior logs and product metadata to obtain preprocessed user behavior data and category lifecycle profiles, further includes: S11, extracting behavior types from the original user behavior logs; and S12, mapping the behavior types to base scores based on a behavior score mapping table. Specifically, to quantify the intensity of interest represented by different user behaviors, base scores need to be generated. This process first executes S11, extracting behavior fields such as browsing, clicking, favorites, adding to cart, or purchasing from the original user behavior logs. Then, it executes S12, converting these text-described behavior types into numerical base scores according to a pre-defined behavior score mapping table. This mapping table is set by domain experts based on business understanding and aims to reflect the strength of user intent behind different behaviors. For example, a mapping table can be set as: {Browse: 1.0, Favorite: 3.0, Add to Cart: 5.0, Purchase: 10.0}. When a log entry for the behavior "Add to Cart" is processed, its corresponding base score is assigned a value of 5.0. Through the above processing, a raw log is finally converted into a structured preprocessed user behavior data record, with the format {User ID:U001, Product ID:spu_12345, Category ID:cate_001, Timestamp:1678886400, Base Score:5.0}.
[0020] Simultaneously, a product category lifecycle profile is constructed. This profile is a static or semi-static configuration table designed to define the consumption characteristics of each product category. The construction of this profile relies heavily on domain expert knowledge and statistical analysis of historical sales data. For each record in the profile, the category ID is first determined, corresponding one-to-one with the category identifier in the product metadata. Next, a lifecycle type is assigned to this category ID. This type is categorized based on the consumption characteristics of the category; for example, it can be divided into task-oriented, consumable, and interest-oriented categories. Task-oriented categories refer to those with long purchase decision cycles and low repurchase rates, such as mobile phones and home appliances; consumable categories refer to those requiring periodic replenishment, such as milk and tissues; and interest-oriented categories refer to those based on personal hobbies where the interest may continue long-term, such as books and musical instruments. Finally, based on the determined lifecycle type, corresponding decay parameters are configured for the category. These parameters will be used for subsequent dynamic score calculations. For example, for a category ID of cate_001, such as smartphones, its lifecycle type can be defined as task-oriented, and its decay parameter can be set to a task decay coefficient, such as 0.1, indicating that interest declines rapidly after purchase. For a category ID of cate_088, such as milk, its type can be defined as consumable, and its decay parameters include a consumable decay coefficient, such as 0.5, and a consumption cycle, such as an average repurchase cycle of 30 days derived from statistical analysis. For a category ID of cate_150, such as classical music records, its type can be defined as interest-oriented, and its decay parameter is an interest-oriented decay coefficient, such as 0.02, indicating that interest decays very slowly. The final generated category lifecycle profile is a collection of records, such as: {Category ID:cate_001, Lifecycle Type: Task, Decay Parameter: 0.1}, {Category ID:cate_088, Lifecycle Type: Consumption, Decay Parameter: 0.5, Consumption Cycle: 30}, {Category ID:cate_150, Lifecycle Type: Interest, Decay Parameter: 0.02}.
[0021] In step S2, dynamic user-item interactions based on category awareness are performed on the preprocessed user behavior data and category lifecycle profiles to obtain a dynamic rating matrix. Correspondingly, although the preprocessed user behavior data is structured, the underlying scores it contains are essentially static and cannot reflect the natural decay or periodic changes in user interest over time. Furthermore, the user interest lifecycle patterns corresponding to different product categories differ significantly. Therefore, to dynamize the static underlying scores, this application introduces a time decay function tightly coupled with the product category to calculate a time-sensitive dynamic score for each historical interaction, thereby constructing a dynamic rating matrix that truly reflects the user's current interest state, providing a foundation for subsequent accurate similarity calculation and recommendation generation.
[0022] Optionally, in one embodiment of this application, Figure 3 This is a flowchart of step S2 in the product collaborative filtering recommendation method based on user behavior analysis according to an embodiment of this application. Figure 3 As shown, step S2, which involves performing category-aware dynamic user-item interaction on the preprocessed user behavior data and category lifecycle archive to obtain a dynamic scoring matrix, includes: S21, extracting the first interaction record from the preprocessed user behavior data; S22, extracting the product ID based on the first interaction record; S23, using the product ID as a query condition to find the corresponding lifecycle type and decay parameter in the category lifecycle archive; and S24, calculating the dynamic score of the first interaction record based on the lifecycle type and decay parameter.
[0023] In the above optional embodiment, step S2 is implemented as follows: First, step S21 is executed to extract the first interaction record from the preprocessed user behavior data. The term "first record" is used here for ease of description; in actual processing, all records are traversed one by one. Taking a record from the aforementioned embodiment as an example, the extracted interaction record is {User ID: U001, Product ID: spu_12345, Category ID: cate_001, Timestamp: 1678886400, Base Score: 5.0}.
[0024] Next, proceed to step S22. From the above records, the product ID spu_12345 can be clearly extracted. Simultaneously, for subsequent queries, its category ID cate_001 is also extracted.
[0025] Then, proceed to step S23. Search the category lifecycle archive using the category ID cate_001. Based on the archive constructed in the aforementioned embodiment, the query result is {Category ID: cate_001, Lifecycle Type: Task-type, Decay Parameter: 0.1}. Therefore, it can be determined that the lifecycle type of the product category is task-type, and its corresponding decay parameter is the task decay parameter of 0.1.
[0026] Finally, step S24 is executed. Optionally, in one embodiment of this application, step S24, calculating the dynamic score of the first interaction record based on the lifecycle type and decay parameter, includes: 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, This is a dynamic fraction. In this formula... The base score is obtained directly from the interaction log; in this case, it is 5.0. This is the time difference between the time the action occurred and the current time. For example, if the current timestamp for recommendation calculation is 1681564800, then... Seconds. For ease of understanding and parameter setting, Converted to days, i.e. sky, For attenuation parameters, This is the decay function, the specific form of which is determined by the lifecycle type. Specifically, if the lifecycle type is task-based, , For task decay parameters, It is a natural exponential function; if the lifecycle type is consumable, , For the modulo operation, For consumption decay parameters, It is the consumption cycle; if the life cycle type is interest-based, , This is the interest-based decay parameter.
[0027] Since the lifecycle type found in this application is task-based, the corresponding decay function is selected: Substituting the known values, the value of the decay function is... Ultimately, the dynamic score of this interaction record... This calculated result is significantly lower than the original baseline score of 5.0, accurately reflecting the user's added-to-cart behavior for task-oriented items such as mobile phones a month ago, indicating that their interest intensity has significantly decreased at the current moment. To further illustrate the impact of different lifecycle types, two other scenarios are listed. If the other record being processed is user U001's purchase of milk, with category ID cate_088, lifecycle type consumable, decay parameter 0.5, consumption cycle: 30, baseline score 10.0, and the behavior occurred 40 days ago, i.e. At this point, the decay function is: The calculation process is as follows: The decay function value is exp(-0.5×10²)=exp(-50). The dynamic score is 10.0×exp(-50)≈0. This indicates that the user has not repurchased within a consumption cycle (30 days), and their purchasing demand may have weakened or been satisfied through other channels. Conversely, if the behavior occurred 31 days ago, i.e. ,but The decay function value is exp(-0.5×1²)=exp(-0.5), and the dynamic score will be relatively high, indicating that the repurchase demand is at its peak. For example, if the record being processed is user U001's purchase of classical music records, its category ID is cate_150, its lifecycle type is interest-based, its decay parameter is 0.02, its base score is 10.0, and the behavior occurred 100 days ago, that is... At this point, the decay function is: The decay function value is exp(-0.02×100)=exp(-2)≈0.135. The dynamic score is 10.0×exp(-2). Because the interest-type decay coefficient is set relatively small, even after a long period of time, its dynamic score remains at a relatively high level, which is consistent with the long-term persistence of interest.
[0028] By repeating steps S21 to S24 on each record in the preprocessed user behavior data, a corresponding dynamic score can be calculated for all historical user-item interactions. This set of triplets (user ID, item ID, dynamic score) forms a dynamic scoring matrix. This matrix is sparse, containing values only at locations where the user and item have interacted, and these values are category-aware, time-sensitive dynamic scores.
[0029] Specifically, the current assumption is that all users within the same product category exhibit the same interest decay pattern, which clearly offers room for optimization. For example, in the interest-based category of photography equipment, user A is a photography enthusiast who frequently buys and browses photography gear; their interest is long-term and stable. Even if they bought a camera a year ago, recommending lenses or accessories now would still be very appropriate for them, and their interest decay should be very slow. User B, on the other hand, is a travel enthusiast who only bought an entry-level camera before a long trip and has had no further activity since; their interest is short-lived and event-driven. Therefore, if the same decay coefficient is applied to both A and B... This inevitably leads to an excessively rapid decline in interest in user A (missing a good recommendation opportunity) or an excessively slow decline in interest in user B (pushing irrelevant and annoying information). Therefore, this application introduces a dynamic personalized decline function to optimize the original static decline coefficient determined solely by the category into a dynamic personalized decline coefficient that combines the basic decline characteristics of the category with the user's activity level within that category. This ensures that the more active and focused a user's historical behavior is, the slower their interest declines in that category, thereby achieving refined 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 made by all users for category c Then divide by the average number of purchases made by user u across all product categories. This yields the normalized number of purchases. This achieves global Bayesian normalization for different users relative to different product categories, effectively smoothing out data noise.
[0032] The normalized number of purchases is calculated using an inverse Sigmoid function based on translation and scaling to obtain a dynamic personalized decay coefficient, i.e.: ;in, It is used for control The scaling factor for the range, for example, set to 2 so that the range is approximately between (0, 2). Shape parameters used to control the steepness of the curve, The larger, right The more sensitive the response to change, It is the center shift parameter, representing the average or baseline activity, when hour, ,For example It can be set based on the median or average activity level of all users. This is a dynamic, personalized decay coefficient. It should be understood that a linear mapping relationship cannot meet complex business needs; for example, the coefficient should tend to stabilize when activity levels are extremely high or low, rather than increasing or decreasing indefinitely. Therefore, to transform quantified user activity into a coefficient with practical regulatory effect, this application uses the inverse Sigmoid function to achieve a non-linear, smooth mapping. That is, this function transforms activity... Mapped to a regulating factor that conforms to preset business logic. This mechanism ensures that when user activity is at an average level, the adjustment factor is close to 1, maintaining a basic decay rate; when activity is high, the factor is less than 1, significantly slowing down the decay; and when activity is low, the factor is greater than 1, significantly accelerating the decay, achieving smooth and effective dynamic adjustment. This nonlinear mapping mechanism, through the configuration of function parameters, allows for flexible control of the intensity and sensitivity of personalized adjustments. For example, adjusting the scaling factor S can limit the upper and lower bounds of the adjustment factor, preventing extreme values and ensuring model stability.
[0033] Based on the dynamic personalized attenuation coefficient and the attenuation coefficient, task-oriented, consumption-oriented, and interest-oriented attenuation functions are constructed, namely: Task-oriented attenuation function: Consumption-type decay function: 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 executed. An inverted index is a data structure whose key is the item ID and whose values are a list containing all user IDs that have interacted with the item and their corresponding dynamic scores. The purpose of constructing this index is to greatly improve subsequent calculation efficiency and avoid global scanning in the large dynamic rating matrix. This construction process iterates through each record (user ID, item ID, dynamic score) in the dynamic rating matrix. For each record, using its item ID as the key, (user ID, dynamic score) is appended as a tuple to the value list corresponding to the key. For example, the dynamic rating matrix contains the following records: {User ID:U001, Product ID:i, Dynamic Score:4.5}, {User ID:U002, Product ID:i, Dynamic Score:3.0}, {User ID:U001, Product ID:j, Dynamic Score:4.0}, {User ID:U002, Product ID:j, Dynamic Score:3.5}, {User ID:U003, Product ID:j, Dynamic Score:2.0}, {User ID:U002, Product ID:k, Dynamic Score:1.5}, {User ID:U003, Product ID:k, Dynamic Score:2.5}. After processing in 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 executed. Here, the first item pair refers to any two items whose similarity needs to be calculated. This process iterates through all possible item pairs; for example, we need to calculate the similarity between item i and item j. By querying the inverted index built in the previous step, we can directly obtain the rating lists for each of these two items. For item i, its rating list, i.e., the first item rating list, denoted as N(i), is: [{User ID:U001, Dynamic Score:4.5}, {User ID:U002, Dynamic Score:3.0}]. For item j, its rating list, i.e., the second item rating list, denoted as N(j), 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 executed. This embodiment uses an improved cosine similarity formula for calculation. Optionally, in one embodiment of this application, step S33, calculating the item similarity of the first item pair based on the first item rating list and the 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: .
[0039] 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. This is the similarity score between the first item and the second item. The calculation process is broken down as follows: First, the numerator of the calculation formula... This part calculates the sum of the products of the dynamic scores of users who have interacted with both item i and item j. First, the intersection of the user scores from the two rating lists is found. In this example, both appear simultaneously and The users in the intersection are U001 and U002. Next, for each user in the intersection, their dynamic scores for item i and item j are extracted and multiplied. For user U001, their dynamic score for item i... The dynamic score for item j is 4.5. The product is 4.0. The product is 4.5 × 4.0 = 18.0. For user U002, the dynamic score for item i is... The dynamic score for item j is 3.0. The product is 3.5. The product is 3.0 × 3.5 = 10.5. Adding all the products together gives the numerator. Secondly, the denominator of the calculation formula This part is the product of the magnitudes of the rating vectors of the two items. First, calculate the sum of squares of all dynamic scores for item i. Then iterate through... All records in the equation: (4.5)^2 + (3.0)^2 = 29.25. Therefore, Next, calculate the sum of squares of all dynamic fractions for item j. Iterate through... All records in the equation: (4.0)^2 + (3.5)^2 + (2.0)^2 = 32.25. Therefore, Calculate the denominator. =sqrt(29.25)*sqrt(32.25). Finally, calculate the final similarity between item i and item j. =28.5 / (sqrt(29.25)*sqrt(32.25))≈0.928. This calculation result is the dynamic similarity between item i and item j.
[0040] By repeating steps S32 and S33 for all item pairs requiring calculation, a complete item similarity matrix can be obtained. The rows and columns of this matrix are item IDs, and the value at position (i,j) is sim(i,j). Each similarity value in this matrix is calculated based on dynamic scoring, thus reflecting the strength of the association between items at the current time due to shared user attention, providing high-quality and timely data support for subsequent recommendation generation. It should be noted that item i, item j, and item k used in the above embodiments are merely illustrative identifiers for convenience; in actual execution, they correspond to unique real product IDs, such as the specific identifier spu_12345 mentioned in the previous embodiments.
[0041] In step S4, a candidate list of recommended items is generated based on the target user ID, dynamic rating matrix, and item similarity matrix. It should be understood that the data in the item similarity matrix are merely a quantitative description of historical behavior and item relationships, and do not directly predict unknown items that the user might be interested in in the future. To achieve the ultimate goal of personalized recommendation—proactively discovering new items for the user—a fusion process is needed. Therefore, this application effectively combines the target user's dynamic preference history with the strength of association between items to predict the user's potential interest in items they have not interacted with before, 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, based on the input target user ID, such as U001, all historical interaction records of the user are retrieved from the dynamic rating matrix. These records constitute the user's preference history. Continuing with the aforementioned embodiment, the retrieved preference history of user U001 may contain two records: {Product ID: spu_12345, Dynamic Score: 4.5} and {Product ID: spu_67890, Dynamic Score: 4.0}. This indicates that at the current point in time, user U001's interest intensity for product spu_12345 is 4.5, and its interest intensity for product spu_67890 is 4.0.
[0043] Next, we determine the set of candidate products for which we need to predict the rating for target user U001. This set consists of products from the entire product set that user U001 has already interacted with, namely spu_12345 and spu_67890. For example, the candidate product set may include a product spu_abcde that the user has never interacted with.
[0044] Then, iterate through each candidate item in the candidate item set and calculate a predicted rating for it. Take calculating the predicted rating of candidate item spu_abcde for user U001 as an example. The core idea of this calculation is that a user's interest in a candidate item can be predicted by weighting the similarity between this candidate item and other items the user has liked in the past. The specific calculation process is as follows: 1. For candidate item spu_abcde, it is necessary to obtain its similarity to each item in user U001's preference history, namely spu_12345 and spu_67890. These similarity values are obtained from the item similarity matrix generated in step S3. For example, the query result is: the similarity between item spu_abcde and item spu_12345 is sim(spu_abcde,spu_12345) = 0.8. 1. The similarity between product spu_abcde and product spu_67890 is sim(spu_abcde,spu_67890) = 0.6. 2. Calculate the numerator of the predicted score, i.e., the weighted sum. Multiply the user's dynamic score for each historical product by the similarity between that historical product and the current candidate product, then sum all these products. Contribution from historical product spu_12345: Dynamic score × Similarity = 4.5 × 0.8 = 3.6. Contribution from historical product spu_67890: Dynamic score × Similarity = 4.0 × 0.6 = 2.4. The sum of the numerators is: 3.6 + 2.4 = 6.0. 3. Calculate the denominator of the predicted score, i.e., the sum of the absolute values of the similarities, used for normalization. The sum of the denominators is: |0.8| + |0.6| = 1.4. 4. Calculate the final predicted score. Divide the numerator by the denominator. The predicted score for candidate product spu_abcde for user U001 is 6.0 / 1.4≈4.286.
[0045] In practical applications, to improve computational efficiency and recommendation effectiveness, not all items in a user's preference history are typically used. A common optimization is to select only the K most similar historical items from each candidate item for weighted calculation. For example, setting K=20, for the candidate item spu_abcde, the 20 items with the highest similarity to spu_abcde from user U001's entire preference history are first identified, and then the predicted score is calculated using only the dynamic scores and corresponding similarities of these 20 items.
[0046] Extending the above calculation process, a predicted score is calculated for each item in the candidate item set. For example, calculating the predicted score for another candidate item, spu_fghij, might yield a score of 3.512.
[0047] After iterating through all candidate products, you will get a series of (product ID, predicted score) tuples, for example: {(spu_abcde, 4.286), (spu_fghij, 3.512), (spu_lmnop, 4.950)...}.
[0048] This list, consisting of all candidate products and their corresponding predicted scores, constitutes the final list of candidate recommended products. The predicted scores in this list take into account both the current value of the user's historical preferences (dynamic scores) and the timeliness correlation between items (dynamic similarity).
[0049] In step S5, the candidate recommended product list is sorted, filtered, and truncated to obtain the final recommendation list. That is, although the candidate recommended product list contains quantitative predictions of user interests, it is essentially still a raw and lengthy collection, which may contain a large number of weakly related products with low prediction scores, or products that are not suitable for direct display due to business reasons. To transform the prediction results into high-quality recommendation content that can be directly presented to users, the original list needs to be refined and constrained. Therefore, this application uses a series of post-processing operations such as sorting, filtering, and truncating to ensure that the final recommendation list presented to the user is high-quality, strongly related, and of appropriate length, thereby completing the crucial transformation from prediction to final decision.
[0050] In an optional embodiment, step S5 is implemented as follows: First, a sorting operation is performed. The input list of candidate recommended products is sorted in descending order according to the predicted rating field. The purpose of this operation is to place the products that the user is most likely to be interested in at the top of the list. Continuing with the previous embodiment, the list of candidate recommended products generated in step S4 contains the following: {(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 sorting in descending order, 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. This filtering aims to remove products unsuitable for recommendation to users and involves a series of rule checks. First, a predicted rating threshold is applied. A minimum predicted rating threshold is set, for example, 3.0. This threshold can be determined through offline evaluation or online A / B testing to balance the accuracy and recall of the recommendation. The list is iterated through, and all items with a predicted rating below 3.0 are removed. In the example above, the predicted rating for product spu_qrstu is 2.100, below the threshold of 3.0, so this item is removed from the list. Second, business rule filtering is applied. This includes, but is not limited to: Purchase history filtering: Checking whether the product ID in the list appears in the target user's historical purchase records. If a non-consumable product has recently been purchased by a user, it should be removed from the recommendation list to avoid duplicate recommendations. For example, if user U001 purchased product spu_11223 last week, this item is removed. Status filtering: Querying the product database to check the real-time status of each product in the list. Products in unavailable states such as "out of stock," "zero inventory," or "not available in certain regions" are removed. For example, if the query shows that product spu_vwxyz is currently out of stock, then that item is removed. Negative feedback filtering: Check if the product is in the user's list of items of no interest or has a history of clear negative feedback behavior such as being removed from the recommendation list; if so, remove it. After the above sorting and filtering operations, the candidate recommended product list is streamlined 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 number of products that a front-end display interface (such as the homepage's recommendation bar or app push notifications) can hold is limited, the list needs to be truncated to a preset length N. The value of N is determined based on the specific business scenario; for example, if the recommendation bar can display 5 products, then N is set to 5. The truncation operation retrieves the first N products from the list. In this 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 predicted ratings are retained.
[0053] After the truncation operation is completed, the product 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 products in this list are not only predicted based on the user's dynamic interests, but have also undergone strict business rule verification to ensure the validity, relevance, and high quality of the recommendation results, and can be directly used for display on the front-end interface.
[0054] In summary, the product collaborative filtering recommendation method based on user behavior analysis, as described in this application, overcomes the static nature of traditional collaborative filtering recommendation methods by constructing a category lifecycle profile and deeply coupling the inherent attributes of product categories with the dynamic decay patterns of user interests. Specifically, products are first categorized, and lifecycle profiles with differentiated decay parameters are established for different categories (e.g., task-oriented, consumption-oriented, interest-oriented). During recommendation calculation, static historical behavior scores are no longer used. Instead, a dynamic, time-sensitive score is calculated for each user-item interaction based on the category lifecycle profile and the interval between the time the behavior occurred and the current time, forming a dynamic score matrix. Subsequent item similarity calculations and recommendation list generation are based on this matrix. This effectively distinguishes the decay rates and patterns of different product interests, enabling the recommendation results to more accurately capture the user's current core needs and solving the problem of inaccurate recommendations caused by the inability to handle the dynamic, periodic, and category-specific differences of user interests in the background technology.
[0055] Figure 5 This is a block diagram of a collaborative filtering recommendation system for products based on user behavior analysis, according to an embodiment of this application. Figure 5 As shown, the product collaborative filtering recommendation system 100 based on user behavior analysis according to an embodiment of this application includes: a user-product data preprocessing module 110, used to preprocess the original user behavior logs and product metadata to obtain preprocessed user behavior data and category lifecycle profiles; a user-item interaction module 120, used to perform category-aware dynamic user-item interaction on the preprocessed user behavior data and category lifecycle profiles to obtain a dynamic rating matrix; an item similarity calculation module 130, used to perform dynamic similarity calculation between items on the dynamic rating matrix to obtain an item similarity matrix; a candidate product recommendation module 140, used to generate a candidate recommended product list based on the target user ID, the dynamic rating matrix, and the item similarity matrix; and a final product recommendation module 150, used to sort, filter, and truncate the candidate recommended product list to obtain a final recommendation list.
[0056] As described above, the product collaborative filtering recommendation system 100 based on user behavior analysis according to embodiments of this disclosure can be implemented in various wireless terminals, such as servers with product collaborative filtering recommendation algorithms based on user behavior analysis. In one possible implementation, the product collaborative filtering recommendation system 100 based on user behavior analysis according to embodiments of this disclosure can be integrated into the wireless terminal as a software module and / or a hardware module. For example, the product collaborative filtering recommendation system 100 based on user behavior analysis can be a software module in the operating system of the wireless terminal, or it can be an application developed for the wireless terminal; of course, the product collaborative filtering recommendation system 100 based on user behavior analysis can also be one of many hardware modules of the wireless terminal.
[0057] Alternatively, in another example, the product collaborative filtering recommendation system 100 based on user behavior analysis and the wireless terminal can also be separate devices, and the product collaborative filtering recommendation system 100 based on user behavior analysis can be connected to the wireless terminal via wired and / or wireless networks, and transmit interactive information in accordance with an agreed data format.
[0058] Here, those skilled in the art will understand that the specific operations of each step in the above-described product collaborative filtering recommendation system based on user behavior analysis have been referenced above. Figures 1 to 4 The description of the product collaborative filtering recommendation method based on user behavior analysis is detailed here, and therefore, its repeated description will be omitted.
Claims
1. A collaborative filtering recommendation method for products based on user behavior analysis, characterized in that, include: Preprocess the raw user behavior logs and product metadata to obtain preprocessed user behavior data and category lifecycle profiles; Dynamic user-item interactions based on category awareness are performed on preprocessed user behavior data and category lifecycle profiles to obtain a dynamic rating matrix; The dynamic similarity between items is calculated from the dynamic rating matrix to obtain the item similarity matrix; a candidate recommended product list is generated based on the target user ID, the dynamic rating matrix, and the item similarity matrix; the candidate recommended product list is sorted, filtered, and truncated to obtain the final recommendation 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 base score; each record in the category lifecycle profile includes category ID, lifecycle type, and decay parameter.
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, To obtain a dynamic scoring matrix, dynamic user-item interaction based on category awareness is performed on preprocessed user behavior data and category lifecycle archives. 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.
5. The product collaborative filtering recommendation method based on user behavior analysis according to claim 4, characterized in that, The dynamic score of the first interaction record is calculated based on the lifecycle type and decay parameter, including: calculating the dynamic score of the first interaction record using the following formula, where 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, This is a dynamic score.
6. The product collaborative filtering recommendation method based on user behavior analysis according to claim 5, characterized in that, in, 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, , This is the interest-based decay parameter.
7. 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.
8. The product collaborative filtering recommendation method based on user behavior analysis according to claim 7, 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.
9. A collaborative filtering recommendation system for goods 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 archives. The user-item interaction module is used to perform category-aware dynamic user-item interaction on preprocessed user behavior data and category lifecycle profiles to obtain a dynamic rating matrix. 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 generates a list of candidate recommended products based on the target user ID, dynamic rating matrix, and item similarity matrix; the final product recommendation module sorts, filters, and truncates 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
E-commerce personalized recommendation method based on cross-domain collaborative filtering
CN120430856A
Product market lifecycle driven recommendations
US20160225061A1
Collaborative filtering method, apparatus, server and storage medium in combination with time factor
US20180300648A1