Self-adaptive knowledge contrast learning recommendation method based on dynamic attention network

By introducing a dynamic attention network into the recommendation system, adaptively adjusting user attention, the problem of poor matching of personal interests and knowledge graph knowledge is solved, and more efficient personalized recommendation is achieved.

CN119599109APending Publication Date: 2025-03-11ZHENGZHOU UNIVERSITY OF LIGHT INDUSTRY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411520088.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

When using the knowledge graph, existing recommendation systems cannot effectively match personal interests and general knowledge in the knowledge graph, resulting in poor personalized recommendation results.

Method used

Adaptive knowledge comparison learning recommendation method based on dynamic attention network is adopted to realize personalized attention distribution by dynamic adjustment of user attention and capturing the weight score between entities and relationships.

Benefits of technology

It effectively makes up for the gap between personal interests and general knowledge, improves the personalized recommendation effect of the recommendation system, and does not increase the computational complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119599109A_ABST
    Figure CN119599109A_ABST
Patent Text Reader

Abstract

The invention provides an adaptive knowledge contrast learning recommendation method based on a dynamic attention network. The method comprises the following steps: step 1, acquiring a user-project interaction graph and a knowledge graph; wherein the user-project interaction graph is used for describing historical interaction records of a user on projects, and the knowledge graph describes a relationship between the projects in a triple form; step 2, constructing an AKCL-DA network framework, and training the AKCL-DA network framework by using the user-project interaction graph and the knowledge graph to obtain a recommendation model; 3, inputting the target user-project interaction diagram into the recommendation model, and generating a recommendation result of the project of the target user; the item recommendation result is an item set with a high matching score output by the recommendation model. According to the method, the AKCL-DA network framework is provided to obtain the recommendation model, and the problem that sparse information and personal interests are not matched with general knowledge in the knowledge graph can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of artificial intelligence and natural language processing, and in particular to an adaptive knowledge comparative learning recommendation method based on a dynamic attention network. Background Art

[0002] In the context of the highly developed Internet and digital technology, when users are faced with a large amount of information, it is easy to exceed their processing capabilities, resulting in the inability to effectively filter, absorb and apply this information. This problem of too much information leading to low efficiency is called "information overload", and the recommendation system can help users generate personalized recommendations and alleviate the information overload problem in real services. The recommendation system is an information filtering system that aims to predict and recommend products or services that users may be interested in. It is widely used in e-commerce, content sharing platforms, music recommendations and many other online services.

[0003] Knowledge-aware methods aim to fully exploit the graph relations in knowledge graphs (KGs) and the collaboration signals in interaction graphs. Early studies focused on knowledge graph embedding techniques to learn item representations in an embedding space. However, these models can only learn single items independently and fail to capture global graph relations and collaboration signals. Path-based methods are hampered by path selection problems, usually require domain-specific expertise and face optimization challenges. Inspired by the advantages of graph neural networks (GNNs), researchers have adopted the information propagation paradigm to capture user behavior patterns in user-item interaction graphs and knowledge graphs, achieving good results, but their performance depends heavily on the quality of knowledge graphs, which are often sparse and noisy.

[0004] Self-supervised contrastive learning shows good prospects in addressing data sparsity by leveraging relationships in the data. However, current methods for generating contrastive views usually rely on techniques such as random information discarding, edge perturbation, and subgraph sampling, which often lead to the problem of not being able to fully utilize sparse information. In addition, existing knowledge graph-based recommendation systems usually use a static attention mechanism to uniformly measure all nodes. This method cannot consider the personalized characteristics of different nodes, resulting in a mismatch between personal interests and general knowledge in the knowledge graph. Summary of the invention

[0005] In order to solve the problem of mismatch between personal interests and general knowledge in knowledge graphs, the present invention provides an adaptive knowledge comparative learning recommendation method based on a dynamic attention network. By increasing the weight scores between entities and relationships captured by the dynamic attention network, personalized attention allocation is achieved without increasing computational complexity. The network dynamically adjusts user attention according to personalized behavior, thus bridging the gap between personal interests and general knowledge.

[0006] The adaptive knowledge contrast learning recommendation method based on dynamic attention network provided by the present invention includes:

[0007] Step 1: Obtain a user-item interaction graph and a knowledge graph; wherein the user-item interaction graph is used to describe the historical interaction records of users on items, and the knowledge graph describes the relationship between items and entities in the form of triples;

[0008] Step 2: construct an AKCL-DA network framework, and train the AKCL-DA network framework using the user-item interaction graph and the knowledge graph to obtain a recommendation model;

[0009] The AKCL-DA network framework includes a graph enhancement module, a node update module, a contrastive learning module and a project matching module; the graph enhancement module is used to perform edge perturbations on the user-project interaction graph and the knowledge graph to generate a user-project enhancement graph and a knowledge enhancement graph; the node update module is used to perform node updates and aggregation on the user-project interaction graph, the user-project enhancement graph and the knowledge enhancement graph to generate user embedding, project embedding, user enhancement embedding, project enhancement embedding and knowledge entity enhancement embedding; the contrastive learning module is used to perform contrastive learning on the project enhancement embedding and the knowledge entity enhancement embedding to generate a project-entity enhancement embedding; the project matching module is used to merge the user embedding and the user enhancement embedding to generate a final user embedding, merge the project embedding and the project-entity enhancement embedding to generate a final project embedding, and calculate the matching score between the final user embedding and the final project embedding;

[0010] Step 3: Input the target user-item interaction graph into the recommendation model to generate recommendation results for the target user's items; the recommendation results for the items are a set of items with high matching scores output by the recommendation model.

[0011] Furthermore, the graph enhancement module is used to perform edge perturbation on the user-item interaction graph, specifically including:

