A graph neural network music recommendation method based on large and small path independence partitioning and aggregation
By dividing large and small paths in music recommendation and performing feature extraction and aggregation, the problems of excessive noise information and insufficient feature information in the prior art are solved, and a more efficient music recommendation effect is achieved.
Patent Information
- Application Number
- CN202510020099.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-07
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2045-01-07
AI Technical Summary
The existing meta-path-based heterogeneous graph neural networks have problems such as excessive noise information and insufficient feature information in music recommendations, resulting in reduced model performance and poor recommendation results.
A music recommendation method for graph neural networks that are divided into large and small path independent division and aggregation is proposed. The metapath is divided into large neighbor paths and small neighbor paths through the path discriminator, and feature extraction and aggregation are performed separately, and finally deep integration is carried out through the heterogeneous graph neural network model.
Effectively reduce noise information, enhance feature extraction capabilities, improve model accuracy and generalization capabilities, and provide more accurate and personalized music recommendations.
Smart Images

Figure CN119415732B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of deep learning, and specifically relates to a graph neural network music recommendation method for large and small path independence division and aggregation. Background Art
[0002] Existing heterogeneous graph neural networks (HGNNs) usually rely on meta-paths to capture rich semantic information in heterogeneous information networks (HINs). This structure is particularly suitable for music recommendation scenarios because music recommendation systems are essentially complex heterogeneous information networks containing multiple types of nodes and edges. Among them, users and music tracks are nodes, and their interactions (such as play, favorite, comment, etc.) constitute edges. These interactions not only reflect user preferences, but also reveal the characteristics of music tracks. By leveraging meta-paths, that is, specific user-music track interaction sequences, semantic information that contains specific user preferences and music track characteristics can be captured. For example, users or music tracks with similar listening history or style preferences can be connected through meta-paths to obtain more accurate representations. In theory, meta-path-based methods can effectively handle complex heterogeneity; however, they face some significant challenges in practical applications.
[0003] Most existing HGNN methods focus on how to aggregate different features, while ignoring the characteristics of the meta-path itself, especially the fact that the number of neighbors connected by different meta-paths varies greatly. Specifically, in music recommendation, large neighbor paths are meta-paths that connect a large number of neighbor nodes, usually through popular music tracks. Due to the popularity of popular tracks, such paths often lead to an exponential growth in the number of user nodes. Although these paths may provide rich semantic information, they are also mixed with a large amount of noise information, resulting in information redundancy and affecting model performance. Small neighbor paths refer to meta-paths that only connect a small number of neighbor nodes, usually through unpopular music tracks. Due to the rarity of unpopular tracks, such paths often fail to capture sufficiently comprehensive user or music track feature information, resulting in inaccurate recommendation results.
[0004] In addition, even if two meta-paths are semantically similar and of the same length, the number of neighbors may be very different due to the different music tracks they connect. This difference means that if we aggregate them indiscriminately in the same way, we will not be able to scientifically process the information brought by different types of meta-paths. For large neighbor paths, too much noise information will reduce the quality of semantic information; while for small neighbor paths, it is difficult to obtain enough feature information to support effective recommendations. The limitations of existing meta-path-based heterogeneous graph neural network classification models in music recommendation applications are mainly reflected in the following aspects:
[0005] In the huge music database, the meta-path based classification model uses the meta-path data indiscriminately for training, ignoring the huge differences in the number of neighbors of different meta-paths, which may cause data loss and redundancy problems, making the model unable to flexibly adapt to different data distribution situations; for the meta-path itself, the large number of neighbor nodes contained in the large neighbor path inevitably introduces noise information, increases the computational complexity, and may cause model overfitting, thereby affecting the recommendation effect; the small neighbor path cannot fully capture the characteristic information of users or music tracks due to the small number of neighbor nodes, which limits the expressiveness and generalization ability of the model.
[0006] In summary, the existing meta-path-based heterogeneous graph neural network classification model has certain limitations in music recommendation. In order to solve these problems, this paper proposes a new method, which aims to improve the performance and accuracy of the music recommendation system by optimizing the selection and aggregation strategy of neighbor nodes, and better cope with the challenges brought by different types of meta-paths. Summary of the invention
[0007] In order to solve the above problems, the present invention proposes a graph neural network music recommendation method based on large and small path independence partitioning and aggregation. Meta-path is a unique connection form in heterogeneous graphs. The meta-path can capture the same type of neighbors with different semantic connection relationships. The heterogeneous graph neural network classification aggregation model LSPI adopts the "classification-extraction-fusion" method for different meta-paths to improve the model capability from three aspects. By identifying, classifying and processing the meta-paths, more comprehensive node information is finally aggregated, so that the heterogeneous graph neural network can be better applied to the modeling and prediction of music recommendation.
[0008] The technical solution of the present invention is as follows:
[0009] A graph neural network music recommendation method based on large and small path independence partitioning and aggregation includes the following steps:
[0010] Step 1: Construct a heterogeneous graph neural network classification aggregation model, which includes a path discriminator, a large path neighbor node selection module, and an intra-path aggregation module;
[0011] Step 2: Construct a loss function to optimize the training of heterogeneous graph neural network classification aggregation model;
[0012] Step 3: Obtain the music data of the current user, input the trained heterogeneous graph neural network classification aggregation model, and generate a personalized music recommendation list.
[0013] Furthermore, in step 1, the working process of the heterogeneous graph neural network classification aggregation model is as follows:
[0014] Step 1.1: According to the topological structure of the graph, a path discriminator is used to divide the meta-path into large neighbor paths and small neighbor paths;
[0015] Step 1.2: Use the large path neighbor node selection module for the large neighbor path to find the nodes with the highest correlation from the topology and feature levels and retain them;
[0016] Step 1.3: Use the intra-path aggregation module to classify and aggregate the large neighbor paths and small neighbor paths to obtain two types of node feature representations.
[0017] Furthermore, the specific process of step 1.1 is as follows:
[0018] Step 1.1.1. Calculate the degree of each meta-path using the following formula:
[0019] (1);
[0020] in, For the Element path The value of express In the adjacency matrix of Line The elements of the column, The row corresponds to Node, Column corresponds to nodes; if Nodes and When there is an edge between nodes, the corresponding setting In the adjacency matrix of Line Elements of a column ,otherwise ; Represents all target nodes the number of Represents all target nodes The set of components;
[0021] Step 1.1.2: Calculate the degree set of all meta-paths ,in is the total number of meta-paths; the paths are divided by calculating the relative difference between the degree values using the following formula:
[0022] (2);
[0023] (3);
[0024] in, Indicates the minimum degree value; For the Element path The relative difference percentage of all meta paths is finally obtained. ;
[0025] Step 1.1.3. After obtaining the relative difference percentages of all meta-paths, the path discriminator divides the meta-paths into large neighbor paths and small neighbor paths according to the values of the relative difference percentages. The division rule is: pre-set hyperparameter values , if the relative difference percentage of the current meta-path is greater than or equal to , the current meta-path is divided into a large neighbor path; otherwise, it is divided into a small neighbor path.
[0026] Furthermore, the specific process of step 1.2 is as follows:
[0027] Step 1.2.1: Calculate the large neighbor path at the topological level The probability of transit :
[0028] (4);
[0029] in, , , For different node types, specify is the type of the target node, , are the types of different neighbor nodes; , , They are , , The corresponding edge relations; , , They are , , The probability of transmission;
[0030] Step 1.2.2: Calculate the target node at the feature level With neighbor nodes Similarity of features:
[0031] (5);
[0032] (6);
[0033] in, , They are , The normalized result is , The target nodes With neighbor nodes The eigenvector of Indicates the path in the big neighborhood Next target node With neighbor nodes Similarity of features after normalization; for Norm function; It is the dot product calculation; is a minimum value;
[0034] Step 1.2.3: Comprehensively consider feature similarity and topological relationship to select neighbor nodes for dual-view optimization in the large neighbor path:
[0035] (7);
[0036] in, Is in the big neighbor path Next target node With neighbor nodes The node importance score of Is in the big neighbor path Next target node With neighbor nodes The probability of transit;
[0037] Step 1.2.4: Select the target node On the Great Neighborhood Path Next and neighbor nodes Neighbor set after similarity selection :
[0038] (8);
[0039] in, is the selection function; Is in the big neighbor path Next target node The node importance score set with all neighboring nodes; is the set hyperparameter, indicating that The number of neighbor nodes retained;
[0040] All target nodes have large neighbor paths The set of neighbor nodes retained below constitutes a large neighbor path The connection matrix ; Since there are multiple different large neighbor paths, the connection relationship matrices under all large neighbor paths constitute the large neighbor connection relationship matrix set , , , Represent different large neighbor paths, is the total number of large neighbor paths; , , Respectively , , The connection relationship matrix below.
[0041] Furthermore, the specific process of step 1.3 is as follows:
[0042] Step 1.3.1: For the target node , the projection formula is as follows:
[0043] (9);
[0044] in, and The target nodes are The original features and the projected features after feature transformation; is the feature projection transformation matrix;
[0045] Step 1.3.2: Perform convolution operations on the subgraphs of the connection relationship matrices under different large neighbor paths to capture the node feature representation under the large neighbor path:
[0046] (10);
[0047] in, , The target nodes In the Layer, When layer convolution Node feature representation of ; yes The normalized adjacency matrix; yes The corresponding degree matrix; yes In the The parameter matrix that can be learned during layer convolution; the target node At the 0th convolution layer Node feature representation The target node Projected features after feature transformation ; Finally get the large neighbor path The node features of all target nodes are expressed as Since there are multiple different large neighbor paths, the node feature representation set of all target nodes under all large neighbor paths is composed of the node feature representation of the large neighbor path. , , , Respectively , , Node feature representation of all target nodes;
[0048] Step 1.3.3, the set of small neighbor paths is , , , Represent different small neighbor paths, is the total number of small neighbor paths; obtain the small neighbor paths in the same way as step 1.2.4 The connection matrix , the connection relationship matrix under all small neighbor paths constitutes the small neighbor connection relationship matrix set , , , They are , , The connection relationship matrix under the small neighbor path is obtained by performing convolution operations on the subgraphs of the connection relationship matrices under different small neighbor paths through the following formula to capture the node feature representation under the small neighbor path:
[0049] (11);
[0050] in, , The target nodes In the Layer, When layer convolution Node feature representation of ; yes The normalized adjacency matrix; yes The corresponding degree matrix; yes In the The parameter matrix that can be learned during layer convolution; the target node At the 0th convolution layer The feature representation The target node Projected features after feature transformation ; Get the final small neighbor path The node features of all target nodes under , since there are multiple different small neighbor paths, the node feature representation set of all target nodes under all small neighbor paths is composed of the node feature representation of the small neighbor path node: , , , Respectively , , The node feature representation of all target nodes.
[0051] Furthermore, the specific process of step 2 is as follows:
[0052] Step 2.1: All large neighbor paths and small neighbor paths form a neighbor path set , including neighbor paths, where , For the neighbor path, corresponding to the Large neighbor paths; For the neighbor path, corresponding to the small neighbor paths; the node feature representation set corresponding to the neighbor path set , express The node feature representations of all target nodes are obtained below; the node feature representations are taken as input, and the embedding vectors learned from different neighbor paths are aggregated using subgraph-level attention:
[0053] (12);
[0054] (13);
[0055] in, For the The attention weights of the neighbor paths; is the weight matrix during aggregation; is the bias vector when embedding aggregation; is the transpose of the graph-level attention vector during aggregation; is the activation function; Indicates that based on Neighbor Path The target node The node feature representation of the target node is the learned embedding vector. For the Neighbor Path Contribution to subsequent recommendation and prediction tasks; is an exponential function with base e; For the The attention weights of the neighbor paths;
[0056] Step 2.2: Calculate the final node feature embedding matrix :
[0057] (14);
[0058] in, Based on Node feature representation of neighbor paths;
[0059] Step 2.3: By minimizing the loss function To optimize the training of the entire model:
[0060] (15);
[0061] in, The target node The label index collection of ; is the final node feature embedding matrix Target Node The vector representation of ; is the label index set of all nodes; is the label index of the node; are the classifier parameters.
[0062] Furthermore, the specific process of step 3 is as follows:
[0063] Step 3.1, determine the large neighbor path and the small neighbor path, and select the neighbor node set optimized by dual perspective in the large neighbor path as the initial value of the node feature matrix;
[0064] The node feature matrix includes the song feature matrix, the singer feature matrix, and the user feature matrix; the song feature matrix is composed of all song information, the singer feature matrix is composed of all singer information, and the user feature matrix is composed of user listening records;
[0065] For each meta-path, the degree value of each meta-path in the node feature matrix is calculated according to formula (1), and then the relative difference percentage of each meta-path is obtained by formula (2) and formula (3). According to the value of the relative difference percentage, the meta-path is divided into large neighbor paths and small neighbor paths; for the large neighbor path, the transit probability of each meta-path at the topological level is calculated by formula (4), and then the feature similarity between nodes in each meta-path at the feature level is calculated by formula (5) and formula (6). Finally, formula (7) and formula (8) are used to reconstruct the connection relationship of the meta-path by combining the transit probability and feature similarity;
[0066] Step 3.2: Node feature extraction based on heterogeneous graph neural network classification aggregation model;
[0067] The collected music data is processed into a heterogeneous graph, where the nodes of the heterogeneous graph represent different entities, such as songs, music, singers, and users; the edges of the heterogeneous graph represent the relationships between entities, including listening relationships and creation relationships;
[0068] First, the node features of all node types are transformed by formula (9), and the original node features are projected to the same dimension; for the large neighbor path obtained by step 3.1, the convolution operation on the subgraph is performed by formula (10) to capture the node feature representation after selection, and for the connection relationship under the small neighbor path, the convolution operation on the subgraph is used to obtain the node feature representation of the small neighbor path; the attention weight of each neighbor path in the neighbor path set composed of large and small neighbor paths is calculated by formula (12) and formula (13), and finally the final node feature embedding matrix integrating different semantics is obtained by formula (14). The final node feature embedding matrix includes the user node embedding matrix and the song node embedding matrix;
[0069] Step 3.3, continuously update and back-propagate the parameters of the heterogeneous graph neural network classification aggregation model according to formula (15);
[0070] Step 3.4, calculate the similarity of each node in the user node embedding matrix and the song node embedding matrix determined by formula (14), compare the similarity between each node in the user node embedding matrix and the song node embedding matrix; sort the similarity values in descending order, and select the top A personalized music recommendation list is generated for songs corresponding to the similarity values. At this time, the music recommendation list contains songs that best match the user's preferences.
[0071] The beneficial technical effects brought about by the present invention are as follows.
[0072] Most music recommendation systems that rely on meta-paths to capture semantic information often only consider the aggregation method of various node features, ignoring the characteristics of the "music-user-music" meta-path itself. The present invention uses the "classification-extraction-fusion" strategy to first divide songs of different styles and corresponding different users into two categories according to the number of their meta-path neighbors, and then classify and aggregate the two types of meta-path information for feature extraction, and finally use a heterogeneous graph neural network model to deeply integrate music of different styles and ages. This comprehensive feature extraction method ensures that the model can deeply understand and capture the complex features in music, thereby providing users with more accurate and personalized music recommendations.
[0073] In the huge music library, different types of music (such as classical, rock, pop, etc.) have rich heterogeneity. In order to fully preserve the uniqueness of these music, the present invention pays special attention to the feature extraction and fusion between heterogeneous types of music. By dividing the meta-path into large neighbor paths and small neighbor paths, and denoising the large neighbor paths, the present invention effectively captures the uniqueness and diversity of different types of music, enabling the model to fully understand the complex structure of music and provide a richer and more diverse music recommendation experience.
[0074] When processing large-scale music data, traditional music recommendation models are prone to the problem of over-smoothing of music features, resulting in the loss of important feature information. The present invention retains the initial features of nodes in the music embedding process by introducing a method of partitioning and aggregating based on large and small path independence, and deeply integrates music of different styles in combination with a graph-level attention mechanism. This method not only effectively avoids the problem of over-smoothing, but also enhances the robustness of the model and its ability to fully understand music features, providing users with a richer music experience. In addition, the present invention not only improves the computational efficiency of the model through advanced model design and optimized data processing methods, but also enhances its generalization ability on large-scale data sets.
[0075] The present invention adopts a method based on heterogeneous graph neural networks to fully extract features according to music styles. This method breaks the limitations of traditional technology on music data and enables the model to understand the intrinsic characteristics of music more accurately. Through the "classification-extraction-fusion" strategy and multi-faceted optimization design, the present invention not only improves the accuracy of recommendations, but also deepens the understanding of music diversity and uniqueness, providing music lovers with a better music experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] Figure 1 This is a flow chart of the graph neural network music recommendation method based on large and small path independence partitioning and aggregation according to the present invention.
[0077] Figure 2 Schematic diagram of the visualization results of the HAN model in the experiment of the present invention.
[0078] Figure 3 Schematic diagram of the visualization results of the RoHe model in the experiment of the present invention.
[0079] Figure 4 This is a schematic diagram of the visualization results of the SR-HGNN model in the experiment of the present invention.
[0080] Figure 5 This is a schematic diagram of the visualization results of the MAGNN model in the experiment of the present invention.
[0081] Figure 6 Schematic diagram of the visualization results of the HPN model in the experiment of the present invention.
[0082] Figure 7 Schematic diagram of the visualization results of the LSPI model in the experiment of the present invention. DETAILED DESCRIPTION
[0083] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:
[0084] The present invention proposes a heterogeneous graph neural network classification aggregation model LSPI for recommending music to users. Metapath is a unique connection form in the network. Through metapath, neighbors of the same type with different semantic connection relationships can be captured. LSPI adopts the "classification-extraction-fusion" method for different metapaths to improve the model capability from three aspects, making full use of all metapaths to obtain more comprehensive node feature embedding, improving the generalization ability and robustness of the model, so as to be better applied to the modeling and prediction of music recommendation.
[0085] When making music recommendations, the LSPI model first classifies the meta-path "user-music-user" containing songs of various styles, and divides the above meta-paths into large neighbor paths and small neighbor paths through the path discriminator; then, the dual-perspective optimized neighbor nodes are screened out for the large neighbor meta-path "music-user-music" based on the comprehensive feature similarity and topological relationship, which can effectively reduce noise interference and capture more meaningful relationships while maintaining high precision; then, the initial features of the nodes are preprocessed to be suitable for the feature aggregation method of the subsequent graph neural network, and then classified aggregation is performed to obtain the node feature representations under the two types of paths respectively; finally, considering that the same weight matrix is used for all large and small meta-paths, it will lead to the problem of not being able to capture "personalized" information for different music, the feature information of different meta-paths is extracted respectively, and the graph-level attention mechanism is used to fuse them to obtain the final embedding of the music, which is applied to downstream tasks such as music recommendation and music sentiment analysis.
[0086] In order to ensure the effectiveness and generalization ability of the model, LSPI designed a specific loss function to guide the training process. The design of the loss function takes into account the special needs of the recommendation system, such as personalized matching, diversity, etc., to ensure that the model can provide high-quality recommendation results in practical applications. After the model training is completed, the music data of the current user is obtained and input into the trained LSPI model. By analyzing the user's historical behavior information, LSPI generates a personalized music recommendation list, making full use of the complex interaction mode between users and music to provide a customized music experience.
[0087] The feature extraction method of the present invention provides a new idea and tool for the field of music recommendation, which helps to more deeply understand the characteristics of music and user preferences, thereby providing strong support for the further development of music recommendation systems.
[0088] like Figure 1 As shown, a graph neural network music recommendation method based on large and small path independence partitioning and aggregation includes the following steps:
[0089] Step 1: Construct a heterogeneous graph neural network classification aggregation model LSPI, which includes a path discriminator, a large path neighbor node selection module, and an intra-path aggregation module.
[0090] The working process of the heterogeneous graph neural network classification aggregation model LSPI is as follows:
[0091] Step 1.1: Use the path discriminator to divide the meta-path according to the topological structure of the graph, and divide the meta-path into large neighbor paths and small neighbor paths by calculating the percentage of degree change between different paths; the specific workflow of the path discriminator is as follows:
[0092] Step 1.1.1. Calculate the degree of each meta-path using the following formula:
[0093] (1);
[0094] in, For the Element path The value of express In the adjacency matrix of Line The elements of the column, The row corresponds to Node, Column corresponds to nodes; if Nodes and When there is an edge between nodes, the corresponding setting In the adjacency matrix of Line Elements of a column ,otherwise ; Represents all target nodes the number of Represents all target nodes The set composed of.
[0095] Step 1.1.2: After the above calculation, we get the degree set of all meta-paths. ,in is the total number of meta-paths; the paths are divided by calculating the relative difference between the degree values using the following formula:
[0096] (2);
[0097] (3);
[0098] in, Indicates the minimum degree value; For the Element path Finally, we get the relative difference percentage of all meta paths. .
[0099] Step 1.1.3, after obtaining the relative difference percentages of all meta-paths, the path discriminator divides the meta-paths into large neighbor paths and small neighbor paths according to the values of the relative difference percentages. The division rule is:
[0100] Preset hyperparameter values , if the relative difference percentage of the current meta-path is greater than or equal to , it is divided into a large neighbor path; otherwise, it is divided into a small neighbor path;
[0101] Step 1.2: For large neighbor paths, use the large path neighbor node selection module to find the most relevant nodes from the many neighbor nodes from the two levels of topology and features to aggregate them to shield noise interference; the specific working process of the large path neighbor node selection module is as follows:
[0102] Step 1.2.1: First, calculate the large neighbor path at the topological level The transit probability is , , For different node types, the present invention defines is the type of the target node, , are the types of different neighbor nodes. , , They are , , The corresponding edge relationship. The transmission probability ,in and Respectively The corresponding adjacency matrix and degree matrix. Affected by the number of neighbors, we define For the passing edge relationship From the target node To neighbor node Therefore, for large neighbor paths Final transit probability It can be calculated by the following formula:
[0103] (4);
[0104] Step 1.2.2: Secondly, at the feature level, since nodes with similar features are more important, and target node , the target node is calculated by the following formula With neighbor nodes The feature similarity is used as the basis for judging the feature angle:
[0105] (5);
[0106] (6);
[0107] in, , They are , The normalized result is , The target nodes With neighbor nodes The eigenvector of Indicates the path in the big neighborhood Next target node With neighbor nodes The similarity of the features after normalization, Is the target node On the Great Neighborhood Path The set of all neighbor nodes below; for Norm function; It is a dot product calculation, which represents the inner product between two unit vectors, that is, the cosine similarity; It is a minimum value, which avoids the adverse effects on subsequent operations when the similarity is 0.
[0108] Step 1.2.3, then use the following formula to comprehensively consider feature similarity and topological relationship to select the neighbor nodes for dual-view optimization in the large neighbor path:
[0109] (7);
[0110] in, Is in the big neighbor path Next target node With neighbor nodes The node importance score is obtained by combining the transit probability and feature similarity. Is in the big neighbor path Next target node The node importance score set with all neighboring nodes; Is in the big neighbor path Next target node With neighbor nodes The probability of crossing the border.
[0111] Step 1.2.4: Finally, the node importance scores calculated in the above steps are used to reconstruct the connection relationship under the meta-path and select the target node. On the Great Neighborhood Path Next and neighbor nodes Neighbor set after similarity selection :
[0112] (8);
[0113] in, To select a function, you can choose The highest median nodes, is the set hyperparameter, indicating that The number of neighbor nodes to be retained. As a target node On the Great Neighborhood Path The set of neighbor nodes retained under the condition that all target nodes are on the large neighbor path The set of neighbor nodes retained below constitutes a large neighbor path The connection matrix Since there are multiple different large neighbor paths, the connection relationship matrices under all large neighbor paths constitute the set of large neighbor connection relationship matrices , , , Represent different large neighbor paths, is the total number of large neighbor paths; , , Respectively , , The connection relationship matrix below.
[0114] Step 1.3: The intra-path aggregation module is used to classify and aggregate the large neighbor paths and the small neighbor paths, and two types of node feature representations are obtained respectively; the working process of the intra-path aggregation module is as follows:
[0115] Step 1.3.1: Considering that different nodes may be located in different feature spaces, first project different types of nodes to the same dimension. Type Target Node , Represents all node types; the projection formula is as follows:
[0116] (9);
[0117] in, and The target nodes are The original features and the projected features after feature transformation. is the feature projection transformation matrix;
[0118] Step 1.3.2: Obtain a large neighbor connection relationship matrix set Afterwards, the connection relationship matrix under different large neighbor paths is subjected to the convolution operation on the subgraph by the following formula to capture the feature representation of the selected nodes:
[0119] (10);
[0120] in, , The target nodes In the Layer, When layer convolution Node feature representation of ; yes The normalized adjacency matrix; yes The corresponding degree matrix; yes In the The parameter matrix that can be learned during layer convolution; the target node At the 0th convolution layer Node feature representation The target node Projected features after feature transformation ; Finally get the large neighbor path The node features of all target nodes are expressed as Since there are multiple different large neighbor paths, the node feature representation set of all target nodes under all large neighbor paths is composed of the node feature representation of the large neighbor path. , , , Respectively , , The node feature representation of all target nodes.
[0121] Step 1.3.3, the set of small neighbor paths is , , , Represent different small neighbor paths, is the total number of small neighbor paths. In the same way as step 1.2.4, the small neighbor paths can be obtained The connection matrix , the connection relationship matrix under all small neighbor paths constitutes the small neighbor connection relationship matrix set , , , They are , , The connection relationship matrix under the small neighbor path is obtained by performing convolution operations on the subgraphs of the connection relationship matrices under different small neighbor paths through the following formula to capture the node feature representation under the small neighbor path:
[0122] (11);
[0123] in, , The target nodes In the Layer, When layer convolution Node feature representation of ; yes The normalized adjacency matrix; yes The corresponding degree matrix; yes In the The parameter matrix that can be learned during layer convolution; the target node At the 0th convolution layer The feature representation The target node Projected features after feature transformation ; Get the final small neighbor path The node features of all target nodes under , since there are multiple different small neighbor paths, the node feature representation set of all target nodes under all small neighbor paths is composed of the node feature representation of the small neighbor path node: , , , Respectively , , The node feature representation of all target nodes.
[0124] Step 2: Construct a loss function to optimize the training of heterogeneous graph neural network classification aggregation model; the specific process is as follows:
[0125] Step 2.1: In order to learn a more comprehensive node embedding, it is necessary to fuse different types of meta-paths to enrich the node feature representation. Therefore, the two types of node feature representations obtained by aggregating large neighbor paths and small neighbor paths are fused. First, all the learned large and small neighbor paths form a neighbor path set Total neighbor paths, where , For the neighbor path, corresponding to the Large neighbor paths; For the neighbor path, corresponding to the small neighbor paths; the node feature representation set corresponding to the neighbor path set , express The node feature representations of all target nodes are obtained below; the node feature representations are taken as input, and the embedding vectors learned from different neighbor paths are aggregated using subgraph-level attention:
[0126] (12);
[0127] (13);
[0128] in, For the The attention weights of the neighbor paths; is the weight matrix during aggregation; is the bias vector when embedding aggregation; is the transpose of the graph-level attention vector during aggregation, is the transpose symbol; is the activation function; Indicates that based on Neighbor Path The target node The feature representation of a single target node is the learned embedding vector; Indicates The attention weights of the neighbor paths; For the Neighbor Path Contribution to subsequent recommendation and prediction tasks; is an exponential function with base e; For the The attention weights of the neighbor paths.
[0129] Step 2.2: Use the following formula to fuse different semantics to get the final node feature embedding matrix :
[0130] (14);
[0131] in, Based on The node feature representation matrix of the neighbor paths.
[0132] Step 2.3: Obtain the final node feature embedding matrix Then, by minimizing the following loss function To optimize the training of the entire model:
[0133] (15);
[0134] in, The target node The label index collection of ; is the final node feature embedding matrix Target Node The vector representation of ; is the label index set of all nodes; is the label index of the node; are the classifier parameters.
[0135] Step 3: Obtain the music data of the current user, input the trained graph neural network classification aggregation model LSPI, and generate a personalized music recommendation list.
[0136] Step 3.1, determine the large neighbor path and the small neighbor path, and select the set of neighbor nodes optimized by dual perspective in the large neighbor path as the initial value of the node feature matrix.
[0137] The node feature matrix includes the song feature matrix, the singer feature matrix, and the user feature matrix; the song feature matrix is composed of all song information, the singer feature matrix is composed of all singer information, and the user feature matrix is composed of user listening records;
[0138] For each meta-path, the degree value of each meta-path in the node feature matrix is calculated according to formula (1), and then the relative difference percentage of each meta-path is obtained by formula (2) and formula (3). According to the value of the relative difference percentage, the meta-path is divided into large neighbor paths and small neighbor paths; for large neighbor paths, the transit probability of each meta-path at the topological level is calculated by formula (4), and then the feature similarity between nodes in each meta-path at the feature level is calculated by formula (5) and formula (6). Finally, formula (7) and formula (8) are used to reconstruct the connection relationship of the meta-path by combining the transit probability and feature similarity.
[0139] Step 3.2, extract node features based on the heterogeneous graph neural network classification aggregation model LSPI;
[0140] The collected music data is processed into a heterogeneous graph, where the nodes of the heterogeneous graph represent different entities, such as songs, music, singers, and users; the edges of the heterogeneous graph represent the relationships between entities, including listening relationships and creation relationships;
[0141] First, the node features of all node types are transformed by formula (9) to project the original node features to the same dimension. For the large neighbor path obtained in step 3.1, the convolution operation on the subgraph is performed by formula (10) to capture the node feature representation after selection. For the connection relationship under the small neighbor path, the convolution operation on the subgraph is performed by formula (11) to obtain the node feature representation of the small neighbor path. The attention weight of each neighbor path in the neighbor path set composed of large and small neighbor paths is calculated by formula (12) and formula (13). Finally, the final node feature embedding matrix that integrates different semantics is obtained by formula (14). The final node feature embedding matrix includes the user node embedding matrix and the song node embedding matrix.
[0142] Step 3.3: Parameter update and back propagation. LSPI continuously updates and back propagates parameters according to formula (15);
[0143] Step 3.4, music recommendation. Use formula (14) to calculate the similarity of each node in the user node embedding matrix and the song node embedding matrix, and compare the similarity between each node in the user node embedding matrix and the song node embedding matrix; sort the similarity values from high to low, and select the top A personalized music recommendation list is generated for songs corresponding to the similarity values. At this time, the music recommendation list contains songs that best match the user's preferences.
[0144] In online applications, the node embedding matrix can be updated regularly or in real time to reflect the latest data changes of the music platform and the dynamic changes of user behavior. This can provide users with more accurate and personalized music recommendations. In order to prove the feasibility and superiority of the present invention, the following comparative experiments were conducted. The present invention compares and analyzes the proposed LSPI model with seven baseline models: HAN, MAGNN, HGSL, HPN, ie-HGCN, SR-HGNN, and RoHe. Among them, HAN is a network that combines node-level and semantic-level attention mechanisms, aiming to capture the subtle connections between different types of nodes and edges in heterogeneous graphs and improve the effect of representation learning; the MAGNN model realizes the learning of heterogeneous graph representation through intra-meta-path aggregation and inter-meta-path aggregation; the HGSL model reconstructs a more information-rich heterogeneous graph by fusing multiple information graphs; the ie-HGCN model helps to discover meta-paths in heterogeneous graphs through a specific type-level attention mechanism; the RoHe model introduces meta-path-based transition probabilities as a priori purifiers, aggregates the neighbor information of all meta-paths using the purified attention, aggregates these meta-paths at the semantic level, and finally generates node embeddings for downstream tasks; HPN is a path-based heterogeneous graph neural network that focuses on using different types of paths in the graph to learn node representations, enhancing the understanding of complex relationships; SR-HGNN is a heterogeneous graph neural network that integrates semantic and relational information, uses attention mechanisms to aggregate at the node level and type level, and maps complex heterogeneous information networks into low-dimensional space to achieve efficient representation learning.
[0145] For fair comparison, all model experimental parameters are set as follows: the middle layer dimension is set to 64, the learning rate is set to 0.005, the optimizer is selected as Adam, and the weight decay is set to 6.0×10 -4 , the feature dropout rate is 0.55, the maximum number of iterations is 1000, and the training and test sets are set to 10% and 80% of the total dataset.
[0146] The present invention selected three data sets, namely, the ACM data set, the IMDB data set, and the Yelp data set for comparative experiments. The ACM data set is a paper data set, the IMDB data set is a data set on the Internet Movie Database, and the Yelp data set is a merchant review data set. In terms of the selection of meta-paths, the heterogeneous graph neural network classification aggregation model LSPI takes into account meta-paths with different numbers of neighbors. Specifically, the meta-path selected from the ACM data set is {PAP, PSPSP, PAPAP} (PSP is the same as PSPSP, so only one is selected); the meta-path selected from the IMDB data set is {MAM, MAMAM, MDMDM} (MDM is the same as MDMDM, so only one is selected); the meta-path selected from the Yelp data set is {BUB, BUBUB, BSBSB, BLBLB} (BSB is the same as BSBSB, BLB is the same as BLBLBLB, and only one of each is selected). In terms of the division of large and small neighbor paths, due to the characteristics of different data sets, different hyperparameter values are set for different data sets. Specifically, for the ACM dataset, we set , then the large neighbor path identified by the path discriminator is {PSPSP, PAPAP}; for the IMDB dataset, set , then the path identified as a large neighbor path after the path discriminator is {MAMAM}; for the Yelp dataset, set , then the path identified as the large neighbor path after the path identifier is {BUBUB, BSBSB}. The number of neighbor nodes retained , which is uniformly set to 500 for all datasets.
[0147] The model was evaluated on a multi-classification task using support vector machine (SVM) as the classifier, and Macro-F1 (Ma-F1 for short) and Micro-F1 (Mi-F1 for short) were used as evaluation indicators. The results are shown in Table 1, where the best results are shown in bold.
[0148] Table 1 Classification results of different models on three datasets (%)
[0149] .
[0150] As shown in Table 1, LSPI is always better than the baseline method at different training ratios, and its performance is significantly improved. Specifically, at a training ratio of 80%, LSPI is improved by 1.19% and 1.15% on the ACM dataset, 3.86% and 3.97% on IMDB, and 22.65% and 12.14% on the Yelp dataset compared with HAN; it is improved by 3.33% and 3.69% on the IMDB dataset, and 2.65% and 2.9% on the Yelp dataset respectively compared with ie-HGCN; it is improved by 5.05% and 5.13% on the IMDB dataset, and 3.84% and 3.44% on the Yelp dataset compared with HPN. This is because the LSPI of the present invention can effectively shield noise information before feature aggregation, resulting in higher aggregation quality.
[0151] The learned node embeddings are clustered using K-means using the mean normalized mutual information (NMI) and adjusted rand index (ARI) as metrics. The results are shown in Table 2, from which the following observations are made, with the best results in bold.
[0152] Table 2 Results of different models in clustering experiments (%)
[0153] .
[0154] It can be seen from Table 2 that LSPI has achieved the best clustering performance on different data sets, especially compared with ie-HGCN, it has achieved a 44% performance improvement on ARI of the ACM data set, a 26% performance improvement on NMI, and 50.06% and 63.55% on the Yelp data set respectively; compared with other models, the present invention has also achieved significant improvements on the three data sets, which further demonstrates the superiority of the LSPI of the present invention.
[0155] To provide a more intuitive evaluation, we use t-SNE (a machine learning algorithm for dimensionality reduction) to project the node embeddings into a two-dimensional space and color them according to their labels, with nodes of the same color belonging to the same type. Figure 2-Figure 7 The visualization results of the node distribution of the existing HAN, RoHe, SR-HGNN, MAGNN, HPN models and the LSPI model proposed in this invention on the ACM dataset are shown respectively. Compared with other models, it can be seen that RoHe, SR-HGN and MAGNN cannot identify the boundaries of different categories very well, while HAN and HPN are too dispersed within the class, and the LSPI model has better effects in boundary distinction and intra-class aggregation, indicating that the type distinction of the present invention is more obvious.
[0156] The above experimental results show that the model of the present invention performs well in predicting user behavior and dividing user groups, and can accurately classify similar users or music. These excellent classification and clustering effects directly improve the performance of the recommendation system, making personalized recommendations more accurate. Therefore, the application of the model of the present invention in music recommendation is not only effective, but also significantly better than existing methods, and better understands and predicts users' music preferences and behavior patterns.
[0157] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by technicians in this technical field within the essential scope of the present invention should also fall within the protection scope of the present invention.
Claims
1. A graph neural network music recommendation method based on large and small path independence partitioning and aggregation, characterized in that: The steps include: Step 1: Construct a heterogeneous graph neural network classification aggregation model, which includes a path discriminator, a large path neighbor node selection module, and an intra-path aggregation module; Step 2: Construct a loss function to optimize the training of heterogeneous graph neural network classification aggregation model; Step 3: Obtain the music data of the current user, input the trained heterogeneous graph neural network classification aggregation model, and generate a personalized music recommendation list; In step 1, the working process of the heterogeneous graph neural network classification aggregation model is as follows: Step 1.1: According to the topological structure of the graph, a path discriminator is used to divide the meta-path into large neighbor paths and small neighbor paths; Step 1.2: Use the large path neighbor node selection module for the large neighbor path to find the nodes with the highest correlation from the topology and feature levels and retain them; Step 1.3: Use the intra-path aggregation module to classify and aggregate the large neighbor paths and small neighbor paths to obtain two types of node feature representations; The specific process of step 1.1 is as follows: Step 1.1.
1. Calculate the degree of each meta-path using the following formula: in, is the mth element path Φ m The degree value of d i,j Represents Φ m The element in the i-th row and j-th column of the adjacency matrix, the i-th row corresponds to the i-th node, and the j-th column corresponds to the j-th node; if there is an edge between the i-th node and the j-th node, then the corresponding setting Φ m The element d in the i-th row and j-th column of the adjacency matrix ij =1, otherwise d ij =0; Represents the number of all target nodes v; represents the set consisting of all target nodes v; Step 1.1.2: Calculate the degree set of all meta-paths Where p is the total number of meta-paths; the paths are divided by calculating the relative difference between the degree values using the following formula: Among them, D min Indicates the minimum degree value; is the mth element path Φ m The relative difference percentage of all meta paths is finally obtained. Step 1.1.3, after obtaining the relative difference percentages of all meta-paths, the path discriminator divides the meta-paths into large neighbor paths and small neighbor paths according to the value of the relative difference percentage. The division rule is: pre-set the hyperparameter value τ, if the relative difference percentage of the current meta-path is greater than or equal to τ, then the current meta-path is divided into a large neighbor path; otherwise, it is divided into a small neighbor path; The specific process of step 1.2 is as follows: Step 1.2.
1. Calculate the large neighbor path Φ at the topological level big The probability of transit in, For different node types, specify is the type of the target node, are the types of different neighbor nodes; They are The corresponding edge relations; They are The probability of transmission; Step 1.2.2: At the feature level, calculate the feature similarity between the target node v and the neighbor node u: Among them, h′ u , h′ v h u 、h v The normalized result, h u 、h v are the feature vectors of the target node v and the neighbor node u respectively; Indicates the large neighbor path Φ big The normalized feature similarity between the target node v and the neighbor node u; ‖·‖ is the L2 norm function; · is the dot product calculation; ∈ is a minimum value; Step 1.2.3: Comprehensively consider feature similarity and topological relationship to select neighbor nodes for dual-view optimization in the large neighbor path: in, is the large neighbor path Φ big The node importance scores of the target node v and its neighbor node u; is the large neighbor path Φ big The transit probability between the target node v and the neighbor node u; Step 1.2.4: Select the target node v in the large neighbor path Φ big The neighbor set after similarity selection with neighbor node u Among them, Select_Top(·) is the selection function; is the large neighbor path φ big The node importance score set of the target node v and all neighboring nodes; is the set hyperparameter, indicating the large neighbor path φ big The number of neighbor nodes retained; All target nodes have large neighbor paths φ big The set of neighbor nodes retained below constitutes the large neighbor path φ big The connection matrix Since there are multiple different large neighbor paths, the connection relationship matrices under all large neighbor paths constitute the set of large neighbor connection relationship matrices Φ big,1 , Φ big,2 , Represent different large neighbor paths, is the total number of large neighbor paths; Respectively represent Φ big,1 , Φ big,2 , The connection relationship matrix below; The specific process of step 1.3 is as follows: Step 1.3.1: For the target node The projection formula is as follows: x′ v =W fea ·x v (9); Among them, x v and x v ′ are the original features of the target node v and the projected features after feature transformation; W fea is the feature projection transformation matrix; Step 1.3.2: Perform convolution operations on the subgraphs of the connection relationship matrices under different large neighbor paths to capture the node feature representation under the large neighbor path: in, They are respectively the target node v at the convolution of the e+1th layer and the eth layer Node feature representation of ; yes The normalized adjacency matrix; yes The corresponding degree matrix; yes The learnable parameter matrix at the e-th convolution layer; where the target node v is at the 0th convolution layer Node feature representation is the projection feature x′ of the target node v after feature transformation v ; Finally, we get the large neighbor path Φ big The node features of all target nodes are expressed as Since there are multiple different large neighbor paths, the node feature representation set of all target nodes under all large neighbor paths is composed of the node feature representation of the large neighbor path: Respectively represent Φ big,1 , Φ big,2 , Node feature representation of all target nodes; Step 1.3.3, the set of small neighbor paths is Φ small,1 , Φ small,2 , Represent different small neighbor paths, is the total number of small neighbor paths; in the same way as step 1.2.4, obtain the small neighbor path Φ small The connection matrix The connection relationship matrix under all small neighbor paths constitutes a small neighbor connection relationship matrix set They are Φ small,1 , Φ small,2 , The connection relationship matrix under the small neighbor path is obtained by performing convolution operations on the subgraphs of the connection relationship matrices under different small neighbor paths through the following formula to capture the node feature representation under the small neighbor path: in, They are respectively the target node v at the convolution of the e+1th layer and the eth layer Node feature representation of ; yes The normalized adjacency matrix; yes The corresponding degree matrix; yes The learnable parameter matrix at the e-th convolution layer; where the target node v is at the 0th convolution layer The feature representation is the projection feature x of the target node v after feature transformation v ′; get the final small neighbor path Φ small The node features of all target nodes under Since there are multiple different small neighbor paths, the node feature representation set of all target nodes under all small neighbor paths is composed of the node feature representation of the small neighbor path node: Respectively represent Φ small,1 , Φ small,2 , The node feature representation of all target nodes.
2. According to claim 1, the graph neural network music recommendation method based on large and small path independence partitioning and aggregation is characterized in that: The specific process of step 2 is: Step 2.1: All large neighbor paths and small neighbor paths form a neighbor path set Total neighbor paths, where For the neighbor path, corresponding to the Large neighbor paths; For the neighbor path, corresponding to the small neighbor paths; the node feature representation set corresponding to the neighbor path set express The node feature representations of all target nodes are obtained below; the node feature representations are taken as input, and the embedding vectors learned from different neighbor paths are aggregated using subgraph-level attention: Among them, w k is the attention weight of the kth neighbor path; W agg is the weight matrix during aggregation; b agg is the bias vector when embedding aggregation; is the transpose of the graph-level attention vector during aggregation; Tanh(·) is the activation function; Represents the k-th neighbor path Φ neigh,k The node feature representation of the target node v, the feature representation of a single target node is the learned embedding vector; β k is the kth neighbor path Φ neigh,k Contribution to subsequent recommendation and prediction tasks; exp(·) is an exponential function with e as the base; w n is the attention weight of the nth neighbor path; Step 2.2, calculate the final node feature embedding matrix Z: Among them, H k is the node feature representation based on the kth neighbor path; Step 2.3: By minimizing the loss function To optimize the training of the entire model: Among them, Y v is the label index set of the target node v; z v is the vector representation of the target node v in the final node feature embedding matrix Z; Y L is the label index set of all nodes; r is the label index of the node; C class is the classifier parameter.
3. According to claim 2, the graph neural network music recommendation method based on large and small path independence partitioning and aggregation is characterized in that: The specific process of step 3 is as follows: Step 3.1, determine the large neighbor path and the small neighbor path, and select the neighbor node set optimized by dual perspective in the large neighbor path as the initial value of the node feature matrix; The node feature matrix includes song feature matrix, singer feature matrix, and user feature matrix; song The feature matrix consists of all song information, the singer feature matrix consists of all singer information, and the user feature matrix consists of user listening records; For each meta-path, the degree value of each meta-path in the node feature matrix is calculated according to formula (1), and then the relative difference percentage of each meta-path is obtained by formula (2) and formula (3). According to the value of the relative difference percentage, the meta-path is divided into large neighbor paths and small neighbor paths; for the large neighbor path, the transit probability of each meta-path at the topological level is calculated by formula (4), and then the feature similarity between nodes in each meta-path at the feature level is calculated by formula (5) and formula (6). Finally, formula (7) and formula (8) are used to reconstruct the connection relationship of the meta-path by combining the transit probability and feature similarity; Step 3.2: Node feature extraction based on heterogeneous graph neural network classification aggregation model; The collected music data is processed into a heterogeneous graph, where the nodes of the heterogeneous graph represent different entities, such as songs, music, singers, and users; the edges of the heterogeneous graph represent the relationships between entities, including listening relationships and creation relationships; First, the node features of all node types are transformed by formula (9), and the original node features are projected to the same dimension; for the large neighbor path obtained in step 3.1, the convolution operation on the subgraph is performed by formula (10) to capture the node feature representation after selection, and for the connection relationship under the small neighbor path, the convolution operation on the subgraph is performed by formula (11) to obtain the node feature representation of the small neighbor path; The attention weight of each neighbor path in the neighbor path set composed of large and small neighbor paths is calculated by formula (12) and formula (13), and finally the final node feature embedding matrix integrating different semantics is obtained by formula (14). The final node feature embedding matrix includes the user node embedding matrix and the song node embedding matrix. Step 3.3, continuously update and back-propagate the parameters of the heterogeneous graph neural network classification aggregation model according to formula (15); Step 3.4, calculate the similarity of each node in the user node embedding matrix and the song node embedding matrix determined by formula (14), compare the similarity between each node in the user node embedding matrix and the song node embedding matrix; sort the similarity values in descending order, select the songs corresponding to the first M similarity values to generate a personalized music recommendation list, at this time the music recommendation list contains the songs that best match the user's preferences.
Citation Information
Patent Citations
Heterogeneous network node representation learning method based on meta-path
CN110555050A
Heterogeneous graph data node embedded feature extraction model training method, embedded feature extraction method and node classification method and device
CN117272017A