A collaborative filtering recommendation method fusing user attributes and time effect
By integrating user attributes and time effects into a collaborative filtering recommendation method, this approach addresses the issue of neglecting static user attributes and time effects in traditional methods, achieving higher recommendation accuracy and personalization. It is suitable for applications such as e-commerce, social networks, and video platforms.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG UNIV
- Filing Date
- 2024-07-15
- Publication Date
- 2026-07-21
AI Technical Summary
Traditional collaborative filtering recommendation methods based on Peirce similarity fail to effectively consider users' static attribute information and time effects, resulting in recommendation results that do not match users' current needs and ignore the dynamic changes in users' interests, affecting the accuracy and timeliness of recommendations.
By employing a collaborative filtering recommendation method that integrates user attributes and time effects, the method calculates the Pierce similarity with time effects using the user rating matrix and the time decay formula. It then combines Jaccard similarity and user attribute similarity to perform weighted similarity calculation, ultimately obtaining the most similar neighbors for each user for recommendation.
It improves the sensitivity of the recommendation system to changes in user interests, enhances the timeliness and personalization of recommendation results, and improves the accuracy of recommendations, making it suitable for application scenarios such as e-commerce, social networks, and video platforms.
Smart Images

Figure CN118820613B_ABST
Abstract
Description
Technical Field
[0001] This invention provides a collaborative filtering recommendation method that integrates user attributes and time effects, belonging to the field of recommendation systems. Background Technology
[0002] With the rapid development of the internet and information technology, recommender systems are playing an increasingly important role in various applications such as e-commerce, social networks, and video platforms. Peirce similarity-based collaborative filtering is a classic and traditional recommendation method. It uses the Peirce correlation coefficient to calculate the similarity between users, finds a set of users with high similarity to the target user, and then predicts the target user's possible behavior based on their historical behavior. This can improve recommendation accuracy and user satisfaction to some extent. However, this traditional recommendation method does not consider users' static attribute information, such as age and occupation, and has certain limitations in handling dynamic user behavior and time effects.
[0003] It is well known that users of different ages and professions have slightly different preferences for watching movies and videos, as well as participating in social networks. Introducing static attribute information such as age and profession into Peirce similarity-based collaborative filtering recommendation methods can better understand and predict user interests and preferences. By performing personalized modeling for different user groups, the personalization of recommendations can be improved, thereby increasing the accuracy of recommendations.
[0004] Furthermore, users' interests and preferences are not static but constantly changing over time, with variations in living environment and personal experiences. Traditional Peirce similarity-based collaborative filtering recommendation methods often ignore the timeliness of user interests, focusing only on historical data, which may lead to recommendations that do not match the user's current needs. In addition, different users may show significant differences in their attention to the same items at different times, such as seasonal goods or holiday-specific products. Therefore, incorporating the time effect into Peirce similarity-based collaborative filtering recommendation methods, utilizing timestamp time features, captures the dynamic changes in user interests. By modeling the time effect, the timeliness and relevance of recommendation results can be improved, thereby further enhancing the accuracy of recommendations.
[0005] To more accurately capture changes in user interests and the effects of time, improve the timeliness and personalization of recommendation results, and further enhance the accuracy of recommendations, a collaborative filtering recommendation method that integrates user attributes and time effects is urgently needed. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this invention provides a collaborative filtering recommendation method that integrates user attributes and time effects. This method accurately captures changes in user interests and time effects, enhances the sensitivity of the recommendation system to changes in user interests, improves the timeliness and personalization of recommendation results, and further improves recommendation accuracy. It is applicable to various application scenarios such as e-commerce, social networks, and video platforms, and has broad application prospects and market value.
[0007] The technical solution of this invention is as follows:
[0008] A collaborative filtering recommendation method that integrates user attributes and time effects includes the following steps:
[0009] (1) Construct a user rating matrix M based on the dataset. score and user rating time matrix M time At the same time, user attributes are obtained;
[0010] (2) The Pierce similarity of the fusion time effect is obtained by using the user rating time matrix and the time decay formula, and then the Pierce similarity of the fusion time and common rating weight coefficient is obtained by combining the Jaccard similarity. At the same time, the Pierce similarity of the fusion user attributes is obtained by combining the user attributes with the Pierce similarity.
[0011] (3) The Pierce similarity of fusion time and common rating weight coefficient is weighted with the Pierce similarity of fused user attributes to obtain the final similarity calculation formula;
[0012] (4) Based on the final similarity obtained in step (3), obtain the k most similar neighbors for each user;
[0013] (5) Based on the scores of the nearest neighbor set, predict the scores of the unrated items for each target user.
[0014] Preferably, in step (1), the dataset is first divided into a training set and a test set according to a ratio, and then the training set is preprocessed to obtain user attributes.
[0015] User project matrix M score It can calculate the similarity between users, user rating matrix M score Each matrix element represents a specific rating given by a different user to a different item, R ui R is the rating of user u for item i. vi It is the rating of user v for item i. The traditional Peirce similarity formula is shown in equation (1).
[0016]
[0017] Where, simpearson (u,v) is the Pierce similarity between user u and user v, I u It is a collection of items rated by user u, I v It is a collection of items rated by user v. It is the average rating of user u. It is the average rating of user v.
[0018] Preferably, in step (2), the user rating time matrix M time After probability normalization using the time decay formula, the time decay probability matrix M is obtained. P-time M time Substituting each element of the matrix into the user rating timestamp value t in formula (3) yields M. P-time Substituting the transformation process into equation (2), we can express it as follows:
[0019]
[0020] The time decay formula f(t) is shown in equation (3) below:
[0021]
[0022] Among them, T max T represents the maximum value among the rating timestamps. min The minimum value among the rating timestamps, where t is the rating timestamp value;
[0023] The closer the rating timestamp value t is, the smaller the user interest decays, and the closer the probability of conversion is to 1; conversely, the longer the time interval between user ratings, the greater the user interest decays.
[0024] The time decay probability matrix M is incorporated into the Peirce similarity formula. P-time Pierce similarity sim with time effects time (u,v) is shown in equation (4):
[0025]
[0026] Wherein, the time decay probability matrix M P-time Each matrix element represents the time decay probability of different users rating different items, R p-ui R is the time decay probability of user u's rating of item i. p-vi The time decay probability of user v's rating for item i, where each element of the user rating matrix represents a different user's specific rating for a different item, R. ui R is the rating of user u for item i. vi It is user v's rating of item i. It is the average rating of user u. It is the average rating of user v, I u It is a collection of items rated by user u, I v It is a collection of items rated by user v.
[0027] Preferably, in step (2), since the Pierce similarity calculation formula depends on users' shared ratings, while the Jaccard similarity considers users' non-shared ratings, the Pierce similarity and Jaccard similarity are combined, and the Jaccard similarity is used as the weighting coefficient of shared ratings to solve the problem that the Pierce similarity calculation formula depends on users' shared ratings. The Jaccard similarity is shown in equation (5):
[0028]
[0029] Where |·| is the number of sets;
[0030] By multiplying the Pierce similarity of the fusion time effect by the Jaccard similarity, the Pierce similarity formula for the fusion time and common rating weight coefficient is obtained, as shown in Equation (6):
[0031] sim T-jaccard (u,v)=sim time (u,v)×sim jaccard (u,v) (6)
[0032] Since Pierce similarity depends on users’ common ratings, and Jaccard similarity, as a common rating weighting coefficient, can be multiplied by Pierce similarity to obtain equation (6), it takes into account users’ non-common ratings on the basis of Pierce similarity, integrates more effective information, and can improve the accuracy of recommendation to a certain extent.
[0033] Preferably, the present invention integrates user attributes on the basis of Pierce similarity, taking age and occupation as user attributes, and the similarity of user attributes between users can be calculated from the user attributes.
[0034] Based on the user's age attribute, the formula for age attribute similarity is obtained, as shown in equation (7):
[0035]
[0036] Among them, Age u and Age v Let u and v be the ages of users respectively. The greater the age difference, the smaller the similarity; conversely, the smaller the age difference, the greater the similarity. Formula (7) calculates the similarity between ages through an exponential function, which conforms to this rule and has a certain degree of rationality.
[0037] Based on the user's occupational attributes, an occupational category tree is built for various occupations in the dataset, and the occupational attribute similarity formula is obtained, as shown in equation (8):
[0038]
[0039] Among them, T uv Let represent the distance between user u and user v, and High represent the depth of the occupation category tree; the more similar the occupations, the greater the similarity, and vice versa.
[0040] Combining the similarity of age and occupation attributes with the Pierce similarity formula, a similarity formula that integrates user attributes based on Pierce similarity can be obtained, as shown in equation (9):
[0041] sim user (u,v)=α×sim pearson (u,v)+(1-α)[η×sim age (u,v)+(1-η)×sim occ (u,v)](9)
[0042] Where η is the weighting coefficient of age attribute in user attributes, and α is the weighting coefficient of traditional Peirce similarity in Peirce similarity of fused user attributes.
[0043] Preferably, in step (3), the Pierce similarity fused with the time effect and the common rating weight coefficient and the Pierce similarity fused with user attributes are combined in a weighted manner to obtain the final similarity calculation formula, as shown in equation (10):
[0044] sim total (u,v)=μ×sim T-jaccard (u,v)+(1-μ)×sim user (u,v) (10)
[0045] Where μ is the weighting coefficient of the Pierce similarity, which incorporates the time effect and the common rating weighting coefficient.
[0046] Preferably, in steps (4) and (5), the following formula is used for prediction scoring:
[0047]
[0048] in, For user u's predicted rating of item i, N k (u) represents the set of k neighboring users of user u. Formula (11) takes into account the degree of user preference for the item, that is, the ratings of similar users are weighted according to their similarity to the target user to take into account the preference differences between the target user and similar users.
[0049] Preferably, the predicted results are compared with the results in the test set and measured using MAE and RMSE indicators, as shown in equations (12) and (13), where n is the number of items evaluated by user u, {p u1 ,p u2 ...,p un} represents the rating calculated by user u for items {1,2,……,n} based on similarity, and {q} represents the rating calculated by user u for items {1,2,……,n}. u1 ,q u2 ……,q un} represents the actual rating of user u for item {1,2,……,n}.
[0050]
[0051] For any details not covered in this invention, please refer to the prior art.
[0052] The beneficial effects of this invention are as follows:
[0053] This invention addresses the changes and shifts in user interests and preferences by integrating time effects and co-rating weighting coefficients into Peirce user similarity. Simultaneously, it incorporates static attributes such as age and occupation, enabling more personalized recommendations for each individual user. By combining user attributes and time effects with Peirce similarity, this invention not only enhances the recommendation system's sensitivity to changes in user interests but also improves the timeliness and personalization of recommendation results, thereby further increasing accuracy. It is applicable to various application scenarios such as e-commerce, social networks, and video platforms, and has broad application prospects and market value. Attached Figure Description
[0054] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments of this application and their descriptions are used to explain this application and do not constitute an undue limitation of this application.
[0055] Figure 1 This is a flowchart of the collaborative filtering recommendation method that integrates user attributes and time effects proposed in this invention.
[0056] Figure 2 This is a tree structure diagram of occupational categories; where (a) is occupational category tree one and (b) is occupational category tree two.
[0057] Figure 3 This is a line graph showing how the MAE index changes with the proportion η of age and occupation attributes among user attributes.
[0058] Figure 4 This is a line graph showing how the RMSE metric changes with the proportion η of age and occupation attributes among user attributes.
[0059] Figure 5 Line graphs showing the variation of the MAE index of the proposed method and the Peirce similarity method with the nearest neighbor k.
[0060] Figure 6 This is a line graph showing the variation of the RMSE index of the proposed method and the Peirce similarity method with the nearest neighbor k. Detailed Implementation
[0061] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. However, this is not the only description; all aspects not described in detail herein are based on conventional techniques in the art.
[0062] Example
[0063] A collaborative filtering recommendation method that integrates user attributes and time effects, such as... Figure 1 It includes the following steps:
[0064] (1) Construct a user rating matrix M based on the dataset. score and user rating time matrix M time At the same time, user attributes are obtained;
[0065] First, the dataset is divided into a training set and a test set in a 4:1 ratio. Then, the training set is preprocessed to obtain user attributes.
[0066] Taking the Movies100K dataset as an example, the u.user file in the MovieLens100K dataset contains users' demographic information. From this, we extract each user's age and occupation, and construct age attribute matrices and occupation attribute matrices, each with a dimension of 943*1. The u.data file in the MovieLens100K dataset consists of 10,000 ratings from 943 users for 1682 movies. We then convert these user ratings into a matrix form, where rows represent users and columns represent movies, with unrated data marked as 0. This forms the user-movie rating matrix M. score And user project rating time matrix M time The matrix dimension is 943*1682.
[0067] User project matrix M score It can calculate the similarity between users, user rating matrix M score Each matrix element represents a specific rating given by a different user to a different item, R ui R is the rating of user u for item i. vi It is the rating of user v for item i. The traditional Peirce similarity formula is shown in equation (1).
[0068]
[0069] Where, sim pearson (u,v) is the Pierce similarity between user u and user v, I u It is a collection of items rated by user u, I v It is a collection of user ratings. It is the average rating of user u. It is the average rating of user v.
[0070] (2) The Pierce similarity of the fusion time effect is obtained using the user rating time matrix and the time decay formula. Then, the Pierce similarity of the fusion time and the co-rating weight coefficient is obtained by combining the Jaccard similarity. At the same time, the Pierce similarity of the fused user attributes is obtained based on user attributes and combined with the Pierce similarity. Specifically:
[0071] User rating time matrix M time After normalizing the probability using the time decay formula, we obtain the time decay probability matrix M. P-time M time Substituting each element of the matrix into the user rating timestamp value t in formula (3) yields M. P-time Substituting the transformation process into equation (2), we can express it as follows:
[0072]
[0073] The time decay formula f(t) is shown in equation (3) below:
[0074]
[0075] Among them, T max T represents the maximum value among the rating timestamps. min The minimum value among the rating timestamps, where t is the rating timestamp value;
[0076] The closer the rating timestamp t is, the smaller the decay of user interest, and the closer the probability of conversion is to 1; conversely, the longer the time interval between user ratings, the greater the decay of user interest.
[0077] The time decay probability matrix M is incorporated into the Peirce similarity formula. P-time Pierce similarity sim with time effects time (u,v) is shown in equation (4):
[0078]
[0079] Wherein, the time decay probability matrix M P-timeEach matrix element represents the time decay probability of different users' ratings for different items, with dimensions of 943*1682, R p-ui R is the time decay probability of user u's rating of item i. p-vi The time decay probability of user v's rating for item i, where each element of the user rating matrix represents a different user's specific rating for a different item, R. ui R is the rating of user u for item i. vi It is user v's rating of item i. It is the average rating of user u. It is the average rating of user v, I u It is a collection of items rated by user u, I v It is a collection of items rated by user v.
[0080] Since the Pierce similarity calculation formula relies on users' shared ratings, while the Jaccard similarity considers users' non-shared ratings, the Pierce similarity and Jaccard similarity are combined, with the Jaccard similarity used as the weighting coefficient for shared ratings, to solve the problem that the Pierce similarity calculation formula relies on users' shared ratings. The Jaccard similarity is shown in equation (5):
[0081]
[0082] Where |·| is the number of sets;
[0083] By multiplying the Pierce similarity of the fusion time effect by the Jaccard similarity, the Pierce similarity formula for the fusion time and common rating weight coefficient is obtained, as shown in Equation (6):
[0084] sim T-jaccard (u,v)=sim time (u,v)×sim jaccard (u,v) (6)
[0085] Since Pierce similarity depends on users’ common ratings, and Jaccard similarity, as a common rating weighting coefficient, can be multiplied by Pierce similarity to obtain equation (6), it takes into account users’ non-common ratings on the basis of Pierce similarity, integrates more effective information, and can improve the accuracy of recommendation to a certain extent.
[0086] Preferably, the present invention integrates user attributes on the basis of Pierce similarity, taking age and occupation as user attributes, and the similarity of user attributes between users can be calculated from the user attributes.
[0087] Based on the user's age attribute, the formula for age attribute similarity is obtained, as shown in equation (7):
[0088]
[0089] Among them, Age u and Age v Let u and v be the ages of users respectively. The greater the age difference, the smaller the similarity; conversely, the smaller the age difference, the greater the similarity. Formula (7) calculates the similarity between ages through an exponential function, which conforms to this rule and has a certain degree of rationality.
[0090] Based on occupational characteristics and domain knowledge, similar occupations are grouped into the same category. Individual occupations are then further categorized based on their similarity into different subcategories, employing a multi-level division. Larger categories are further subdivided into smaller categories, thus constructing an occupational category tree. The number of levels is the depth High of the occupational category tree. The distance between user u and user v is determined by first using a depth-first search (DFS) algorithm to find the nearest common node between users u and v, and then selecting the maximum value from these two nodes to the common node. The occupational category tree is... Figure 2 (a) Figure 2 As shown in (b);
[0091] The formula for occupational attribute similarity is shown in equation (8):
[0092]
[0093] Among them, T uv Let represent the distance between user u and user v, and High represent the depth of the occupation category tree; the more similar the occupations, the greater the similarity, and vice versa.
[0094] Combining the similarity of age and occupation attributes with the Pierce similarity formula, a similarity formula that integrates user attributes based on Pierce similarity can be obtained, as shown in equation (9):
[0095] sim user (u,v)=α×sim pearson (u,v)+(1-α)[η×sim age (u,v)+(1-η)×sim occ (u,v)](9)
[0096] Where η is the weighting coefficient of age attribute in user attributes, and α is the weighting coefficient of traditional Peirce similarity in Peirce similarity of fused user attributes.
[0097] Depend on Figure 3 and Figure 4It can be seen that η is the weighting coefficient of age attribute in user attributes, which is 0.4. That is, the age attribute accounts for 0.4 and the occupation attribute accounts for 0.6, which can obtain relatively good user attribute similarity. α is the weighting coefficient of traditional Peirce similarity in Peirce similarity fused with user attributes, which is 0.7. That is, the Peirce similarity accounts for 0.7 and the combined weighting of age and occupation attributes is 0.3, which can obtain relatively good user attribute similarity.
[0098] (3) The Pierce similarity of fusion time and common rating weight coefficient is weighted with the Pierce similarity of fused user attributes to obtain the final similarity calculation formula, as shown in Equation (10):
[0099] sim total (u,v)=μ×sim T-jaccard (u,v)+(1-μ)×sim user (u,v) (10)
[0100] Wherein, μ is the weighting coefficient of the Pierce similarity that integrates the time effect and the common rating weighting coefficient. In this embodiment, μ is 0.5, that is, each accounts for 0.5.
[0101] (4) Based on the final similarity obtained in step (3), obtain the k most similar neighbors for each user;
[0102] (5) Based on the scores of the nearest neighbor set, predict the scores of the unrated items for each target user.
[0103] The following formula is used for prediction scoring:
[0104]
[0105] in, The predicted rating for user u for item i. Nk(u) Let represent the set of user u's k-th neighbor users. Formula (11) takes into account the degree of user preference for the item, that is, the ratings of similar users are weighted according to their similarity to the target user to take into account the preference differences between the target user and similar users.
[0106] The predicted results are compared with the results in the test set and measured using MAE and RMSE indicators, as shown in equations (12) and (13), where n is the number of items evaluated by user u, {p u1 ,p u2 ...,p un} represents the rating calculated by user u for items {1,2,……,n} based on similarity, and {q} represents the rating calculated by user u for items {1,2,……,n}. u1 ,q u2 ……,q un} represents the actual rating of user u for item {1,2,……,n}.
[0107]
[0108]
[0109] Based on the MAE and RMSE indices, curves showing the changes in MAE and RMSE values as a function of the nearest neighbor number k for these two methods are plotted, as detailed below. Figure 5 and Figure 6 As shown, it is evident that the method proposed in this invention has smaller MAE and RMSE values and better recommendation performance compared to the traditional Pierce similarity method.
[0110] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A collaborative filtering recommendation method that integrates user attributes and time effects, characterized in that, Includes the following steps; (1) Establish a user rating matrix and a user rating time matrix based on the dataset, and obtain user attributes at the same time; (2) The Pierce similarity of the fusion time effect is obtained by using the user rating time matrix and the time decay formula, and then the Pierce similarity of the fusion time and common rating weight coefficient is obtained by combining the Jaccard similarity. At the same time, the Pierce similarity of the fusion user attributes is obtained by combining the user attributes with the Pierce similarity. (3) The Pierce similarity of fusion time and common rating weight coefficient is weighted with the Pierce similarity of fused user attributes to obtain the final similarity calculation formula; (4) Obtain the k most similar neighbors for each user based on the final similarity obtained in step (3); (5) Predict ratings for unrated target users based on the ratings of the nearest neighbor set; In step (1), the dataset is first divided into a training set and a test set according to a certain ratio. Then, the training set is preprocessed to obtain user attributes. In step (2), the user rating time matrix After normalizing the probability using the time decay formula, the time decay probability matrix is obtained. Time decay formula As shown in equation (3): (3) in, The maximum value among the rating timestamps. The minimum value among the rating timestamps, where t is the rating timestamp value; The closer the rating timestamp t is, the smaller the decay of user interest, and the closer the probability of conversion is to 1; conversely, the longer the time interval between user ratings, the greater the decay of user interest. Pierce similarity with time effects As shown in equation (4): (4) Wherein, the time decay probability matrix Each matrix element represents the probability of time decay in ratings for different items by different users. It is the time decay probability of user u's rating for item i. The time decay probability of user v's rating for item i, where each element of the user rating matrix represents a specific rating from a different user for a different item. It is user u's rating of item i. It is user v's rating of item i. It is the average rating of user u. It is the average rating of user v. User The set of items to be evaluated User The set of items to be evaluated; In step (2), the Jaccard similarity is shown in equation (5): (5) By multiplying the Pierce similarity of the fusion time effect by the Jaccard similarity, the Pierce similarity formula for the fusion time and common score weight coefficient is obtained, as shown in Equation (6): (6); In step (2), based on the user's age attribute, the age attribute similarity formula is obtained, as shown in equation (7): (7) in, and These are the ages of user u and user v, respectively; Based on the user's occupational attributes, the occupational attribute similarity formula is obtained, as shown in equation (8): (8) in, The distance between user u and user v The depth of the occupation category tree; Combining the similarity of age and occupation attributes with the Pierce similarity formula, a similarity formula integrating user attributes is obtained, as shown in equation (9): (9) in, It is the weighting coefficient of age attribute out of user attributes. It is the weighting coefficient of traditional Peirce similarity to the Peirce similarity of fused user attributes; In step (3), the Pierce similarity fused with the time effect and the common rating weight coefficient and the Pierce similarity fused with user attributes are combined in a weighted manner to obtain the final similarity calculation formula, as shown in equation (10): (10) Where μ is the weighting coefficient of the Pierce similarity, which incorporates the time effect and the common rating weighting coefficient; In steps (4) and (5), the following formula (11) is used for prediction scoring: (11) in, The predicted rating for user u for item i. Describes the set of k neighboring users of user u; This method is applicable to movies, e-commerce, and video platforms.