An interpretable recommendation method based on subgraph reasoning

By using a subgraph-based reasoning-based interpretable recommendation algorithm, which generates user subgraphs using heterogeneous graph neural networks and behavioral cloning loss function, the problem of insufficient recommendation performance and interpretability in existing technologies is solved, achieving higher recommendation accuracy and interpretability.

CN119129757BActive Publication Date: 2026-03-24SHANGHAI UNIVERSITY OF FINANCE AND ECONOMICS
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing knowledge graph-based interpretable recommendation algorithms struggle to balance recommendation performance and interpretability simultaneously; traditional methods either reduce performance or lack interpretability.

Method used

An interpretable recommendation algorithm based on subgraph reasoning is adopted. Node embeddings are extracted from the knowledge graph through a heterogeneous graph neural network to generate a subgraph centered on the user node. The behavior cloning loss function is used to guide the subgraph generation. Combining the subgraph encoder and the recommendation loss function, the recommendation score is calculated and the recommendation results and explanations are output.

Benefits of technology

It improves the accuracy and interpretability of the recommendation system, enabling it to capture user preferences and product characteristics more comprehensively and provide detailed explanations for recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119129757B_ABST
    Figure CN119129757B_ABST
Patent Text Reader

Abstract

The application discloses an interpretable recommendation algorithm based on subgraph reasoning, comprising the following steps: firstly, defining the interpretable recommendation problem based on a knowledge graph; then extracting the embedding of nodes from a heterogeneous knowledge graph for downstream tasks; extracting a user subgraph capable of representing user interest from the knowledge graph; setting a behavior cloning loss function to guide the generation of the user subgraph; setting a subgraph encoder to obtain the embedding capable of representing user interest from the subgraph; calculating a recommendation score to model the user interest and the product; setting a recommendation loss function to maximize the recommendation effect of the model; finally outputting a product set with the highest recommendation score and outputting the corresponding subgraph as a recommendation explanation. The application adopts the above-described interpretable recommendation algorithm based on subgraph reasoning, uses the subgraph structure to enhance the accuracy and interpretability of the recommendation system, and through modeling the mutual relationship between different paths in the subgraph, can more comprehensively capture user preferences and product characteristics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of recommendation algorithm technology, and in particular to an interpretable recommendation algorithm based on subgraph reasoning. Background Technology

[0002] In today's information-overloaded era, both individual users and modern businesses urgently need a tool to help them sift through massive amounts of information to find the content they need, thus highlighting the importance of recommendation systems. As a tool for solving information overload and identifying user preferences, recommendation systems are now widely used on various platforms such as e-commerce, social networks, and entertainment. They not only help users save time, reduce costs, and improve the quality of their experience, but also bring significant economic benefits to the platforms themselves. With the advancement of recommendation algorithms, businesses and users' expectations for recommendation systems are no longer limited to high accuracy; they also want to obtain the basis for product recommendations. Therefore, interpretable recommendation systems have emerged, capable of not only providing personalized recommendations but also offering users and businesses reasons for recommending a particular product.

[0003] Explainable recommendation algorithms based on knowledge graphs have become an important branch of interpretability research in recent years. These methods utilize the rich structured knowledge and semantic information in product and user knowledge graphs to model the interaction relationships between users and products, as well as the structural information of the product knowledge graph. These methods not only help recommendation systems gain a deeper understanding of user behavior but also effectively capture user preferences and product characteristics, thereby significantly improving the performance and interpretability of recommendation systems. Although knowledge graph-based explainable recommendation algorithms have achieved some success, current research still has significant shortcomings.

[0004] Existing knowledge graph-based interpretable recommendation algorithms often fail to simultaneously balance recommendation performance and interpretability. Currently, these algorithms are generally implemented in two ways: one enhances interpretability by adding a post-explanation module to the recommendation system; the other replaces the original high-performance but complex and interpretability-lacking model with a model that is structurally simple but has limited performance. The former cannot provide a true explanation of the algorithm's decision-making process, while the latter may reduce the overall performance of the recommendation. To address these issues and comprehensively improve recommendation accuracy and model interpretability, this invention proposes an interpretable recommendation algorithm based on subgraph reasoning. Summary of the Invention

