Subgraph reasoning-based interpretable recommendation algorithm

Through an interpretable recommendation algorithm based on sub-graph inference, using heterogeneous graph neural network and sub-graph structure, the problem of difficult to take into account in the existing technology's recommendation performance and interpretation ability is achieved, and higher recommendation accuracy and interpretability are achieved. Capture user preferences and product characteristics more comprehensively through sub-graph structure.

CN119129757AActive Publication Date: 2024-12-13SHANGHAI UNIVERSITY OF FINANCE AND ECONOMICS

Patent Information

Application Number
CN202411107438.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2024-12-13
Estimated Expiration
2044-08-13

AI Technical Summary

Technical Problem

Existing interpretable recommendation algorithms based on knowledge graphs are difficult to take into account both recommendation performance and interpretation capabilities. Traditional methods either add interpretation modules to sacrifice performance, or adopt strong performance but lack interpretation models.

Method used

Using an interpretable recommendation algorithm based on sub-graph inference, extract node embedding from the knowledge graph through heterogeneous graph neural network, generate user sub-graphs, and use sub-graph structure and attention mechanism to build user interest models, calculate recommendation scores and output corresponding Sub-pictures are used as explanation.

Benefits of technology

It improves the accuracy and interpretability of the recommendation system, and more comprehensively captures user preferences and product characteristics through the sub-graph structure, providing richer data information and interpretation capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119129757A_ABST
    Figure CN119129757A_ABST
Patent Text Reader

Abstract

The invention discloses an interpretable recommendation algorithm based on subgraph reasoning, and the algorithm comprises the following steps: firstly, defining an interpretable recommendation problem based on a knowledge graph; then extracting embedding of nodes from the heterogeneous knowledge graph for downstream tasks; extracting a user sub-graph capable of representing user interests from the knowledge graph; setting a behavior clone loss function to guide the generation of a user sub-graph; setting a sub-graph encoder, and obtaining an embedding capable of representing the interest of the user from the sub-graph; calculating recommendation scores, and modeling user interests and products; a recommendation loss function is set, and the recommendation effect of the model is maximized; and finally, outputting a product set with the highest recommendation score, and outputting a corresponding sub-graph as a recommendation explanation. According to the interpretable recommendation algorithm based on subgraph reasoning, the accuracy and interpretability of a recommendation system are enhanced by utilizing a subgraph structure, and user preferences and product characteristics can be captured more comprehensively by modeling the mutual relation between different paths in the subgraph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of recommendation algorithms, and in particular to an explainable recommendation algorithm based on subgraph reasoning. Background Art

[0002] In today's era of information explosion, both individual users and modern enterprises are in urgent need of a tool to help them filter out the required content from a large amount of information, and recommendation systems have therefore received attention. As a tool to solve information overload and identify user preferences, recommendation systems have been widely used in multiple platforms such as e-commerce, social networks, and entertainment. They not only help users save time, save costs, and improve the quality of experience, but also bring significant economic benefits to the platform itself. With the advancement of recommendation algorithms, the expectations of enterprises and users for recommendation systems are no longer limited to high accuracy. They also hope to obtain the basis for product recommendations. Therefore, explainable recommendation systems came into being, which are not only capable of providing personalized recommendations, but also capable of providing users and enterprises with reasons for recommending a certain product.

[0003] In recent years, interpretable recommendation algorithms based on knowledge graphs have become an important branch in the field of interpretability research. This type of method uses the rich structured knowledge and semantic information in product and user knowledge graphs to model the interaction between users and products and the structural information of product knowledge graphs. This type of method not only helps the recommendation system to deeply understand user behavior, but also effectively captures user preferences and product characteristics, thereby significantly improving the performance and explanation ability of the recommendation system. Although interpretable recommendation algorithms based on knowledge graphs have achieved certain results, there are still obvious deficiencies in current related research.