[0012] Adding a small number of hypothetical edges to the user-item interaction graph to generate an interaction subgraph;

[0013] Calculating the edge weight of each edge in the interaction subgraph;

[0014] Calculate the edge sampling probability of each edge in the interaction subgraph according to the edge weight;

[0015] The interaction subgraph is edge deleted according to the edge sampling probability to generate a user-item enhanced graph.

[0016] Furthermore, the graph enhancement module is used to perform edge perturbations on the knowledge graph, specifically including:

[0017] Calculating the edge weight of each edge in the knowledge graph;

[0018] Calculate the edge sampling probability of each edge in the knowledge graph according to the edge weight;

[0019] The edges of the knowledge graph are deleted according to the edge sampling probability to generate a knowledge enhancement graph.

[0020] Furthermore, edge deletion specifically includes:

[0021] Dispersing the edge sampling probability in [0,1], and updating the edge sampling probability using the Gumbel-Max reparameterization technique;

[0022] The edges corresponding to the updated edge sampling probability value of 1 are retained, and the edges corresponding to 0 are deleted.

[0023] Furthermore, the node updating module is used to update and aggregate nodes of the user-item interaction graph, the user-item enhancement graph and the knowledge enhancement graph, specifically including:

[0024] Visually encoding the user-item interaction graph, the user-item enhancement graph, and the knowledge enhancement graph to obtain an optimal user-item interaction graph, an optimal user-item enhancement graph, and an optimal knowledge enhancement graph;

[0025] Use the DAn encoder to update and aggregate nodes on the optimal user-item interaction graph and the optimal user-item enhancement graph to generate user embedding, item embedding, user enhancement embedding, and item enhancement embedding;

[0026] The Relation-aware DAn encoder is used to update and aggregate nodes on the optimal knowledge enhancement graph to generate knowledge entity enhanced embedding.

[0027] Furthermore, the DAn encoder is used to update and aggregate nodes of the optimal user-item interaction graph and the optimal user-item enhancement graph, specifically including:

[0028] For the target node h1, calculate the linear representation of the self-network of node h1:

[0029]

[0030] Among them, e j represents node j, represents all nodes connected to h1, represents the attention score of node h1 to node j in the optimal user-item interaction graph and the optimal user-item enhancement graph The calculation formula is as follows:

[0031]

[0032] in, Represents node h1, a u and W u represents a trainable parameter, LeakyReLU represents an activation function, and exp is the abbreviation of the exponential function, which represents the natural exponential function;

[0033] The representation of node h1 and the linear representation of the ego network of node h1 are aggregated into a new representation of node h1.

[0034] Furthermore, the relationship-aware DAn encoder is used to update and aggregate nodes on the optimal knowledge enhancement graph, including:

[0035] For the target node h2, calculate the linear representation of the self-network of node h2:

[0036]

[0037] in, represents all nodes connected to h2, Represents the attention score of node h2 to node t. In the optimal knowledge enhancement graph, the attention score The calculation formula is as follows:

[0038]

[0039] Among them, a k , W k and W r represents the trainable parameters, e t and They are head entity embedding, tail entity embedding and relation r(<h2,t> ) is embedded; r(<h2,t> ) represents the relationship type between node h2 and node t;

[0040] The representation of node h2 and the linear representation of the ego network of node h2 are aggregated into a new representation of node h2.

[0041] Furthermore, the contrastive learning module is used to perform contrastive learning on the project enhanced embedding and the knowledge project enhanced embedding, specifically including:

[0042] Feed the item-enhanced embedding and the knowledge item-enhanced embedding into the MLP and project them into the same space;

[0043] Compute the contrast loss between the item-augmented embeddings and knowledge-item-augmented embeddings containing the same item to increase their consistency;

[0044] The contrast loss calculation formula is as follows:

[0045]

[0046] Among them, S(·) is the cosine similarity of two vectors, N is the negative sample set, τ cl is the temperature hyperparameter, represents the embedding of the same item in the user-item interaction enhanced graph and the knowledge enhanced graph, and Representing the embeddings of different items in the user-item interaction augmented graph and the knowledge augmented graph;

[0047] The item augmented embeddings and knowledge item augmented embeddings containing the same items are aggregated to generate the optimal item augmented embeddings.

[0048] Further, using the user-item interaction graph and the knowledge graph to train the AKCL-DA specifically includes:

[0049] The AKCL-DA is trained by joint training, and the objective function The calculation formula is as follows:

[0050]

[0051] Among them, λ1 and λ2 are hyperparameters, To evaluate the recommended results, is the contrast loss function of the contrastive learning module, is the regularization loss function of the knowledge graph,

[0052]

[0053] Among them, O={(u,i,j)|(u,i)∈O + ,(u,j)∈O -} is the observed interaction O + and unobserved interactions O - training data, represents the matching score between user u and item i, represents the matching score between user u and item j,

[0054]

[0055] Among them, h' and t' are entities other than h and t in the knowledge graph, respectively, f(·) represents the score function of the triple in the knowledge graph, G k Represents a knowledge graph and is defined as follows:

[0056]

[0057] Among them, e h and Represents h, t and r in knowledge Figure 3 The representation in the tuple (h, t, r), Represents the transformation matrix of the relational space, projecting from the d-dimensional entity space to the k-dimensional relational space.

[0058] In a second aspect, the present invention provides an adaptive knowledge contrast learning recommendation system based on a dynamic attention network, comprising:

[0059] A user input module, used to input the user-item historical interaction records of the target user and generate a corresponding user-item interaction graph;

[0060] A graph enhancement module, used to perform data enhancement on the user-item interaction graph and the preset knowledge graph to generate a user-item enhanced graph and a knowledge enhanced graph;