[0005] The purpose of this invention is to provide an interpretable recommendation algorithm based on subgraph reasoning. By utilizing subgraphs in a knowledge graph to represent user preferences, and generating corresponding subgraphs during the recommendation process to explain the recommendation results, the algorithm can more comprehensively capture user preferences and product characteristics.

[0006] To achieve the above objectives, this invention provides an interpretable recommendation algorithm based on subgraph reasoning, comprising the following steps:

[0007] S1. Define the interpretable recommendation problem based on knowledge graphs and preprocess the data, including knowledge graphs, label representations, and dataset partitioning;

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

[0009] S3. Set up 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. Define the behavior cloning loss function to guide the generation of user subgraphs;

[0011] S5. Set the subgraph encoder to obtain embeddings that represent user interests from the subgraph;

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

[0013] S7. Set a recommendation loss function to maximize the model's recommendation performance;

[0014] S8. Output the set of products with the highest recommendation scores, and output the corresponding subgraph as a recommendation explanation.

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

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

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

[0018] S13. In the recommendation task scenario, the defined tag set is as follows: ,in It is the first in the dataset i Each user All are associated with a set of tags Contact, tag set and users All belong to V;

[0019] S14, Transfer the dataset The dataset is divided into training, validation, and test sets according to a set ratio.

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

[0021] S21. Use the node number as the initial input, and then use the embedding model to generate the embedding as the input to the graph neural network;

[0022] S22. Heterogeneous graph neural networks update node embeddings in two stages: edge encoding and neighbor edge aggregation. The characteristic of the first stage, edge encoding, is that different neural networks are used to encode edge information of different relation types. The edge encoding formula is as follows:

[0023] (1)

[0024] in, Representing relations Perceptor Different relationships It will correspond to different sensors. For nodes i In the embedding of the graph neural network at round t-1, Indicates will Matrix and Perform matrix concatenation;

[0025] S23. The characteristic of the second-stage neighbor edge aggregation is that it aggregates the edge embeddings obtained from the first-stage edge encoding, and updates the node embeddings with the aggregated neighbor edge information. The neighbor edge aggregation formula is as follows:

[0026] (2)

[0027] in Represents a node The set of neighboring nodes, Represents a node The number of neighboring nodes, in After the node representation is updated, the final node representation is obtained. Subgraph reasoning module used for the model.

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

[0029] S31. Adding subgraph nodes relies on calculating node attention scores. To calculate a node's attention score, the user node embedding must first be considered. The formula for calculating the attention score of an edge is as follows:

[0030]

[0031] (3)

[0032] in, Perceptron , Indicates will Matrix and Matrix concatenation This represents the center of the user subgraph, i.e., the user node. Indicates the first The user subgraph obtained in the round, Subgraph The leaf node is the first New nodes added to the subgraph during round-robin time;

[0033] S32, the first The attention scores of the nodes calculated in each round are used as the weights of the edges in the subgraph. Combined with the edge attention scores calculated in step S31, the attention scores of the nodes are calculated. Then, the M nodes with the highest scores are selected and added to the user subgraph. The formula for calculating the node attention score is as follows:

[0034] (4) (5)

[0035] in, These are triples that exist in the knowledge graph. Indicates in The set of neighboring nodes of a leaf node in a wheel graph. For the first wheel node The attention score is used to select a certain number of nodes to add to the user subgraph, forming the first subgraph. User subgraph of the wheel .

[0036] Preferably, step S4 is performed as follows:

[0037] conduct After updating the user subgraph, the final user subgraph is obtained. In the next round of recommendation decision-making, behavior cloning is used to guide subgraph generation. Specifically, a user behavior loss function based on knowledge graph is constructed to guide the calculation of edge attention values ​​in each round of subgraph generation. The specific formula is as follows:

[0038] (6).

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

[0040] In subgraph encoding, the different information implied in the relationships between different paths is modeled. The relationships between different paths in 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 the product 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 formulas are as follows:

[0041] (7)

[0042] in, Represents user subgraph The product nodes connected to the leaf nodes; Subgraph The set of partial subgraphs belonging to structure j, where j is one of structures a, b, and c; Indicates belonging to a set of partial subgraphs Partial subgraph The representation; For subgraph In and user nodes Distance is The set of nodes, With user nodes Distance is ; It is the perceptron of the subgraph structure j, and the perceptron acts as the content encoder for extracting the subgraph structure j.

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

[0044] After encoding the subgraphs, the matching score between product nodes and subgraphs is calculated. First, the matching score between each subgraph and product node is calculated, then multiplied by the subgraph's weight to obtain the importance of that subgraph in the user's interests. Finally, the matching scores of all subgraphs and product nodes are added together to obtain the final recommendation score. The specific formula is as follows:

[0045] (8)

[0046] (9)

[0047] Formula (9) calculates a partial subgraph. With product nodes The matching score; Representing a partial subgraph The distance between the middle and the user node is The set of nodes, here, product nodes. With user nodes Distance is The score calculated during the subgraph generation phase. The weight score of this subgraph is used in the matching score calculation, and the final model aggregates all subgraphs and product nodes. The matching score constitutes the product node. For user nodes Recommended score.

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

[0049] S71. Calculate the recommended loss function, as shown in the following formula:

[0050] (10)

[0051] in, Indicates user A collection of real products that I've interacted with. Indicates the size of the actual product set;

[0052] S72. Calculate the total model loss by combining the loss function of behavioral cloning:

[0053] (11).

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

[0055] The candidate product list for each user is sorted based on the recommendation score. Then, the K products with the highest scores are selected, and the corresponding subgraphs used to calculate the recommendation scores are output as explanations for the corresponding products.

[0056] Therefore, the present invention employs the above-mentioned interpretable recommendation algorithm based on subgraph reasoning, which has the following advantages compared with the prior art:

[0057] (1) This invention provides a more comprehensive interpretable recommendation method based on knowledge graph subgraph structure. This method aims to enhance the accuracy and interpretability of the recommendation system by replacing the traditional path structure with the subgraph structure.

[0058] (2) In this invention, the subgraph structure can provide richer data information, and by modeling the relationship between different paths in the subgraph, the recommendation algorithm can more comprehensively capture user preferences and product characteristics.

[0059] (3) The subgraph-based knowledge graph interpretable recommendation algorithm designed in this invention uses subgraphs in the knowledge graph to represent user preferences and generates corresponding subgraphs to explain the recommendation results during the recommendation process. Specifically, the algorithm consists of two main parts: representation learning and subgraph reasoning. In the representation learning stage, the model uses a heterogeneous graph neural network to learn the representation of nodes using the structural information and node relationship information of the knowledge graph. In the subgraph reasoning stage, the algorithm uses an attention mechanism to select nodes related to user preferences, constructs a subgraph that reflects user preferences, and excludes noisy nodes that are irrelevant to user preferences.

[0060] (4) This invention extracts subgraphs related to the target product from the user subgraph, then designs different subgraph structures, mines the relationships between different paths within the subgraphs, and models the user subgraphs using these subgraph structures to form a series of pattern subgraphs. Finally, the recommendation score between the target product and the user is calculated based on these pattern subgraphs.

[0061] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0062] Figure 1 This is a flowchart of an interpretable recommendation algorithm based on subgraph reasoning, according to an embodiment of the present invention.

[0063] Figure 2 This is a subgraph structure category graph of an interpretable recommendation algorithm based on subgraph reasoning according to an embodiment of the present invention;