[0004] Existing interpretable recommendation algorithms based on knowledge graphs often fail to take into account both recommendation performance and explanation capabilities. Currently, the implementation methods of such algorithms can be roughly divided into two categories: one is to enhance the explainability by adding a post-explanation module to the recommendation system; the other is to use a model with strong explanation ability but simple structure and limited performance to replace the original model with high performance but complex structure and lack of explainability. The former cannot provide a true explanation of the algorithm decision-making process, while the latter may reduce the overall performance of the recommendation. In order to solve the above problems and comprehensively improve the recommendation accuracy and model explainability, the present invention proposes an interpretable recommendation algorithm based on subgraph reasoning. Summary of the invention

[0005] The purpose of this invention is to provide an explainable recommendation algorithm based on subgraph reasoning, which expresses user preferences by utilizing subgraphs in knowledge graphs and generates corresponding subgraphs in the recommendation process to explain the recommendation results, thereby more comprehensively capturing user preferences and product characteristics.

[0006] To achieve the above object, the present invention provides an explainable recommendation algorithm based on subgraph reasoning, comprising the following steps:

[0007] S1. Define the problem of explainable recommendation based on knowledge graph and preprocess the data, including knowledge graph, label representation and data set division;

[0008] S2. Set up a heterogeneous graph neural network to extract node embeddings from heterogeneous knowledge graphs for downstream tasks in an end-to-end manner;

[0009] S3. Set a subgraph generation model centered on user nodes, and extract user subgraphs that can represent user interests from the knowledge graph by calculating the graph attention dispersion of nodes;

[0010] S4, setting the behavior cloning loss function to guide the generation of user subgraphs;

[0011] S5, setting a sub-graph encoder to obtain an embedding that can represent the user's interest from the sub-graph;

[0012] S6. Calculate the recommendation score and model the user interests and products based on the idea of ​​collaborative filtering;

[0013] S7. Set the recommendation loss function to maximize the recommendation effect of the model;

[0014] S8. Output the product set with the highest recommendation score and the corresponding subgraph as the recommendation explanation.

[0015] Preferably, step S1 specifically includes the following steps:

[0016] S11. Obtain the recommendation task data set, perform data cleaning and preprocessing, and construct and initialize the recommendation knowledge graph;

[0017] S12. Given a knowledge graph G = (V, E, R), V is the set of nodes in G, E is the set of edges in G, and R is the set of relationships in G. Nodes represent entities in the data, edges represent the connections between entities, and relationships represent the specific relationship between two entities in the edge.

[0018] S13. In the scenario of recommendation tasks, the defined label set is D = {(U1, Y1), (U2, Y2), (U3, Y3), …, (U n ,Y n )}, where U i is the i-th user in the data set, and each user U i All with a label set Y i Contact, label set Y i and user U i All belong to V;

[0019] S14. Divide the dataset D into a training set, a validation set, and a test set in proportion.

[0020] Preferably, step S2 specifically includes the following steps:

[0021] S21, taking the node number as the initial input, and then using the embedding model to generate embedding as the input of the graph neural network;

[0022] S22. Heterogeneous graph neural network updates node embedding in two stages, namely edge coding and neighbor edge aggregation. The characteristic of the first stage edge coding is that different neural networks are used to encode the information of edges of different relationship types. The edge coding formula is as follows:

[0023]

[0024] in, Represents the relationship x Perceptron Different relationships x will correspond to different perceptrons, is the embedding of node i in the t-1th round of the graph neural network, Indicates that Matrix and Matrix does matrix stitching;

[0025] S23. The characteristic of the second stage of neighbor edge aggregation is to aggregate the edge embedding obtained from the first stage of edge encoding, aggregate the neighbor edge information to update the node embedding, and the neighbor edge aggregation formula is as follows:

[0026]

[0027] Among them, N(v h ) represents node v h The neighbor node set, |N(v h )| represents node v h The number of neighbor nodes in After the round node representation is updated, the final node representation is obtained Subgraph reasoning module for the model.

[0028] Preferably, step S3 specifically includes the following steps:

[0029] S31. The subgraph nodes are newly added based on the calculated node attention score. To calculate the node attention score, we first need to combine the user node embedding. The formula for calculating the edge attention score is as follows:

[0030]

[0031] Among them, β represents the perceptron MLP, Indicates that Matrix and Matrix concatenation, v u represents the center of the user subgraph, i.e., the user node. represents the user subgraph obtained in round t-1, Representing a subgraph The leaf nodes are the nodes newly added to the subgraph in the t-1th round;

[0032] S32: The attention score of the node calculated in the t-1th round is used as the weight of the edge in the subgraph, and combined with the edge attention score calculated in step S31, the attention score of the node is calculated, and then the M nodes with the highest scores are selected to be added to the user subgraph. The node attention score calculation formula is as follows:

[0033]

[0034] in, is the triple existing in the knowledge graph, Represents the set of neighbor nodes of the leaf node in the t-1 wheel graph. The tth round node v j Attention scores are obtained, and a certain number of nodes are selected based on the scores to be added to the user subgraph to form the user subgraph of round t

[0035] Preferably, the specific process of step S4 is as follows:

[0036] After T rounds of user subgraph updates, the final user subgraph is obtained In the next round of recommendation decision-making tasks, the behavior cloning method is used to guide the subgraph generation. Specifically, a user behavior loss function based on the knowledge graph is constructed to guide the calculation of the edge attention value in each round of subgraph generation. The specific formula is as follows:

[0037]

[0038] Preferably, the specific process of step S5 is as follows:

[0039] In subgraph encoding, different information contained in the relationship between different paths is modeled. Different relationships between paths on a subgraph actually represent different subgraph structures. Three subgraph structures are designed to extract the structural information of the subgraph. Structure a focuses on the depth of user interests, structure b focuses on the matching degree between products and user interests, and structure c focuses on the diversity of user interests. The user subgraph is cut according to these three structures and then encoded separately. The specific formula is as follows:

[0040]

[0041] Among them, vi Representation and User Subgraph Product nodes connected to leaf nodes; Representing a subgraph The set of partial subgraphs belonging to structure j in , where j is one of structures a, b and c; Indicates that it belongs to a partial subgraph set Partial subgraph of Representation of; For subgraph and user node v u The set of nodes with a distance of l, v i With user node v u The distance is T+1; ψ j is the perceptron of subgraph structure j, and the perceptron serves as the content encoder for extracting subgraph structure j.

[0042] Preferably, the specific process of step S6 is as follows:

[0043] After encoding the subgraph, the matching scores between the product node and the subgraph are calculated. First, the matching scores between each subgraph and the product node are calculated, and then multiplied by the weight of the subgraph to obtain the importance of this part of the subgraph in the user's interest. Finally, the matching scores between each part of the subgraph and the product node are added to obtain the final recommendation score. The specific formula is as follows:

[0044]

[0045] Among them, formula (9) calculates the partial subgraph With product node v i The matching score of Represents a partial subgraph The node set with a distance T from the user node in the product node v i With user node v u The distance is T+1; the score calculated in the subgraph generation phase As the weight score of this part of the subgraph in the subgraph, it participates in the matching score calculation. The final model aggregates all the partial subgraphs and product nodes v i The matching score of the product node v i For user node v u Recommendation score.

[0046] Preferably, step S7 specifically includes the following steps:

[0047] S71. Calculate the recommended loss function. The formula is as follows:

[0048]

[0049] Among them, Y(u) represents the set of real products that user u has interacted with, and |Y(u)| represents the size of the real product set;

[0050] S72. Combine the loss function of behavioral cloning and calculate the total loss of the model:

[0051] Loss u =Loss2 u +Loss1 u (11).

[0052] Preferably, the specific process of step S8 is as follows:

[0053] The candidate product list for each user is sorted based on the recommendation score, and then the K products with the highest scores are selected. The corresponding subgraph when calculating the recommendation score is output as an explanation of the corresponding product.

[0054] Therefore, the present invention adopts the above-mentioned explainable recommendation algorithm based on subgraph reasoning, which has the following beneficial effects compared with the prior art:

[0055] (1) The present invention provides a more comprehensive explainable recommendation method based on the knowledge graph subgraph structure, which aims to enhance the accuracy and explainability of the recommendation system by replacing the traditional path structure with the subgraph structure.

[0056] (2) The subgraph structure in the present invention can provide richer data information, and by modeling the relationships between different paths within the subgraph, the recommendation algorithm can more comprehensively capture user preferences and product characteristics.

[0057] (3) The subgraph-based knowledge graph explainable recommendation algorithm designed by the present invention uses subgraphs in the knowledge graph to represent user preferences, and generates corresponding subgraphs in the recommendation process to explain the recommendation results. Specifically, the algorithm is divided into two main parts: representation learning and subgraph reasoning. In the representation learning stage, the model uses the structural information and node relationship information of the knowledge graph through a heterogeneous graph neural network to learn the representation of nodes. In the subgraph reasoning stage, the algorithm uses the attention mechanism to select nodes related to user preferences, construct a subgraph that can reflect user preferences, and exclude noise nodes that are irrelevant to user preferences.

[0058] (4) The present invention extracts subgraphs related to the target product from the user subgraph, then designs different subgraph structures to mine the relationships between different paths within the subgraph. Through these subgraph structures, the algorithm models the user subgraph to form a series of pattern subgraphs. Finally, the recommendation scores between the target product and the user are calculated based on these pattern subgraphs.

[0059] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] Figure 1 It is a flow chart of an explainable recommendation algorithm based on subgraph reasoning of an embodiment of an explainable recommendation algorithm based on subgraph reasoning of the present invention;

[0061] Figure 2 It is a subgraph structure category diagram of an embodiment of an explainable recommendation algorithm based on subgraph reasoning of the present invention;

[0062] Figure 3 It is a schematic diagram of the overall model architecture of an explainable recommendation algorithm embodiment based on subgraph reasoning of the present invention, wherein a represents knowledge graph representation learning, and b represents the subgraph reasoning process. DETAILED DESCRIPTION

[0063] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.

[0064] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.

[0065] This implementation case takes the Beauty dataset in the public Amazon review dataset as an example, and adopts the explainable recommendation algorithm based on subgraph reasoning of the present invention. The Amazon review dataset comes from the open dataset of the Amazon e-commerce platform, with a large amount of user review information and product information. The knowledge graph composed of the Beauty dataset is a heterogeneous graph with 16 types of relationships, and the dataset has 22,363 users, 12,101 products and 224,080 entities.

[0066] like Figure 1 As shown in the figure, a subgraph reasoning-based explainable recommendation algorithm is specifically implemented on the Beauty dataset, including the following steps:

[0067] S1. Define the problem of explainable recommendation based on knowledge graph and preprocess the data, including knowledge graph, label representation and data set division. Specifically, the following steps are included:

[0068] S11. Obtain the recommendation task data set, perform data cleaning and preprocessing, and build and initialize the recommendation knowledge graph.

[0069] S12. Given a knowledge graph G = (V, E, R), V is the node set in G, E is the edge set in G, and R is the relationship set in G. Nodes represent entities in the data, edges represent the connections between entities, and relationships represent the specific relationship between the two entities in the edge.

[0070] In the Beauty dataset, there are 8 types of relationships, including users purchasing products, user comment keywords, keyword descriptions of products, brands producing products, products belonging to a certain category, products and products being purchased at the same time, clicking on a certain product while also clicking on another product, and purchasing a certain product while also purchasing another product. In order to consider more comprehensive information, reverse relationships are also added, that is, there are a total of 16 types of relationships.

[0071] S13. In the scenario of recommendation tasks, the defined label set is D = {(U1, Y1), (U2, Y2), (U3, Y3), …, (U n ,Y n )}, where U i is the i-th user in the data set, and each user U i All with a label set Y i Contact, label set Y i and user U i All belong to V.

[0072] S14. Divide the dataset D into a training set, a validation set, and a test set in a ratio of 6:1:3.

