Explanatable recommendation method based on causal enhancement graph comparative learning
By using the method of causal enhanced graph contrastive learning in the recommendation system, causal features and confounding features are separated, and backdoor adjustment is implemented through contrastive learning, which solves the problem that the existing recommendation system is affected by confounding factors when processing user-item-interpretation triples. problem, improving the generalization and recommendation accuracy of the model.
Patent Information
- Application Number
- CN202411383053.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-21
AI Technical Summary
When processing user-item-interpretation triples, existing recommendation systems are susceptible to confounding factors, resulting in low generalization performance of the model and difficulty in effectively removing the influence of unobservable confounding factors.
It proposes an explanatory recommendation method (CGCLER) based on causal enhanced map comparison learning. By separating causality characteristics and mixed features at the level of the graph node, and using comparison learning to achieve backdoor adjustment, reducing the impact of mixed factor.
Effectively use causality characteristics to combine the combined sorting of users, items, and interpretation, reduce the interference of mixed factor, and improve the generalization and recommendation accuracy of the model.
Smart Images

Figure CN119338017A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of recommendation systems, and in particular to an explainable recommendation method based on causal enhancement graph contrast learning. Background Art
[0002] As one of the most effective tools for dealing with information overload, the recommendation system can effectively filter out information that meets user needs. It has been widely used on social networking sites, e-commerce and other platforms, and has become an indispensable part of people's daily life. At the same time, with the continuous deepening of research on recommendation systems, more and more works have begun to focus on explainable recommendations, aiming to generate user-understandable explanations while recommending items to users. Explainable recommendations can be divided into two types: model-aware and model-agnostic. The former refers to a recommendation model in which the model itself is explainable, and the recommendation model can also provide recommendation explanations while generating recommended items. The latter refers to a specially designed explanation model to generate explanations for specific recommended items. The sources and forms of explanations are varied, such as feature-based, path-based, sentence-based, and aspect-based. This makes it difficult to compare even model-agnostic explainable recommendation models. In recent years, explainable recommendations have received a lot of attention from academia and industry, and have become one of the research hotspots in the recommendation field. There are many styles of explanations for recommendations, including visual highlighting, item neighbors, knowledge graph paths, word clouds, item features, predefined templates, automatically generated text, and retrieved text. However, the explanations in these works are only incidental products of their recommendation models, and the explanations are in different forms, lacking quantitative indicators to measure the quality of explanations. Recently, Li et al. formalized the explanation generation task into a ranking task similar to the item recommendation task by collecting the most frequently occurring sentences from user comments to construct an explanation set. When generating explanations for a specific recommended item, it is only necessary to sort the sentences in the explanation set, and the top K sentences will be presented to the user as explanations. Under this paradigm, commonly used indicators for evaluating recommendation performance, such as NDCG and Recall, can also be used to evaluate the explanation ability of the explanation model, that is, the higher the Recall and NDCG of the explanation list presented to the item, the better the explanation performance of the explanation model. The extracted explanations and the related users and items form a (user, item, explanation) triple, and item recommendation and explanation generation form a joint learning problem. Chen et al. use pairwise interaction tensor factorization (PITF) to learn from the user-item-explanation cube. Li et al. decomposed the (user, item, explanation) triple relationship into two binary relationships (user, explanation) and (item, explanation) to alleviate the problem of high data sparsity, and used a pre-trained language model to explore the semantic relationship between explanations. At the same time, they defined an item-explanation joint ranking task, that is, designing an explanation model that can not only rank items to make recommendations, but also rank the explanations in the explanation set given the user and item, so as to generate an explanation for recommending an item to the user, such as Figure 1 shown.
[0003] Existing research work on recommender systems formalizes explainable recommendations as an item-explanation joint ranking task. Graph neural networks, with their powerful representation learning capabilities, can well support the modeling of user-item-explanation triplets. Graph Neural Networks (GNNs) have shown excellent performance in many fields such as rumor detection, social networks, and knowledge graph completion, mainly due to GNN's powerful representation learning ability, which can encode the topology of the graph into node representations in an end-to-end manner. In collaborative filtering, since user-item interactions can be naturally represented as a bipartite graph, GNN-based recommendations have attracted widespread attention from researchers. In order to capture the collaborative signals between users and items, Wang et al. first designed a GNN-based recommendation model, namely Neural Graph Collaborative Filtering (NGCF), which showed excellent ability in capturing correlations. He et al. found that NGCF only utilized ID information, and some complex components in graph convolutional neural networks, such as nonlinear activation functions, did not contribute to the model performance. Therefore, He et al. proposed the Simplifying and Powering Graph Convolution Network for Recommendation (LightGCN) model, which removed these invalid components and improved efficiency and effectiveness. In addition, some studies have mined attributes and labels from user reviews as explanations to form a heterogeneous graph of ternary data of users, items, and explanations. That is, when applying graph neural networks to model user-item-explanation triples, users, items, and explanations are designed as nodes in the graph, and user-item-explanation triples that describe the interaction relationship between the three are represented as edges in the graph. By explicitly modeling high-order synergistic effects through stacking graph convolutional layers, the explainable recommendation algorithm based on graph neural networks shows excellent performance. In order to deal with ternary data, Liu et al. proposed an attribute-aware attentive graph convolutional network model for attribute missing in recommendation (An Attribute-aware Attentive GCN Model for Attribute Missing in Recommendation, A 2-GCN), which aggregates multiple types of information through the attention mechanism and effectively captures the connection information between users, items and attributes. Chen et al. proposed TGCN, which aggregates nodes in heterogeneous graphs by performing node-level and type-level graph convolution operations. In order to avoid the negative transfer problem in multi-task joint learning, Wei et al. decomposed the user-item-explanation heterogeneous graph into three isomorphic graphs to learn task-oriented node representations, effectively alleviating the conflict between item recommendation and explanation ranking tasks, thereby achieving better performance in interpretable recommendation. However, none of the above works considers the possible confounding factors in the graph data, such as the popularity of the product, which leads to suboptimal model performance. Since these models ignore causal relationships when designing, they are easily misled by many confounding factors, and there are a large number of observable or unobservable confounding factors in the graph data, which makes the model learn false correlations, resulting in low generalization performance of the model. For example, the user's mood and product popularity when making a purchase decision interfere with model learning as confounding factors, causing the model to prioritize those popular products instead of recommending products that truly meet the user's preferences, thereby causing the user to make decisions that deviate from his or her interests. Graph neural network models are affected by these confounding factors, resulting in unstable or inaccurate modeling of user, item, and explanation collaborative relationships.
[0004] More and more studies have shown that causal inference is beneficial to various machine learning tasks because it can give models the ability to pursue true causal relationships. Researchers in the recommendation field have proposed various methods to use causal inference theory to reduce the impact of confounding factors to improve recommendation accuracy and interpretability. For example, Zhang et al. regarded product popularity as a confounding factor between items and user clicks, and eliminated the confounding effect of product popularity through causal intervention through backdoor adjustment. He et al. regarded video length as a confounding factor between items and user clicks, and used the Mixture of Experts (MoE) architecture to efficiently implement backdoor adjustment to implement causal intervention, so that the system can more accurately recommend videos that match user preferences. In order to eliminate the confounding effect caused by unobservable confounding factors, Xu et al. used the invariant characteristics of items as mediating variables between items and user behaviors that are not interfered by confounding factors, and used the front-door adjustment method to reduce the confounding effect of confounding factors. Zhu et al. used user click behavior as a mediating variable between item features and user purchase behavior that is not interfered by confounding factors, and used the front-door adjustment rule to reduce the confounding effect of confounding factors. Although these works have achieved certain success, there are many confounding factors in real data, and the deconfounding method that only targets one confounding factor cannot improve the generalization of the model in most cases. In some cases, the confounding factor is even an unobservable hidden variable, such as the quality of the product and the mood of the user when browsing the system. At present, some works have proposed deconfounding methods based on front-door adjustment to deal with the problem of unobservable confounding factors, but this requires finding an intermediary variable that is not interfered by the confounding factors, and it is difficult to find an intermediary variable that meets this condition in the item-explanation joint sorting task. Summary of the invention
[0005] In view of the above-mentioned shortcomings of the prior art, the present invention processes various confounding factors in a unified manner, realizes backdoor adjustment through causal intervention based on contrastive learning, and proposes an explainable recommendation method based on causal enhanced graph contrastive learning (Causality-enhanced Graph Contrastive Learning for Explainable Recommendation, CGCLER), which does not need to find intermediary variables with harsh conditions or model different confounding factors one by one, and aims to provide explanations that are in line with user preferences and item characteristics when accurately recommending items to users.
[0006] The present invention proposes an explainable recommendation method based on causal enhanced graph contrastive learning, which comprises the following steps:
[0007] Step 1: Collect user data, item data, and explanation data, and construct several user-item-explanation triples (u, i, a), where u represents the user; i represents the item; and a represents the explanation;
[0008] Step 2: Build an explainable recommendation model based on causal enhanced graph contrastive learning;
[0009] Step 3: Input the user-item-explanation triple (u, i, a) into the interpretable recommendation model based on causal enhanced graph contrastive learning and train the model to obtain a trained interpretable recommendation model based on causal enhanced graph contrastive learning;
[0010] Step 4: Get any set of user data, item data and explanation data and input them into the trained interpretable recommendation model based on causal enhanced graph contrastive learning to obtain the user's item recommendation results and recommendation explanations;
[0011] The explainable recommendation model based on causal enhanced graph contrastive learning includes: a graph construction module, a node representation module, a backdoor adjustment module based on contrastive learning, and a recommendation and explanation prediction module;
[0012] The graph construction module is used to construct a heterogeneous graph according to the input user-item-explanation triples, and divide the constructed heterogeneous graph into a user-item interaction subgraph, a user-explanation interaction subgraph, and an item-explanation interaction subgraph, and then transmit the divided three subgraphs to the node representation module;
[0013] The node representation module is used to receive three subgraphs and construct the 0th layer embedding matrices of the three subgraphs respectively, use the soft mask module to extract the causal features and the mixed features of the 0th layer embedding matrix of each subgraph respectively, and then use the lightweight graph convolution LightGCNConv to perform node embedding on the extracted initial causal feature embedding matrix and the initial mixed feature embedding matrix respectively, to obtain the causal feature embedding matrix and the mixed feature embedding matrix of each subgraph, and divide each subgraph into a causal feature subgraph and a mixed feature subgraph, and transmit all the obtained causal feature subgraphs and mixed feature subgraphs to the backdoor adjustment module and the explanation prediction module based on contrastive learning;
[0014] The backdoor adjustment module based on contrastive learning is used to calculate the predicted score and the explained predicted score of the item according to all causal feature subgraphs, and construct a Bayesian personalized ranking BPR loss function; it is used to calculate the confounding factor impact score and the explained confounding factor impact score of the item according to all confounding feature subgraphs, and to learn the loss function of the confounding factor impact based on contrastive learning;
[0015] The recommendation and explanation prediction module is used to update the node embeddings of all causal feature subgraphs and mixed feature subgraphs using a random addition strategy, and to construct a backdoor loss function based on contrastive learning;
[0016] The step 3 further comprises:
[0017] Step 3.1: Input the user-item-explanation triple (u, i, a) into the interpretable recommendation model based on causal enhanced graph contrastive learning, construct a heterogeneous graph G based on the user-item-explanation triple, and divide the heterogeneous graph G into user-item interaction subgraphs G ui , user and explanation interaction subgraph G ua , and the interaction subgraph G between items and explanations ia ;
[0018] Step 3.2: Build G separately ui The 0th layer embedding matrix G ua The 0th layer embedding matrix and G ia The 0th layer embedding matrix Use the soft mask module to and To extract causal features and mixed features, the lightweight graph convolution LightGCNConv is used to embed nodes in the extracted initial causal feature embedding matrix and the initial mixed feature embedding matrix respectively, and G ui , G ua and G ia Divided into G ui The causal feature subgraph of G ui The mixed feature subgraph of G ua The causal feature subgraph of G ua The mixed feature subgraph of G ia The causal feature subgraph of and G ia The mixed feature subgraph of
[0019] Step 3.3: Using G ui The causal feature subgraph of G ua The causal feature subgraph of and G ia The causal feature subgraph of Calculate the prediction score of the item and the prediction score of the explanation respectively, and use the prediction score of the explanation and the prediction score of the item to construct the Bayesian personalized ranking BPR loss function;
[0020] Step 3.4: Using G ui The mixed feature subgraph of G ua The mixed feature subgraph of and G iaThe mixed feature subgraph of Calculate the confounding factor impact score and the explained confounding factor impact score of the item respectively, and use the confounding factor impact score and the explained confounding factor impact score of the item to construct a loss function based on contrastive learning of confounding factor impact;
[0021] Step 3.5: Update using random addition strategy and Node embedding in , and constructing a backdoor loss function based on contrastive learning;
[0022] Step 3.6: Use the Bayesian personalized ranking BPR loss function, the loss function based on the influence of the contrastive learning confounding factor, and the backdoor loss function based on contrastive learning to construct the loss function based on causal enhancement graph contrastive learning, and obtain the trained interpretable recommendation model based on causal enhancement graph contrastive learning by minimizing the loss function based on causal enhancement graph contrastive learning;
[0023] The step 3.1 further comprises:
[0024] Step 3.1.1: Take the user data of the user-item-explanation triple as the user node v u , take the item data as the item node v i , interpret the data as the interpretation node v a , and construct a node set V;
[0025] Step 3.1.2: Use the relationship between the user and the item in the user-item-explanation triple as an edge connecting the user node and the item node <v u ,v i >, the relationship between the user and the explanation in the user-item-explanation triple is used as the edge connecting the user node and the explanation node <v u ,v a >, the relationship between the item and the explanation in the user-item-explanation triple is used as the edge connecting the item node and the explanation node <v i ,v a >, and construct the adjacency matrix A;
[0026] Step 3.1.3: Use the node set V and the adjacency matrix A to construct a heterogeneous graph G, and divide the heterogeneous graph G into user-item interaction subgraphs G ui , user and explanation interaction subgraph G ua , and the interaction subgraph G between items and explanations ia ; where G = {A, V}, and Represents a matrix whose number of rows and columns are the number of nodes in the node set V;
[0027] Step 3.1.4: Obtain the user's preference for explanations and the matching degree between items and explanations, and extract fine-grained information from the user's preference for explanations and the matching degree between items and explanations as the number of co-occurrences between users or items and explanations, and then use the number of co-occurrences between users or items and explanations to calculate G ui , G ua and G ia The edge weights in G are constructed separately ui , G ua and G ia The edge weight matrix of
[0028] The step 3.2 further comprises:
[0029] Step 3.2.1: Construct G using random initialization ui The initial embedding matrix G ua The initial embedding matrix and G ia The initial embedding matrix of
[0030] Step 3.2.2: Using G ua The initial embedding matrix and G ia The initial embedding matrix update G ui The initial embedding matrix G ui The 0th layer embedding matrix Using G ui The initial embedding matrix and G ia The initial embedding matrix update G ua The initial embedding matrix G ua The 0th layer embedding matrix Using G ui The initial embedding matrix and G ua The initial embedding matrix update G ia The initial embedding matrix G ia The 0th layer embedding matrix
[0031] Step 3.2.3: Use lightweight graph convolution LightGCNConv to perform ui The 0th layer embedding matrix G ua The 0th layer embedding matrix and G ia The 0th layer embedding matrix Perform R-layer node embedding and obtain G after each layer of node embedding ui , G ua and G ia The embedding matrix of
[0032] Step 3.2.4: Determine the soft mask module and based on Gui The 0th layer embedding matrix G ua The 0th layer embedding matrix and G ia The 0th layer embedding matrix Get the causal feature soft mask M c and the mixed feature mask M o , using M c Get G respectively ui The initial causal feature embedding matrix G ua The initial causal feature embedding matrix and G ia The initial causal feature embedding matrix Using M o Get G respectively ui The initial confounding feature embedding matrix G ua The initial confounding feature embedding matrix and G ia The initial confounding feature embedding matrix
[0033] Step 3.2.5: Use lightweight graph convolution LightGCNConv to perform ui The initial causal feature embedding matrix G ua The initial causal feature embedding matrix G ia The initial causal feature embedding matrix G ui The initial confounding feature embedding matrix G ua The initial confounding feature embedding matrix and G ia The initial confounding feature embedding matrix Perform node embedding and get G ui The causal feature embedding matrix G ua The causal feature embedding matrix G ia The causal feature embedding matrix G ui The hybrid feature embedding matrix G ua The hybrid feature embedding matrix and G ia The hybrid feature embedding matrix
[0034] Step 3.2.6: According to G ui The causal feature embedding matrix and G ui The hybrid feature embedding matrix G ui Divided into G ui The causal feature subgraph of and G ui The mixed feature subgraph of Among them A ui Represents G ui The adjacency matrix of G ua The causal feature embedding matrix and G ua The hybrid feature embedding matrix G ua Divided into G ua The causal feature subgraph of and G ua The mixed feature subgraph of Among them A ua Represents G ua The adjacency matrix of G ia The causal feature embedding matrix and G ia The hybrid feature embedding matrix G ia Divided into G ia The causal feature subgraph of and G ia The mixed feature subgraph of Among them A ia Represents G ia The adjacency matrix of
[0035] The node embedding method described in step 3.2.3 is: for G ui , G ua , G ia For any node p in any subgraph in the , get the 0th-level node embedding of node p from the 0th-level embedding matrix of the subgraph And use lightweight graph convolution LightGCNConv to embed the 0th layer node of node p Carry out R-layer node embedding in sequence, then update the node embedding of any layer of node p as follows:
[0036]
[0037] in represents the k+1th layer node embedding of node p; represents the k-th node embedding of node p, and k∈{0,1,...,R}; represents the set of neighbor nodes of node p; q represents any neighbor node of node p; d p is the weighted degree of node p; d q is the weighted degree of node q; Apq represents the initial embedding of node p and node q;
[0038] The average value of all layer node embeddings except the 0th layer node embedding is taken as the node embedding of node p after R layer node embedding, expressed as:
[0039]
[0040] where e p represents the node embedding of node p;
[0041] For G ui , G ua , G ia For any subgraph in , the updating method of the embedding matrix of the subgraph is expressed as:
[0042]
[0043] Where X (k+1) represents the k+1th layer embedding matrix of the subgraph; LightGCNConv(·) means that LightGCNConv is used for node embedding; X (k) represents the k-th level embedding matrix of the subgraph, and N is the number of nodes, d is the embedding dimension; D is a diagonal matrix, and the elements D pp is the weighted degree of node p;
[0044] The step 3.3 further comprises:
[0045] Step 3.3.1: For any given user, Get Causal feature embedding of user nodes and Causal feature embedding of item nodes And calculate the prediction score of item i;
[0046] Step 3.3.2: For any given user and item, Get Causal feature embedding of user nodes and Causal feature embedding of explanation nodes from Get Causal feature embedding of item nodes and Causal feature embedding of explanation nodes and calculate the prediction score of the explanation;
[0047] Step 3.3.3: Use the predicted scores of explanations and items to construct the Bayesian personalized ranking BPR loss function;
[0048] The BPR loss function is:
[0049]
[0050] in represents the BPR loss function; I u represents the set of all items that have an interactive relationship with user u; j represents any item that does not have an interactive relationship with user u; σ(·) represents the sigmoid function; represents the predicted score of item i; represents the predicted score of item j for a given user u; E ui represents the set of explanations that user u has a correlation when interacting with item i; m represents any explanation that user u has a correlation when interacting with item i; n represents any explanation that user u has no correlation when interacting with item i; represents the predicted score of explanation m for a given user u and item i; represents the predicted score of explanation n for a given user u and item i;
[0051] The step 3.4 further comprises:
[0052] Step 3.4.1: For any given user, Get User node hybrid feature embedding and Item node hybrid feature embedding And calculate the confounding factor impact score of item i;
[0053] Step 3.4.2: For any given user and item, Get User node hybrid feature embedding and Explanation of node hybrid feature embedding from Get Item node hybrid feature embedding and Explanation of node hybrid feature embedding and calculate explained confounder impact scores;
[0054] Step 3.4.3: Use the confounding factor impact score of the item and the explained confounding factor impact score to construct a loss function based on contrastive learning of confounding factor impact;
[0055] The loss function based on the influence of the confounding factor of contrastive learning is:
[0056]
[0057] in represents the loss function based on the influence of the confounding factor of contrastive learning; Indicates that for a given user u, the confounding factor of item j affects the score; Indicates that for a given user u and item i, the confounding factor of explanation m affects the score; Indicates that for a given user u and item i, explain the impact of n confounding factors on the score;
[0058] The method for constructing the backdoor loss function based on contrastive learning described in step 3.5 is:
[0059]
[0060] where z i ′ and z i ″ are all node embeddings updated by random addition strategy; j′ and j″ are numbers randomly generated by random number generator in (0,N), that is, j′, j″∈(0,N), and j′ and j″ are used as node representations; Represents any causal feature subgraph containing item nodes The updated node embedding of item i; is any mixed feature subgraph containing item nodes The node embedding of node j′ after the update; represents the backdoor loss function based on contrastive learning; τ is the temperature coefficient; ||·|| represents the norm of the vector;
[0061] The loss function based on causal enhancement graph contrast learning described in step 3.6 is:
[0062]
[0063] in represents the loss function based on causal enhanced graph contrastive learning; λ1 is a hyperparameter used to control the strength of separation of causal features and confounding features; λ2 is a hyperparameter used to control the strength of causal intervention; λ3 is a hyperparameter used to control the strength of L2 regularization; θ represents an updateable parameter in the model.
[0064] The beneficial effects of adopting the above technical solution are:
[0065] (1) In the task of joint item-explanation ranking, various confounding factors will eventually be encoded into the representation of the node. The method of the present invention innovatively proposes a decongestion method CGCLER based on causal enhanced graph contrastive learning. By separating causal features from non-causal features at the representation level of graph nodes, where causal features represent useful information for the correct prediction of the model, and non-causal features represent useless information that interferes with the correct prediction of the model, and based on the learned causal features, users, items, and explanations are modeled, and joint ranking decisions of items and explanations are made. Causal features can be effectively used to accurately rank items and explanations according to user preferences.
[0066] (2) In order to further reduce the interference of the confounding effect of the confounding factors in the graph on the graph learning process, the method of the present invention proposes a new graph contrast learning method, which randomly combines causal features and confounding features, that is, non-causal features, for contrast learning to achieve backdoor adjustment, and implements the criterion of backdoor adjustment through causal intervention, so that CGCLER can make more accurate joint sorting decisions based on causal relationships. In addition, by ensuring that the predictions made by the model based on the confounding features are as consistent as possible, the useful information correctly predicted by the model is attributed to the causal features to the greatest extent, and the useless information correctly predicted by the model is attributed to the confounding features to the greatest extent. This is conducive to CGCLER learning a stable relationship between labels and causal features, making causal features more robust to the interference of confounding factors, and better distinguishing causal features from confounding features. It is also conducive to CGCLER distinguishing causal features from confounding features at the node representation level. By distinguishing causal features from non-causal features in the nodes learned from the graph model and applying implicit causal intervention, the confounding effect of confounding factors is effectively reduced, without the need to find mediating variables, and the generalization of the model is improved.
[0067] (3) The method of the present invention conducted a large number of experiments on three open source datasets to comprehensively analyze the performance of CGCLER. The results of the ablation experiment also proved that the principle of backdoor adjustment through comparative learning can help CGCLER better capture the collaborative semantics between users, items, and explanations, confirming the effectiveness of CGCLER. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Figure 1 A simple example diagram for the joint item-explanation ranking task in an explainable recommender system.
[0069] Figure 2 is a flow chart of an explainable recommendation method based on causal enhanced graph contrast learning in this embodiment;
[0070] Figure 3 Schematic diagram of an interpretable recommendation model based on causal enhanced graph contrastive learning in this embodiment;
[0071] Figure 4 Learning a causal graph for the graph of the item-explanation joint ranking task in this embodiment;
[0072] Figure 5 Schematic diagram of the impact of loss function coefficients λ1 and λ2 on the performance of CGCLER in this implementation; Figure (a) is a schematic diagram of the impact of loss function coefficient λ1 on the performance of CGCLER in the AmazonMTV dataset; Figure (b) is a schematic diagram of the impact of loss function coefficient λ2 on the performance of CGCLER in the AmazonMTV dataset; Figure (c) is a schematic diagram of the impact of loss function coefficient λ1 on the performance of CGCLER in the Yelp dataset; Figure (d) is a schematic diagram of the impact of loss function coefficient λ2 on the performance of CGCLER in the Yelp dataset. DETAILED DESCRIPTION
[0073] In order to facilitate the understanding of the present application, the specific embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and embodiments. The following embodiments are used to illustrate the present invention, but are not intended to limit the scope of the present invention. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thoroughly understood.
[0074] In this embodiment, an explainable recommendation method based on causal enhanced graph contrastive learning is provided. Figure 2 As shown, the method comprises the following steps:
[0075] Step 1: Collect user data, item data, and explanation data, and construct several user-item-explanation triplets (u, i, a), where u represents the user; i represents the item; and a represents the explanation.
[0076] In this embodiment, a crawler is used to obtain user information as user data, hotel information as item data, and comment data as explanation data from the Ctrip hotel platform, and a number of user-item-explanation triplets are constructed based on the relationship between user information, hotel information, and comment data.
[0077] Step 2: Build an explainable recommendation model based on causal enhanced graph contrastive learning;
[0078] The explainable recommendation model based on causal enhanced graph contrastive learning includes: a graph construction module, a node representation module, a backdoor adjustment module based on contrastive learning, and a recommendation and explanation prediction module.
[0079] In this embodiment, if Figure 3As shown in the figure, an explainable recommendation model based on causal enhanced graph contrastive learning is constructed. The model mainly consists of four modules: graph construction module, node representation module, backdoor adjustment module based on contrastive learning, and recommendation and explanation prediction module.
[0080] The graph construction module is used to construct a heterogeneous graph based on the input user-item-explanation triples, and divide the constructed heterogeneous graph into a user-item interaction subgraph, a user-explanation interaction subgraph, and an item-explanation interaction subgraph, and then transmit the divided three subgraphs to the node representation module.
[0081] The node representation module is used to receive three subgraphs and construct the 0th layer embedding matrices of the three subgraphs respectively, use the soft mask module to extract the causal features and mixed features of the 0th layer embedding matrix of each subgraph respectively, and then use the lightweight graph convolution LightGCNConv to perform node embedding on the extracted initial causal feature embedding matrix and the initial mixed feature embedding matrix respectively, to obtain the causal feature embedding matrix and the mixed feature embedding matrix of each subgraph, and divide each subgraph into a causal feature subgraph and a mixed feature subgraph, and transmit all the obtained causal feature subgraphs and mixed feature subgraphs to the backdoor adjustment module based on contrastive learning and the recommendation and explanation prediction module.
[0082] The backdoor adjustment module based on contrastive learning is used to calculate the prediction score and the explained prediction score of the item according to all causal feature subgraphs, and construct a Bayesian personalized ranking BPR loss function; it is used to calculate the confounding factor impact score and the explained confounding factor impact score of the item according to all confounding feature subgraphs, and to learn the loss function of the confounding factor impact based on contrastive learning.
[0083] The recommendation and explanation prediction module is used to update the node embeddings of all causal feature subgraphs and mixed feature subgraphs using a random addition strategy, and to construct a backdoor loss function based on contrastive learning.
[0084] Step 3: Input the user-item-explanation triplet (u, i, a) into the interpretable recommendation model based on causal enhanced graph contrastive learning and train the model to obtain a trained interpretable recommendation model based on causal enhanced graph contrastive learning.
[0085] Step 3.1: Input the user-item-explanation triple (u, i, a) into the interpretable recommendation model based on causal enhanced graph contrastive learning, construct a heterogeneous graph G based on the user-item-explanation triple, and divide the heterogeneous graph G into user-item interaction subgraphs G ui , user and explanation interaction subgraph G ua , and the interaction subgraph G between items and explanations ia .
[0086] Step 3.1.1: Take the user data of the user-item-explanation triple as the user node v u , take the item data as the item node v i , interpret the data as the interpretation node v a , and construct a node set V.
[0087] In this embodiment, according to the user node v u Get the user node set U, according to the item node v i Get the item node set I, according to the interpretation node v a Get the explanation node set E.
[0088] Step 3.1.2: Use the relationship between the user and the item in the user-item-explanation triple as an edge connecting the user node and the item node <v u ,v i >, the relationship between the user and the explanation in the user-item-explanation triple is used as the edge connecting the user node and the explanation node <v u ,v a >, the relationship between the item and the explanation in the user-item-explanation triple is used as the edge connecting the item node and the explanation node <v i ,v a >, and construct the adjacency matrix A.
[0089] In this embodiment, the edges are divided into three types according to the types of nodes they connect, namely: edges connecting user nodes and item nodes <v u ,v i >, the edge connecting the user node and the explanation node <v u ,v a >, and the edge connecting the item node and the explanation node <v i ,v a >. The two-dimensional array used to store data representing the relationship between nodes is called an adjacency matrix. According to the type of edge, the adjacency matrix A is divided into three types: ui , the adjacency matrix A of user-explanation interaction ua , and the adjacency matrix A of the interaction between items and explanations ia .
[0090] Step 3.1.3: Use the node set V and the adjacency matrix A to construct a heterogeneous graph G, and divide the heterogeneous graph G into user-item interaction subgraphs G ui , user and explanation interaction subgraph G ua , and the interaction subgraph G between items and explanations ia ; where G = {A, V}, and Represents a matrix with the same number of rows and columns as the number of nodes in the node set V.
[0091] In this embodiment, following the setting of Review-aware Graph Convolution Network for explainable recommendation (ExpGCN), the original heterogeneous graph is divided into three subgraphs according to the edge type, namely G ui , G ua , G ia . The user and explanation interaction subgraph G ua and the interaction subgraph G between items and explanations ia Both are weighted graphs, and the user-item interaction subgraph G ui It is an unweighted graph.
[0092] Step 3.1.4: Obtain the user's preference for explanations and the matching degree between items and explanations, and extract fine-grained information from the user's preference for explanations and the matching degree between items and explanations as the number of co-occurrences between users or items and explanations, and then use the number of co-occurrences between users or items and explanations to calculate G ui , G ua and G ia The edge weights in G are constructed separately ui , G ua and G ia The edge weight matrix of .
[0093] In this embodiment, the number of co-occurrences between users or items and explanations contains fine-grained information about the user's preference for explanations or the degree of match between items and explanations. Using it as the edge weight between the user node or item node and the explanation node helps capture the collaborative semantics between users, items, and explanations.
[0094] In the user-explanation interaction subgraph G ua For any given user node v u and explain node v a , will connect user node v u and interpret node v a Edge <v u ,v a The edge weight of > is defined as:
[0095]
[0096] Where W ua Represents edge <v u ,v a >The edge weight of y uiarepresents the collaborative interaction between users, items, and explanations, and if the triple (u,i,a) exists, then y uia =1, otherwise y uia =0.
[0097] Since the user interacts with the explanation subgraph G ua and the interaction subgraph G between items and explanations ia They are all weighted graphs, so the interaction subgraph G between items and explanations ia The edge weights of the subgraph G are defined with the user and the explanation interaction ua similar.
[0098] For the user-item interaction subgraph G ui , connect user node v i and item node v u Edge <v u ,v i The edge weight of > is defined as:
[0099]
[0100] Where W ui Represents edge <v u ,v i >The edge weight of useruinteractsitemi indicates that there is interaction and influence between users and items.
[0101] Obviously, for any subgraph, the relationship between the adjacency matrix A and the edge weight matrix W corresponding to the subgraph is expressed as:
[0102]
[0103] Step 3.2: Build G separately ui The 0th layer embedding matrix G ua The 0th layer embedding matrix and G ia The 0th layer embedding matrix Use the soft mask module to and To extract causal features and mixed features, the lightweight graph convolution LightGCNConv is used to embed nodes in the extracted initial causal feature embedding matrix and the initial mixed feature embedding matrix respectively, and G ui , G ua and G ia Divided into G ui The causal feature subgraph of G ui The mixed feature subgraph of Gua The causal feature subgraph of G ua The mixed feature subgraph of G ia The causal feature subgraph of and G ia The mixed feature subgraph of
[0104] Step 3.2.1: Construct G using random initialization ui The initial embedding matrix G ua The initial embedding matrix and G ia The initial embedding matrix of .
[0105] Step 3.2.2: Using G ua The initial embedding matrix and G ia The initial embedding matrix update G ui The initial embedding matrix G ui The 0th layer embedding matrix Using G ui The initial embedding matrix and G ia The initial embedding matrix update G ua The initial embedding matrix G ua The 0th layer embedding matrix Using G ui The initial embedding matrix and G ua The initial embedding matrix update G ia The initial embedding matrix G ia The 0th layer embedding matrix
[0106] The use of G ua The initial embedding matrix and G ia The initial embedding matrix update G ui The method of initial embedding matrix is: from G ua The initial embedding matrix G is obtained ua The initial embedding of the user node in and will Add to G ui In the initial embedding of the user node in G ui The 0th layer user node embedding; from G ia The initial embedding matrix G is obtained ia Initial embedding of item nodes in Then Add to G ui In the initial embedding of the item node, we get G ui The 0th layer item node embedding is based on G ui The layer 0 user node embedding and G uiThe 0th layer item node embedding constructs G ui The 0th layer embedding matrix
[0107] The G ui The embedding of the user node at the 0th layer is expressed as:
[0108]
[0109] in Represents G ui The 0th layer user node embedding representation; Represents G ui The initial embedding of the user node in .
[0110] The G ui The embedding representation of the 0th-level item node is:
[0111]
[0112] in Represents G ui The embedding representation of the 0th layer item node; Represents G ui The initial embedding of the item nodes in .
[0113] The use of G ui The initial embedding matrix and G ia The initial embedding matrix update G ua The initial embedding matrix of G ui The initial embedding matrix and G ua The initial embedding matrix update G ia The initial embedding matrix method is similar to that using G ua The initial embedding matrix and G ia The initial embedding matrix update G ui The method of the initial embedding matrix is the same.
[0114] Step 3.2.3: Use lightweight graph convolution LightGCNConv to perform ui The 0th layer embedding matrix G ua The 0th layer embedding matrix and G ia The 0th layer embedding matrix Perform R-layer node embedding and obtain G after each layer of node embedding ui , G ua and G ia The embedding matrix of .
[0115] The node embedding method is: for G ui , Gua , G ia For any node p in any subgraph in the , get the 0th-level node embedding of node p from the 0th-level embedding matrix of the subgraph And use lightweight graph convolution LightGCNConv to embed the 0th layer node of node p Carry out R-layer node embedding in sequence, then update the node embedding of any layer of node p as follows:
[0116]
[0117] in represents the k+1th layer node embedding of node p; represents the k-th node embedding of node p, and k∈{0,1,...,R}; represents the set of neighbor nodes of node p; q represents any neighbor node of node p; d p is the weighted degree of node p; d q is the weighted degree of node q; A pq represents the initial embedding of node p and node q.
[0118] The average value of all layer node embeddings except the 0th layer node embedding is taken as the node embedding of node p after R layer node embedding, expressed as:
[0119]
[0120] where e p Represents the node embedding of node p.
[0121] In this implementation, the recommendable explanation task is divided into two tasks: item recommendation and explanation sorting. In order to better establish the connection between the two tasks, graph convolution is performed on the subgraph, that is, LightGCNConv is used to embed nodes in the subgraph. Since the underlying node embeddings on each subgraph, that is, the 0th layer node embeddings, do not participate in the calculation of the final node embeddings, the average value of all layer node embeddings of node p except the 0th layer node embedding is taken as the final node embedding of node p.
[0122] In this embodiment, LightGCNConv is expressed in matrix form.
[0123] For G ui , G ua , G ia For any subgraph in , the updating method of the embedding matrix of the subgraph is expressed as:
[0124]
[0125] Where X (k+1) represents the k+1th layer embedding matrix of the subgraph; LightGCNConv(·) means that LightGCNConv is used for node embedding; X (k) represents the k-th level embedding matrix of the subgraph, and N is the number of nodes, d is the embedding dimension; D is a diagonal matrix, and the elements D pp is the weighted degree of node p.
[0126] In this embodiment, causal inference is a research field in statistics and data science that focuses on determining causal relationships between variables rather than just correlations. In recommendation systems, causal inference can help understand how user preferences affect user choices and how recommendation systems affect user behavior. A causal analysis is performed on the learning process of the graph neural network GNN in the item-explanation joint rank task to study the potential causal mechanism and construct a causal graph such as Figure 4 As shown in the figure, the causal relationship between 8 variables is displayed, and the 8 variables are: User Preference (U), which is used to indicate the user's preference for certain items or contents; Item Attributes (A), which is used to indicate the characteristics or attributes of items; Hidden Confounder (H), which is used to indicate factors that may affect the results in the causal relationship but are not actually observed; Graph Data (G), which is used to indicate the data structure represented in the form of a graph; Causal Feature (C), which is used to indicate the features that have a direct impact on the results, that is, the data in the graph data that can accurately describe the matching relationship between users and items; Confounder Feature (F), which is used to indicate the features related to both causal features and results, that is, the data in the graph data that cannot accurately describe the matching relationship between users and items, and this feature may interfere with the identification of causal relationships; Node Representation (R), which is used to indicate the mathematical representation of nodes in graph data; Result or Label (Y), which is used to indicate the target variable of a data sample or the output used to train a model in supervised learning. In a recommendation system, a label may be a user's rating of an item or whether a user clicked on an item. The directed edges connecting different variables express the causal relationship between them and reveal the underlying causal dynamics. The causal relationships between the eight variables are as follows:
[0127] U→G←A: represents the user preference U and item attribute A which will determine which interactive user-item-explanation triplets exist in the collected user data, item data, and explanation data.
[0128] H→G: Indicates that the hidden confounder H contains observable confounders, such as product popularity, and unobservable confounders, such as product quality and the user’s mood when making interactive decisions.
[0129] C←G→F←H: indicates that the graph data G determines the causal feature C and the confounding feature F in the graph, and the confounding feature F exists due to the data bias caused by the hidden confounding factor H.
[0130] F→R←C: Indicates that given the graph data G, GNN learns node representation R based on causal features C and mixed features F to describe user nodes, item nodes, and explanation nodes.
[0131] R→Y: indicates that the graph neural network model makes predictions about recommended items and explanations based on the learned node representations.
[0132] Depend on Figure 4 It can be seen that there are two backdoor paths between the causal feature C and the result or label Y: C←G→F→R→Y and C←G→H→F→R→Y. In order to accurately capture the causal relationship between C and Y, a backdoor adjustment is introduced and the node representation F is used as a condition to block the false correlation between C and Y caused by these two backdoor paths. By taking the Do calculus for C, the confounding effect caused by H is eliminated, thereby accurately capturing the causal relationship. The process of taking the do-calculus for C is expressed as:
[0133]
[0134] Where do(C) represents the action or intervention taken on C; P(Y|do(C)) represents the probability of Y when intervening on C; Γ represents all possible values of the confounding feature F; f represents the value of the confounding feature F; P(f) represents the prior probability of the confounding feature F taking the value f; P(Y|C,f) represents the conditional probability given the causal feature C and the confounding feature F.
[0135] In different application scenarios and data structures, the application of existing methods in causal inference may be different. This implementation proposes to apply the concepts and methods of causal inference such as backdoor adjustment and Do-calculus to the graph neural network model to eliminate the influence of confounding factors, thereby accurately estimating the causal effect, effectively improving the interpretability and accuracy of the recommendation system, and expanding and deepening the existing technology.
[0136] However, there are several challenges in implementing the calculation of formula (9): Challenge (1): How to distinguish which parts of the graph data are causal features and which parts are confounding features? Challenge (2): Even if the causal features and confounding features are determined, since the graph data is unstructured, the value set of the confounding feature F may be difficult to determine. Challenge (3): Formula (9) requires that all values of the causal features and the confounding features F be matched one by one for summation calculation. Even if the value set of the confounding feature F can be determined, the actual computational cost may be unacceptable. Since graph data is naturally unstructured, it may be very difficult to identify confounding features and causal features at the graph data level. However, no matter what kind of confounding factor it is, it will eventually be encoded into the node representation during the graph convolution process, which provides an opportunity to separate causal features from confounding features. This embodiment proposes to estimate the causal feature C and the confounding feature F through a soft mask module at the node representation level.
[0137] Step 3.2.4: Determine the soft mask module and based on G ui The 0th layer embedding matrix G ua The 0th layer embedding matrix and G ia The 0th layer embedding matrix Get the causal feature soft mask M c and the mixed feature mask M o , using M c Get G respectively ui The initial causal feature embedding matrix G ua The initial causal feature embedding matrix and G ia The initial causal feature embedding matrix Using M o Get G respectively ui The initial confounding feature embedding matrix G ua The initial confounding feature embedding matrix and G ia The initial confounding feature embedding matrix
[0138] In this embodiment, the soft mask module is composed of causal feature masks and mixed feature masks The causal feature mask is used to separate the causal features of the node from the representation level, and the mixed feature mask is used to separate the mixed features of the node from the representation level. This process can solve the problems of challenges (1) and (2). A variety of models can be selected as soft mask modules to separate causal features and mixed features, such as Convolutional Neural Network (CNN), Recurrent Neural Network (RNN), Attention Mechanism, Graph Neural Network (GNN), Autoencoder, Variational Autoencoder (VAE) and Transformer. When selecting a model for the soft mask module, it is necessary to consider the data type, task requirements and model complexity. In practical applications, experiments are also needed to determine which model is most suitable for a specific task. If the data has local correlation in space or time, CNN may be more suitable for extracting features; for sequence data or time series data, RNN or its variants, such as LSTM or GRU, may be more effective; the attention mechanism can help the model focus on the most important part of the data and improve the effect of feature separation; for graph-structured data, GNN can better capture the complex relationship between nodes; autoencoders learn the compressed representation of data through encoding and decoding processes, which can be used to extract features; VAE uses a probabilistic generation model to learn the potential representation of data; the Transformer model performs well in processing sequence data, especially in the field of Natural Language Processing (NLP).
[0139] In this implementation, a multilayer perceptron (MLP) is selected as a soft mask module to learn the representation of nonlinear features and extract causal features and mixed features from the representation level, which is expressed as:
[0140] M c ,M o =σ(MLP(LightGCNConv (0) (X (0) )) (10)
[0141] X c =X (0) ⊙M c ,X o =X (0) ⊙Mo (11)
[0142] M c +M o =1 (12)
[0143] Where σ(·) represents the sigmoid function; MLP(·) represents the use of multi-layer perceptron as a soft mask module for feature extraction; LightGCNConv (0) (·) represents a lightweight graph convolution on the 0th layer embedding matrix of the subgraph; X (0) represents the 0th level embedding matrix of the subgraph, and ⊙ indicates a broadcast operation; X c represents the causal feature matrix of the nodes in the subgraph, and X o represents the mixed feature matrix of the nodes in the subgraph, and 1 is an all-ones matrix, and
[0144] The underlying node embeddings on each subgraph do not participate in the calculation of the final node embeddings. Although the underlying node embeddings are affected by the mixed features, they still have a certain amount of information that needs to be utilized through the information propagation process. For example, the products purchased by users based on herd mentality also characterize the user's preferences to a certain extent. Therefore, the soft mask module is only used once after the first convolution layer of each subgraph. After passing through the soft mask module, each subgraph has two node embedding matrices, that is, each subgraph is divided into 2 subgraphs.
[0145] Step 3.2.5: Use lightweight graph convolution LightGCNConv to perform ui The initial causal feature embedding matrix G ua The initial causal feature embedding matrix G ia The initial causal feature embedding matrix G ui The initial confounding feature embedding matrix G ua The initial confounding feature embedding matrix and G ia The initial confounding feature embedding matrix Perform node embedding and get G ui The causal feature embedding matrix G ua The causal feature embedding matrix G ia The causal feature embedding matrix G ui The hybrid feature embedding matrix G uaThe hybrid feature embedding matrix and G ia The hybrid feature embedding matrix
[0146] Step 3.2.6: According to G ui The causal feature embedding matrix and G ui The hybrid feature embedding matrix G ui Divided into G ui The causal feature subgraph of and G ui The mixed feature subgraph of Among them A ui Represents G ui The adjacency matrix of G ua The causal feature embedding matrix and G ua The hybrid feature embedding matrix G ua Divided into G ua The causal feature subgraph of and G ua The mixed feature subgraph of Among them A ua Represents G ua The adjacency matrix of G ia The causal feature embedding matrix and G ia The hybrid feature embedding matrix G ia Divided into G ia The causal feature subgraph of and G ia The mixed feature subgraph of Among them A ia Represents G ia The adjacency matrix of .
[0147] In this embodiment, for a given user u∈U, item i∈I pair, the score of user u's interest in item i is calculated, that is, the predicted score s of the item ui ; For a given triple of user u∈U, item i∈I, and explanation a∈E, calculate the relevance score of user u’s interest in item i, that is, when user u interacts with item i, the interaction and explanation a, that is, the predicted score s of the explanation uia . The higher the prediction score, the more likely the explanation is.
[0148] For a given user u∈U, the Top-K recommendation list of generated items is:
[0149]
[0150] in It means sorting the items from high to low according to their predicted scores and selecting the items corresponding to the top K predicted scores in the sorting results to form the Top-K recommendation list of items.
[0151] For a given user u∈U and recommended item i∈I, the Top-K recommendation list generated with explanation is:
[0152]
[0153] in It means to sort the explanations from high to low according to their prediction scores and select the explanations corresponding to the top K prediction scores in the sorted results to form the Top-K recommendation list of explanations.
[0154] Since each type of node will appear in both subgraphs, for example, the user node will appear in G ua , G ui , so the embedding representations learned by convolution on different subgraphs will be used to focus on different tasks. Specifically, in G ua and G ia The node embeddings learned in G ui The node embeddings learned in the paper will focus on the item recommendation task.
[0155] For any given user and item, according to G ua User node embedding G ua Explanation of node embedding G ia Item node embedding and G ia Explanation of node embedding Calculate the prediction score of the explanation; for any given user and item, according to G ui User node embedding and G ui Item node embedding Calculate the predicted score of the item;
[0156] The prediction score for the explanation is:
[0157]
[0158] where s uia represents the predicted score of the explanation; <·,·> represents the vector inner product.
[0159] The predicted score for the item is:
[0160]
[0161] where s ui Represents the predicted score of the item.
[0162] For both the item recommendation and explanation ranking tasks, the Bayesian Personalized Ranking (BPR) loss function is used for training. Specifically, for a given triple (u, i, a), items are sampled from the set of items that user u has not interacted with as negative samples for the item recommendation task, and explanations are sampled from the set of explanations that user u did not mention when interacting with item i as negative samples for the explanation ranking task.
[0163] The BPR loss function is expressed as:
[0164]
[0165] in represents the BPR loss function; I u represents the set of all items that have an interactive relationship with user u; j represents any item that does not have an interactive relationship with user u; σ(·) represents the sigmoid function; s uj represents the predicted score of item j for a given user u; E ui represents the set of explanations that user u has a correlation when interacting with item i; m represents any explanation that user u has a correlation when interacting with item i; n represents any explanation that user u has no correlation when interacting with item i; s uim represents the predicted score of explanation m for a given user u and item i; s uin For a given user u and item i, explain the predicted score of n.
[0166] Step 3.3: Using G ui The causal feature subgraph of G ua The causal feature subgraph of and G ia The causal feature subgraph of The prediction scores of items and explanations are calculated separately, and the prediction scores of explanations and items are used to construct the Bayesian personalized ranking BPR loss function.
[0167] Step 3.3.1: For any given user, Get Causal feature embedding of user nodes and Causal feature embedding of item nodes And calculate the prediction score of item i.
[0168] The predicted score of item i is:
[0169]
[0170] in represents the predicted score of item i; <·,·> represents the vector inner product.
[0171] Step 3.3.2: For any given user and item, Get Causal feature embedding of user nodes and Causal feature embedding of explanation nodes from Get Causal feature embedding of item nodes and Causal feature embedding of explanation nodes And calculate the prediction score of the explanation.
[0172] The prediction score for the explanation is:
[0173]
[0174] in represents the prediction score of explanation a.
[0175] In this embodiment, for a given triple (u, i, a), items are sampled from the set of items that user u has not interacted with as negative samples for the item recommendation task, and explanations are sampled from the set of explanations that user u has not mentioned when interacting with item i as negative samples for the explanation ranking task. After applying the soft mask module, the model will make correct predictions based on causal features to maximize the gap between positive and negative samples, so formula (17) is redefined.
[0176] Step 3.3.3: Use the predicted scores of the explanations and the predicted scores of the items to construct the Bayesian Personalized Ranking (BPR) loss function;
[0177] The BPR loss function is:
[0178]
[0179] in represents the BPR loss function; I u represents the set of all items that have an interactive relationship with user u; j represents any item that does not have an interactive relationship with user u; σ(·) represents the sigmoid function; represents the predicted score of item i; represents the predicted score of item j for a given user u; E ui represents the set of explanations that user u has a correlation when interacting with item i; m represents any explanation that user u has a correlation when interacting with item i; n represents any explanation that user u has no correlation when interacting with item i; represents the predicted score of explanation m for a given user u and item i; represents the predicted score of explanation n for a given user u and item i.
[0180] Step 3.4: Using G ui The mixed feature subgraph of G ua The mixed feature subgraph of and G ia The mixed feature subgraph of The confounding factor influence scores and explained confounding factor influence scores of the items are calculated respectively, and the confounding factor influence scores and explained confounding factor influence scores of the items are used to construct a loss function based on contrastive learning of confounding factor influence.
[0181] In this embodiment, since the confounding features may mislead the learning of the model, the user, item and explanation features captured based on the confounding features in the training set may not have good generalization. In order to reduce the influence of the confounding features, a loss function based on the influence of the confounding factors of contrastive learning is constructed.
[0182] Step 3.4.1: For any given user, Get User node hybrid feature embedding and Item node hybrid feature embedding And calculate the confounding factor impact score of item i.
[0183] The confounding factor impact score of item i is:
[0184]
[0185] in Indicates the confounding factor impact score of item i.
[0186] Step 3.4.2: For any given user and item, Get User node hybrid feature embedding and Explanation of node hybrid feature embedding from Get Item node hybrid feature embedding and Explanation of node hybrid feature embedding And calculate the explained confounding factor impact score.
[0187] The explained confounder impact score is:
[0188]
[0189] in Represents the explained confounder effect score.
[0190] Step 3.4.3: Use the confounding factor impact score of the item and the explained confounding factor impact score to construct a loss function based on contrastive learning of confounding factor impact;
[0191] The loss function based on the influence of the confounding factor of contrastive learning is:
[0192]
[0193] in represents the loss function based on the influence of the confounding factor of contrastive learning; Indicates that for a given user u, the confounding factor of item j affects the score; Indicates that for a given user u and item i, the confounding factor of explanation m affects the score; It means that for a given user u and item i, the confounding factor n explained affects the score.
[0194] In this embodiment, by minimizing formula (24), the prediction based on the mixed features will make the scores of positive and negative samples as close as possible. The mixed features do not have any useful information to capture the collaborative semantics between users, objects, and explanations, reducing the possibility of mixed features misleading model learning.
[0195] like Figure 4 As shown in the figure, due to the existence of the backdoor paths C←G→F→R→Y and C←G→H→F→R→Y, the model will learn the false and unstable correlation between the causal feature C and the label Y during the training process. In order to block the confounding effect caused by the backdoor path, the backdoor adjustment shown in formula (9) should be implemented, that is, the causal feature of each node in the graph is matched one by one with the confounding feature of each node to achieve causal intervention. However, due to the large number of nodes in the graph and the extremely large value set of the confounding feature, it is not feasible to strictly follow formula (9) to achieve causal intervention. Therefore, it is assumed that P(s) obeys a uniform distribution and introduces the principle of implementing implicit causal intervention at the representation level using contrastive learning based on the random addition strategy to achieve backdoor adjustment.
[0196] Step 3.5: Update using random addition strategy and The node embedding in is constructed, and a backdoor loss function based on contrastive learning is constructed.
[0197] The method for constructing the backdoor loss function based on contrastive learning is:
[0198]
[0199] where z i ′ and z i ″ are all node embeddings updated by random addition strategy; j′ and j″ are numbers randomly generated by random number generator in (0,N), that is, j′, j″∈(0,N), and j′ and j″ are used as node representations. In this implementation, j′ and j″ can be node representations of any node, including user, item, and explanation; Represents any causal feature subgraph containing item nodes The updated node embedding of item i; is any mixed feature subgraph containing item nodes The node embedding of node j′ after the update; represents the backdoor loss function based on contrastive learning; τ is the temperature coefficient, which is used to adjust the similarity calculation in contrastive learning; ||·|| represents the norm of the vector, which is used for normalization.
[0200] In this embodiment, by minimizing The purpose is to make P(Y|C,f i )=P(Y|C,f j ), where P(Y|C,f i ) means that given the causal feature C and the confounding feature f i The conditional probability of label Y under the condition of j ) means that given the causal feature C and different confounding features f i The conditional probability of label Y under the condition of ; CGCLER can learn an invariant causal feature representation that is robust to confounding features, and promote CGCLER to make correct predictions based on causal features under the perturbations of different confounding features. Through this implicit causal intervention, CGCLER solves challenge (3) well. From another perspective, causal intervention is a process that uses confounding features to interfere with the prediction of causal features to eliminate the confounding effect caused by confounding features. The implicit causal intervention based on contrastive learning enables CGCLER to more effectively distinguish causal features from confounding features at the representation level.
[0201] Step 3.6: Use the Bayesian personalized ranking BPR loss function, the loss function based on the influence of contrastive learning confounding factors, and the backdoor loss function based on contrastive learning to construct the loss function based on causal enhancement graph contrastive learning, and obtain the trained interpretable recommendation model based on causal enhancement graph contrastive learning by minimizing the loss function based on causal enhancement graph contrastive learning.
[0202] The loss function based on causal enhancement graph contrast learning is:
[0203]
[0204] in represents the loss function based on causal enhanced graph contrastive learning; λ1 is a hyperparameter used to control the strength of separation of causal features and confounding features; λ2 is a hyperparameter used to control the strength of causal intervention; λ3 is a hyperparameter used to control the strength of L2 regularization to prevent the model from overfitting; θ represents the updateable parameters in the model, that is, the model's setting of causal weights between items, users, and explanations.
[0205] In this embodiment, non-causal features are treated as confounding factors and normalized and discretized to make the degree of confounding more uniform and control the degree of confounding. Then, the confounding factors and causal features are learned by the model together, and the model only learns the causal features. In this way, the model theoretically has rich robustness and anti-interference ability, can distinguish causal and non-causal features, thereby extracting more useful information and enhancing the anti-interference ability to useless information.
[0206] In this embodiment, the detailed implementation pseudo code of CGCLER is shown in Algorithm 1.
[0207] Algorithm 1 Learning algorithm of CGCLER
[0208]
[0209]
[0210] Step 4: Get any set of user data, item data, and explanation data and input them into the trained interpretable recommendation model based on causal enhanced graph contrastive learning to obtain the user's item recommendation results and recommendation explanations.
[0211] In this embodiment, the effectiveness of this method will be demonstrated through comprehensive experiments. First, the experimental settings are introduced in detail. This embodiment uses three public datasets open sourced by Li et al. for experiments: Amazon Movies&TV, TripAdvisor, and Yelp. The Amazon Movies&TV dataset contains review information for movies and TV shows on the Amazon website; the TripAdvisor dataset usually contains review and rating information for hotels, restaurants, attractions, etc.; the Yelp dataset contains a large number of user reviews, ratings, business information, etc. Following the existing research settings, users, items, and explanations with less than 5 interactions in the original dataset are filtered out. The statistical data of the processed dataset are shown in Table 1. Since these datasets come from different topics and have different scales and data sparsity, a comprehensive evaluation can be carried out.
[0212] Table 1 Statistics of the dataset
[0213]
[0214] In the experimental setting, the items and explanations that have been interacted with are considered as positive samples. In order to facilitate model training, this experiment uses a random negative sampling strategy to generate negative samples. In order to make a fair comparison, the negative sampling rate of all datasets is 20, and the datasets are randomly divided into training sets, validation sets, and test sets according to the ratio of 0.7, 0.15, and 0.15.
[0215] For the item recommendation task and explanation ranking task, two common indicators, Recall@K and NDCG@K, are used to evaluate the model performance. In order to comprehensively evaluate the model performance, the geometric mean (GM) of the same indicators of the two tasks is used to treat the importance of the two tasks equally. In multi-task evaluation, GM is less affected by the size of different indicators. The GM calculation method for the two indicator scores s1 and s2 is:
[0216]
[0217] In order to verify the superiority of CGCLER, the following seven models are selected as baseline models:
[0218] PITF-J: This model is an extension of the parameter-sharing tag recommendation model PITF on joint tasks. In PITF, the embeddings of users and items originally used to perform tag recommendation can be directly used for item recommendation through dot products.
[0219] AMCF: Attentive Multitask Collaborative Filtering. It introduces a novel item reconstruction task to establish a mapping relationship between items and aspects to increase the interpretability of recommendations.
[0220] BPER-J: Joint-ranking on Bayesian Personalized Explanation Ranking. It extends PITF to perform item-explanation joint ranking.
[0221] ·A 2 -GCN: Attribute-aware Attentive Graph Convolution Network. It uses graph convolutional neural networks to characterize the interactions in user-item-attribute triplets.
[0222] TGCN: Tag Graph Convolution Network. It adopts type-aware node sampling and convolutional aggregation to perform node aggregation at the node level and type level, and designs a TransTag regularization term to enhance the performance of tag-aware recommendation by identifying user preferences.
[0223] ExpGCN: Explanation-aware Graph Convolution Network. It learns task-oriented node representations by aggregating information from different subgraphs to avoid performance degradation caused by conflicts between different task learning objectives in the item-explanationjoint rank task.
[0224] For all the above baseline models, the Recbole ToolBox is used to evaluate the model performance, and the data partitioning method, random seed, and evaluation index are kept unchanged for fair comparison and reproducibility. All baseline models use the Adam optimizer, the weight decay is adjusted in {1e-6, 1e-5, 1e-4}, the learning rate is adjusted in {1e-4, 1e-3, 1e-2}, the maximum training round is 500, and the early stopping strategy is used, and the early stopping round is 10. For GNN-based models, the number of graph convolution layers is adjusted in {1, 2, 3, 4, 5}. All model parameters are initialized using Xavier uniform distribution. By randomly selecting different random seeds, each baseline model is experimented at least 5 times, and the average value of the evaluation index is reported as the experimental result as follows.
[0225] 1. About the effectiveness of CGCLER in explainable recommendation work: As shown in Table 2, recall @k (Recall@K) and normalized discounted cumulative gain @k (NDCG@K) are represented by R@K and N@K respectively. The indicator values are in %, and % is omitted. These two indicators are used to measure the proportion of relevant items that are correctly recommended in the first k positions of the recommendation list, that is, the recall rate, and the recommendation quality, that is, the normalized discounted cumulative gain. In practical applications, these indicators are helpful in evaluating the performance of recommendation systems, especially when considering recommendation explanations. For each indicator in Table 2, the best performing model is indicated in bold and the second best performing model is underlined. It can be seen from the experimental results in Table 2 that the CGCLER proposed in this embodiment has achieved significant improvement in both the indicators of a single task and the indicators of a joint task. Regardless of the size and sparsity of the data, CGCLER has achieved effective improvements overall, which can be attributed to the following points: (1) CGCLER can distinguish between confounding features and causal features at the node representation level; (2) CGCLER makes item recommendations and explanation ranking decisions based on the extracted causal features rather than on the embedding of the graph after convolution affected by confounding features; (3) The criterion strategy for backdoor adjustment based on contrastive learning makes the causal features learned by CGCLER sufficiently generalizable. On the other hand, this strategy also avoids the heavy computational burden brought by the summation part of the backdoor adjustment; (4) The predictions made by CGCLER based on confounding features are very average, which makes the confounding features contain as little information as possible.
[0226] Comparison of different models on the joint ranking task of item recommendation and explanation. Recall@k and NDCG@k are denoted as “R@k” and “N@k” respectively. The metrics are expressed in percentage units, omitting the percentage sign.
[0227] Table 2 Comparison of different models on the joint ranking task of item recommendation and explanation
[0228]
[0229]
[0230] On the Yelp dataset, although most indicators have achieved significant improvements, the Recall@10 of the recommendation task and the NDCG@10 of the explanation task are slightly lower than the best baseline, which may be because the Yelp dataset is more sparse than the other two datasets. A key to the effective work of CGCLER lies in its strategy of backdoor adjustment criteria based on contrastive learning. The sparsity of the Yelp dataset makes it impossible for CGCLER to obtain a rich set of adjustments.
[0231] 2. Verify the effectiveness source of CGCLER and the contribution of each component: In order to verify the effectiveness source of CGCLER and the contribution of each component, ablation experiments were performed on the following variant models of CGCLER:
[0232] w / o RD: When generating views for contrastive learning, the random addition strategy of causal features and confounding features is removed, and the causal features of each node are only added to the corresponding confounding features.
[0233] w / o CI: The backdoor adjustment based on contrastive learning was completely removed in CGCLER.
[0234] w / o CC: The constraints on confounding features are removed in CGCLER, that is, CGCLER is no longer constrained to make predictions based on confounding features as close as possible.
[0235] w / o CIC: The constraints on confounding features and the backdoor adjustment based on contrastive learning are removed in CGCLER.
[0236] Table 3 Ablation experiment results on Amazon movies & TV dataset
[0237]
[0238]
[0239] As shown in Table 3, Recall@K and NDCG@K are represented by R@K and N@K, respectively. The indicator values are in percentage units, and the percentage symbol is omitted. For each indicator in Table 3, the best performing model is represented by bold, and the second best performing model is represented by underline. From the results of the ablation experiment, the following conclusions can be drawn: (1) CGCLER performs best, and all variants perform worse than CGCLER. The worst performing variant is w / o CI, which shows the effectiveness of the causal intervention strategy based on contrastive learning to implement the backdoor adjustment criterion. (2) The performance of variant w / o RD is lower than that of CGCLER, which shows that a rich adjustment set helps CGCLER to learn, which to some extent explains why CGCLER sometimes performs poorly on the Yelp dataset with higher sparsity. (3) The performance of variant w / o CIC is worse than that of variant w / o CI but worse than that of variant w / o CC, which shows that simply constraining the model to make the prediction based on the confounding features as close as possible is not conducive to the model distinguishing causal features from non-causal features. Intuitively, the contrastive learning module of CGCLER requires the model to make the same sorting decisions under the interference of different confounding features. Therefore, the strategy of implementing the backdoor adjustment criterion based on contrastive learning can also help the model to effectively distinguish causal features from confounding features at the node level to a certain extent.
[0240] 3. The impact of different parameters on CGCLER: The impact of and on the performance of CGCLER is studied on two datasets, Yelp and Amazon movies&TV. The strength of and is controlled. The experimental results are as follows: Figure 5 As shown. Figure 5 The following conclusions can be drawn from : (1) Compared with , is more sensitive, and the value range varies greatly on different datasets, so it needs to be set carefully. The reasonable value range on the Yelp dataset is [0.002, 0.003], and the reasonable value range on the AmazonMovies&TV dataset is [0.02, 0.18]. (2) Too large a value can easily lead to performance degradation. This may be because when separating causal features from confounding features at the node representation level, CGCLER tends to set the causal feature soft mask to an all-one matrix and the confounding feature soft mask to an all-zero matrix, which makes CGCLER unable to effectively distinguish causal features from confounding features. (3) Overall, the model performance on the two datasets increases with the increase of , first increasing, then decreasing, then increasing, and then decreasing. This shows that a larger is more helpful for CGCLER to minimize the amount of information contained in the confounding features.
[0241] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the claims of the present invention.
Claims
1. An explainable recommendation method based on causal enhanced graph contrastive learning, characterized in that: The method comprises the following steps: Step 1: Collect user data, item data, and explanation data, and construct several user-item-explanation triples (u, i, a), where u represents the user; i represents the item; and a represents the explanation; Step 2: Build an explainable recommendation model based on causal enhanced graph contrastive learning; Step 3: Input the user-item-explanation triple (u, i, a) into the interpretable recommendation model based on causal enhanced graph contrastive learning and train the model to obtain a trained interpretable recommendation model based on causal enhanced graph contrastive learning; Step 4: Get any set of user data, item data, and explanation data and input them into the trained interpretable recommendation model based on causal enhanced graph contrastive learning to obtain the user's item recommendation results and recommendation explanations.
2. According to claim 1, an explainable recommendation method based on causal enhanced graph contrastive learning is characterized in that: The explainable recommendation model based on causal enhanced graph contrastive learning includes: a graph construction module, a node representation module, a backdoor adjustment module based on contrastive learning, and a recommendation and explanation prediction module; The graph construction module is used to construct a heterogeneous graph according to the input user-item-explanation triples, and divide the constructed heterogeneous graph into a user-item interaction subgraph, a user-explanation interaction subgraph, and an item-explanation interaction subgraph, and then transmit the divided three subgraphs to the node representation module; The node representation module is used to receive three subgraphs and construct the 0th layer embedding matrices of the three subgraphs respectively, use the soft mask module to extract the causal features and the mixed features of the 0th layer embedding matrix of each subgraph respectively, and then use the lightweight graph convolution LightGCNConv to perform node embedding on the extracted initial causal feature embedding matrix and the initial mixed feature embedding matrix respectively, to obtain the causal feature embedding matrix and the mixed feature embedding matrix of each subgraph, and divide each subgraph into a causal feature subgraph and a mixed feature subgraph, and transmit all the obtained causal feature subgraphs and mixed feature subgraphs to the backdoor adjustment module and the explanation prediction module based on contrastive learning; The backdoor adjustment module based on contrastive learning is used to calculate the predicted score and the explained predicted score of the item according to all causal feature subgraphs, and construct a Bayesian personalized ranking BPR loss function; it is used to calculate the confounding factor impact score and the explained confounding factor impact score of the item according to all confounding feature subgraphs, and to learn the loss function of the confounding factor impact based on contrastive learning; The recommendation and explanation prediction module is used to update the node embeddings of all causal feature subgraphs and mixed feature subgraphs using a random addition strategy, and to construct a backdoor loss function based on contrastive learning.
3. The explainable recommendation method based on causal enhanced graph contrastive learning according to claim 2, characterized in that: The step 3 further comprises: Step 3.1: Input the user-item-explanation triple (u, i, a) into the interpretable recommendation model based on causal enhanced graph contrastive learning, construct a heterogeneous graph G based on the user-item-explanation triple, and divide the heterogeneous graph G into user-item interaction subgraphs G ui , user and explanation interaction subgraph G ua , and the interaction subgraph G between items and explanations ia ; Step 3.2: Build G separately ui The 0th layer embedding matrix G ua The 0th layer embedding matrix and G ia The 0th layer embedding matrix Use the soft mask module to and To extract causal features and mixed features, the lightweight graph convolution LightGCNConv is used to embed nodes in the extracted initial causal feature embedding matrix and the initial mixed feature embedding matrix respectively, and G ui , G ua and G ia Divided into G ui The causal feature subgraph of G ui The mixed feature subgraph of G ua The causal feature subgraph of G ua The mixed feature subgraph of G ia The causal feature subgraph of and G ia The mixed feature subgraph of Step 3.3: Using G ui The causal feature subgraph of G ua The causal feature subgraph of and G ia The causal feature subgraph of Calculate the prediction score of the item and the prediction score of the explanation respectively, and use the prediction score of the explanation and the prediction score of the item to construct the Bayesian personalized ranking BPR loss function; Step 3.4: Using G ui The mixed feature subgraph of G ua The mixed feature subgraph of and G ia The mixed feature subgraph of Calculate the confounding factor impact score and the explained confounding factor impact score of the item respectively, and use the confounding factor impact score and the explained confounding factor impact score of the item to construct a loss function based on contrastive learning of confounding factor impact; Step 3.5: Update using random addition strategy and Node embedding in , and constructing a backdoor loss function based on contrastive learning; Step 3.6: Use the Bayesian personalized ranking BPR loss function, the loss function based on the influence of contrastive learning confounding factors, and the backdoor loss function based on contrastive learning to construct the loss function based on causal enhancement graph contrastive learning, and obtain the trained interpretable recommendation model based on causal enhancement graph contrastive learning by minimizing the loss function based on causal enhancement graph contrastive learning.
4. The explainable recommendation method based on causal enhanced graph contrastive learning according to claim 3, characterized in that: The step 3.1 further comprises: Step 3.1.1: Take the user data of the user-item-explanation triple as the user node v u , take the item data as the item node v i , interpret the data as the interpretation node v a , and construct a node set V; Step 3.1.2: Use the relationship between the user and the item in the user-item-explanation triple as an edge connecting the user node and the item node <v u ,v i >, the relationship between the user and the explanation in the user-item-explanation triple is used as the edge connecting the user node and the explanation node <v u ,v a >, the relationship between the item and the explanation in the user-item-explanation triple is used as the edge connecting the item node and the explanation node <v i ,v a >, and construct the adjacency matrix A; Step 3.1.3: Use the node set V and the adjacency matrix A to construct a heterogeneous graph G, and divide the heterogeneous graph G into user-item interaction subgraphs G ui , user and explanation interaction subgraph G ua , and the interaction subgraph G between items and explanations ia ; where G = {A, V}, and Represents a matrix whose number of rows and columns are the number of nodes in the node set V; Step 3.1.4: Obtain the user's preference for explanations and the matching degree between items and explanations, and extract fine-grained information from the user's preference for explanations and the matching degree between items and explanations as the number of co-occurrences between users or items and explanations, and then use the number of co-occurrences between users or items and explanations to calculate G ui , G ua and G ia The edge weights in G are constructed separately ui , G ua and G ia The edge weight matrix of .
5. The explainable recommendation method based on causal enhanced graph contrastive learning according to claim 4, characterized in that: The step 3.2 further comprises: Step 3.2.1: Construct G using random initialization ui The initial embedding matrix G ua The initial embedding matrix and G ia The initial embedding matrix of Step 3.2.2: Using G ua The initial embedding matrix and G ia The initial embedding matrix update G ui The initial embedding matrix G ui The 0th layer embedding matrix Using G ui The initial embedding matrix and G ia The initial embedding matrix update G ua The initial embedding matrix G ua The 0th layer embedding matrix Using G ui The initial embedding matrix and G ua The initial embedding matrix update G ia The initial embedding matrix G ia The 0th layer embedding matrix Step 3.2.3: Use lightweight graph convolution LightGCNConv to perform ui The 0th layer embedding matrix G ua The 0th layer embedding matrix and G ia The 0th layer embedding matrix Perform R-layer node embedding and obtain G after each layer of node embedding ui , G ua and G ia The embedding matrix of Step 3.2.4: Determine the soft mask module and based on G ui The 0th layer embedding matrix G ua The 0th layer embedding matrix and G ia The 0th layer embedding matrix Get the causal feature soft mask M c and the mixed feature mask M o , using M c Get G respectively ui The initial causal feature embedding matrix G ua The initial causal feature embedding matrix and G ia The initial causal feature embedding matrix Using M o Get G respectively ui The initial confounding feature embedding matrix G ua The initial confounding feature embedding matrix and G ia The initial confounding feature embedding matrix Step 3.2.5: Use lightweight graph convolution LightGCNConv to perform ui The initial causal feature embedding matrix G ua The initial causal feature embedding matrix G ia The initial causal feature embedding matrix G ui The initial confounding feature embedding matrix G ua The initial confounding feature embedding matrix and G ia The initial confounding feature embedding matrix Perform node embedding and get G ui The causal feature embedding matrix G ua The causal feature embedding matrix G ia The causal feature embedding matrix G ui The hybrid feature embedding matrix G ua The hybrid feature embedding matrix and G ia The hybrid feature embedding matrix Step 3.2.6: According to G ui The causal feature embedding matrix and G ui The hybrid feature embedding matrix G ui Divided into G ui The causal feature subgraph of and G ui The mixed feature subgraph of Among them A ui Represents G ui The adjacency matrix of G ua The causal feature embedding matrix and G ua The hybrid feature embedding matrix G ua Divided into G ua The causal feature subgraph of and G ua The mixed feature subgraph of Among them A ua Represents G ua The adjacency matrix of G ia The causal feature embedding matrix and G ia The hybrid feature embedding matrix G ia Divided into G ia The causal feature subgraph of and G ia The mixed feature subgraph of Among them A ia Represents G ia The adjacency matrix of .
6. The explainable recommendation method based on causal enhanced graph contrastive learning according to claim 5, characterized in that: The node embedding method described in step 3.2.3 is: for G ui , G ua , G ia For any node p in any subgraph in the , get the 0th-level node embedding of node p from the 0th-level embedding matrix of the subgraph And use lightweight graph convolution LightGCNConv to embed the 0th layer node of node p Carry out R-layer node embedding in sequence, then update the node embedding of any layer of node p as follows: in represents the k+1th layer node embedding of node p; represents the k-th node embedding of node p, and k∈{0,1,...,R}; represents the set of neighbor nodes of node p; q represents any neighbor node of node p; d p is the weighted degree of node p; d q is the weighted degree of node q; A pq represents the initial embedding of node p and node q; The average value of all layer node embeddings except the 0th layer node embedding is taken as the node embedding of node p after R layer node embedding, expressed as: where e p represents the node embedding of node p; For G ui , G ua , G ia For any subgraph in , the updating method of the embedding matrix of the subgraph is expressed as: Where X (k+1) represents the k+1th layer embedding matrix of the subgraph; LightGCNConv(·) means that LightGCNConv is used for node embedding; X (k) represents the k-th level embedding matrix of the subgraph, and N represents the number of nodes, and d is the embedding dimension; D is a diagonal matrix, and the elements D pp is the weighted degree of node p.
7. The explainable recommendation method based on causal enhanced graph contrastive learning according to claim 6, characterized in that: The step 3.3 further comprises: Step 3.3.1: For any given user, Get Causal feature embedding of user nodes and Causal feature embedding of item nodes And calculate the prediction score of item i; Step 3.3.2: For any given user and item, Get Causal feature embedding of user nodes and Causal feature embedding of explanation nodes from Get Causal feature embedding of item nodes and Causal feature embedding of explanation nodes and calculate the prediction score of the explanation; Step 3.3.3: Use the predicted scores of explanations and items to construct the Bayesian personalized ranking BPR loss function; The BPR loss function is: in represents the BPR loss function; I u represents the set of all items that have an interactive relationship with user u; j represents any item that does not have an interactive relationship with user u; σ(·) represents the sigmoid function; represents the predicted score of item i; represents the predicted score of item j for a given user u; E ui represents the set of explanations that user u has a correlation when interacting with item i; m represents any explanation that user u has a correlation when interacting with item i; n represents any explanation that user u has no correlation when interacting with item i; represents the predicted score of explanation m for a given user u and item i; represents the predicted score of explanation n for a given user u and item i.
8. The explainable recommendation method based on causal enhanced graph contrastive learning according to claim 7, characterized in that: The step 3.4 further comprises: Step 3.4.1: For any given user, Get User node hybrid feature embedding and Item node hybrid feature embedding And calculate the confounding factor impact score of item i; Step 3.4.2: For any given user and item, Get User node hybrid feature embedding and Explanation of node hybrid feature embedding from Get Item node hybrid feature embedding and Explanation of node hybrid feature embedding and calculate explained confounder impact scores; Step 3.4.3: Use the confounding factor impact score of the item and the explained confounding factor impact score to construct a loss function based on contrastive learning of confounding factor impact; The loss function based on the influence of the confounding factor of contrastive learning is: in represents the loss function based on the influence of the confounding factor of contrastive learning; Indicates that for a given user u, the confounding factor of item j affects the score; Indicates that for a given user u and item i, the confounding factor of explanation m affects the score; It means that for a given user u and item i, the confounding factor n explained affects the score.
9. The explainable recommendation method based on causal enhanced graph contrastive learning according to claim 8, characterized in that: The method for constructing the backdoor loss function based on contrastive learning described in step 3.5 is: where z i ′ and z i ″ are all node embeddings updated by random addition strategy; j′ and j″ are numbers randomly generated by random number generator in (0,N), that is, j′, j″∈(0,N), and j′ and j″ are used as node representations; Represents any causal feature subgraph containing item nodes The updated node embedding of item i; is any mixed feature subgraph containing item nodes The node embedding of node j′ after the update; represents the backdoor loss function based on contrastive learning; τ is the temperature coefficient; ||·|| represents the norm of the vector.
10. The explainable recommendation method based on causal enhanced graph contrastive learning according to claim 9, characterized in that: The loss function based on causal enhancement graph contrast learning described in step 3.6 is: in represents the loss function based on causal enhanced graph contrastive learning; λ1 is a hyperparameter used to control the strength of separation of causal features and confounding features; λ2 is a hyperparameter used to control the strength of causal intervention; λ3 is a hyperparameter used to control the strength of L2 regularization; θ represents an updateable parameter in the model.
Citation Information
Cited By
Grain pile surface pest detection model training method, detection method and equipment
CN121074541A
Grain heap surface pest detection model training method, detection method and device
CN121074541B
Rumor detection method and system based on adaptive cause subgraph learning
CN121581060A