A song recommendation method based on graph neural network and knowledge graph
By constructing a song knowledge graph and graph neural network, and combining user social information and song semantic relationships, the problem of insufficient utilization of auxiliary information in the song recommendation system is solved, and more accurate song recommendations are achieved.
Patent Information
- Application Number
- CN202310619137.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-29
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-05-29
AI Technical Summary
Existing song recommendation systems fail to fully utilize the auxiliary information between users and songs, resulting in data sparsity and cold start problems, and poor recommendation results.
By constructing a song knowledge graph and combining it with a graph neural network to learn users' social information, the semantics and relationship information of songs in the knowledge graph, we enrich the embedding vectors of users and songs, capture users' hidden, long-distance, unknown interests, and use the TransE algorithm for preprocessing and calculating the embedding vectors. Finally, we use MSE as the loss function to optimize the recommendation results.
The accuracy of song recommendations is improved, data sparsity and cold start problems are improved, and the recommendation results are more accurate.
Smart Images

Figure CN116662601B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of recommendation systems, and in particular to a song recommendation method based on graph neural networks and knowledge graphs. Background Art
[0002] With the development of the Internet, the number of songs online is also growing rapidly. It is difficult for people to quickly locate their favorite songs from the massive amount of songs. Therefore, song recommendation systems have emerged and are widely used in major music applications. Traditional song recommendation systems generally use user-song interaction graphs (UI graphs) for prediction. However, due to the lack of interaction information between users and items, this approach generally suffers from problems such as data sparsity and cold start. To improve the effectiveness of song recommendations, researchers have attempted to introduce more external data, prior knowledge, and auxiliary information into the recommendation system. Song recommendations based on social networks can greatly improve the difficulty of recommending songs to new users. While improving the accuracy of recommendations, users will also trust the results given by social recommendations more. As an information carrier that can carry a large amount of song semantic information and related knowledge, song knowledge graphs can also achieve better recommendation performance when combined with song recommendation systems.
[0003] Currently, many recommendation system algorithms incorporate auxiliary information, but these methods do not fully utilize the additional information between users and items. Recommendation methods that incorporate song knowledge graphs enhance indirect interactions between users and songs, and between songs themselves, modeling higher-order relationships between users and songs and improving recommendation effectiveness. Because user-song interaction graphs, social graphs, and song knowledge graphs are essentially non-Euclidean graph models, using graph neural networks can effectively capture node information and interdependencies between nodes in the graphs, helping to improve recommendation system performance. Summary of the Invention
[0004] In order to overcome the problem that existing song recommendation system methods fail to fully utilize the bilateral auxiliary information of users and songs and improve the accuracy of the recommendation algorithm, the present invention proposes a song recommendation method based on graph neural network and knowledge graph.
[0005] The specific steps adopted by the present invention to solve the technical problem are:
[0006] Step 1: Extract the feature information of each entity and the relationship information between entities in the song dataset to be processed, and construct a song knowledge graph with entities as nodes and entity relationships as node edges. The nodes include: song name nodes, singer nodes, genre nodes, and year nodes; obtain the user and song sets based on the user-song interaction graph, and use the edges on the graph as rating information; obtain the user's social friend set based on the edge information of the social graph;
[0007] Step 2: Use the knowledge graph representation learning algorithm TransE to preprocess the song knowledge graph data and obtain the initial embedding vectors of the song knowledge graph entities and relationships;
[0008] Step 3: Randomly select a user from the user set and calculate the embedding vector of the song they listen to after aggregating the neighbor entities of the song knowledge graph;
[0009] Step 4: Calculate the embedding vector of the user in the user-song interaction graph based on the embedding vector of the songs listened to;
[0010] Step 5: Calculate the embedding vector of the user in the social graph, and calculate the final embedding vector based on the user-song interaction graph and the embedding vector of the user in the social graph. Repeat steps 3 to 5 to calculate the final embedding vectors for all users.
[0011] Step 6: Randomly select a song from the song collection and calculate the embedding vector of the song in the user-song interaction graph based on the embedding vector of the interacting user;
[0012] Step 7: Calculate the embedding vector of the song in the song knowledge graph, and calculate the final embedding vector based on the user-song interaction graph and the embedding vector of the song in the song knowledge graph; repeat steps 6 to 7 to calculate the final embedding vector of all songs;
[0013] Step 8: Predict the ratings based on the embedding vectors of the user and the song, and use MSE as the loss function. The calculation ends when the loss value is less than the set minimum loss value. For a user in the set, recommend the top K songs based on the predicted ratings from high to low, where K is the set number of recommended songs.
[0014] In step 1, in the user-song interaction graph R, U = {u1,u2,...,u m} represents the user set, V={v1,v2,...,v n} represents a song collection, where the interaction record between users and songs is a score matrix Ω={(u i ,v j )|O ij ≠0}, O ij For user u i Song v j The rating results are from 1 to 5.
[0015] Step 1 aligns the songs in the user-song interaction graph with the corresponding entities on the song knowledge graph to obtain the corresponding neighbor attribute features of the songs on the song knowledge graph.
[0016] In step 2, the knowledge graph representation learning algorithm TransE is used to map the entities and relations in the knowledge graph into a low-dimensional vector space to obtain the initial embedding vector. The song knowledge graph consists of H triples (h, r, t), where h∈ε, r∈η and t∈ε are the head entity, relation and tail entity of the triple respectively, and ε={e1,e2,...,e A} represents the song entity set, η={r1,r2,...,r B} represents a collection of relationships between song entities.
[0017] In step 3, for any user u i , arbitrarily select a song entity v from its interactive song set C(i) a , calculate v a Embedding vectors on the song knowledge graph
[0018]
[0019]
[0020] where λ k =e ui ·e rak , S(a) represents the song v a The set of directly connected neighbor entities on the knowledge graph, r ak Represents the song entity v a and neighbor entity t k The relationship vector between ui Represents user u i The embedding vector, e rak Represents the relationship r ak The embedding vector of . Representative song v a The initial embedding vector, e tak Represents the neighbor entity t ak The embedding vector of , W and b are trainable weights and biases, and σ is the activation function. It traverses all song entities in the C(i) set, calculates the attention weights of all neighbor entities of the song entity, and calculates the embedding vectors of all song entities in C(i) based on the attention weights.
[0021] In step 4, the song embedding vector calculated in step 3 is used, combined with the score vector to calculate the user u in the user-song interaction graph. i Embedding vector of
[0022]
[0023] in
[0024]
[0025]
[0026]
[0027] e O is the corresponding user u i Song v a The rating vector of is the song embedding vector that introduces rating information, is a concatenation operation, and MLP is a multi-layer perceptron computing operation. a A two-layer neural network is used for calculation, where W1, W2 and b1, b2 are the trainable weights and biases in different neural networks.
[0028] In step 5, user u is calculated based on the social graph i The embedding vector of the user, who has an edge with the user on the social graph is the user's social friend
[0029]
[0030] in
[0031]
[0032]
[0033] F(i) represents user u i The set of song users that have direct edges on the social graph. Calculate the final embedding vector based on the user embedding vectors calculated in steps 4 and 5.
[0034]
[0035] Traverse the user set U and repeat steps 3 to 5 to obtain the embedding vectors of all users.
[0036] In step 6, traverse the song v j All users in the interactive user set D(j) are combined with the interactive user vector and the corresponding score vector to calculate the song v in the user-song interaction graph j Embedding vector of
[0037]
[0038]
[0039] in
[0040]
[0041]
[0042] is user u b The embedding vector, e O is the corresponding user u b Song v j The rating vector, e vj It's a song v j The initial embedding vector of .
[0043] In step 7, the song v in the song knowledge graph is calculated. j Embedding vector of
[0044]
[0045] Where S(j) represents song v j The set of neighbors that have direct edges on the knowledge graph. The final embedding vector is calculated based on the song embedding vectors calculated in steps 6 and 7.
[0046]
[0047] Traverse the song set V and repeat steps 6 to 7 to obtain the embedding vectors of all songs.
[0048] Calculate the loss function in step 8
[0049]
[0050] in
[0051]
[0052] |Ω| is the number of samples of interaction between users and songs through ratings, is a pair of users u in the rating matrix Ω i and song v j The predicted score, y ij is the corresponding true score.
[0053] The technical concept of this invention is to use a graph attention network to learn from users' social information, the semantics and relationships of songs in the knowledge graph, and the interactions between users and songs. This enriches the user and song embedding vectors, making song recommendations more accurate. This invention considers the importance of external auxiliary information in recommendation systems and incorporates knowledge graphs and social network information, achieving high accuracy and effective recommendations.
[0054] The advantages of the present invention are: by combining knowledge graph recommendation and social recommendation, the high-order relationship between users and songs is modeled, the user's hidden long-distance unknown interests are captured, the recommendation accuracy is high, and the data sparsity and cold start problems in song recommendation are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 Schematic diagram of a song recommendation system consisting of a user-song interaction graph, a user social graph, and a song knowledge graph. Circles represent user entities, rectangles represent song entities, and diamonds represent knowledge graph entities.
[0056] Figure 2 It is a flow chart of the method of the present invention. DETAILED DESCRIPTION
[0057] In order to further illustrate the implementation case, the present invention is further described below with reference to the accompanying drawings.
[0058] Reference Figure 2 , a song recommendation method based on graph neural network and knowledge graph, including the following steps:
[0059] Step 1: Extract the feature information of each entity and the relationship information between entities in the song dataset to be processed, and construct a song knowledge graph with entities as nodes and entity relationships as node edges. The nodes include: song name nodes, singer nodes, genre nodes, and year nodes; obtain the user and song sets based on the user-song interaction graph, and use the edges on the graph as rating information; obtain the user's social friend set based on the edge information of the social graph;
[0060] Step 2: Use the knowledge graph representation learning algorithm TransE to preprocess the song knowledge graph data and obtain the initial embedding vectors of the song knowledge graph entities and relationships;
[0061] Step 3: Randomly select a user from the user set and calculate the embedding vector of the song they listen to after aggregating the neighbor entities of the song knowledge graph;
[0062] Step 4: Calculate the embedding vector of the user in the user-song interaction graph based on the embedding vector of the songs listened to;
[0063] Step 5: Calculate the embedding vector of the user in the social graph, and calculate the final embedding vector based on the user-song interaction graph and the embedding vector of the user in the social graph. Repeat steps 3 to 5 to calculate the final embedding vectors for all users.
[0064] Step 6: Randomly select a song from the song collection and calculate the embedding vector of the song in the user-song interaction graph based on the embedding vector of the interacting user;
[0065] Step 7: Calculate the embedding vector of the song in the song knowledge graph, and calculate the final embedding vector based on the user-song interaction graph and the embedding vector of the song in the song knowledge graph; repeat steps 6 to 7 to calculate the final embedding vector of all songs;
[0066] Step 8: Predict the ratings based on the embedding vectors of the user and the song, and use MSE as the loss function. The calculation ends when the loss value is less than the set minimum loss value. For a user in the set, recommend the top K songs based on the predicted ratings from high to low, where K is the set number of recommended songs.
[0067] In step 1, in the user-song interaction graph R, U = {u1,u2,...,u m} represents the user set, V={v1,v2,...,v n} represents a song collection, where the interaction record between users and songs is a score matrix Ω={(u i ,v j )|O ij ≠0}, O ij For user u i Song v j The rating results are from 1 to 5.
[0068] Step 1 aligns the songs in the user-song interaction graph with the corresponding entities on the song knowledge graph to obtain the corresponding neighbor attribute features of the songs on the song knowledge graph.
[0069] In step 2, the knowledge graph representation learning algorithm TransE is used to map the entities and relations in the knowledge graph into a low-dimensional vector space to obtain the initial embedding vector. The song knowledge graph consists of H triples (h, r, t), where h∈ε, r∈η and t∈ε are the head entity, relation and tail entity of the triple respectively, and ε={e1,e2,...,e A} represents the song entity set, η={r1,r2,...,r B} represents a collection of relationships between song entities.
[0070] In step 3, for any user u i , arbitrarily select a song entity v from its interactive song set C(i) a , calculate v a Embedding vectors on the song knowledge graph
[0071]
[0072]
[0073] where λ k =e ui ·e rak , S(a) represents the song v a The set of directly connected neighbor entities on the knowledge graph, r ak Represents the song entity v a and neighbor entity t kThe relationship vector between ui Represents user u i The embedding vector, e rak Represents the relationship r ak The embedding vector of . Representative song v a The initial embedding vector, e tak Represents the neighbor entity t ak The embedding vector of , W and b are trainable weights and biases, and σ is the activation function. It traverses all song entities in the C(i) set, calculates the attention weights of all neighbor entities of the song entity, and calculates the embedding vectors of all song entities in C(i) based on the attention weights.
[0074] In step 4, the song embedding vector calculated in step 3 is used, combined with the score vector to calculate the user u in the user-song interaction graph. i Embedding vector of
[0075]
[0076] in
[0077]
[0078]
[0079]
[0080] e O is the corresponding user u i Song v a The rating vector of is the song embedding vector that introduces rating information, is a concatenation operation, and MLP is a multi-layer perceptron computing operation. a A two-layer neural network is used for calculation, where W1, W2 and b1, b2 are the trainable weights and biases in different neural networks.
[0081] In step 5, user u is calculated based on the social graph i The embedding vector of the user, who has an edge with the user on the social graph is the user's social friend
[0082]
[0083] in
[0084]
[0085]
[0086] F(i) represents user u iThe set of song users that have direct edges on the social graph. Calculate the final embedding vector based on the user embedding vectors calculated in steps 4 and 5.
[0087]
[0088] like Figure 1 User i The final embedding vector of combines social information, interactive songs, and the corresponding knowledge graph information. Traverse the user set U and repeat steps 3 to 5 to obtain the embedding vectors of all users.
[0089] In step 6, traverse the song v j All users in the interactive user set D(j) are combined with the interactive user vector and the corresponding score vector to calculate the song v in the user-song interaction graph j Embedding vector of
[0090]
[0091]
[0092] in
[0093]
[0094]
[0095] is user u b The embedding vector, e O is the corresponding user u b Song v j The rating vector, e vj It's a song v j The initial embedding vector of .
[0096] In step 7, the song v in the song knowledge graph is calculated. j Embedding vector of
[0097]
[0098] Where S(j) represents song v j The set of neighbors that have direct edges on the knowledge graph. The final embedding vector is calculated based on the song embedding vectors calculated in steps 6 and 7.
[0099]
[0100] like Figure 1 Song v jThe final embedding vector of combines the interactive user information and the song knowledge graph information. Traverse the song set V and repeat steps 6 to 7 to obtain the embedding vectors of all songs.
[0101] Calculate the loss function in step 8
[0102]
[0103] in
[0104]
[0105] |Ω| is the number of samples of interaction between users and songs through ratings, such as Figure 1 In the rating matrix Ω, any pair of users u is selected i and song v j Calculated y ij is the corresponding true score.
[0106] As described above, the specific implementation steps of the present invention make the present invention clearer. Any modifications and changes made to the present invention within the spirit of the present invention and the protection scope of the claims fall within the protection scope of the present invention.
Claims
1. A song recommendation method based on graph neural network and knowledge graph, comprising the following steps: Step 1: Extract the feature information of each entity and the relationship information between entities in the song dataset to be processed, and construct a song knowledge graph with entities as nodes and entity relationships as nodes and edges, where the nodes include: Song name node, singer node, genre node and year node; Obtain user and song collections based on the user-song interaction graph, and use the edges on the graph as rating information; obtain the user's social friend collection based on the edge information of the social graph; Step 2: Use the knowledge graph representation learning algorithm TransE to preprocess the song knowledge graph data and obtain the initial embedding vectors of the song knowledge graph entities and relationships; Step 3: Randomly select a user from the user set and calculate the embedding vector of the song they listen to after aggregating the neighbor entities of the song knowledge graph; Step 4: Calculate the embedding vector of the user in the user-song interaction graph based on the embedding vector of the songs listened to; Step 5: Calculate the embedding vector of the user in the social graph, and calculate the final embedding vector based on the user-song interaction graph and the embedding vector of the user in the social graph. Repeat steps 3 to 5 to calculate the final embedding vectors for all users. Step 6: Randomly select a song from the song collection and calculate the embedding vector of the song in the user-song interaction graph based on the embedding vector of the interacting user; Step 7: Calculate the embedding vector of the song in the song knowledge graph, and calculate the final embedding vector based on the user-song interaction graph and the embedding vector of the song in the song knowledge graph; repeat steps 6 to 7 to calculate the final embedding vector of all songs; Step 8: Predict the ratings based on the embedding vectors of the user and the song, and use MSE as the loss function. The calculation ends when the loss value is less than the set minimum loss value. For a user in the set, recommend the top K songs based on the predicted ratings from high to low, where K is the set number of recommended songs.
2. The method according to claim 1, wherein In step 1, in the user-song interaction graph R, U = {u1,u2,...,u m } represents the user set, V={v1,v2,...,v n } represents a song collection, where the interaction record between users and songs is a score matrix Ω={(u i ,v j )|O ij ≠0}, O ij For user u i Song v j The rating results are from 1 to 5.
3. The method according to claim 1, wherein In step 1, the songs in the user-song interaction graph are aligned with the corresponding entities on the song knowledge graph to obtain the corresponding neighbor attribute features of the songs on the song knowledge graph.
4. The method according to claim 1, wherein In step 2, the knowledge graph representation learning algorithm TransE is used to map the entities and relations in the knowledge graph into a low-dimensional vector space to obtain the initial embedding vector. The song knowledge graph consists of H triplets (h, r, t), where h∈ε, r∈η, and t∈ε are the head entity, relation, and tail entity of the triplet respectively, and ε={e1,e2,...,e A } represents the song entity set, η={r1,r2,...,r B } represents a collection of relationships between song entities.
5. The method according to claim 1, wherein In step 3, for any user u i , arbitrarily select a song entity v from its interactive song set C(i) a , calculate v a Embedding vectors on the song knowledge graph where λ k =e ui ·e rak , S(a) represents the song v a The set of directly connected neighbor entities on the knowledge graph, r ak Represents the song entity v a and neighbor entity t k The relationship vector between ui Represents user u i The embedding vector, e rak Represents the relationship r ak Embedding vector of Representative song v a The initial embedding vector, e tak Represents the neighbor entity t ak The embedding vector of , W and b are trainable weights and biases, and σ is the activation function; Traverse all song entities in the C(i) set, calculate the attention weights of all neighbor entities of the song entity, and calculate the embedding vectors of all song entities in C(i) based on the attention weights.
Citation Information
Patent Citations
Song recommendation method, song recommendation device, equipment and storage medium
CN113220930A
Music recommendation method based on knowledge graph multi-task feature learning
CN114676268A