A graph neural network movie recommendation method based on path enhancement
By using the multi-relational classification aggregation graph neural network model DCMR-HGCA in the movie recommendation system, the meta-relational paths are analyzed and aggregated, and the problems of redundancy and insufficient personalization in the existing system are solved, and more accurate and personalized movie recommendations are achieved.
Patent Information
- Application Number
- CN202510053707.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-05-20
- Estimated Expiration
- 2045-01-14
AI Technical Summary
The existing movie recommendation system has problems such as redundancy in information, ignoring complex interaction modes and insufficient personalization when dealing with complex heterogeneous relationships, resulting in poor recommendation results.
The multi-relational classification aggregation graph neural network model DCMR-HGCA is used to analyze the meta-relational paths through the same type and cross-type aggregation modules, divide the paths into tightly coupled paths and loosely coupled paths, and design corresponding aggregation strategies to reduce information redundancy, and integrate information between different types of nodes through the cross-category feature aggregation layer.
It effectively reduces redundant information interference in the information transmission process, improves the accuracy and efficiency of the recommendation system, enhances the understanding and prediction ability of user preferences, realizes more personalized movie recommendations, and improves user experience and satisfaction.
Smart Images

Figure CN119474551B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of deep learning, and particularly relates to a movie recommendation method based on path enhancement for graph neural networks. Background Art
[0002] Existing heterogeneous graph neural networks usually rely on meta-paths to capture rich semantic information in heterogeneous information networks. This structure is particularly suitable for movie recommendation scenarios because a movie recommendation system is essentially a complex heterogeneous information network containing various types of nodes and edges. Among them, users and movies are nodes, and the interactions between them (such as viewing, collecting, commenting, etc.) constitute the edges. These interactions not only reflect users' preferences but also reveal the characteristics of movies. By utilizing meta-paths, that is, specific user-movie interaction sequences, semantic information containing specific user preferences and movie characteristics can be captured, and users or movies with similar viewing histories or style preferences can be connected through meta-paths, thus obtaining more accurate representations. In theory, meta-path-based methods can effectively handle complex heterogeneity; however, they face some significant challenges in practical applications.
[0003] In current movie recommendation systems, the interaction data between users and movies usually exists in the form of a two-class multi-relational heterogeneous graph, which contains rich information. For example, users may rate, comment on, collect, or view movies, and these behaviors can be regarded as various types of edges between cross-type nodes of users and movies. There may be relationships such as the same director or the same production company between movies, and relationships such as the same gender or the same age between users. Therefore, there are also various types of edges between nodes of the same type. However, the meta-path-based HGNN recommendation algorithm often has limitations in dealing with multi-type interactions in such a complex relationship structure, resulting in poor recommendation effects. Specifically, in practical application scenarios such as social networks and recommendation systems, the following problems are mainly faced: the problem of information redundancy. Most existing recommendation systems build models based on a single type of relationship (such as user-movie ratings). When more types of relationships are introduced, it may lead to information redundancy because all relationships are processed without discrimination, thus affecting the accuracy of the recommendation system; ignoring complex interaction patterns. In real life, users' interests and preferences are jointly determined by multiple factors, such as their favorite actors, directors, and movie genres. However, traditional methods are difficult to effectively capture and utilize these complex interaction patterns to improve the recommendation quality; due to the failure to fully explore the multi-level relationships between different types of nodes, existing recommendation systems cannot provide highly personalized services for users, reducing the user experience satisfaction.
[0004] In view of the above problems, the present invention proposes a movie recommendation method based on path-enhanced graph neural network, which adopts a multi-relational classification aggregation graph neural network model DCMR-HGCA. The model solves the problems existing in the prior art in the following ways: by analyzing different types of meta-relational paths through the same-type aggregation module and cross-type aggregation module, the paths are divided into tightly coupled paths and loosely coupled paths, and corresponding aggregation strategies are designed according to the path characteristics, thus reducing the interference of redundant information in the information transmission process; using the cross-category feature aggregation layer to integrate the information between different types of nodes, it can better understand the multi-level relationship between users and movies, including but not limited to various interaction methods such as ratings, comments, and collections, and provide more accurate recommendation results based on this; by effectively identifying and processing different types of node relationships, the understanding and prediction ability of user preferences are enhanced, more personalized movie recommendations are realized, and the user experience and satisfaction are improved. Summary of the Invention
[0005] In order to solve the problems of information redundancy, ignoring complex interaction patterns and insufficient personalization in the existing movie recommendation methods, the present invention proposes a movie recommendation method based on path-enhanced graph neural network, which adopts a multi-relational classification aggregation graph neural network model DCMR-HGCA, enhances the path analysis and aggregation strategy, optimizes the information transmission process, improves the accuracy and efficiency of the recommendation system, significantly enhances the understanding and prediction ability of user preferences, and finally provides higher-quality and more personalized movie recommendation services for users.
[0006] The technical solution of the present invention is as follows:
[0007] A movie recommendation method based on path-enhanced graph neural network includes the following steps:
[0008] Step 1, construct a multi-relational classification aggregation graph neural network model, which includes a same-type aggregation module, a cross-type aggregation module and a cross-category feature aggregation layer;
[0009] Step 2, construct a loss function to optimize and train the multi-relational classification aggregation graph neural network model;
[0010] Step 3, obtain the movie data of the current user, input the trained multi-relational classification aggregation graph neural network model, and generate a personalized movie recommendation list.
[0011] Further, in the above Step 1, the working process of the multi-relational classification aggregation graph neural network model is as follows:
[0012] Step 1.1: Construct a dual-type multi-relational heterogeneous graph containing several meta-relation paths; the meta-relation paths are divided into two types, namely: homogeneous meta-relation paths and cross-type meta-relation paths; a homogeneous meta-relation path means that there is only one type of entity in a path; a cross-type meta-relation path means that there are two or more types of entities in a path;
[0013] According to the adjacency matrix of each meta-relation path, calculate the degree value of each meta-relation path:
[0014] (1);
[0015] Among them, is the degree value of the th meta-relation path ; define as the adjacency matrix of , define to represent the element in the th row and the th column of , the th row corresponds to the th target node, and the th column corresponds to the th target node; if there is an edge between the th target node and the th target node, then set the element in the th row and the th column of to , otherwise ; represents the number of all target nodes ; represents the set composed of all target nodes ;
[0016] Step 1.2: In the homogeneous aggregation module, a homogeneous node association filter is adopted. All meta-relation paths are filtered by the homogeneous node association filter to obtain all homogeneous meta-relation paths, and all homogeneous meta-relation paths are divided into homogeneous tightly coupled paths and homogeneous loosely coupled paths, and the final feature representation of the target nodes in the homogeneous meta-relation paths is calculated;
[0017] Step 1.3: In the cross-type aggregation module, a cross-type node association filter is adopted. All meta-relation paths are filtered by the cross-type node association filter to obtain all cross-type meta-relation paths, and all cross-type meta-relation paths are divided into cross-type tightly coupled paths and cross-type loosely coupled paths, and the final feature representation of the target nodes in the cross-type meta-relation paths is calculated;
[0018] Step 1.4: The cross-category feature aggregation layer adopts a category-level attention mechanism to fuse semantic and feature information of the same type and cross-types, generating the final node embeddings for use in the recommendation task.
[0019] Further, the specific process of Step 1.2 is as follows:
[0020] Step 1.2.1: Calculate the degree values of all the same-type meta-relation paths according to formula (1), and define the set of degree values of the same-type meta-relation paths , where is the total number of the same-type meta-relation paths, is the degree value of the th same-type meta-relation path ;
[0021] Calculate the relative degree difference of each same-type meta-relation path:
[0022] (2);
[0023] where, is the relative degree difference of ; is the minimum degree value among the same-type meta-relation paths; is a small positive number;
[0024] Finally, obtain the set of relative degree differences of all the same-type meta-relation paths ;
[0025] Step 1.2.2: Divide the same-type meta-relation paths into same-type tightly coupled paths and same-type loosely coupled paths according to the relative degree differences; the judgment criterion is: preset a same-type division threshold , if the relative degree difference of the current same-type meta-relation path is greater than , then this path is classified as a same-type tightly coupled path, otherwise, it is a same-type loosely coupled path;
[0026] Step 1.2.3: Adopt the global average strategy to perform node feature aggregation on the same-type tightly coupled paths; the specific process is as follows:
[0027] First, for the target node perform average pooling on the features of its neighbor nodes to calculate the pooled feature representation of the target node :
[0028] (3);
[0029] where, is the pooled feature representation of the target node ; is the set composed of all neighbor nodes of the target node in the meta-relation path of the same type ; is the number of all neighbor nodes; is the target node in the meta-relation path of the same type 's neighbor node; is the neighbor node 's initial feature representation;
[0030] Then, perform a non-linear transformation to obtain the updated feature representation of the node in the tightly coupled path of the same type:
[0031] (4);
[0032] where is the updated feature representation of the target node in the tightly coupled path of the same type ; is the ReLu activation function; is the weight matrix of the non-linear transformation in the aggregation module of the same type; is the bias term of the non-linear transformation in the aggregation module of the same type;
[0033] Step 1.2.4, Calculate the feature similarity between the target node and the neighbor nodes in all loosely coupled paths of the same type:
[0034] (5);
[0035] where is the feature similarity between the target node and the neighbor node in the loosely coupled path of the same type; is the initial feature representation of the target node ; is the inner product calculation; is the L2 norm;
[0036] Step 1.2.5, Calculate the feature similarity between the target node and all neighbor nodes in the loosely coupled path of the same type according to formula (5), and sort the feature similarities in descending order, and filter and construct the candidate neighbor node set through formula (6):
[0037] (6);
[0038] where is the candidate neighbor node set composed of neighbor nodes with high feature similarity to the target node in the loosely coupled path of the same type; is a function to obtain the largest value in the entire sequence and its corresponding index;
[0039] Step 1.2.6. Perform the same-type aggregation operation on the target node to obtain the node feature representation after the same-type aggregation:
[0040] (7);
[0041] Among them, is the feature representation of the target node after the same-type aggregation; represents the adaptive weight coefficient, which is calculated by formula (8):
[0042] (8);
[0043] Among them, is the exponential function with base e; is the learnable attention vector, is the transpose symbol; is the weight matrix; is one of the neighbor nodes of the target node in; is the initial feature representation of; represents the concatenation operation; is the activation function;
[0044] Perform a non-linear transformation on the node feature representation after the same-type aggregation through the activation function to obtain the updated feature representation of the target node in the same-type loose coupling path;
[0045] Step 1.2.7. Perform semantic-level fusion; the specific process is as follows:
[0046] First, the attention weights of the same-type tight coupling path and the same-type loose coupling path are defined as follows:
[0047] (9);
[0048] (10);
[0049] Among them, is the attention weight of the same-type tight coupling path; is the attention weight of the same-type loose coupling path; is the shared learnable parameter vector;
[0050] Then, generate the final feature representation of the target node in the meta-relation path of the same type:
[0051] (11);
[0052] Among them, is the final feature representation of the target node in the meta-relation path of the same type.
[0053] Furthermore, the specific process of step 1.3 is as follows:
[0054] Step 1.3.1: Calculate the degree values of all cross-type meta-relation paths according to formula (1), and define the degree value set of the cross-type meta-relation paths, where is the total number of cross-type meta-relation paths, is the th cross-type meta-relation path ;
[0055] Calculate the relative degree difference of each cross-type meta-relation path:
[0056] (12);
[0057] Among them, is the relative degree difference of ; is the minimum degree value in the cross-type meta-relation path;
[0058] Finally, obtain the relative degree difference set containing all cross-type meta-relation paths;
[0059] Step 1.3.2: Divide the cross-type meta-relation paths into cross-type tightly coupled paths and cross-type loosely coupled paths according to the relative degree difference; the judgment criterion is: preset a cross-type division threshold , if the relative degree difference of the current cross-type meta-relation path is greater than , then this path is classified as a cross-type tightly coupled path, otherwise it is a cross-type loosely coupled path;
[0060] Step 1.3.3: Perform node feature aggregation on the cross-type tightly coupled paths obtained through the cross-type node association filter; the specific process is as follows:
[0061] First, calculate the node feature representation after cross-type aggregation:
[0062] (13);
[0063] Among them, is the target node after cross-type aggregation Feature representation; Is the target node in the cross-type meta-relationship path Of the neighbor nodes; Represents the set composed of all neighbor nodes of the target node in the cross-type meta-relationship path ; Is the initial feature representation of the neighbor node ; Represents the target node For the neighbor node The weight assignment coefficient, the formula is:
[0064] (14);
[0065] Among them, Is the learned weight vector; Is One of the neighbor nodes of the target node in ; Is The initial feature representation of;
[0066] Then, perform a non-linear transformation on the cross-type aggregated target node representation to obtain the updated feature representation of the nodes in the cross-type tightly coupled path:
[0067] (15);
[0068] Among them, Is the updated feature representation of the target node in the cross-type tightly coupled path ; Is the weight matrix of the non-linear transformation in the cross-type aggregation module; Is the bias term of the non-linear transformation in the cross-type aggregation module;
[0069] Step 1.3.4. Use formula (5) to calculate the feature similarity between all target nodes In all cross-type loosely coupled paths and all neighbor nodes , and sort the feature similarities in descending order, and select the first Neighbor nodes with high feature similarity to the target node to form a candidate neighbor node set:
[0070] (16);
[0071] Among them, Is the candidate neighbor node set composed of Neighbor nodes with high feature similarity to the target node in the cross-type loosely coupled path ; Is the target node in the cross-type loosely coupled path The feature similarity with neighbor nodes ;
[0072] Step 1.3.5, calculate the updated feature representation of the target node in the cross-type loose coupling path:
[0073] (17);
[0074] Among them, is the updated feature representation of the target node in the cross-type loose coupling path; is the weight matrix during weighted aggregation in the cross-type loose coupling path; is the bias term during weighted aggregation in the cross-type loose coupling path; and are the degrees of neighbor nodes and target node respectively;
[0075] Step 1.3.6, perform semantic-level fusion, and the specific process is as follows:
[0076] The attention weights corresponding to the cross-type tight coupling path and the cross-type loose coupling path are defined as follows respectively:
[0077] (18);
[0078] (19);
[0079] Among them, is the attention weight of the cross-type tight coupling path; is the attention weight of the cross-type loose coupling path;
[0080] Then, generate the final feature representation of the target node in the cross-type meta-relation path:
[0081] (20);
[0082] Among them, is the final feature representation of the target node in the cross-type meta-relation path.
[0083] Furthermore, the specific process of step 1.4 is as follows:
[0084] Step 1.4.1, calculate the attention score:
[0085] (21);
[0086] Among them, is the attention score; is a learnable query vector; is the Tanh activation function; weight matrix of the attention mechanism; is the bias term of the attention mechanism;
[0087] Step 1.4.2: Use the softmax activation function to calculate the attention weights for each category based on the obtained attention scores, and perform weighted summation to generate the final embedding representation of the target node:
[0088] (22);
[0089] where, is the final embedding representation of the target node; is the category serial number; is the number of categories, including the same type or cross types; , are respectively the and attention scores of category
[0090] Furthermore, in the said Step 2, the cross-entropy loss is used to optimize the model:
[0091] (23);
[0092] where, is the set of label indices of the target node ; is the vector representation of the target node in is the set of label indices of all nodes; is the label index of the node; is the classifier parameter.
[0093] Furthermore, the specific process of the said Step 3 is as follows:
[0094] Step 3.1: Determine the user-movie dual-type multi-relationship heterogeneous graph and the node feature matrix;
[0095] The collected movie data is processed into a dual - type multi - relationship heterogeneous graph form. In the heterogeneous graph, the nodes represent different entities, namely movies and users. The edges in the heterogeneous graph represent the relationships between two nodes, and these relationships are divided into two types. If the two nodes are of the same entity, it represents multiple relationships between the same entities, specifically including the same director relationship between movies, the same production company relationship between movies, the same gender relationship between users, and the same age relationship between users. If the two nodes are of different entities, it represents multiple relationships between different entities, specifically including the viewing relationship, the collection relationship, the recommendation relationship, and the click relationship. The node feature matrix includes a movie feature matrix and a user feature matrix. The movie feature matrix is composed of the initial feature representations of all movie nodes and contains all movie information. The user feature matrix is composed of the initial feature representations of all user nodes and contains all user information;
[0096] Step 3.2: According to the adjacency matrix of each same - type meta - relationship path in the dual - type multi - relationship heterogeneous graph, calculate the degree value of each same - type meta - relationship path through formula (1). Use the same - type node association filter and filter out the same - type tightly - coupled paths and the same - type loosely - coupled paths in all same - type meta - relationship paths through formula (2). Aggregate the node features of the same - type tightly - coupled paths through formula (3) and formula (4). For the same - type loosely - coupled paths, first calculate the feature similarity between all target nodes and neighbor nodes within the path through formula (5), then use formula (6) to screen out the neighbor nodes with high feature similarity values to the target node to form a candidate neighbor node set. Aggregate the node features of the same - type tightly - coupled paths through formula (7) and formula (8). Finally, use formula (9), formula (10), and formula (11) to aggregate the two types of updated feature representations obtained from the same - type tightly - coupled paths and the same - type loosely - coupled paths to obtain the final feature representation of the target node in the same - type meta - relationship path;
[0097] According to the adjacency matrix of each cross - type meta - relation path in the dual - type multi - relation heterogeneous graph, calculate the degree value of each cross - type meta - relation path through formula (1). Use the cross - type node association filter and filter out the cross - type tightly - coupled paths and cross - type loosely - coupled paths in all cross - type meta - relation paths through formula (12). Aggregate the node features of the cross - type tightly - coupled paths through formula (13), formula (14) and formula (15). For the cross - type loosely - coupled paths, first calculate the feature similarity between all target nodes and neighbor nodes within the path through formula (5), then use formula (16) to screen out neighbor nodes with large feature similarity values to form a candidate neighbor node set, aggregate the node features of the cross - type loosely - coupled paths through formula (17), and finally use formula (18), formula (19) and formula (20) to aggregate the two types of updated feature representations obtained based on the cross - type tightly - coupled paths and cross - type loosely - coupled paths to obtain the final feature representation of the target nodes in the cross - type meta - relation paths;
[0098] Finally, perform cross - category aggregation according to formula (21) and formula (22) to obtain the final embedding representation of each target node, and the final embedding representation is the node embedding matrix;
[0099] Step 3.3: Continuously update the model parameters and perform backpropagation according to formula (23);
[0100] Step 3.4: Determine the user node embedding matrix and the movie node embedding matrix respectively according to formula (22), and compare the similarity between each node in the user node embedding matrix and the movie node embedding matrix; sort the similarity values in descending order, and select the top movies corresponding to the similarity values to generate a personalized movie recommendation list. At this time, the movie recommendation list contains the movies that best match the user's preferences.
[0101] The beneficial technical effects brought by the present invention: Analyze different types of meta - relation paths through the same - type aggregation module and the cross - type aggregation module, divide the paths into tightly - coupled paths and loosely - coupled paths, and design corresponding aggregation strategies according to the path characteristics, thereby reducing the interference of redundant information in the information transmission process; use the cross - category feature aggregation layer to integrate the information between different types of nodes, and can better understand the multi - level relationship between users and movies, including but not limited to various interaction methods such as ratings, comments, and collections, and provide more accurate recommendation results based on this; through the effective identification and processing of different types of node relationships, enhance the understanding and prediction ability of user preferences, realize more personalized movie recommendations, and improve the user experience and satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0102] Figure 1Flowchart of the movie recommendation method based on path-enhanced graph neural network of the present invention.
[0103] Figure 2 Schematic diagram of the visualization result of the HPN model in the experiment of the present invention.
[0104] Figure 3 Schematic diagram of the visualization result of the HAN model in the experiment of the present invention.
[0105] Figure 4 Schematic diagram of the visualization result of the ie-HGCN model in the experiment of the present invention.
[0106] Figure 5 Schematic diagram of the visualization result of the SR-HGN model in the experiment of the present invention.
[0107] Figure 6 Schematic diagram of the visualization result of the OSGNN model in the experiment of the present invention.
[0108] Figure 7 Schematic diagram of the visualization result of the DCMR-HGCA model in the experiment of the present invention. Detailed implementation manners
[0109] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners:
[0110] Most neural network recommendation systems that rely on meta-paths to capture semantic information are often better at dealing with datasets that contain only a single type of edge relationship. However, an increasing number of current movie data are stored in the form of a two-class multi-relational graph. Therefore, the present invention combines a two-class multi-relational heterogeneous graph neural network and proposes a movie recommendation method based on path-enhanced graph neural network, which can effectively process datasets containing two different types of nodes and their multiple relationships, aiming to solve the problems of information redundancy, ignoring complex interaction patterns, and insufficient personalization existing in existing recommendation systems. By introducing the multi-relational classification aggregation graph neural network model DCMR-HGCA and particularly enhancing the path analysis and aggregation strategy, this method realizes the effective identification and processing of different types of node relationships, thus significantly improving the performance of the movie recommendation system.
[0111] First of all, the present invention reduces information redundancy and improves the recommendation accuracy. By distinguishing between tightly coupled paths and loosely coupled paths and designing specialized processing methods for different types of meta-relation paths. For tightly coupled paths, the weighted summation method and the global average strategy are adopted, while for loosely coupled paths, the adaptive weight allocation strategy and the neighborhood feature propagation technique are used. This method effectively reduces the redundant interference in the information transmission process, ensures the effective transmission of key information, and makes the recommendation results more accurate.
[0112] When dealing with large-scale movie data, traditional movie recommendation models are prone to the problem of over-smoothing of movie features, resulting in the loss of important feature information. The present invention captures complex interaction patterns and improves the recommendation quality. By using a cross-category feature aggregation layer, information from different types of nodes is integrated, such as direct interactions between users and movies, like ratings, comments, and favorites, as well as indirect associations between movies (such as the same director, the same production company) and between users (such as the same gender, the same age). This method not only considers direct user-movie interactions but also synthesizes multi-level relationships, providing richer and more diverse recommendation results and significantly enhancing the recommendation quality. In addition, the present invention realizes highly personalized recommendations and enhances the user experience. By effectively identifying and processing relationships between different types of nodes, especially by extracting accurate feature vectors through a local extreme value selection mechanism, the understanding and prediction ability of user preferences are enhanced. This enables the recommendation system to provide more meticulous personalized services for users, meet the unique needs of different users, greatly improve the user experience satisfaction, and at the same time contribute to increasing user stickiness and platform activity.
[0113] The present invention optimizes the information aggregation process by using a method based on a dual-class multi-relationship heterogeneous graph neural network, improving the efficiency of the system. By designing a same-type aggregation module, a cross-type aggregation module, and a cross-category feature aggregation layer, the DCMR-HGCA model can efficiently process complex multi-type interactions, enhance the path analysis and aggregation strategy, and optimize the information transmission process. This method improves the computational efficiency and response speed of the system, can quickly generate high-quality recommendation results on large-scale data sets, and is suitable for real-time recommendation scenarios.
[0114] The present invention proposes a movie recommendation method based on a path-enhanced graph neural network, using a multi-relationship classification aggregation graph neural network model DCMR-HGCA. By distinguishing different types of meta-relationship paths and designing specialized processing methods according to their characteristics, the invention develops three key modules: a same-type aggregation module, a cross-type aggregation module, and a cross-category feature aggregation layer. It effectively identifies and processes relationships between various nodes, achieving a significant enhancement of path analysis and aggregation strategy. Finally, this method aggregates more comprehensive node information, making the dual-class multi-relationship graph neural network perform more excellently in movie recommendation modeling and prediction.
[0115] When making movie recommendations, the DCMR-HGCA model first classifies the meta-relation paths of the same type, including "movie-movie" and "user-user". To better capture the strong correlations between nodes of the same type and reduce the interference of redundant information, a same-type node association filter is used to filter them to obtain tightly coupled paths and loosely coupled paths. Then, for the tightly coupled paths, since the nodes in these paths usually have a high degree of correlation and the information transfer between them is relatively frequent, a global average strategy is adopted to aggregate information. This strategy ensures that important information will not be ignored and reduces the impact of outliers. For the loosely coupled paths, the algorithm first starts from the perspective of node features, selects a small range of neighbor nodes with high similarity, and then captures the feature information of specific subgraphs through an adaptive weight assignment method.
[0116] Then, it classifies the meta-relation paths of different types, including "movie-user-movie" and "user-movie-user". The meta-relation paths are filtered by a cross-type node association filter. To reveal the potential connections between different types of nodes and enhance the complexity and flexibility of the recommendation system, all cross-type meta-relation paths are divided into tightly coupled paths and loosely coupled paths. For the tightly coupled paths, DCMR-HGCA uses a weighted summation method to aggregate information to effectively capture and synthesize more valuable neighbor node information. For the loosely coupled paths, the algorithm first calculates the feature similarity between nodes, selects the nodes with the highest correlation from them, and then aggregates them through neighborhood feature propagation technology, thereby reducing the interference of irrelevant information. This not only ensures that meaningful information can be extracted even for sparse connections but also improves the relevance of the recommendation results. Finally, DCMR-HGCA uses a category-level attention mechanism to fuse the semantic and feature information of the same type and different types to generate the final node embeddings for use in downstream tasks.
[0117] To ensure the effectiveness and wide applicability of the model, DCMR-HGCA adopts a carefully designed loss function to guide the training process. This loss function particularly considers the requirements of the recommendation system, such as personalized matching and diversity, to ensure that the model can provide high-quality recommendations in a real environment. After training, the system will collect the movie and viewing history data of users and input this information into the trained DCMR-HGCA model. By carefully analyzing the user's behavior patterns, the model can generate a movie recommendation list that conforms to the user's preferences and provide unique viewing suggestions using a complex relationship network.
[0118] In addition, the feature extraction method provided by the present invention injects new vitality into the field of movie recommendations. It not only deepens the understanding of movie characteristics and user preferences but also provides valuable tools and support for subsequent research and development. This method greatly improves the intelligence level of the recommendation system and brings a more personalized and satisfactory viewing experience to users.
[0119] As shown Figure 1 below, a movie recommendation method based on path-enhanced graph neural network includes the following steps:
[0120] Step 1: Construct a multi-relational classification aggregation graph neural network model DCMR-HGCA, which includes a homogeneous type aggregation module, a cross-type aggregation module, and a cross-category feature aggregation layer;
[0121] The working process of the multi-relational classification aggregation graph neural network model DCMR-HGCA is as follows:
[0122] Step 1.1: Construct a dual-type multi-relational heterogeneous graph, which contains several meta-relation paths;
[0123] The meta-relation paths contained in the dual-type multi-relational heterogeneous graph can be divided into two types, namely: homogeneous type meta-relation paths and cross-type meta-relation paths; A homogeneous type meta-relation path means that there is only one type of entity in a path; A cross-type meta-relation path means that there are two or more types of entities in a path;
[0124] According to the adjacency matrix of each meta-relation path, calculate the degree value of each meta-relation path:
[0125] (1);
[0126] Among them, is the degree value of the th meta-relation path ; Define as the adjacency matrix of , define to represent the element in the th row and the th column of , the th row corresponds to the th target node, and the th column corresponds to the th target node; If there is an edge between the th target node and the th target node, then set the element in the th row and the th column of to , otherwise represents the number of all target nodes ; represents the set composed of all target nodes .
[0127] Step 1.2. In the same - type aggregation module, a same - type node association filter is adopted; according to the topological structure of the graph, all meta - relation paths are filtered by the same - type node association filter to obtain all same - type meta - relation paths, and all same - type meta - relation paths are divided into same - type tightly - coupled paths and same - type loosely - coupled paths, and then classified to obtain the final feature representation of the target nodes in the same - type meta - relation paths; the specific working process of the same - type aggregation module is as follows:
[0128] Step 1.2.1. Calculate the degree values of all same - type meta - relation paths according to formula (1), and define the degree - value set of the same - type meta - relation paths , where is the total number of same - type meta - relation paths, is the th same - type meta - relation path ; through the following formula, the relative difference of the degree value of each same - type meta - relation path relative to the minimum degree value among all same - type meta - relation path degree values can be calculated:
[0129] (2);
[0130] where, is the relative difference of the degree value of ; is the minimum degree value among the same - type meta - relation paths; is a small positive number ( used in the present invention), which is used to prevent the situation of division by zero.
[0131] Finally, a set of relative differences of degree values containing all same - type meta - relation paths is obtained.
[0132] Step 1.2.2. Divide the same - type tightly - coupled paths and same - type loosely - coupled paths according to the relative difference of degree values; the judgment criterion is: a same - type division threshold is preset. If the relative difference of the degree value of the current same - type meta - relation path is greater than , then this path is classified as a same - type tightly - coupled path; otherwise, it is a same - type loosely - coupled path.
[0133] Step 1.2.3. For the same - type tightly - coupled paths, directly perform node feature aggregation on the same - type tightly - coupled paths by using the global average strategy; the specific process is as follows:
[0134] First, for the target node average - pool the features of its neighbor nodes to calculate the pooled feature representation of the target node :
[0135] (3);
[0136] Among them, is the pooled feature representation of the target node ; is the set of all neighbor nodes of the target node in the same type of meta-relation path; is the number of all neighbor nodes; is the neighbor node of the target node in the same type of meta-relation path; is the initial feature representation of the neighbor node , and the initial feature representation is obtained from the node feature matrix which contains all node information;
[0137] Then, through the following formula, the feature representation obtained by average pooling is non-linearly transformed using the ReLu activation function to obtain the updated feature representation of the node in the same type of tightly coupled path:
[0138] (4);
[0139] Among them, is the updated feature representation of the target node in the same type of tightly coupled path; is the ReLu activation function; is the weight matrix of the non-linear transformation in the same type of aggregation module; is the bias term of the non-linear transformation in the same type of aggregation module.
[0140] Step 1.2.4. For each same type of loosely coupled path obtained through the same type of node association filter, the same type of aggregation module first calculates the feature similarity between all nodes and selects the node with the highest correlation. Calculate the feature similarity between the target node and the neighbor node in all same type of loosely coupled paths through the following formula:
[0141] (5);
[0142] Among them, is the initial feature representation of the target node ; is the initial feature representation of the neighbor node ; is the inner product calculation, represents the inner product of the feature representations of two nodes; is the L2 norm.
[0143] Step 1.2.5. Calculate the feature similarity between the target node and all neighbor nodes in the same type of loosely coupled path according to formula (5), and sort the feature similarities in descending order. Select the top neighbor nodes with high feature similarity to the target node through formula (6) to form a candidate neighbor node set for subsequent aggregation operations:
[0144] (6);
[0145] where, is the candidate neighbor node set composed of neighbor nodes with high feature similarity to the target node in the same type of loosely coupled path; is a function to obtain the largest values and their corresponding indices in the entire sequence.
[0146] Step 1.2.6. According to , perform node feature aggregation through the same type of loosely coupled path; calculate the features of each target node and the influence degree of the first neighbor nodes on the target node, and use an adaptive weight allocation mechanism to adjust the contribution of each neighbor node. Perform the same type of aggregation operation on the target node through the following formula to obtain the node feature representation after the same type of aggregation:
[0147] (7);
[0148] where, is the feature representation of the target node after the same type of aggregation; represents the adaptive weight coefficient, which is used to measure the influence degree of the neighbor node on the target node , and this coefficient is calculated through formula (8):
[0149] (8);
[0150] where, is the exponential function with base e; is the learnable attention vector, is the transpose symbol; is the weight matrix; is one of the neighbor nodes of the target node in ; is the initial feature representation of Indicates a splicing operation; is the activation function.
[0151] The node feature representations aggregated by the same type are further non-linearly transformed through the activation function to obtain the updated feature representations of the target nodes in the same-type loose coupling path of. .
[0152] Step 1.2.7. The last step in the same-type aggregation module is to semantically fuse the node update representations obtained based on these two types of meta-relation paths respectively and ; The specific process is as follows:
[0153] First, the attention mechanism is used to dynamically adjust the influence of the aggregation results of different types on the final node representation. For the same-type tight coupling path and the same-type loose coupling path, the corresponding attention weights can be defined as follows:
[0154] (9);
[0155] (10);
[0156] Among them, is the attention weight of the same-type tight coupling path; is the attention weight of the same-type loose coupling path; A shared learnable parameter vector is introduced to evaluate the importance of each type.
[0157] Then, the aggregation results of the two types are obtained through the following formula to generate the final feature representation of the target node in the same-type meta-relation path:
[0158] (11);
[0159] Among them, is the final feature representation of the target node in the same-type meta-relation path;
[0160] Step 1.3. A cross-type node association filter is adopted in the cross-type aggregation module; All meta-relation paths are filtered through the cross-type node association filter to obtain all cross-type meta-relation paths, and all cross-type meta-relation paths are divided into cross-type tight coupling paths and cross-type loose coupling paths for differential processing to obtain the final feature representation of the target node in the cross-type meta-relation path; The specific workflow of the cross-type aggregation module is as follows:
[0161] Step 1.3.1. Calculate the degree values of all cross-type meta-relationship paths according to formula (1), and define the set of degree values of cross-type meta-relationship paths , where is the total number of cross-type meta-relationship paths, is the th cross-type meta-relationship path ; through the following formula, the relative difference between the degree value of each cross-type meta-relationship path and the minimum degree value among all cross-type meta-relationship path degree values can be calculated:
[0162] (12);
[0163] where, is the relative difference in degree value; is the minimum degree value in the cross-type meta-relationship paths.
[0164] Finally, obtain the set of relative differences in degree values of all cross-type meta-relationship paths .
[0165] Step 1.3.2. Divide the cross-type tightly coupled paths and cross-type loosely coupled paths according to the relative differences in degree values; the judgment criterion is: preset a cross-type division threshold , if the relative difference in degree value of the current cross-type meta-relationship path is greater than , then this path is classified as a cross-type tightly coupled path, otherwise it is a cross-type loosely coupled path.
[0166] Step 1.3.3. Aggregate the node features of the cross-type tightly coupled paths obtained through the cross-type node association filter; the specific process is as follows:
[0167] First, calculate the influence of each neighbor node on the target node according to the features of each node in the path and the meta-relationship information of the path. Use the weighted summation method to aggregate the information of neighbor nodes, and implement the aggregation operation on the target node through the following formula to obtain the cross-type aggregated node feature representation:
[0168] (13);
[0169] where, is the feature representation of the cross-type aggregated target node ; is the neighbor node of the target node in the cross-type meta-relationship path; represents the set composed of all neighbor nodes of the target node in the cross-type meta-relationship path; For neighbor nodes The initial feature representation; Denote the target node The weight assignment coefficient for neighbor nodes is dynamically calculated according to the relationship between nodes, and the formula is:
[0170] (14);
[0171] Among them, is the learned weight vector; is One of the neighbor nodes of the target node in; is The initial feature representation;
[0172] Then, the target node representation after cross-type aggregation is further non-linearly transformed through the ReLu activation function to obtain the node update feature representation of the cross-type tight coupling path:
[0173] (15);
[0174] Among them, is the updated feature representation of the target node in the cross-type tight coupling path; is the weight matrix of the non-linear transformation in the cross-type aggregation module; is the bias term of the non-linear transformation in the cross-type aggregation module.
[0175] Step 1.3.4. For the cross-type loose coupling path obtained through the cross-type node association filter, this module first uses the formula (5) in Step 1.2.5 to calculate the feature similarity between the target node and all neighbor nodes in all cross-type loose coupling paths, and sorts the feature similarities in descending order. To reduce the interference of irrelevant information, the following formula is used to select the top neighbor nodes with high feature similarity to the target node to form a candidate neighbor node set:
[0176] (16);
[0177] Among them, is the candidate neighbor node set composed of neighbor nodes with high feature similarity to the target node in the cross-type loose coupling path; is the target node in the cross-type loose coupling path and the neighbor node Feature similarity between
[0178] Step 1.3.5. For , the cross-type aggregation module further aggregates the node features through the neighborhood feature propagation technique. Using the following formula (17), the feature representation of the target node is weighted and aggregated using the feature representations of the neighbor nodes to obtain the updated feature representation of the target node based on the loose coupling path in the cross-type aggregation module:
[0179] (17);
[0180] Where, is the updated feature representation of the target node in the cross-type loose coupling path; is the weight matrix during weighted aggregation in the cross-type loose coupling path; is the bias term during weighted aggregation in the cross-type loose coupling path; and are the degrees of the neighbor node and the target node respectively.
[0181] Step 1.3.6. The last step of the cross-type aggregation module is to semantically fuse the updated feature representations and of the target node obtained based on these two types of meta-relation paths. The specific process is as follows:
[0182] First, for the cross-type tight coupling path and the cross-type loose coupling path, the corresponding attention weights can be defined as follows:
[0183] (18);
[0184] (19);
[0185] Where, is the attention weight of the cross-type tight coupling path; is the attention weight of the cross-type loose coupling path.
[0186] Then, through the two types of attention weights and that have been calculated, the aggregation result of the two types of updated feature representations is obtained using formula (20) to form the final feature representation of the target node in the cross-type meta-relation path:
[0187] (20);
[0188] Where, is the target node Final feature representation;
[0189] Step 1.4: The cross-category feature aggregation layer adopts a category-level attention mechanism to fuse semantic and feature information of the same type and cross-type, generating the final node embedding for use in downstream recommendation tasks; the working process of the cross-category feature aggregation layer is as follows:
[0190] Step 1.4.1: To learn a more comprehensive node embedding, DCMR-HGCA aggregates the final feature representations of two types of nodes based on the same-type meta-relation path and cross-type meta-relation path through the cross-category feature aggregation layer and using a category-level attention mechanism during aggregation. First, calculate the attention scores through the following formula:
[0191] (21);
[0192] where, is the attention score; is the learnable query vector; is the Tanh activation function; the weight matrix of the attention mechanism; is the bias term of the attention mechanism; represents the concatenation operation.
[0193] Step 1.4.2: Use the softmax activation function on the obtained attention scores to calculate the attention weights for each category and perform weighted summation to generate the final embedding representation of the target node:
[0194] (22);
[0195] where, is the final embedding representation of the target node; is the category serial number; is the number of categories, in this invention , including the same type or cross-type; , are respectively the attention scores of category and category .
[0196] DCMR-HGCA finally uses the cross-category feature aggregation layer to aggregate node embedding features from the same type and cross-type, automatically adjusts the weights according to the relative importance of the input features, and performs weighted summation to obtain the final node representation, thereby improving the effect of feature fusion for tasks such as node classification.
[0197] Step 2: Construct a loss function to optimize and train the multi-relational classification aggregation graph neural network model DCMR-HGCA. The specific process is as follows:
[0198] After obtaining the final embeddings of the nodes through Step 1, DCMR-HGCA uses cross-entropy loss for semi-supervised node classification tasks to optimize the model:
[0199] (23);
[0200] where is the set of label indices of the target node ; is the vector representation of the target node in is the set of label indices of all nodes; is the label index of the node; are the classifier parameters.
[0201] Step 3: Obtain the movie data of the current user, input the trained multi-relational classification aggregation graph neural network model DCMR-HGCA, and generate a personalized movie recommendation list. The specific process is as follows:
[0202] Step 3.1: Determine the node feature matrix and determine the user-movie dual-type multi-relational heterogeneous graph.
[0203] Process the collected movie data into the form of a dual-type multi-relational heterogeneous graph, where the nodes of the heterogeneous graph represent different entities, namely movies and users; the edges of the heterogeneous graph represent the relationships between two nodes, and this relationship is divided into two types; if the two nodes are the same entity, it represents multiple relationships between the same entity, specifically including the same director between movies, the same production company between movies, the same gender between users, and the same age between users; if the two nodes are different entities, it represents multiple relationships between different entities, specifically including the viewing relationship, the collection relationship, the recommendation relationship, and the click relationship. The node feature matrix includes a movie feature matrix and a user feature matrix; the movie feature matrix is composed of the initial feature representations of all movie nodes and contains all movie information, and the user feature matrix is composed of the initial feature representations of all user nodes and contains all user information;
[0204] Step 3.2: Perform node feature extraction based on the multi-relational classification aggregation graph neural network model DCMR-HGCA.
[0205] According to the adjacency matrix of each homogeneous meta-relation path in the dual-type multi-relation heterogeneous graph, calculate the degree value of each homogeneous meta-relation path through formula (1). Use the homogeneous node association filter and filter out the homogeneous tight-coupling paths and homogeneous loose-coupling paths in all homogeneous meta-relation paths through formula (2). Aggregate the node features of the homogeneous tight-coupling paths through formula (3) and formula (4). For the homogeneous loose-coupling paths, first calculate the feature similarity between all target nodes and neighbor nodes within the path through formula (5), and then use formula (6) to filter out the neighbor nodes with high feature similarity values to the target nodes to form a candidate neighbor node set. Aggregate the node features of the homogeneous loose-coupling paths through formula (7) and formula (8). Finally, use formula (9), formula (10) and formula (11) to aggregate the two types of updated feature representations obtained based on the homogeneous tight-coupling paths and homogeneous loose-coupling paths to obtain the final feature representation of the target nodes in the homogeneous meta-relation paths.
[0206] According to the adjacency matrix of each cross-type meta-relation path in the dual-type multi-relation heterogeneous graph, calculate the degree value of each cross-type meta-relation path through formula (1). Use the cross-type node association filter and filter out the cross-type tight-coupling paths and cross-type loose-coupling paths in all cross-type meta-relation paths through formula (12). Aggregate the node features of the cross-type tight-coupling paths through formula (13), formula (14) and formula (15). For the cross-type loose-coupling paths, first calculate the feature similarity between all target nodes and neighbor nodes within the path through formula (5), and then use formula (16) to filter out the neighbor nodes with large feature similarity values to form a candidate neighbor node set. Aggregate the node features of the cross-type loose-coupling paths through formula (17). Finally, use formula (18), formula (19) and formula (20) to aggregate the two types of updated feature representations obtained based on the cross-type tight-coupling paths and cross-type loose-coupling paths to obtain the final feature representation of the target nodes in the cross-type meta-relation paths.
[0207] Finally, calculate according to formula (21) and formula (22) to perform cross-category aggregation on the final feature representations of the above types to obtain the final embedding representation of each target node. The final embedding representation is the node embedding matrix;
[0208] Step 3.3: Continuously update the model parameters and perform backpropagation according to formula (23);
[0209] Step 3.4: Calculate the similarity of each node in the user node embedding matrix and the movie node embedding matrix determined according to formula (22), and 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 Generate a personalized movie recommendation list for the movie corresponding to the similarity value. At this time, the movie recommendation list contains the movies that best match the user's preferences.
[0210] In an online application, the node embedding matrix can be updated regularly or in real time to reflect the latest data changes on the movie platform and the dynamic changes in user behavior. This can provide more accurate and personalized movie recommendations for users. To prove the feasibility and superiority of the present invention, the following comparative experiments were conducted. The proposed DCMR-HGCA model of the present invention was compared and analyzed with eight baseline models, namely HAN, HPN, ie-HGCN, SR-HGN, GCN, GAT, OSGNN, and MECCH. 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 a heterogeneous graph and improve the effect of representation learning; HPN is a path-based heterogeneous graph neural network that focuses on using different types of paths in the graph to learn node representations and enhances the understanding of complex relationships; SR-HGN is a heterogeneous graph neural network that integrates semantic and relational information, uses the attention mechanism to aggregate at the node level and type level, and maps the complex heterogeneous information network into a low-dimensional space to achieve efficient representation learning. GCN is a neural network model designed specifically for graph-structured data, which constructs node representations by recursively aggregating node neighbor information, thereby fusing the features of the node itself and its directly associated nodes; GAT is a graph neural network that introduces the attention mechanism and can adaptively adjust the importance weights of each node to its neighbors to optimize the information aggregation process; the OSGNN model decomposes the original heterogeneous graph to form weighted combined subgraphs, taking into account both local and global structural information to comprehensively learn the first-order and high-order features of the target node; the MECCH model proposes a heterogeneous graph neural network based on meta-path context convolution to learn node representations from a heterogeneous graph, which can extract comprehensive node features from the input graph while maintaining moderate computational time and memory occupancy.
[0211] For fair comparison, the experimental parameters of all models were set as follows: the dimension of the intermediate layer was set to 64, the learning rate was 0.005, the weight decay was 1.0×10 -3 ⁻⁵, the feature dropout rate was 0.5, the maximum number of iterations was 1000, and the training set and test set were set to 10% and 80% of the total dataset, respectively.
[0212] The present invention selects two datasets, AL_BMHG1 and AL_BMHG2, for comparative experiments. AL_BMHG1 and AL_BMHG2 are generated from different numbers of nodes and edges in the AL_BMHG dataset. AL_BMHG is provided by the Alibaba Cloud Tianchi Data Competition (CIKM2019 EComm AI), and the dataset is real transaction data from the Taobao platform. The AL_BMHG1 dataset and the AL_BMHG2 dataset used in the present invention are constructed for three-classification and six-classification of target nodes. In terms of the division of tight-coupling and loose-coupling paths, the multi-relation classification aggregation graph neural network model DCMR-HGCA takes into account four different types of meta-relation paths at the same time and sets different parameters for different datasets. In the AL_BMHG1 dataset, set , after passing through the same-type node association filter, the same-type tight-coupling path is determined to be {I-I:brand}, and for the cross-type node relationship, after passing through the cross-type node association filter, the cross-type tight-coupling path is divided into {I-U-I:cart, I-U-I:pv}; in the AL_BMHG2 dataset, set , for the cross-type relationship, after passing through the cross-type node association filter, the cross-type tight-coupling path is divided into {I-U-I:cart, I-U-I:pv}, and after passing through the same-type node association filter, the same-type tight-coupling path is determined to be {I-I:brand}. In both datasets, the number of nodes selected in the tight and loose-coupling paths in the cross-type relationship is uniformly set to 500; the number of nodes selected in the same-type loose-coupling meta-relation path in the AL_BMHG1 dataset is 29, and the number of nodes selected in the same-type loose-coupling meta-relation path in the AL_BMHG2 dataset is 49.
[0213] The support vector machine SVM is used as the classifier to evaluate the model in multi-classification tasks, and Macro-F1 (abbreviated as Ma-F1) and Micro-F1 (abbreviated as Mi-F1) are used as evaluation metrics. The results are shown in Table 1, where the best results are shown in bold.
[0214] Table 1 Classification results of different models on two datasets (%)
[0215] .
[0216] As shown in Table 1, the DCMR-HGCA model outperforms other models on both datasets, demonstrating its significant advantages in processing the dual-class relationship aggregation task. At a sampling ratio of 0.8, on the AL_BMHG1 dataset, DCMR-HGCA improved by 4.97% and 4.94% compared to SR-HGN, and the improvement compared to GAT was 5.87% and 6.04%; on the AL_BMHG2 dataset, DMMR-HGCA improved by 12.04% and 11.52% compared to ie-HGCN, showing a significant improvement compared to other algorithms. Generally speaking, the DCMR-HGCA model of the present invention realizes the differential processing of different types of meta-relationship paths by introducing the same-type aggregation module and cross-type aggregation module. This refined design enables the algorithm to flexibly adopt the most suitable information aggregation strategy according to the characteristics of specific paths (tight coupling or loose coupling), so as to more accurately capture valuable semantic information.
[0217] The learned node embeddings were clustered using K-means with the average normalized mutual information (NMI) and adjusted Rand index (ARI) as metrics. The results are shown in Table 2, from which the following observations are obtained, where the best results are shown in bold.
[0218] Table 2 Results of different models in the clustering experiment (%)
[0219] 。
[0220] As can be seen from Table 2, the DCMR-HGCA model achieved the highest clustering accuracy on the AL_BMHG1 dataset compared to other baselines. In particular, the average normalized mutual information (NMI) and adjusted Rand index (ARI) increased by 27.69% and 41.58% respectively compared to SR-HGN, but the improvement compared to HPN was relatively small. On the AL_BMHG2 dataset, DCMR-HGCA improved compared to most baselines.
[0221] To provide a more intuitive evaluation, the t-distributed stochastic neighbor embedding (t-SNE) was used to map the node embeddings of the AL_BMHG1 dataset into a two-dimensional space, and three colors were used to label different nodes. Figures 2 - 7The visualization results of the node distributions of the existing HPN, HAN, ie-HGCN, SR-HGN, and OSGNN models and the DCMR-HGCA model proposed in the present invention on the AL_BMHG1 dataset are respectively shown. The node distribution of HPN is relatively scattered, and there is no obvious separation among nodes of different categories, indicating its limitations in capturing the differences between nodes; there is a slight aggregation trend for some category nodes of HAN, but the aggregation density is insufficient; the node distributions of ie-HGCN and SR-HGN are relatively concentrated, showing a certain degree of intra-category cohesion, but the boundaries between different categories are still not clear enough, affecting the final clustering effect; the node distribution of OSGNN is more dense, and the nodes of different categories show a better separation effect. While the node distribution of DCMR-HGCA is the most compact, and the nodes of different categories are almost completely separated, showing the best clustering effect. In summary, through t-SNE visualization, the differences in the node embedding representations of each model can be intuitively seen. DCMR-HGCA not only has the most compact node distribution but also achieves the best separation of nodes of different categories, further verifying its superior performance in processing the dual-class multi-relationship heterogeneous graph task.
[0222] Based on the above experimental results, it shows that the model of the present invention performs excellently in user behavior prediction and user group division, and can accurately classify similar users or movies. 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 movie recommendation is not only effective but also significantly superior to the existing methods, better understanding and predicting the movie preferences and behavior patterns of users.
[0223] Certainly, 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 those skilled in the art within the scope of the essence of the present invention should also fall within the protection scope of the present invention.
Claims
1. A graph neural network movie recommendation method based on path enhancement, characterized in that: The steps include: Step 1: Build a multi-relation classification aggregation graph neural network model, which includes a same-type aggregation module, a cross-type aggregation module, and a cross-category feature aggregation layer; Step 2: Construct a loss function to optimize the training of a multi-relation classification aggregation graph neural network model; Step 3: Obtain the movie data of the current user, input the trained multi-relation classification aggregation graph neural network model, and generate a personalized movie recommendation list; In step 1, the working process of the multi-relation classification aggregation graph neural network model is as follows: Step 1.1, construct a dual-type multi-relation heterogeneous graph containing several meta-relation paths; meta-relation paths are divided into two types: same-type meta-relation paths and cross-type meta-relation paths; same-type meta-relation paths refer to a path in which only one entity exists; A cross-type meta-relationship path refers to a path in which there are two or more entities; According to the adjacency matrix of each meta-relationship path, calculate the degree value of each meta-relationship path: in, is the mth element relationship path Φ m The value of Φ m The adjacency matrix of i,j express The element in the i-th row and j-th column in the , the i-th row corresponds to the i-th target node, and the j-th column corresponds to the j-th target node; if there is an edge between the i-th target node and the j-th target node, then the corresponding setting The element d in the i-th row and j-th column of ij =1, otherwise d ij =0; |N| represents the number of all target nodes v; N represents the set consisting of all target nodes v; Step 1.2: The same type node association filter is used in the same type aggregation module. All meta-relation paths are filtered through the same type node association filter to obtain all the same type meta-relation paths, and all the same type meta-relation paths are divided into the same type tightly coupled paths and the same type loosely coupled paths, and the final feature representation of the target node in the same type meta-relation path is calculated; Step 1.3: A cross-type node association filter is used in the cross-type aggregation module. All meta-relation paths are filtered through the cross-type node association filter to obtain all cross-type meta-relation paths, and all cross-type meta-relation paths are divided into cross-type tightly coupled paths and cross-type loosely coupled paths. The final feature representation of the target node in the cross-type meta-relation path is calculated; Step 1.4: The cross-category feature aggregation layer uses a category-level attention mechanism to fuse the semantic and feature information of the same type and across types to generate the final node embedding for use in recommendation tasks.
2. According to claim 1, the method for recommending movies using graph neural networks based on path enhancement is characterized in that: The specific process of step 1.2 is as follows: Step 1.2.1: Calculate the degree values of all meta-relation paths of the same type according to formula (1) and define the degree value set of meta-relation paths of the same type: Where p is the total number of meta-relation paths of the same type, is the sth element relationship path of the same type Φ s,same The degree value of Calculate the relative difference in degree of each meta-relationship path of the same type: in, Φ s,same The relative difference of the degree value; is the minimum degree value among the same type of meta-relation paths; θ is a small positive number; Finally, we obtain a set of relative differences in the degree values of all meta-relation paths of the same type. Step 1.2.2, according to the relative difference of degree value, the same type of tightly coupled paths and the same type of loosely coupled paths are obtained; the judgment criterion is: a same type division threshold γ1 is pre-set, if the relative difference of the degree value of the current same type of meta-relationship path is greater than γ1, then the path is classified as the same type of tightly coupled path, otherwise, it is the same type of loosely coupled path; Step 1.2.3: Use the global average strategy to aggregate node features of tightly coupled paths of the same type; the specific process is as follows: First, the features of the target node v and its neighbor node u are averaged and the pooled feature representation of the target node v is calculated: in, is the pooled feature representation of the target node v; is the set of all neighbor nodes of the target node v in the same type of meta-relation path; is the number of all neighbor nodes; u is the neighbor node of the target node v in the same type of meta-relation path; h u is the initial feature representation of neighbor node u; Then, a nonlinear transformation is performed to obtain the updated feature representation of nodes in the same type of tightly coupled paths: in, is the updated feature representation of the target node v in the same type of tightly coupled path; ReLu(·) is the ReLu activation function; W0 is the weight matrix of the nonlinear transformation in the same type of aggregation module; b0 is the bias term of the nonlinear transformation in the same type of aggregation module; Step 1.2.4: Calculate the feature similarity between the target node and neighbor nodes in all loosely coupled paths of the same type: Among them, sim1(v,u) is the feature similarity between the target node v and the neighbor node u in the same type of loosely coupled paths; h v is the initial feature representation of the target node v; · is the inner product calculation; ‖·‖ is the L2 norm; Step 1.2.5: Calculate the feature similarity between the target node v and all neighbor nodes in the same type of loosely coupled path according to formula (5), sort the feature similarities from high to low, and construct a set of candidate neighbor nodes by screening using formula (6): in, is a set of candidate neighbor nodes consisting of k neighbor nodes with high feature similarity to the target node v in the same type of loosely coupled paths; TopK(·) is a function to obtain the largest K values in the entire sequence and their corresponding indexes; Step 1.2.6: Perform the same type of aggregation operation on the target node v to obtain the node feature representation after the same type of aggregation: Among them, h′ v is the feature representation of the target node v after aggregation of the same type; α uv represents the adaptive weight coefficient, which is calculated by formula (8): Where exp(·) is an exponential function with e as the base; is a learnable attention vector, is the transposed symbol; W1 is the weight matrix; t is One of the neighbor nodes of the target node v; h t is the initial feature representation of t; ∥ represents the concatenation operation; LeakyReLu(·) is the activation function; The feature representation of nodes after aggregation of the same type is transformed nonlinearly through the activation function to obtain the updated feature representation of the target node v in the same type of loosely coupled path. Step 1.2.7: Perform semantic level fusion; the specific process is as follows: First, the attention weights of the same type of tightly coupled paths and the same type of loosely coupled paths are defined as follows: Among them, β den is the attention weight of the same type of tightly coupled paths; β sp is the attention weight of the same type of loosely coupled paths; q is a shared learnable parameter vector; Then, the final feature representation of the target node in the same type of meta-relation path is generated: in, It is the final feature representation of the target node v in the meta-relation path of the same type.
3. According to claim 2, the path-enhanced graph neural network movie recommendation method is characterized in that: The specific process of step 1.3 is as follows: Step 1.3.1: Calculate the degree values of all cross-type meta-relation paths according to formula (1) and define the degree value set of cross-type meta-relation paths: where g is the total number of cross-type meta-relation paths, is the a-th cross-type meta-relation path φ a,across The degree value of Calculate the relative difference in degree of each cross-type meta-relationship path: in, is φ a,across The relative difference of the degree value; is the minimum degree value in the cross-type meta-relation path; Finally, we obtain a set of relative differences in degree values of all cross-type meta-relation paths. Step 1.3.2: According to the relative difference of degree values, the cross-type tightly coupled path and the cross-type loosely coupled path are obtained; the judgment criterion is: a cross-type division threshold γ2 is pre-set, if the relative difference of the degree value of the current cross-type meta-relationship path is greater than γ2, then the path is classified as a cross-type tightly coupled path, otherwise it is a cross-type loosely coupled path; Step 1.3.3: Perform node feature aggregation on the cross-type tightly coupled paths obtained through the cross-type node association filter; the specific process is as follows: First, calculate the node feature representation after cross-type aggregation: Among them, h″ v is the feature representation of the target node v after cross-type aggregation; o is the neighbor node of the target node v in the cross-type meta-relation path; represents the set of all neighbor nodes of the target node v in the cross-type meta-relation path; h o is the initial feature representation of neighbor node o; η vo It represents the weight distribution coefficient of the target node v to the neighbor node o. The formula is: in, is the learned weight vector; for One of the neighbor nodes of the target node v; for The initial feature representation of Then, a nonlinear transformation is performed on the target node representation after cross-type aggregation to obtain the node update feature representation of the cross-type tightly coupled path: in, is the updated feature representation of the target node v in the cross-type tightly coupled path; W3 is the weight matrix of the nonlinear transformation in the cross-type aggregation module; b3 is the bias term of the nonlinear transformation in the cross-type aggregation module; Step 1.3.4: Use formula (5) to calculate the feature similarity between the target node v and all neighbor nodes o in all cross-type loosely coupled paths, and sort the feature similarities from high to low. Select the first x neighbor nodes with high feature similarity to the target node to form the candidate neighbor node set: in, is a set of candidate neighbor nodes consisting of x neighbor nodes with high feature similarity to the target node v in the cross-type loosely coupled path; sim2(v,o) is the feature similarity between the target node v and the neighbor node o in the cross-type loosely coupled path; Step 1.3.5: Calculate the updated feature representation of the target node of the cross-type loosely coupled path: in, is the updated feature representation of the target node v in the cross-type loosely coupled path; W4 is the weight matrix during weighted aggregation in the cross-type loosely coupled path; b4 is the bias term during weighted aggregation in the cross-type loosely coupled path; and are the degrees of neighbor node o and target node v respectively; Step 1.3.6: Perform semantic level fusion. The specific process is as follows: The attention weights corresponding to the cross-type tightly coupled path and the cross-type loosely coupled path are defined as follows: Among them, ω den is the attention weight of the tightly coupled path across types; ω sp is the attention weight of loosely coupled paths across types; Then, the final feature representation of the target node in the cross-type meta-relation path is generated: in, is the final feature representation of the target node v in the cross-type meta-relation path.
4. According to claim 3, the path-enhanced graph neural network movie recommendation method is characterized in that: The specific process of step 1.4 is as follows: Step 1.4.
1. Calculate the attention score: Among them, σ is the attention score; is the learnable query vector; Tanh(·) is the Tanh activation function; W5 is the weight matrix of the attention mechanism; b5 is the bias term of the attention mechanism; Step 1.4.2: Use the softmax activation function to calculate the attention weight of each category and perform weighted summation to generate the final embedding representation of the target node: Where Z is the final embedding representation of the target node; e is the category number; P is the number of categories, including the same type or cross-type; σ e , σ f are the attention scores of category e and category f respectively.
5. According to claim 4, the method for recommending movies using graph neural networks based on path enhancement is characterized in that: In step 2, cross entropy loss is used To optimize the 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 Z; Y L is the label index set of all nodes; r is the label index of the node; C is the classifier parameter.
6. According to claim 5, the method for recommending movies using graph neural networks based on path enhancement is characterized in that: The specific process of step 3 is as follows: Step 3.1, determine the user-movie dual-type multi-relation heterogeneous graph and node feature matrix; The collected movie data is processed into a dual-type multi-relation heterogeneous graph, where the nodes of the heterogeneous graph represent different entities, namely movies and users; the edges of the heterogeneous graph represent the relationship between two nodes, which is divided into two types; if two nodes are the same entity, they represent multiple relationships between the same entity, including the same director between movies, the same production company between movies, the same gender relationship between users, and the same age relationship between users; if two nodes are different entities, they represent multiple relationships between different entities, including viewing relationship, collection relationship, recommendation relationship, and click relationship; the node feature matrix includes the movie feature matrix and the user feature matrix; The movie feature matrix is composed of the initial feature representations of all movie nodes and contains all movie information. The user feature matrix is composed of the initial feature representations of all user nodes and contains all user information. Step 3.2: According to the adjacency matrix of each same-type meta-relationship path in the dual-type multi-relationship heterogeneous graph, the degree value of each same-type meta-relationship path is calculated by formula (1). The same-type node association filter is used to filter out the same-type tightly coupled paths and the same-type loosely coupled paths in all the same-type meta-relationship paths by formula (2). The node features of the same-type tightly coupled paths are aggregated by formulas (3) and (4). For the same-type loosely coupled paths, the feature similarity between all target nodes and neighbor nodes in the path is first calculated by formula (5). Then, the neighbor nodes with high feature similarity values with the target nodes are selected by formula (6) to form a set of candidate neighbor nodes. The node features of the same-type tightly coupled paths are aggregated by formulas (7) and (8). Finally, the two types of updated feature representations obtained based on the same-type tightly coupled paths and the same-type loosely coupled paths are aggregated by formulas (9), (10) and (11) to obtain the final feature representation of the target node in the same-type meta-relationship path. According to the adjacency matrix of each cross-type meta-relationship path in the dual-type multi-relationship heterogeneous graph, the degree value of each cross-type meta-relationship path is calculated by formula (1). The cross-type node association filter is used and the cross-type tightly coupled paths and cross-type loosely coupled paths in all cross-type meta-relationship paths are filtered out by formula (12). The node features of the cross-type tightly coupled paths are aggregated by formulas (13), (14) and (15). For the cross-type loosely coupled paths, the feature similarity between all target nodes and neighbor nodes in the path is first calculated by formula (5). Then, the neighbor nodes with large feature similarity values are selected by formula (16) to form a set of candidate neighbor nodes. The node features of the cross-type loosely coupled paths are aggregated by formula (17). Finally, the two types of updated feature representations obtained based on the cross-type tightly coupled paths and the cross-type loosely coupled paths are aggregated by formulas (18), (19) and (20) to obtain the final feature representation of the target node in the cross-type meta-relationship path. Finally, cross-category aggregation is performed according to formula (21) and formula (22) to obtain the final embedding representation of each target node. The final embedding representation is the node embedding matrix. Step 3.3: Continuously update and back-propagate model parameters according to formula (23); Step 3.4: Determine the user node embedding matrix and the movie node embedding matrix respectively according to formula (22), compare the similarity between each node in the user node embedding matrix and the movie node embedding matrix; sort the similarity values in descending order, select the movies corresponding to the first M similarity values to generate a personalized movie recommendation list. At this time, the movie recommendation list contains the movies that best match the user's preferences.
Citation Information
Patent Citations
Movie recommendation method integrating heterogeneous information network and deep learning
CN110598130A