[0073] S2. Set up a heterogeneous graph neural network to extract node embeddings from heterogeneous knowledge graphs for downstream tasks in an end-to-end manner, specifically including the following steps:

[0074] S21. This model takes the node number as the initial input, and then uses the embedding model to generate embedding as the input of the graph neural network;

[0075] S22. Heterogeneous graph neural network updates node embedding in two stages, namely edge coding and neighbor edge aggregation. The characteristic of the first stage edge coding is that different neural networks are used to encode the information of edges of different relationship types. The edge coding formula of this model is as follows:

[0076]

[0077] in, Represents the relationship x Perceptron Different relationships x will correspond to different perceptrons, is the embedding of node i in the t-1th round of the graph neural network, Indicates that Matrix and Matrix-to-matrix concatenation, each relationship has its corresponding perceptron, the purpose is to extract the information implied by different relationships.

[0078] S23. The characteristic of the second stage of neighbor edge aggregation is to aggregate the edge embedding obtained from the edge encoding in the first stage, aggregate the neighbor edge information to update the node embedding. The neighbor edge aggregation formula of this model is as follows:

[0079]

[0080] Among them, N(v h ) represents node v h The neighbor node set, |N(v h )| represents node v h The number of neighbor nodes in After the round node representation is updated, the final node representation will be obtained Subgraph reasoning module for the model.

[0081] S3. Set a subgraph generation model centered on user nodes, extract user subgraphs that can represent user interests from the knowledge graph by calculating the graph attention dispersion of nodes. In this example, a three-layer user subgraph will be formed, that is, the farthest distance between the node in the subgraph and the user is 2. Specifically, the following steps are included:

[0082] S31, the initial subgraph has only one node, namely the user node. The subgraph will undergo multiple rounds of expansion. In this example, two rounds of subgraph expansion will be performed, and a certain number of nodes will be added in each round. In this example, the number of newly added nodes in each round is set to 60. The addition of subgraph nodes depends on the calculated node attention score. To calculate the node attention score, it is first necessary to combine the user node embedding. The formula for calculating the edge attention score is as follows:

[0083]

[0084] Among them, β represents the perceptron MLP, Indicates that Matrix and Matrix concatenation, v u represents the center of the user subgraph, i.e., the user node. represents the user subgraph obtained in round t-1, Representing a subgraph The leaf node is the node added to the subgraph in the t-1th round; this formula is the calculation formula for the neighboring edge attention value of the subgraph in the tth round, which is responsible for calculating the newly added node v in the t-1th round h In the knowledge graph g, the adjacent edge (v h ,r,v d )’s attention value.

[0085] S32, taking the attention score of the node calculated in the t-1th round as the weight of the edge in the subgraph, and combining it with the edge attention score calculated in step S31, calculate the attention score of the node, and then select the M (M=60) nodes with the highest scores to add to the user subgraph. The node attention score calculation formula is as follows:

[0086]

[0087] in, is the triple existing in the knowledge graph, Represents the set of neighbor nodes of the leaf node in the t-1 wheel graph. The tth round node v j The model will select a certain number of nodes based on the attention score and add them to the user subgraph to form the user subgraph of round t.

[0088] S4. Set the behavior cloning loss function to guide the generation of user subgraphs. The specific process is as follows:

[0089] After T = 2 rounds of user subgraph updates, the final user subgraph is obtained In the next round of recommendation decision task, it is worth noting that since the model reasoning process is divided into two parts: multi-round sub-graph generation and recommendation decision, the traditional recommendation loss cannot directly guide the sub-graph generation. Therefore, the present invention uses the behavior cloning method to guide the sub-graph generation. Specifically, a user behavior loss function based on the knowledge graph is constructed to guide the calculation of the edge attention value in each round of sub-graph generation. The specific formula is as follows:

[0090]

[0091] S5. Set the sub-graph encoder to obtain the embedding that can represent the user's interest from the sub-graph. The specific process is as follows:

[0092] In subgraph encoding, in order to preserve the hierarchical structure of the subgraph and the distance information between nodes, the present invention models the different information contained in the relationship between different paths, because different relationships between paths on the subgraph actually represent different subgraph structures, such as Figure 2 As shown, the present invention designs three subgraph structures for the purpose of extracting structural information of subgraphs. Structure a focuses on the depth of user interests, structure b focuses on the matching degree between products and user interests, and structure c focuses on the diversity of user interests. The present invention cuts the user subgraph according to these three structures and then encodes them respectively. The specific formulas are as follows:

[0093]

[0094] Among them, v i Representation and User Subgraph Product nodes connected to leaf nodes; Representing a subgraph The set of partial subgraphs belonging to structure j in , where j is one of structures a, b and c; Indicates that it belongs to a partial subgraph set Partial subgraph of Representation of; For subgraph and user node v u The set of nodes with a distance of l, v i With user node v u The distance is T+1; ψ j is the perceptron of subgraph structure j, and the perceptron serves as the content encoder for extracting subgraph structure j.

[0095] S6. Calculate the recommendation score and model the user interests and products based on the idea of ​​collaborative filtering. The specific process is as follows:

[0096] After encoding the subgraph, the next step is to calculate the matching score between the product node and the subgraph. First, the matching score between each subgraph and the product node is calculated, and then multiplied by the weight of the subgraph to obtain the importance of this part of the subgraph in the user's interest. Finally, the matching scores of each part of the subgraph and the product node are added together to obtain the final recommendation score. The specific formula is as follows:

[0097]

[0098] Among them, formula (9) calculates the partial subgraph With product node v i The matching score of Represents a partial subgraph The node set with a distance T from the user node in the product node v i With user node v u The distance is T+1; the score calculated in the subgraph generation phase As the weight score of this part of the subgraph in the subgraph, it participates in the matching score calculation. The final model aggregates all the partial subgraphs and product nodes v i The matching score of the product node v i For user node v u Recommendation score.

[0099] S7. Set the recommendation loss function to maximize the recommendation effect of the model, which specifically includes the following steps:

[0100] S71. Calculate the recommended loss function. The formula is as follows:

[0101]

[0102] Among them, Y(u) represents the set of real products that user u has interacted with, and |Y(u)|| represents the size of the real product set.

[0103] S72. Combine the loss function of behavioral cloning and calculate the total loss of the model:

[0104] Loss u =Loss2 u +Loss1 u (11).

[0105] S8. Select and output the product set with the highest recommendation score, and output the corresponding subgraph as the recommendation explanation. In this example, the size of the product set is selected as 5. The specific process is as follows:

[0106] The model will sort the candidate product list for each user based on the recommendation score, then select the K (K=5) products with the highest scores, and output the corresponding subgraph when calculating the recommendation score as an explanation of the corresponding product.

[0107] S9, training set training model, fitting historical data; validation set testing model, selecting the best model; test set testing model, testing model performance:

[0108] S91. Set Batch Size to 128, repeat steps 1 to 7 to calculate the model loss and gradient, and then update the trainable parameters of the model.

[0109] S92. Execute the model based on the validation set. Do not perform training but only record the model results. Select the model with the best performance from each round of training as the final model.

[0110] S93. Execute the optimal model based on the test set and record the model test results as shown in Table 1:

[0111] Table 1 Test results of the benchmark model for comparison

[0112]

[0113] In Table 1, the underlined values ​​are the maximum values ​​of the baseline model in the same column, and the bold values ​​are the maximum values ​​of the whole model in the same column. It can be seen from Table 1 that the method provided by the present invention is the best in the four indicators of the test model effect, and the method provided by the present invention is 7% higher than the maximum value of the baseline model in the four indicators on average, and the accuracy is 10% higher than the maximum value of the baseline model. This reflects the recommendation performance advantage of the method provided by the present invention compared with the baseline model.