[0061] A node updating module, used for updating and aggregating nodes of the user-item interaction graph, the user-item enhancement graph and the knowledge enhancement graph, and generating user embedding, item embedding, user enhancement embedding, item enhancement embedding and knowledge entity enhancement embedding;

[0062] A local contrastive learning module, used for contrastive learning and aggregation of the project enhanced embedding and the knowledge project enhanced embedding to generate a project-entity enhanced embedding;

[0063] Item matching module: used to merge the user embedding and the user enhanced embedding to obtain a final user embedding, merge the item embedding and the optimal item enhanced embedding to obtain a final item embedding, and calculate the matching score of the final user embedding and the final item embedding;

[0064] The project recommendation module is used to generate project recommendation results for target users, and the project recommendation results are a set of projects corresponding to the high matching scores.

[0065] Beneficial effects of the present invention:

[0066] (1) This paper proposes a knowledge contrastive learning recommendation (AKCL-DA) network framework based on dynamic attention network. By performing data enhancement on the user-item interaction graph through edge perturbation, richer underlying semantic information can be explored. The personalized dynamic attention is used to update the graph nodes and dynamically adjust the attention of the nodes (users, projects and items), which fills the gap between personal interests and the general knowledge of the knowledge graph and alleviates the mismatch problem in existing methods.

[0067] (2) This paper proposes an adaptive data augmentation strategy to expand the semantic associations and user behaviors in the knowledge graph and interaction graph by adding hypothetical edges. This strategy effectively utilizes sparse information, thereby ensuring that the comparison views are more representative of the underlying data relationships.

[0068] (3) The present invention adopts a joint training method to train the model, which can better capture the semantic associations between items and relationships during the training process, and more balancedly utilize information and guide recommendation results, thereby ensuring the accuracy of model recommendations. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 A flowchart of an adaptive knowledge comparative learning recommendation method based on a dynamic attention network provided by an embodiment of the present invention:

[0070] Figure 2 A schematic diagram of the AKCL-DA network framework provided by an embodiment of the present invention;

[0071] Figure 3 A graph showing the hyperparameter sensitivity analysis results of Movielens provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0072] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0073] User-item interaction graph: In a typical recommendation scenario, there is a user set U = {u1,u2,…,u M} and the set of items V = {v1,v2,…,v N}, where u and v represent a single user and item respectively, and M and N represent the number of users and items. The present invention constructs a user-item interaction graph G based on the historical interaction records of users on items. u ={(u,y uv ,v)}, where y uv is a binary, if y uv = 1 means user u interacts with item v (e.g., purchases, browses, or clicks), otherwise y uv =0.

[0074] Knowledge graph: In addition to historical interaction data, KG stores a large amount of real-world structured information related to objects in the form of heterogeneous graphs or heterogeneous information networks, such as object attributes and other external common sense. k =(h,r,t) represents a knowledge graph obtained from a public dataset, where h,t∈ε respectively represent the head entity and the tail entity, r∈R represents the relationship between h and t, and ε and R represent the entity set and the relationship set in the knowledge graph respectively. Here, the entity set ε contains the item set V and the non-item set. For example, in the movie recommendation scenario, the triple (Forrest Gump, Directed by, Robert Zemeckis) means that the director of the movie Forrest Gump is Robert Zemeckis. It should be noted that an item v∈V corresponds to an entity e∈ε.

[0075] When the item "Iron Man" in the user-item interaction graph also appears in the knowledge graph as an entity with the same name, the present invention establishes a complex connection between the interaction graph and the knowledge graph through alignment between items (items) and KG entities, provides more auxiliary information for the interaction data, and improves the modeling of user personalized preferences.

[0076] Embodiment 1:

[0077] like Figure 1 As shown, an embodiment of the present invention provides an adaptive knowledge contrast learning recommendation method based on a dynamic attention network, comprising the following steps:

[0078] Step 1: Obtain the user-item interaction graph and knowledge graph;

[0079] Specifically, a user-item interaction graph can be constructed based on the historical interaction records of users on items (articles) or the user-item interaction graph can be obtained from a public data set, and the knowledge graph can be obtained from a public data set. It should be noted that the present invention can be used for recommendation systems with interaction history, such as merchant recommendations, FM online music system recommendations, and movie recommendations.

[0080] Step 2: Build the AKCL-DA network framework, train AKCL-DA using the user-item interaction graph and knowledge graph, and obtain the recommendation model;

[0081] like Figure 2 As shown, a schematic diagram of the AKCL-DA network framework provided by an embodiment of the present invention, wherein the AKCL-DA network framework includes a graph enhancement module, a node update module, a comparative learning module and a project matching module;

[0082] Specifically, the graph enhancement module is used to perform edge perturbation on the user-item interaction graph to generate a user-item enhanced graph, including:

[0083] Add a small number of hypothetical edges to the user-item interaction graph to generate an interaction subgraph;

[0084] It can be understood that in order to avoid the possibility that important collaboration signals in the user-item interaction graph may be discarded, this embodiment adds a small number of hypothetical edges therein to compensate for the loss of user preferences caused by edge discarding; it can also alleviate the problem that users do not observe their favorite items in some cases and thus have no interaction records.

[0085] Calculate the edge weight of the interaction subgraph. The edge weight calculation formula is as follows:

[0086]

[0087] in, Indicates the importance of the edge e = (u, v) in the interaction subgraph. The higher the score, the more important the edge. MLP stands for multi-layer perceptron. and are the embeddings of users and items in the interaction subgraph, respectively.

[0088] Calculate the edge sampling probability of the interaction graph based on the edge weights of the interaction subgraph

[0089]

[0090] Among them, ∈ represents a random variable distributed in Uniform(0,1), σ(·) represents the sigmoid function, and the temperature hyperparameter τ is used u Controls edge sampling probability.