[0064] Figure 3 This is a schematic diagram of the overall model architecture of an interpretable recommendation algorithm based on subgraph reasoning according to the present invention, where a represents knowledge graph representation learning and b represents the subgraph reasoning process. Detailed Implementation

[0065] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.

[0066] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.

[0067] This implementation example uses the Beauty dataset from the publicly available Amazon review dataset as an example, employing the interpretable recommendation algorithm based on subgraph reasoning of this invention. The Amazon review dataset comes from the open dataset of the Amazon e-commerce platform and contains a large amount of user review information and product information. The knowledge graph formed by the Beauty dataset is a heterogeneous graph with 16 types of relations, and the dataset contains 22,363 users, 12,101 products, and 224,080 entities.

[0068] like Figure 1 As shown, a specific implementation of an interpretable recommendation algorithm based on subgraph reasoning on the Beauty dataset includes the following steps:

[0069] S1. Define the interpretable recommendation problem based on knowledge graphs and preprocess the data, including knowledge graphs, label representations, and dataset partitioning. Specifically, this includes the following steps:

[0070] S11. Obtain the recommendation task dataset, perform data cleaning and preprocessing, and construct and initialize the recommendation knowledge graph.

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

[0072] The Beauty dataset contains eight relationships: user purchase of products, user review keywords, keyword description of products, brand production of products, products belonging to a certain category, products being purchased simultaneously, clicking on one product while also clicking on another, and purchasing one product while also purchasing another. In addition, reverse relationships were added to consider more comprehensive information, resulting in a total of 16 relationships.

[0073] S13. In the recommendation task scenario, the defined tag set is as follows: ,in It is the first in the dataset i Each user All are associated with a set of tags Contact, tag set and users All belong to V.

[0074] S14, Transfer the dataset The dataset is divided into training, validation, and test sets in a 6:1:3 ratio.

[0075] S2. Configure a heterogeneous graph neural network to extract node embeddings from the heterogeneous knowledge graph in an end-to-end manner for downstream tasks. This includes the following steps:

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

[0077] S22. Heterogeneous graph neural networks update node embeddings in two stages: edge encoding and neighbor edge aggregation. The characteristic of the first stage, edge encoding, is that different neural networks are used to encode edge information of different relation types. The edge encoding formula of this model is as follows:

[0078] (1)

[0079] in, Representing relations Perceptor Different relationships It will correspond to different sensors. For nodes i In the embedding of the graph neural network at round t-1, Indicates will Matrix and Matrix concatenation involves piecing together matrices, with each relation having its corresponding perceptron, the aim of which is to extract the information implied by different relations.

[0080] S23. The characteristic of the second-stage neighbor edge aggregation is that it aggregates the edge embeddings obtained from the first-stage edge encoding, and updates the node embeddings with the aggregated neighbor edge information. The neighbor edge aggregation formula of this model is as follows:

[0081] (2)

[0082] in Represents a node The set of neighboring nodes, Represents a node The number of neighboring nodes, in After each round of node representation updates, the final node representation will be obtained. Subgraph reasoning module used for the model.

[0083] S3. Set up a subgraph generation model centered on user nodes. By calculating the graph attention dispersion of nodes, extract user subgraphs that can represent user interests from the knowledge graph. In this example, a three-layer user subgraph will be formed, that is, the farthest distance between a node in the subgraph and the user is 2. The specific steps include:

[0084] S31. The initial subgraph has only one node, the user node. The subgraph will undergo multiple rounds of expansion. In this example, there will be two rounds of subgraph expansion, with a certain number of new nodes added in each round. In this example, the number of new nodes added in each round is set to 60. The addition of subgraph nodes relies on the calculated node attention score. To calculate the node attention score, the user node embedding must first be considered. The formula for calculating the edge attention score is as follows:

[0085]

[0086] (3)