[0114] Therefore, the present invention adopts the above-mentioned explainable recommendation algorithm based on subgraph reasoning. First, the subgraph structure is used to replace the traditional path structure to enhance the accuracy and interpretability of the recommendation system; then, by modeling the relationship between different paths in the subgraph, the recommendation algorithm can more comprehensively capture user preferences and product characteristics; and in the subgraph reasoning stage, the algorithm uses the attention mechanism to select nodes related to user preferences, constructs a subgraph that can reflect user preferences, and excludes noise nodes that are irrelevant to user preferences.

[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.

Claims

1. An explainable recommendation algorithm based on subgraph reasoning, characterized in that: The following steps are involved: S1. Define the problem of explainable recommendation based on knowledge graph and preprocess the data, including knowledge graph, label representation and data set division; S2. Set up a heterogeneous graph neural network to extract node embeddings from heterogeneous knowledge graphs for downstream tasks in an end-to-end manner; S3. Set a subgraph generation model centered on user nodes, and extract user subgraphs that can represent user interests from the knowledge graph by calculating the graph attention dispersion of nodes; S4, setting the behavior cloning loss function to guide the generation of user subgraphs; S5, setting a sub-graph encoder to obtain an embedding that can represent the user's interest from the sub-graph; S6. Calculate the recommendation score and model the user interests and products based on the idea of ​​collaborative filtering; S7. Set the recommendation loss function to maximize the recommendation effect of the model; S8. Output the product set with the highest recommendation score and the corresponding subgraph as the recommendation explanation.

2. The explainable recommendation algorithm based on subgraph reasoning according to claim 1, characterized in that: Step S1 specifically includes the following steps: S11. Obtain the recommendation task data set, perform data cleaning and preprocessing, and construct and initialize the recommendation knowledge graph; S12. Given a knowledge graph G = (V, E, R), V is the set of nodes in G, E is the set of edges in G, and R is the set of relationships in G. Nodes represent entities in the data, edges represent the connections between entities, and relationships represent the specific relationship between two entities in the edge. S13. In the scenario of recommendation tasks, the defined label set is D = {(U1, Y1), (U2, Y2), (U3, Y3), …, (U n ,Y n )}, where U i is the i-th user in the data set, and each user U i All with a label set Y i Contact, label set Y i and user U i All belong to V; S14. Divide the dataset D into a training set, a validation set, and a test set in proportion.

3. The explainable recommendation algorithm based on subgraph reasoning according to claim 2, characterized in that: Step S2 specifically includes the following steps: S21, taking the node number as the initial input, and then using the embedding model to generate embedding as the input of the graph neural network; S22. Heterogeneous graph neural network updates node embedding in two stages, namely edge coding and neighbor edge aggregation. The characteristic of the first stage edge coding is that different neural networks are used to encode the information of edges of different relationship types. The edge coding formula is as follows: in, Represents the relationship x Perceptron Different relationships x will correspond to different perceptrons, is the embedding of node i in the t-1th round of the graph neural network, Indicates that Matrix and Matrix does matrix stitching; S23. The characteristic of the second stage of neighbor edge aggregation is to aggregate the edge embedding obtained from the first stage of edge encoding, aggregate the neighbor edge information to update the node embedding, and the neighbor edge aggregation formula is as follows: Among them, N(v h ) represents node v h The neighbor node set, |N(v h )| represents node v h The number of neighbor nodes in After the round node representation is updated, the final node representation is obtained Subgraph reasoning module for models.

4. The explainable recommendation algorithm based on subgraph reasoning according to claim 3 is characterized in that: Step S3 specifically includes the following steps: S31. The subgraph nodes are newly added based on the calculated node attention score. To calculate the node attention score, we first need to combine the user node embedding. The formula for calculating the edge attention score is as follows: Among them, β represents the perceptron MLP, Indicates that Matrix and Matrix concatenation, v u represents the center of the user subgraph, i.e., the user node. represents the user subgraph obtained in round t-1, Representing a subgraph The leaf nodes are the nodes newly added to the subgraph in the t-1th round; S32: The attention score of the node calculated in the t-1th round is used as the weight of the edge in the subgraph, and combined with the edge attention score calculated in step S31, the attention score of the node is calculated, and then the M nodes with the highest scores are selected to be added to the user subgraph. The node attention score calculation formula is as follows: in, is the triple existing in the knowledge graph, Represents the set of neighbor nodes of the leaf node in the t-1 wheel graph. The tth round node v j Attention scores are obtained, and a certain number of nodes are selected based on the scores to be added to the user subgraph to form the user subgraph of round t 5. The explainable recommendation algorithm based on subgraph reasoning according to claim 4 is characterized in that: The specific process of step S4 is as follows: After T rounds of user subgraph updates, the final user subgraph is obtained In the next round of recommendation decision-making tasks, the behavior cloning method is used to guide the subgraph generation. Specifically, a user behavior loss function based on the knowledge graph is constructed to guide the calculation of the edge attention value in each round of subgraph generation. The specific formula is as follows:

6. The explainable recommendation algorithm based on subgraph reasoning according to claim 5, characterized in that: The specific process of step S5 is as follows: In subgraph encoding, different information contained in the relationship between different paths is modeled. Different relationships between paths on a subgraph actually represent different subgraph structures. Three subgraph structures are designed to extract the structural information of the subgraph. Structure a focuses on the depth of user interests, structure b focuses on the matching degree between products and user interests, and structure c focuses on the diversity of user interests. The user subgraph is cut according to these three structures and then encoded separately. The specific formula is as follows: Among them, v i Representation and User Subgraph Product nodes connected to leaf nodes; Representing a subgraph The set of partial subgraphs belonging to structure j in , where j is one of structures a, b and c; Indicates that it belongs to a partial subgraph set Partial subgraph of Representation of; For subgraph and user node v u The set of nodes with a distance of l, v i With user node v u The distance is T+1; ψ j is the perceptron of subgraph structure j, and the perceptron serves as the content encoder for extracting subgraph structure j.

7. The explainable recommendation algorithm based on subgraph reasoning according to claim 6, characterized in that: The specific process of step S6 is as follows: After encoding the subgraph, the matching scores between the product node and the subgraph are calculated. First, the matching scores between each subgraph and the product node are calculated, and then multiplied by the weight of the subgraph to obtain the importance of this part of the subgraph in the user's interest. Finally, the matching scores between each part of the subgraph and the product node are added to obtain the final recommendation score. The specific formula is as follows: Among them, formula (9) calculates the partial subgraph With product node v i The matching score of Represents a partial subgraph The node set with a distance T from the user node in the product node v i With user node v u The distance is T+1; the score calculated in the subgraph generation phase As the weight score of this part of the subgraph in the subgraph, it participates in the matching score calculation. The final model aggregates all the partial subgraphs and product nodes v i The matching score of the product node v i For user node v u Recommendation score.

8. The explainable recommendation algorithm based on subgraph reasoning according to claim 7, characterized in that: Step S7 specifically includes the following steps: S71. Calculate the recommended loss function. The formula is as follows: Where Y(u) represents the set of real products that user u has interacted with, and |Y(u)|| represents the size of the real product set; S72. Combine the loss function of behavioral cloning and calculate the total loss of the model: Loss u =Loss2 u +Loss1 u (11)。 9. The explainable recommendation algorithm based on subgraph reasoning according to claim 8, characterized in that: The specific process of step S8 is as follows: The candidate product list for each user is sorted based on the recommendation score, and then the K products with the highest scores are selected. The corresponding subgraph when calculating the recommendation score is output as an explanation of the corresponding product.

Citation Information

Patent Citations

  • Recommendation method and system based on multi-level comparative learning and multi-modal knowledge graph

    CN116091152A

  • Multi-view self-supervised learning recommendation method for heterogeneous information network

    CN117743685A

  • Knowledge graph rule learning method and system based on graph structure

    CN118193756A

  • Personalized comment recommendation method based on link prediction model of graph bidirectional aggregation network

    US20230185865A1

Cited By

  • Intensified reasoning interpretable recommendation method based on anti-fact path enhancement and evaluation method thereof

    CN119886365A

  • Distributed co-purchase recommendation method based on graph pattern matching

    CN122066499A