[0091] The edges of the interaction subgraph are deleted according to the edge sampling probability of the interaction graph to generate a user-item enhanced graph.

[0092] Specifically, edge deletion includes:

[0093] The sampling probability is dispersed in [0,1] and the sampling probability is updated using the Gumbel-Max reparameterization technique;

[0094] Specifically, the discrete sampling probability is dispersed in a continuous variable of [0, 1], and the Gumbel-Max reparameterization technique is applied. In this distribution, the probability value corresponding to the category with higher probability is closer to 1, and the probability value corresponding to the category with lower probability is closer to 0.

[0095] The updated sampling probability value is p e =1 The corresponding edge e is retained if p e = 0, the edge e corresponding to is deleted.

[0096] The user-item augmentation graph is represented as:

[0097]

[0098] Among them, M u ∈{0, 1} represents the mask vector on the edge set E. When the sampling probability is 1, M u When the sampling probability is 1, the edge is retained; when the sampling probability is 0, the edge is masked, M u is 0, that is, this edge does not exist; V represents the items in the user-item interaction graph, and E represents the edge set of the interaction subgraph.

[0099] Specifically, the graph enhancement module is used to perform edge perturbations on the knowledge graph to generate a user-item enhanced graph:

[0100] Calculate the edge weights of the knowledge graph;

[0101]

[0102] in, and They are the head entity, relationship and tail entity on the edge of the knowledge graph (0) Embedding.

[0103] Calculate the edge sampling probability of the knowledge graph according to the edge weight of the knowledge graph:

[0104]

[0105] Among them, ∈ represents a random variable distributed in Uniform(0,1), σ(·) represents the sigmoid function, and the temperature hyperparameter τ is used k Controls the sampling probability.

[0106] The knowledge graph is edge deleted according to its edge sampling probability to generate a knowledge enhanced graph.

[0107] Specifically, edge deletion on the knowledge graph is consistent with the above-mentioned edge deletion on the interaction subgraph, which will not be elaborated again.

[0108] The knowledge enhancement graph is represented as follows:

[0109]

[0110] Among them, M k ∈{0,1} is the masking vector that determines whether to retain the triplet. When the sampling probability is 1, M k When the sampling probability is 1, the edge is retained; when the sampling probability is 0, the edge is masked, M k is 0, which means this edge does not exist;

[0111] Specifically, the node update module is used to update and aggregate nodes in the user-item interaction graph, the user-item enhancement graph, and the knowledge enhancement graph to generate user embedding, item embedding, user enhancement embedding, item enhancement embedding, and knowledge entity enhancement embedding, including:

[0112] Visually encode the user-item interaction graph, the user-item enhancement graph, and the knowledge enhancement graph to obtain the optimal user-item interaction graph, the optimal user-item enhancement graph, and the optimal knowledge enhancement graph;

[0113] Use the DAn encoder to perform node update and neighborhood aggregation on the optimal user-item interaction graph and the optimal user-item enhancement graph to generate user embedding, item embedding, user enhancement embedding, and item enhancement embedding;

[0114] Specifically, we use a single layer of DAn to update the node representation and then perform neighborhood aggregation;

[0115] The node representation is computed by recursively aggregating and transforming the representations of multiple neighborhoods, via Represents all nodes connected to h1, and the linear representation of h1’s self-network is calculated as follows:

[0116]

[0117] Among them, e j represents node j, represents the attention score of node h1 to node j; The calculation formula is as follows:

[0118]

[0119] Among them, a u and W u represents a trainable parameter, LeakyReLU represents an activation function, exp is the abbreviation of the exponential function, and represents the natural exponential function. Represents node h1.

[0120] Use the representation of node h1 and the linear representation of the ego network of node h1 to aggregate into a new representation of node h1;

[0121] Specifically, the new representation of node h1 at layer l is:

[0122]

[0123] Among them, W u (l) is the learnable weight matrix of the lth layer, and σ is the activation function.

[0124] It should be noted that the node h1 represents a user or item in the optimal user-item interaction graph and the optimal user-item enhancement graph.

[0125] The relation-aware DAn encoder is used to perform node updates on the optimal knowledge augmentation graph and generate knowledge item augmented embeddings.

[0126] DAn does not take the relationship type into consideration in modeling and is not suitable for encoding knowledge graphs. Therefore, we expand on the original attention mechanism and consider the impact of different relationship types on entities. We obtain an encoder relationship-aware DAn suitable for heterogeneous graphs to update nodes in knowledge graphs.

[0127] The node update and aggregation process in the optimal knowledge enhancement graph is as follows:

[0128] For the target node h2, calculate the linear representation of the self-network of node h2:

[0129]

[0130] in, represents all nodes connected to h2, Represents the attention score of node h2 to node t. In the optimal knowledge enhancement graph, the attention score The calculation formula is as follows:

[0131]

[0132] Among them, a k , W k and W r represents the trainable parameters, e t and They are head entity embedding, tail entity embedding and relation r(<h2,t> ) is embedded; r(<h2,t> ) represents the relationship type between node h2 and node t;

[0133] The representation of node h2 and the linear representation of the ego network of node h2 are aggregated into a new representation of node h2.

[0134] It should be noted that other modules of knowledge enhancement graph node update and user-item interaction enhancement Figure 1 I will not elaborate on this in detail.

[0135] It should be noted that node h2 represents an entity in the knowledge enhancement graph, which can be an item or a non-item. For example, Forrest Gump and Robert Zemeckis in the triple (Forrest Gump, Directedby, Robert Zemeckis) can both be regarded as node h2.

[0136] Specifically, the contrastive learning module is used to perform contrastive learning on the project-enhanced embedding and the knowledge-project-enhanced embedding to generate the project-entity-enhanced embedding, which specifically includes:

[0137] The item-enhanced embedding and the knowledge-item-enhanced embedding are fed into the MLP and projected into the same space; they can be expressed as:

[0138]

[0139] Compute the augmented embeddings of items containing the same item V and knowledge item enhancement embedding The contrast loss of is used to increase its consistency;

[0140] Specifically, the same item V in two views is considered to be facing On the contrary, embedding other items j and item v as negative samples, such as The contrast loss is used to maximize the consistency between positive pairs and minimize the consistency between negative pairs. The contrast loss calculation formula is as follows:

[0141]

[0142] Among them, S(·) is the cosine similarity of two vectors, N is the negative sample set, τ cl is the temperature hyperparameter.

[0143] The item augmented embeddings and knowledge item augmented embeddings containing the same item are aggregated to generate the optimal item augmented embedding.

[0144] Specifically, the item matching module is used to merge the user embedding and the user enhanced embedding to generate the final user embedding, merge the item embedding and the item-entity enhanced embedding to generate the final item embedding, and calculate the matching score of the final user embedding and the final item embedding, specifically including:

[0145] Enhance the embedding of optimal items and project embedding h v Merge to generate the final project embedding v ;

[0146]

[0147] Embed the user into hu and user-enhanced embedding Merge to generate end-user embed u ;

[0148]

[0149] Compute the matching score of the final item embedding and the final user embedding:

[0150]

[0151] in, Represents the matching score between user U and item V.

[0152] Step 3: Input the target user-item interaction graph into the recommendation model to generate the recommendation results of the target user's items; the recommended results of the items are the set of items arranged according to the matching scores output by the model.

[0153] The method provided by the embodiment of the present invention effectively utilizes sparse information through adaptive data enhancement and captures personalized behavior of knowledge perception by dynamically adjusting user attention, thereby alleviating the mismatch between personalized behavior and general knowledge.

[0154] In one embodiment, the AKCL-DA is trained using joint training, and the objective function The calculation formula is as follows:

[0155]

[0156] Wherein, λ1 and λ2 are hyperparameters. In this embodiment, λ1 and λ2 are fixed to 0.1 and 1 respectively; To evaluate the recommended results, is the contrastive loss function of the contrastive learning module, is the regularization loss function of the knowledge graph,

[0157]

[0158] Among them, O={(u,i,j)|(u,i)∈O + ,(u,j)∈O -} is the observed interaction O + and unobserved interactions O - training data, represents the matching score between user u and item i, represents the matching score between user u and item j,

[0159]

[0160] Among them, h' and t' are entities other than h and t in the knowledge graph, respectively, and f(·) represents the score function of the triple, which is defined as follows:

[0161]

[0162] Among them, e h and represents the representation of h, t and r in the triple (h, r, t), The transformation matrix representing the relational space, projecting from the d-dimensional entity space to the k-dimensional relational space. The lower the score of the function, the greater the authenticity of the triple.

[0163] The embodiment of the present invention also provides an adaptive knowledge comparative learning recommendation system based on a dynamic attention network, comprising:

[0164] A user input module, used to input the user-item historical interaction records of the target user and generate a corresponding user-item interaction graph;

[0165] The graph enhancement module is used to perform data enhancement on the user-item interaction graph and the preset knowledge graph to generate a user-item enhanced graph and a knowledge enhanced graph;

[0166] A node updating module is used to update and aggregate nodes in the user-item interaction graph, the user-item enhancement graph, and the knowledge enhancement graph to generate user embedding, item embedding, user enhancement embedding, item enhancement embedding, and knowledge entity enhancement embedding;

[0167] The local contrastive learning module is used to contrast and aggregate the item-enhanced embedding and the knowledge-item-enhanced embedding to generate the item-entity-enhanced embedding.

[0168] Item matching module: used to merge the user embedding and the user enhanced embedding to obtain the final user embedding, merge the item embedding and the optimal item enhanced embedding to obtain the final item embedding, and calculate the matching score of the final user embedding and the final item embedding;

[0169] The project recommendation module is used to generate project recommendation results for target users, and the project recommendation results are a set of projects corresponding to high matching scores.

[0170] Embodiment 2:

[0171] (I) To verify the effectiveness of AKCL-DA, the present invention uses three datasets: Yelp2018, LastFM, and Movie-lens. These datasets differ in size and sparsity and are publicly accessible in different fields, which makes the experiment more convincing. The datasets used in the present invention are introduced below:

[0172] Yelp2018: It mainly recommends businesses, such as restaurants, bars and their locations. A 10-core setting is used to remove users and items with less than 10 interactions in the dataset.

[0173] LastFM: It is collected from the Last.FM online music system, containing the listening history of 23566 users.

[0174] Movie-lens: It is a benchmark dataset for movie recommendation, which contains interaction records from 37,385 users.

[0175] In order to ensure the fairness of the experiment of the embodiment of the present invention, the dataset partitioning results in KGAT will be directly adopted. For each dataset, 80% and 20% of the interaction history of each user are randomly selected to construct the training set and test set. From the training set, 10% of the interactions are randomly selected as the validation set to adjust the hyperparameters. The basic statistical results of the three datasets are shown in Table 1.

[0176] Table 1 Statistics of experimental datasets

[0177]

[0178] To demonstrate the effectiveness of the above recommended models, AKCL-DA is compared with the following models:

[0179] BPRMF, by learning the implicit features between users and items, and using the BPR loss function to optimize the implicit feedback in pairwise matrix factorization.

[0180] FM,represents features as latent vectors and obtains the interactions between features by calculating the inner product between latent vectors.

[0181] NFM,represents features as latent vectors and learns the interactions between latent vectors through neural networks.

[0182] CKE, an embedding-based model, uses TransR to encode item semantic information and combines collaborative filtering with item knowledge embedding.

