Movie recommendation method based on social network and collaborative filtering
By combining social networks and collaborative filtering algorithms in the movie recommendation system, the fusion similarity of users is calculated, data sparsity and cold start problems are solved, and the accuracy and diversity of the recommendation system are improved.
Patent Information
- Application Number
- CN202411297804.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2024-12-13
AI Technical Summary
When traditional collaborative filtering algorithms process massive data, due to data sparseness and cold start problems, the recommendation accuracy is insufficient, especially when new users or new items appear, they cannot effectively tap into users' potential preferences.
By obtaining Douban data set, the user-movie rating matrix and user explicit social network are constructed, the implicit social network is obtained using single-mode projection, the user's fusion similarity is calculated, and the recommendation list is generated in combination with the collaborative filtering algorithm.
It enhances the diversity and accuracy of the recommendation system, solves the problems of user cold start and data sparseness, and improves the recommendation effect.
Smart Images

Figure CN119128287A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a movie recommendation method based on social network and collaborative filtering, belonging to the technical field of recommendation systems. Background Art
[0002] In the era of rapid development of big data and Internet technology, the vast amount of data on the Internet not only meets people's demand for information, but also brings the problem of "information overload", and the recommendation system came into being. The task of the recommendation system is to mine and analyze user preferences and needs from massive amounts of data, so as to accurately recommend content that users may be interested in. Compared with traditional search engines, the application scenarios of recommendation systems are more extensive, and they have been widely integrated into many fields such as e-commerce, news media, music, and social networking.
[0003] The traditional collaborative filtering algorithm is one of the most classic methods in the recommendation system. The collaborative filtering algorithm is mainly divided into user-based collaborative filtering and item-based collaborative filtering. The user-based collaborative filtering algorithm predicts the target user's preferences based on the behaviors of these similar users by finding other users with similar interests as the target user; while the item-based collaborative filtering algorithm makes recommendations by analyzing the user's preferences for similar items. With the increasing amount of data in the recommendation system, the data types tend to be diversified and complex. Obtaining similar preferences based on the behavioral data directly generated by users obviously cannot capture the user's potential preferences. On the one hand, in real business scenarios, there are a large number of candidate products that can be recommended, and users only have interactive relationships with a small number of products, which leads to a very sparse rating matrix of users and products. The traditional collaborative filtering algorithm cannot effectively mine the user's preferences and interests, thereby limiting the accuracy of the recommendation algorithm. On the other hand, when new users or new items appear, the system does not have enough historical feedback data on the items from users to learn the user's preferences for the items, resulting in user cold start problems and item cold start problems. The cold start problem also greatly reduces the accuracy of the recommendation algorithm.
[0004] With the popularity of social networks, social relationship data provides a new way to solve the above problems. Users have explicit and implicit social relationships with other users in social networks. Explicit social relationships are usually manifested as friendships, while implicit social relationships can be mined through common interests or behaviors between users. Integrating social network data into the recommendation system can not only make up for the lack of user behavior data, but also improve the accuracy and diversity of the recommendation system by considering the social influence of users. Summary of the invention
[0005] The present invention provides a movie recommendation method based on social network and collaborative filtering, so as to overcome the problem that the accuracy of existing recommendation methods needs to be improved due to data sparsity.
[0006] The technical solution of the present invention is: a movie recommendation method based on social network and collaborative filtering, the specific steps of the method are as follows:
[0007] Step 1: Obtain the Douban dataset and process the data, and construct a user-movie rating matrix based on the uir.index data in the dataset;
[0008] Step 2: Build a user-movie bipartite network;
[0009] Step 3: Build the user explicit social network based on the social.index data in the dataset;
[0010] Step 4: Obtain the user’s implicit social network by performing a single-mode projection on the user-movie bipartite network;
[0011] Step 5: Calculate the user's explicit similarity through the explicit social network, calculate the user's implicit similarity according to the user's implicit social network, and obtain the user's fused similarity;
[0012] Step 6: Given a target user, obtain the top-n users with the highest similarity to the target user, and calculate the recommendation list based on the scores of similar users.
[0013] Furthermore, the user-movie rating matrix R in step 1 is expressed as:
[0014]
[0015] The rows of the user-movie rating matrix R represent users, the columns represent movies, and the elements r in the matrix are ij represents the rating of movie h by user i, m represents the number of users, and n represents the number of objects.
[0016] Furthermore, in the step 2, the user-movie bipartite network is constructed by taking each user and each movie as a node, the node set consisting of all user nodes is recorded as user set A, the node set consisting of all movie nodes is recorded as movie set B, and the user's rating of the movie is taken as the edge. If user i rates movie α, then node i and node α are connected, and so on, to construct a user-movie bipartite network.
[0017] Furthermore, the step 3 of constructing the user explicit social network according to the social.index data in the data set includes:
[0018] The data social.index contains all users' explicit social relationships in the format of UserId1:UserId2, indicating that user 1 and user 2 have an explicit social relationship. The user explicit social network consists of all user nodes. If there is an explicit social relationship between two users, an edge is connected between the two users.
[0019] Furthermore, in step 4, by performing a single-mode projection on the user-movie bipartite network, when two user nodes have at least one movie node as their common neighbor, there is an edge between the two user nodes, thereby obtaining the user's implicit social network.
[0020] Furthermore, in step 5, the explicit similarity of the user is calculated through the explicit social network of the user, the implicit similarity of the user is calculated according to the implicit social network of the user, and the fused similarity of the user is obtained, including the following contents:
[0021] The explicit similarity of users is expressed as
[0022]
[0023] In formula (2), u i represents the rating of movie i by user u, v i represents the rating of movie i by user v, sim1(u,v) represents the explicit similarity between user u and user v, and cos(u,v) represents the explicit similarity of users using cosine similarity;
[0024] The implicit similarity of users is expressed as
[0025]
[0026] In formula (3), r ui represents the rating of movie i by user u, r vi represents the rating of user v on movie i, The intersection R of user u in the ratings uv The average rating in For user v in the score intersection R uv The average score in R uv represents the score intersection of user u and user v, sim2(u,v) represents the implicit similarity between user u and user v, and pearson(u,v) represents the implicit similarity of users using the Pearson correlation coefficient;
[0027] The fusion similarity of users is expressed as
[0028] sim(u,v)=αsim1(u,v)+(1-α)sim2(u,v)#(4)
[0029] In formula (4), sim(u,v) represents the fusion similarity between user u and user v, and α is a parameter.
[0030] Furthermore, in step 6, given a target user, the top-n users with the highest similarity to the target user are obtained, and a recommendation list is calculated based on the scores of similar users, including the following:
[0031] The score calculation of the target user u for the movie p is expressed as:
[0032]
[0033] In formula (5), P u,p represents the rating of user u on movie p, U represents the user set, and weight w u,s represents the similarity between user u and user s, r s,p It represents the rating of movie p by user s. After obtaining the ratings of different movies by user u, the final recommendation list can be obtained by sorting them according to the ratings.
[0034] The beneficial effects of the present invention are as follows: the present invention integrates two social networks of user relationships, combines a collaborative filtering algorithm, solves the user cold start and data sparsity problems in the recommendation system, enhances the diversity of recommendations, and improves the recommendation effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A schematic diagram of a user-object bipartite network constructed according to user-object interaction behaviors in the present invention;
[0036] Figure 2 Schematic diagram of a single-mode projection of the user-object bipartite network on the user set in the present invention. DETAILED DESCRIPTION
[0037] Example 1: Figure 1-Figure 2 As shown, a movie recommendation method based on social network and collaborative filtering, the specific steps of the method are as follows:
[0038] Step 1: Obtain the Douban dataset and process the data, and construct a user-movie rating matrix based on the uir.index data in the dataset;
[0039] Furthermore, the user-movie rating matrix R in step 1 is expressed as:
[0040]
[0041] The rows of the user-movie rating matrix R represent users, the columns represent movies, and the elements r in the matrix are ij represents the rating of movie j by user i, m represents the number of users, and n represents the number of objects.
[0042] Step 2: Build a user-movie bipartite network;
[0043] Furthermore, in the step 2, the user-movie bipartite network is constructed by taking each user and each movie as a node, the node set consisting of all user nodes is recorded as user set A, the node set consisting of all movie nodes is recorded as movie set B, and the user's rating of the movie is taken as the edge. If user i rates movie α, then node i and node α are connected, and so on, to construct a user-movie bipartite network.
[0044] Step 3: Build the user explicit social network based on the social.index data in the dataset;
[0045] Furthermore, the step 3 of constructing the user explicit social network according to the social.index data in the data set includes:
[0046] The data social.index contains all users' explicit social relationships in the format of UserId1:UserId2, indicating that user 1 and user 2 have an explicit social relationship. The user explicit social network consists of all user nodes. If there is an explicit social relationship between two users, an edge is connected between the two users.
[0047] Step 4: Obtain the user’s implicit social network by performing a single-mode projection on the user-movie bipartite network;
[0048] Furthermore, in step 4, by performing a single-mode projection on the user-movie bipartite network, when two user nodes have at least one movie node as their common neighbor, there is an edge between the two user nodes, thereby obtaining the user's implicit social network.
[0049] Step 5: Calculate the user's explicit similarity through the explicit social network, calculate the user's implicit similarity according to the user's implicit social network, and obtain the user's fused similarity;
[0050] Furthermore, in step 5, the explicit similarity of the user is calculated through the explicit social network of the user, the implicit similarity of the user is calculated according to the implicit social network of the user, and the fused similarity of the user is obtained, including the following contents:
[0051] The explicit similarity of users is expressed as
[0052]
[0053] In formula (2), u i represents the rating of movie i by user u, v irepresents the rating of movie i by user v, sim1(u,v) represents the explicit similarity between user u and user v, and cos(u,v) represents the explicit similarity of users using cosine similarity;
[0054] The implicit similarity of users is expressed as
[0055]
[0056] In formula (3), r ui represents the rating of movie i by user u, r vi represents the rating of user v on movie i, The intersection R of user u in the ratings uv The average rating in For user v in the score intersection R uv The average score in R uv represents the score intersection of user u and user v, sim2(u,v) represents the implicit similarity between user u and user v, and pearson(u,v) represents the implicit similarity of users using the Pearson correlation coefficient;
[0057] The fusion similarity of users is expressed as
[0058] sim(u,v)=αsim1(u,v)+(1-α)sim2(u,v)#(4)
[0059] In formula (4), sim(u,v) represents the fusion similarity between user u and user v, and α is a parameter.
[0060] Step 6: Given a target user, obtain the top-n users with the highest similarity to the target user, and calculate the recommendation list based on the scores of similar users.
[0061] Furthermore, in step 6, given a target user, the top-n users with the highest similarity to the target user are obtained, and a recommendation list is calculated based on the scores of similar users, including the following:
[0062] The score calculation of the target user u for the movie p is expressed as:
[0063]
[0064] In formula (5), P u,p represents the rating of user u on movie p, U represents the user set, and weight w u,s represents the similarity between user u and user s, r s,p It represents the rating of movie p by user s. After obtaining the ratings of different movies by user u, the final recommendation list can be obtained by sorting them according to the ratings.
[0065] The present invention selected Douban dataset and FilmTrust dataset for testing. Douban dataset contains 129490 users and 58541 movies, and the number of movie rating records is 16830839. For user explicit social network, it contains a total of 1692952 social relationships. FilmTrust dataset contains 1508 users and 2071 movies, and the number of movie rating records is 35497. For user explicit social network, it contains a total of 1853 social relationships. The rating range of the two datasets is between 1-5. The size of the rating value represents the user's preference for the movie. The higher the score, the more the user likes the movie.
[0066] The effect of the present invention is verified by the following experiment: using five-fold cross validation, the Douban dataset is randomly divided into five parts, four of which are selected as training datasets each time, and the remaining one is selected as a test dataset. A total of five experiments are conducted, and the final result is the average of the five experiments. In the experimental verification, the comparison method of the present invention is to use the collaborative filtering recommendation algorithm (UCF) based on Pearson similarity, and the recommendation effect is evaluated by using the accuracy index (Precision) and the root mean square error index (RMSE).
[0067]
[0068] Here R(u) represents the recommendation list given based on user training data, and T(u) represents the recommendation list given based on user test data.
[0069]
[0070] Here i is the predicted score, r i is the actual score and N is the number of scores.
[0071] Table 1 is a comparison of the recommendation effect evaluation of the two recommendation methods.
[0072]
[0073] It can be seen from Table 1 that the recommendation effect of the present invention is obviously better than that of UCF.
[0074] The specific implementation modes of the present invention are described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the above implementation modes, and various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention.
Claims
1. A movie recommendation method based on social network and collaborative filtering, characterized by: The specific steps of the method are as follows: Step 1: Obtain the Douban dataset and process the data, and construct a user-movie rating matrix based on the uir.index data in the dataset; Step 2: Build a user-movie bipartite network; Step 3: Build the user explicit social network based on the social.index data in the dataset; Step 4: Obtain the user’s implicit social network by performing a single-mode projection on the user-movie bipartite network; Step 5: Calculate the user's explicit similarity through the explicit social network, calculate the user's implicit similarity according to the user's implicit social network, and obtain the user's fused similarity; Step 6: Given a target user, obtain the top-n users with the highest similarity to the target user, and calculate the recommendation list based on the scores of similar users.
2. The movie recommendation method based on social network and collaborative filtering according to claim 1, characterized in that: The user-movie rating matrix R in step 1 is expressed as: The rows of the user-movie rating matrix R represent users, the columns represent movies, and the elements r in the matrix are ij represents the rating of movie j by user i, m represents the number of users, and n represents the number of objects.
3. The movie recommendation method based on social network and collaborative filtering according to claim 1, characterized in that: In the step 2, the user-movie bipartite network is constructed by taking each user and each movie as a node, the node set consisting of all user nodes is recorded as user set A, the node set consisting of all movie nodes is recorded as movie set B, and the user's rating of the movie is taken as the edge. If user i rates movie α, then node i and node α are connected, and so on, to construct a user-movie bipartite network.
4. The movie recommendation method based on social network and collaborative filtering according to claim 1, characterized in that: The step 3 of constructing the user explicit social network according to the social.index data in the dataset includes: The data social.index contains all users' explicit social relationships in the format of UserId1:UserId2, indicating that user 1 and user 2 have an explicit social relationship. The user explicit social network consists of all user nodes. If there is an explicit social relationship between two users, an edge is connected between the two users.
5. The movie recommendation method based on social network and collaborative filtering according to claim 1, characterized in that: In step 4, by performing a single-mode projection on the user-movie bipartite network, when two user nodes have at least one movie node as their common neighbor, there is an edge between the two user nodes, thereby obtaining the user's implicit social network.
6. The movie recommendation method based on social network and collaborative filtering according to claim 1, characterized in that: In the step 5, the explicit similarity of the user is calculated through the explicit social network of the user, the implicit similarity of the user is calculated according to the implicit social network of the user, and the fused similarity of the user is obtained, including the following contents: The explicit similarity of users is expressed as In formula (2), u i represents the rating of movie i by user u, v i represents the rating of movie i by user v, sim1(u,v) represents the explicit similarity between user u and user v, and cos(u,v) represents the explicit similarity of users using cosine similarity; The implicit similarity of users is expressed as In formula (3), r ui represents the rating of movie i by user u, r vi represents the rating of user v on movie i, The intersection R of user u in the ratings uv The average rating in For user v in the score intersection R uv The average score in R uv represents the score intersection of user u and user v, sim2(u,v) represents the implicit similarity between user u and user v, and pearson(u,v) represents the implicit similarity of users using the Pearson correlation coefficient; The fusion similarity of users is expressed as sim(u,v)=αsin1(u,v)+(1-α)sim2(u,v)#(4) In formula (4), sim(u,v) represents the fusion similarity between user u and user v, and α is a parameter.
7. The movie recommendation method based on social network and collaborative filtering according to claim 1, characterized in that: In step 6, given a target user, the top-n users with the highest similarity to the target user are obtained, and a recommendation list is calculated based on the scores of similar users, including the following: The score calculation of the target user u for the movie p is expressed as: In formula (5), P u,p represents the rating of movie p by user u, U represents the user set, and weight w u,s represents the similarity between user u and user s, r s,p It represents the rating of movie p by user s. After obtaining the ratings of different movies by user u, the final recommendation list can be obtained by sorting them according to the ratings.
Citation Information
Patent Citations
Video recommendation method based on explicit and implicit information
CN108628999A
Popular and novel commodity recommendation method based on weighted bipartite graph
CN110310185A
Matrix decomposition recommendation algorithm fusing multi-dimensional social information
CN114862505A
Recommendation method and system based on subspace trust fusion
CN115168692A