[0087] in, Perceptron , Indicates will Matrix and Matrix concatenation This represents the center of the user subgraph, i.e., the user node. Indicates the first The user subgraph obtained in the round, Subgraph The leaf node is the first The newly added nodes in the subgraph during the cycle; this formula is the first... The formula for calculating the attention value of the adjacent edges in the subgraph of the wheel, that is, the formula responsible for calculating the attention value of the adjacent edges in the subgraph. New nodes added in round In knowledge graph Middle adjacent side Attention value.

[0088] S32, the first The attention scores of the nodes calculated in each round are used as the weights of the edges in the subgraph. Combined with the edge attention scores calculated in step S31, the attention scores of the nodes are calculated. Then, the M nodes with the highest scores (M=60) are selected and added to the user subgraph. The formula for calculating the node attention score is as follows:

[0089] (4)

[0090] (5)

[0091] in, These are triples that exist in the knowledge graph. Indicates in The set of neighboring nodes of a leaf node in a wheel graph. For the first wheel node Based on the attention score, the model will select a certain number of nodes to add to the user subgraph, forming the first subgraph. User subgraph of the wheel .

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

[0093] conduct =After two rounds of user subgraph updates, the final user subgraph is obtained. In the next round of recommendation decision-making, it is worth noting that since the model inference process is divided into two parts—multi-round subgraph generation and recommendation decision-making—the loss of traditional recommendation cannot directly guide subgraph generation. Therefore, this invention uses behavior cloning to guide subgraph generation. Specifically, a user behavior loss function based on knowledge graphs is constructed to guide the calculation of edge attention values ​​in each round of subgraph generation. The specific formula is as follows:

[0094] (6).

[0095] S5. Set up a subgraph encoder to obtain embeddings that represent user interests from the subgraph. The specific process is as follows:

[0096] In subgraph encoding, to preserve the hierarchical structure and inter-node distance information of the subgraph, this invention models the different information implied in the relationships between different paths. This is because the relationships between different paths in a subgraph actually represent different subgraph structures, such as... Figure 2 As shown, this invention designs three subgraph structures to extract structural information from the subgraphs. Structure a focuses on the depth of user interests, structure b focuses on the matching degree between the product and user interests, and structure c focuses on the diversity of user interests. This invention segments the user subgraph according to these three structures and then encodes them separately. The specific formulas are as follows:

[0097] (7)

[0098] in, Represents user subgraph The product nodes connected to the leaf nodes; Subgraph The set of partial subgraphs belonging to structure j, where j is one of structures a, b, and c; Indicates belonging to a set of partial subgraphs Partial subgraph The representation; For subgraph In and user nodes Distance is The set of nodes, With user nodes Distance is ; It is the perceptron of the subgraph structure j, and the perceptron acts as the content encoder for extracting the subgraph structure j.

[0099] S6. Calculate the recommendation score. Based on the idea of ​​collaborative filtering, model the relationship between user interests and products. The specific process is as follows:

[0100] After encoding the subgraphs, the next step is to calculate the matching score between the product nodes and the subgraphs. First, calculate the matching score between each subgraph and the product node, then multiply it by the weight of the subgraph to obtain the importance of this part of the subgraph in the user's interests. Finally, add the matching scores of each part of the subgraphs to obtain the final recommendation score. The specific formula is as follows:

[0101] (8)

[0102] (9)

[0103] Formula (9) calculates a partial subgraph. With product nodes The matching score; Representing a partial subgraph The distance between the middle and the user node is The set of nodes, here, product nodes. With user nodes Distance is The score calculated during the subgraph generation phase. The weight score of this subgraph is used in the matching score calculation, and the final model aggregates all subgraphs and product nodes. The matching score constitutes the product node. For user nodes Recommended score.

[0104] S7. Set the recommendation loss function to maximize the model's recommendation performance, which includes the following steps:

[0105] S71. Calculate the recommended loss function, as shown in the following formula:

[0106] (10)

[0107] in, Indicates user A collection of real products that I've interacted with. This indicates the size of the actual product set.

[0108] S72. Calculate the total model loss by combining the loss function of behavioral cloning:

[0109] (11).

[0110] S8. Select and output the set of products with the highest recommendation scores, 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:

[0111] The model sorts each user's candidate product list based on the recommendation score, then selects the K (K=5) products with the highest scores, and outputs the corresponding subgraphs when calculating the recommendation scores as an explanation of the corresponding products.

[0112] S9. Training set: Train the model and fit it to historical data; Validation set: Test the model and select the optimal model; Test set: Test the model and evaluate its performance.

[0113] S91. Set the 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.

[0114] S92. Execute the model based on the validation set, without training but only recording the model results, and select the best-performing model from each round of training as the final model.

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

[0116] Table 1 compares the test results of the benchmark model.

[0117] In Table 1, the underlined values ​​represent the maximum values ​​of the baseline model in that column, and the bolded values ​​represent the maximum values ​​of all models in that column. As can be seen from Table 1, the method provided by this invention is the best in all four indicators of the tested model performance. Moreover, the method provided by this invention is on average 7% higher than the maximum values ​​of the baseline model in all four indicators, with the accuracy being 10% higher than the maximum values ​​of the baseline model. This demonstrates the recommendation performance advantage of the method provided by this invention compared to the baseline model.

[0118] Therefore, this invention employs the aforementioned interpretable recommendation algorithm based on subgraph reasoning. First, it uses a subgraph structure to replace the traditional path structure to enhance the accuracy and interpretability of the recommendation system. Then, by modeling the relationships between different paths within the subgraph, the recommendation algorithm can more comprehensively capture user preferences and product characteristics. Furthermore, in the subgraph reasoning stage, the algorithm uses an attention mechanism to select nodes related to user preferences, constructing a subgraph that reflects user preferences while eliminating noisy nodes that are irrelevant to user preferences.