[0183] KGCN, a GCN-based model, encodes the semantic information in KG by performing high-order dependency context.

[0184] LightGCN, a lightweight recommendation model based on GCN, learns the embedding vectors of users and items by simplifying the graph neural network structure.

[0185] KGAT, a propagation-based recommendation model, builds a collaborative knowledge graph (CKG) from the KG and user-item graph, and applies an attention mechanism to generate representations of users and items.

[0186] CKAN, a propagation-based recommendation model, further extends KGCN by considering the user-item graph, using different neighborhood aggregation strategies, and combining the collaborative filtering representation space with knowledge graph embedding.

[0187] KGIN, a state-of-the-art GNN-based recommendation model, explores the intentions behind user-item interactions by using auxiliary item knowledge and provides explainability for recommendations.

[0188] KGCL, a state-of-the-art recommendation model based on contrastive learning, proposes a knowledge graph enhancement mode to suppress KG noise in information aggregation and obtain more robust item knowledge-aware representation.

[0189] In order to comprehensively evaluate the effectiveness of the method proposed in the embodiment of the present invention, two widely used indicators are used, namely Recall@K and NDCG@K, where K is set to 20. Recall is a recall rate indicator used to evaluate the recommendation system, which can measure how many items of real interest are successfully recommended in a given recommendation list. NDCG@K is the normalized discounted cumulative gain of K points, which takes into account the relevance and sorting order of the recommended items, and can more accurately evaluate the performance of the recommendation system in terms of sorting quality. The indicators are calculated by ranking all items that the user has not interacted with in the training data set. The acceptable range of these two methods is between 0 and 1. The higher the value of the two indicators, the better the model recommendation performance.

[0190] This example implements AKCL-DA and all baseline models in Pytorch, and tunes the key parameters of each model. For fair comparison, the embedding dimension of all models is set to 64; the optimizer is set to Adam; and the embedding parameters are initialized using the Xavier method. For each baseline model, the parameters of all models are set according to the parameters in the prior art. Pre-trained MF embedding is used to stabilize and accelerate model training. In this example, the number of GNN layers is fixed to 2; the learning rate is 10 -4 ; The batch size is 4096; The graph edge discard rate ρ = 0.3. In AKCL-DA, τ is tuned at {0.01, 0.05, 0.1, 0.5, 0.7} and {0.5, 0.6, 0.7, 0.8, 0.9} respectively. u and τ cl ; τ k The fixed setting is 0.5; the proportion of hypothetical edges added is adjusted in {0.01, 0.02…, 0.05} (hypothetical edge proportion = number of hypothetical edges / total number of edges). To avoid overfitting, L2 regularization is applied at each layer (the coefficient is set to 10 -3 ) and dropout((dropout rate is 0.1).

[0191] Table 2 Performance comparison results

[0192]

[0193] As can be seen from the above table, the AKCL-DA proposed in the embodiment of the present invention achieves the best performance on all data sets compared with other models, and improves the Recall@20 index by 3.41%, 13.12% and 1.71% respectively. These results verify the superiority of building a recommendation model through the AKCL-DA network framework, which is mainly reflected in the following aspects:

[0194] (1) By adding an appropriate proportion of hypothetical edges to the interaction graph, we can actively predict items that users may like but have not yet observed, thereby enhancing the collaborative signal;

[0195] (2) The dynamic attention network proposed in the embodiment of the present invention can effectively distinguish the importance of neighbors and improve the embedding of nodes. By aggregating information from the interaction graph and the knowledge graph, it can better capture collaborative signals and semantic feature information;

[0196] (3) The contrastive view enhancement strategy designed in the embodiment of the present invention can identify and keep important edges and recommendation-related edges unchanged, while removing edges that may be unimportant, providing high-quality embedding for contrastive learning.

[0197] In addition, KGCL, KGIN, CKAN, KGAT, LightGCN, KGCN, and CKE are all graph-based GNN (GAT) models. Obviously, their performance is better than BPR-MF, NFM, and FM, which shows that using graph neural networks to aggregate contextual information and model long-range connections can provide better recommendation performance.

[0198] In all datasets, AKCL-DA outperforms FM, NFM, BPR-MF, CKE, KGCN, LightGCN, KGAT, CKAN, and KGCL by 38.89%, 41.04%, 31.50%, 22.85%, 26.17%, 16.99%, 16.62%, 18.65%, and 11.02% on average in NDCG@20 metrics, respectively. These results illustrate that self-supervised learning provides insights into overcoming data sparsity and cold start by extracting information from unlabeled data. Given the results achieved by KGCL and AKCL-DA, it can be found that the item knowledge extracted by contrastive learning can guide the interaction data augmentation mode of self-supervised information. With the help of contrastive learning, the two graph augmentation modes can obtain more robust item knowledge-aware representations; in addition, since contrastive learning only encodes the shared information between the interaction graph and the knowledge graph, it can alleviate the dominance of collaborative signals and suppress noise irrelevant to recommendations.

[0199] (II) The present invention selects the hyperparameter research results of AKCL-DA in the Movielens dataset. It should be noted that the trends of Yelp2018 and LastFM are similar to those of Movielens, which will not be repeated here. It should be noted that when analyzing one parameter, other important parameters remain unchanged.

[0200] In order to evaluate the impact of the hypothesized edge ratio on AKCL-DA, the embodiment of the present invention selects a value ranging from 0.01 to 0.05, and plots the recall@20 and ndcg@20 scores to demonstrate the impact. Figure 3 As shown in (a), when r is 0.04, the model achieves the best performance. The appropriate proportion of hypothetical edges can expand the semantic association of the knowledge graph and more comprehensively capture user preferences. Adding hypothetical edges to the interaction graph does improve the recommendation performance to a certain extent.

[0201] like Figure 3 (b) shows the recall@20 and ndcg@20 scores when GNN stacks different numbers of layers. It can be observed that the model achieves the best performance when L (the number of GNN layers) is 2. It can be observed that as L increases, the performance of the model decreases, which indicates that it is affected by the over-smoothing of the graph neural network.

[0202] like Figure 3 (c) shows different τ cl The recall@20 and ndcg@20 scores of the values. It can be seen that when τ cl The model achieves optimal performance when it is 0.7, which shows that exploring a suitable contrast learning temperature hyper-parameter is particularly important for the performance of the model.

[0203] like Figure 3 (d) shows the influence of the edge dropout rate on the model. The embodiment of the present invention changes the dropout rate from 0.5 to 0.9, and the results show that the model achieves the best performance when ρ is 0.3. This shows that when constructing interaction and knowledge subgraphs, an edge dropout rate that is too large or too small will have a negative impact on the performance of the model. An edge dropout rate that is too large will cause each round of model training to lose important information, and an edge dropout rate that is too small will cause more noise information to exist in each round of training.

[0204] (III) In order to verify the effectiveness of the AKCL-DA component, two variants of the AKCL-DA component were designed in the embodiment of the present invention to analyze their performance.

[0205] AKCL-DA w / o Assumed edge: In this variant, no assumed edge is added to the interaction graph, and the other parts are kept consistent with the complete model to observe the impact of the results on the entire model.

[0206] AKCL-DAw / o Att: This variant does not use dynamic attention to calculate the importance between nodes, but adopts the original version of GAT to calculate the attention score.

[0207] Table 3 Experimental results of two variants and AKCL-DA

[0208]

[0209] Table 3 shows the results of the two variants and AKCL-DA. It is easy to see from the results that: (1) removing the hypothetical edges in the interaction graph will affect the performance of the recommendation, and adding the hypothetical edges in the interaction subgraph has a certain positive effect on fully capturing the user's preferences; (2) the dynamic attention network used can effectively capture the relationship between nodes, making a great contribution to improving the embedding of nodes, ensuring high-quality embedding for contrastive learning input. Finally, these results fully demonstrate that the performance of the recommendation system can be significantly improved by making full use of collaborative supervision signals and effectively suppressing noise in the knowledge graph.

[0210] (IV) To evaluate the performance of AKCL-DA on noisy knowledge graphs, the test set is kept unchanged and 10% of noisy triples are added to the existing knowledge graph to construct a large number of entities that are not relevant to recommendation. The noisy knowledge graphs are used for recommendation in models KGAT, KGCL, and AKCL-DA, and the results are shown in Table 4.

[0211] Table 4 Experimental results on alleviating knowledge noise

[0212]

[0213] From the results in Table 4, it can be seen that compared with KGAT and KGCL, AKCL-DA has the best average performance in suppressing knowledge graph noise. In general, the method provided by the embodiment of the present invention can effectively capture user preferences and further improve the suppression of knowledge graph noise.

[0214] 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 of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An adaptive knowledge contrastive learning recommendation method based on dynamic attention network, characterized in that: include: Step 1: Obtain a user-item interaction graph and a knowledge graph; wherein the user-item interaction graph is used to describe the historical interaction records of users on items, and the knowledge graph describes the relationship between items and entities in the form of triples; Step 2: construct an AKCL-DA network framework, and train the AKCL-DA network framework using the user-item interaction graph and the knowledge graph to obtain a recommendation model; The AKCL-DA network framework includes a graph enhancement module, a node update module, a comparative learning module and an item matching module; The graph enhancement module is used to perform edge perturbations on the user-item interaction graph and the knowledge graph to generate a user-item enhancement graph and a knowledge enhancement graph; the node update module is used to perform node updates and aggregation on the user-item interaction graph, the user-item enhancement graph and the knowledge enhancement graph to generate user embedding, item embedding, user enhancement embedding, item enhancement embedding and knowledge entity enhancement embedding; The contrastive learning module is used to perform contrastive learning on the project enhanced embedding and the knowledge entity enhanced embedding to generate project-entity enhanced embedding; The item matching module is used to merge the user embedding and the user enhanced embedding to generate a final user embedding, merge the item embedding and the item-entity enhanced embedding to generate a final item embedding, and calculate a matching score between the final user embedding and the final item embedding; Step 3: Input the target user-item interaction graph into the recommendation model to generate recommendation results for the target user's items; the recommendation results for the items are a set of items with high matching scores output by the recommendation model.

2. The adaptive knowledge contrastive learning recommendation method based on dynamic attention network according to claim 1 is characterized in that: The graph enhancement module is used to perform edge perturbation on the user-item interaction graph, specifically including: Adding a small number of hypothetical edges to the user-item interaction graph to generate an interaction subgraph; Calculating the edge weight of each edge in the interaction subgraph; Calculate the edge sampling probability of each edge in the interaction subgraph according to the edge weight; The interaction subgraph is edge deleted according to the edge sampling probability to generate a user-item enhanced graph.

3. The adaptive knowledge contrastive learning recommendation method based on dynamic attention network according to claim 1 is characterized in that: The graph enhancement module is used to perform edge perturbations on the knowledge graph, specifically including: Calculating the edge weight of each edge in the knowledge graph; Calculate the edge sampling probability of each edge in the knowledge graph according to the edge weight; The edges of the knowledge graph are deleted according to the edge sampling probability to generate a knowledge enhancement graph.

4. The adaptive knowledge contrastive learning recommendation method based on dynamic attention network according to any one of claims 2 or 3, characterized in that: Edge deletion specifically includes: Dispersing the edge sampling probability in [0,1], and updating the edge sampling probability using the Gumbel-Max reparameterization technique; The edges corresponding to the updated edge sampling probability value of 1 are retained, and the edges corresponding to 0 are deleted.

5. The adaptive knowledge contrastive learning recommendation method based on dynamic attention network according to claim 1, characterized in that: The node updating module is used to update and aggregate nodes of the user-item interaction graph, the user-item enhancement graph, and the knowledge enhancement graph, and specifically includes: Visually encoding the user-item interaction graph, the user-item enhancement graph, and the knowledge enhancement graph to obtain an optimal user-item interaction graph, an optimal user-item enhancement graph, and an optimal knowledge enhancement graph; Use the DAn encoder to update and aggregate nodes on the optimal user-item interaction graph and the optimal user-item enhancement graph to generate user embedding, item embedding, user enhancement embedding, and item enhancement embedding; The relation-aware DAn encoder is used to perform node update and aggregation on the optimal knowledge augmented graph to generate knowledge entity augmented embedding.

6. The adaptive knowledge contrastive learning recommendation method based on dynamic attention network according to claim 5 is characterized in that: The DAn encoder is used to update and aggregate nodes of the optimal user-item interaction graph and the optimal user-item enhancement graph, including: For the target node h1, calculate the linear representation of the self-network of node h1: Among them, e j represents node j, represents all nodes connected to h1, represents the attention score of node h1 to node j in the optimal user-item interaction graph and the optimal user-item enhancement graph The calculation formula is as follows: in, Represents node h1, a u and W u represents a trainable parameter, LeakyReLU represents an activation function, and exp is the abbreviation of the exponential function, which represents the natural exponential function; The representation of node h1 and the linear representation of the ego network of node h1 are aggregated into a new representation of node h1.

7. The adaptive knowledge contrastive learning recommendation method based on dynamic attention network according to claim 5, characterized in that: The relationship-aware DAn encoder is used to update and aggregate nodes in the optimal knowledge enhancement graph, including: For the target node h2, calculate the linear representation of the self-network of node h2: in, represents all nodes connected to h2, Represents the attention score of node h2 to node t. In the optimal knowledge enhancement graph, the attention score The calculation formula is as follows: Among them, a k , W k and W r represents the trainable parameters, e t and They are head entity embedding, tail entity embedding and relation r(<h2,t> ) is embedded; r(<h2,t> ) represents the relationship type between node h2 and node t; The representation of node h2 and the linear representation of the ego network of node h2 are aggregated into a new representation of node h2.

8. The adaptive knowledge contrastive learning recommendation method based on dynamic attention network according to claim 1, characterized in that: The contrastive learning module is used to perform contrastive learning on the project enhanced embedding and the knowledge project enhanced embedding, specifically including: Feed the item-enhanced embedding and the knowledge item-enhanced embedding into the MLP and project them into the same space; Compute the contrast loss between the item-augmented embeddings and knowledge-item-augmented embeddings containing the same item to increase their consistency; The contrast loss calculation formula is as follows: Among them, S(·) is the cosine similarity of two vectors, N is the negative sample set, τ cl is the temperature hyperparameter, represents the embedding of the same item in the user-item interaction enhanced graph and the knowledge enhanced graph, and Representing the embeddings of different items in the user-item interaction augmented graph and the knowledge augmented graph; The item augmented embeddings and knowledge item augmented embeddings containing the same items are aggregated to generate the optimal item augmented embeddings.

9. The adaptive knowledge contrastive learning recommendation method based on dynamic attention network according to claim 1, characterized in that: Training the AKCL-DA using the user-item interaction graph and the knowledge graph specifically includes: The AKCL-DA is trained by joint training, and the objective function The calculation formula is as follows: Among them, λ1 and λ2 are hyperparameters, To evaluate the recommended results, is the contrast loss function of the contrastive learning module, is the regularization loss function of the knowledge graph, Among them, O={(u,i,j)|(u,i)∈O + ,(u,j)∈O - } is the observed interaction O + and unobserved interactions O - training data, represents the matching score between user u and item i, represents the matching score between user u and item j, Among them, h' and t' are entities other than h and t in the knowledge graph, respectively, f(·) represents the score function of the triple in the knowledge graph, G k Represents a knowledge graph and is defined as follows: Among them, e h and represents the representation of h, t and r in the knowledge graph triple (h, t, r), Represents the transformation matrix of the relational space, projecting from the d-dimensional entity space to the k-dimensional relational space.

10. An adaptive knowledge contrastive learning recommendation system based on dynamic attention network, characterized in that: include: A user input module, used to input the user-item historical interaction records of the target user and generate a corresponding user-item interaction graph; A graph enhancement module, used to perform data enhancement on the user-item interaction graph and the preset knowledge graph to generate a user-item enhanced graph and a knowledge enhanced graph; A node updating module, used for updating and aggregating nodes of the user-item interaction graph, the user-item enhancement graph and the knowledge enhancement graph, and generating user embedding, item embedding, user enhancement embedding, item enhancement embedding and knowledge entity enhancement embedding; A local contrastive learning module, used for contrastive learning and aggregation of the project enhanced embedding and the knowledge project enhanced embedding to generate a project-entity enhanced embedding; Item matching module: used to merge the user embedding and the user enhanced embedding to obtain a final user embedding, merge the item embedding and the optimal item enhanced embedding to obtain a final item embedding, and calculate the matching score of the final user embedding and the final item embedding; The project recommendation module is used to generate project recommendation results for target users, and the project recommendation results are a set of projects corresponding to the high matching scores.

Citation Information

Cited By

  • Web service causal depolarization recommendation method based on attention enhancement contrast learning

    CN121681928A

  • Web service causal debiasing recommendation method based on attention-enhanced contrastive learning

    CN121681928B