[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.

Claims

1. An interpretable recommendation method based on subgraph reasoning, characterized in that, Includes the following steps: S1. Define the interpretable recommendation problem based on knowledge graphs and preprocess the user and product data of e-commerce platforms, including knowledge graphs, tag representations and dataset partitioning; S2. Set up a heterogeneous graph neural network and extract node embeddings from the heterogeneous knowledge graph in an end-to-end manner for downstream tasks. S3. Set up 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. Define the behavior cloning loss function to guide the generation of user subgraphs; S5. Set the subgraph encoder to obtain embeddings that represent user interests from the subgraph; S6. Calculate the recommendation score, and model the relationship between user interests and products based on the idea of ​​collaborative filtering; S7. Set a recommendation loss function to maximize the model's recommendation performance; S8. Output the set of products with the highest recommendation scores, and output the corresponding subgraph as a recommendation explanation; Step S3 specifically includes the following steps: S31. Adding subgraph nodes relies on calculating node attention scores. To calculate a node's attention score, the user node embedding must first be considered. The formula for calculating the attention score of an edge is as follows: (3) in, Perceptron , Indicates will Matrix and Matrix concatenation This represents the center of the user subgraph, i.e., the user node. Indicates the first The user subgraph obtained in the round, Subgraph The leaf node is the first New nodes added to the subgraph during round-robin time; S32, the first The attention scores of the nodes calculated in each round are used as the weights of the edges in the subgraph. Combined with the edge attention scores calculated in step S31, the attention scores of the nodes are calculated. Then, the M nodes with the highest scores are selected and added to the user subgraph. The formula for calculating the node attention score is as follows: (4) (5) in, These are triples that exist in the knowledge graph. Indicates in The set of neighboring nodes of a leaf node in a wheel graph. For the first wheel node The attention score is used to select a certain number of nodes to add to the user subgraph, forming the first subgraph. User subgraph of the wheel ; The specific process of step S6 is as follows: After encoding the subgraphs, the matching score between product nodes and subgraphs is calculated. First, the matching score between each subgraph and product node is calculated, then multiplied by the subgraph's weight to obtain the importance of that subgraph in the user's interests. Finally, the matching scores of all subgraphs and product nodes are added together to obtain the final recommendation score. The specific formula is as follows: (8) (9) Formula (9) calculates a partial subgraph. With product nodes The matching score; Representing a partial subgraph The distance between the middle and the user node is The set of nodes, here, product nodes. With user nodes Distance is The score calculated during the subgraph generation phase. The weight score of this subgraph is used in the matching score calculation, and the final model aggregates all subgraphs and product nodes. The matching score constitutes the product node. For user nodes Recommended score.

2. The interpretable recommendation method based on subgraph reasoning according to claim 1, characterized in that, Step S1 specifically includes the following steps: S11. Obtain the recommendation task dataset, perform data cleaning and preprocessing, and construct and initialize the recommendation knowledge graph. S12. Given a knowledge graph G=(V,E,R), where V is the set of nodes in G, E is the set of edges in G, and R is the set of relations in G, nodes represent entities in the data, edges represent the connections between entities, and relations represent the specific relationship between two entities within an edge. S13. In the recommendation task scenario, the defined tag set is as follows: ,in It is the first in the dataset i Each user All are associated with a set of tags Contact, tag set and users All belong to V; S14, Transfer the dataset The dataset is divided into training, validation, and test sets according to a set ratio.

3. The interpretable recommendation method based on subgraph reasoning according to claim 2, characterized in that, Step S2 specifically includes the following steps: S21. Use the node number as the initial input, and then use the embedding model to generate the embedding as the input to the graph neural network; S22. Heterogeneous graph neural networks update node embeddings in two stages: edge encoding and neighbor edge aggregation. The characteristic of the first stage, edge encoding, is that different neural networks are used to encode edge information of different relation types. The edge encoding formula is as follows: (1) in, Representing relations Perceptor Different relationships It will correspond to different sensors. For nodes i In the embedding of the graph neural network at round t-1, Indicates will Matrix and Perform matrix concatenation; S23. The characteristic of the second-stage neighbor edge aggregation is that it aggregates the edge embeddings obtained from the first-stage edge encoding, and updates the node embeddings with the aggregated neighbor edge information. The neighbor edge aggregation formula is as follows: (2) in Represents a node The set of neighboring nodes, Represents a node The number of neighboring nodes, in After the node representation is updated, the final node representation is obtained. Subgraph reasoning module used for the model.

4. The interpretable recommendation method based on subgraph reasoning according to claim 3, characterized in that, The specific process of step S4 is as follows: conduct After updating the user subgraph, the final user subgraph is obtained. In the next round of recommendation decision-making, behavior cloning is used to guide subgraph generation. Specifically, a user behavior loss function based on knowledge graph is constructed to guide the calculation of edge attention values ​​in each round of subgraph generation. The specific formula is as follows: (6)。 5. The interpretable recommendation method based on subgraph reasoning according to claim 4, characterized in that, The specific process of step S5 is as follows: In subgraph encoding, the different information implied in the relationships between different paths is modeled. The relationships between different paths in 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 the product 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 formulas are as follows: (7) in, Represents user subgraph The product nodes connected to the leaf nodes; Subgraph The set of partial subgraphs belonging to structure j, where j is one of structures a, b, and c; Indicates belonging to a set of partial subgraphs Partial subgraph The representation; For subgraph In and user nodes Distance is The set of nodes, With user nodes Distance is ; It is the perceptron of the subgraph structure j, and the perceptron acts as the content encoder for extracting the subgraph structure j.

6. The interpretable recommendation method based on subgraph reasoning according to claim 5, characterized in that, Step S7 specifically includes the following steps: S71. Calculate the recommended loss function, as shown in the following formula: (10) in, Indicates user A collection of real products that I've interacted with. Indicates the size of the actual product set; S72. Calculate the total model loss by combining the loss function of behavioral cloning: (11)。 7. The interpretable recommendation method based on subgraph reasoning according to claim 6, 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. Then, the K products with the highest scores are selected, and the corresponding subgraphs used to calculate the recommendation scores are output as explanations for the corresponding products.