A course recommendation system based on a knowledge graph and a graph attention network
By developing a course recommendation system based on knowledge graphs and graph attention networks, we have solved the cold start and data scarcity problems of collaborative filtering algorithms in large knowledge graphs, provided rich semantic association information of items, and improved the accuracy and interpretability of the recommendation system.
Patent Information
- Application Number
- CN202211602359.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-13
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2042-12-13
AI Technical Summary
Existing collaborative filtering algorithms suffer from limitations in recommendation systems due to cold start and sparse data. Furthermore, knowledge graph-based recommendation models ignore the importance users place on different relationships between items, making them difficult to apply in large knowledge graphs. Additionally, spatial vector models lose information about the relationships between entity classes.
A course recommendation system based on knowledge graphs and graph attention networks is adopted. Through the domain knowledge graph construction module, the knowledge representation learning CTransD module, and the graph attention network CTransD-GAT module, the system uses a top-down construction approach to abstract and generalize domain knowledge, embed entities and relationships, calculate the weight of relationships to users by combining attention mechanisms, and reduce the number of entity projections by clustering algorithms to generate new node representations.
It provides rich semantic association information for items, solves the problem that recommendation models ignore the importance that users attach to different relationships between items, improves the performance of recommendation systems in large knowledge graphs, and enhances the accuracy and interpretability of recommendations.
Smart Images

Figure CN115840853B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of course recommendation technology, and in particular to a course recommendation system based on knowledge graphs and graph attention networks. Background Technology
[0002] In an era of information overload, the task of recommender systems is to connect users and items. On the one hand, it helps users discover items that are valuable to them; on the other hand, it ensures that items are displayed to users who are interested in them, thus achieving a win-win situation for both consumers and producers. Recommender systems play a vital role in various online services. Collaborative filtering, as one of the classic recommender algorithms, embeds user and item vectors based on a user-item rating matrix, simulating user preferences through inner product operations. However, collaborative filtering suffers from limitations in recommendation performance due to cold start and sparse data, and it is also difficult to explain the reasons behind the recommendation results.
[0003] To address the aforementioned shortcomings, knowledge graph-based recommender systems have become a research hotspot in recent years. This is because knowledge graphs contain item attributes and various types of relational information, providing rich semantic information for recommender systems. Embedding methods embed entities and relations from the knowledge graph into a continuous, dense, low-dimensional vector space. This low-dimensional, dense vectorized representation is then fused with the item and user embedding vectors from the original recommender system. Knowledge graph embedding algorithms are divided into two categories: translation-based models, such as TransE, TransH, TransR, and TransD, and semantic matching models, such as DistMult. However, the TransD model has many parameters and lacks correlation with entity representations, making it difficult to apply to large knowledge graphs. Furthermore, existing knowledge graph-based recommender models ignore the varying degrees of importance users place on different relationships within items. Summary of the Invention
[0004] To address the aforementioned issues, this invention proposes a course recommendation system based on knowledge graphs and graph attention networks. This system enables knowledge representation learning to be better applied to large-scale knowledge graphs, providing rich semantic association information for the recommendation system, compensating for the deficiency of spatial vector models in losing relational information between entity classes, and solving the problem that recommendation models ignore the different levels of importance users attach to different relationships between items.
[0005] To achieve the above-mentioned objectives of the present invention, the technical solution adopted by the present invention is as follows:
[0006] A course recommendation system based on knowledge graphs and graph attention networks includes a domain knowledge graph construction module, a knowledge representation learning module (CTransD), a graph attention network module (CTransD-GAT), and a rating prediction module.
[0007] The domain knowledge graph construction module adopts a top-down construction approach, abstracts and summarizes domain knowledge, obtains entity concepts of the domain knowledge graph, defines entity class, object attributes, data attributes, value range and constraints for each entity concept in the domain, constructs the domain knowledge graph ontology library, obtains data from the dataset, extracts the entity, attribute and relation elements required by the knowledge graph, instantiates the ontology library, and forms structured knowledge stored in the knowledge graph;
[0008] The knowledge representation learning CTransD module embeds entities and relations in the knowledge graph into a continuous, dense, low-dimensional vector space to form initial embedding vectors for users, courses, and relations, which are used to characterize the course semantic information of the recommendation system.
[0009] The CTransD-GAT graph attention network module calculates the weight of a relation to a user in the knowledge graph through an attention mechanism. It uses the inner product of the user's embedding vector and the relation's embedding vector to represent the importance of the relation to the user. Entity nodes pass feature information to neighboring nodes according to the weight coefficients, and the entity nodes and the propagated neighboring nodes are embedded and aggregated to generate new node representations containing more information.
[0010] The rating prediction module: embeds the user's embedding vector e u With the aggregated course embedding vector e k Calculate the inner product to represent the probability of a user clicking on an item.
[0011] Furthermore, the knowledge representation learning module is an optimized CTransD module, and the model creation steps are as follows:
[0012] Step 1, Triple Extraction: Convert the data in the knowledge graph into a triple structure;
[0013] Step 2: Construct the triplet scoring function: For each triple (h, r, t), h is the head entity vector, r is the relation vector, and t is the tail entity vector. Using the K-Means clustering algorithm, entity vectors are clustered into k classes based on their similarity. Each entity vector belongs to one and only one cluster whose distance to its cluster center is minimized. The arithmetic mean of the clusters is calculated, and this mean is used as the entity cluster center. The center of the head entity is denoted as h. The neighborhood composed of head entities The center of the tail entity is denoted as Neighborhood composed of tail entities The center of the head and tail entity classes are defined as follows:
[0014]
[0015] After the head and tail entities are clustered, the head and tail projection matrix M is obtained. rh and M rt They are represented as follows:
[0016]
[0017]
[0018] The projected head entity h in relation space ⊥ Combined tail entity t ⊥ They are represented as follows:
[0019] h ⊥ =M rh h, t ⊥ =M rt t
[0020] Head entity h projected onto relation r plane ⊥ Combined tail entity t ⊥ Satisfy h ⊥ +rt ⊥ ≈0, the triplet score function is:
[0021]
[0022] Step 3: Construct negative triplets: For a given triplet, replace the head entity with probability P and the tail entity with probability 1-P to generate negative triplets, where probability P is:
[0023]
[0024] Where, N tph N represents the average number of tail entities corresponding to each head entity. hpt This represents the average number of head entities corresponding to each tail entity.
[0025] Step 4: Construct entity class centers and entity projection similarity: Use entity class centers to replace the entire entity class for class distance calculation, and measure the similarity of entity class centers using Euclidean distance. Defined as:
[0026]
[0027] The Euclidean distance is transformed into a probability representation of similarity using the normal distribution function. Select based on conditions Entity class center similarity probability Defined as:
[0028]
[0029] Entity Center Corresponding projection vector by Select based on conditions Entity projection vector similarity probability Defined as:
[0030]
[0031] By symmetrizing the conditional probability in the above equation, we obtain the symmetrized entity class center similarity probability. Similarity probability with entity projection vector Defined as:
[0032]
[0033]
[0034] Step 5: Perform gradient update based on the objective function: Use the triplet loss function and the KL divergence loss function as the objective function for the samples. The objective function is:
[0035]
[0036] Where (h,r,t)∈S represents the set of positive triples, and (h',r,t')∈S' represents the set of negative triples, generated by the negative triple construction strategy. The objective function uses the stochastic gradient descent algorithm to update the model parameters. Each Bernoulli sampling extracts a portion of triples, generating negative triples which are added to the triple dataset. γ represents the distance between the scores of positive and negative triples. The entities and relations in the set are normalized in their respective vector spaces, and the normalized vector data is used to train the model.
[0037] Furthermore, the creation steps for the graph attention network CTransD-GAT module are as follows:
[0038] Step 1: Calculate the user weight preference coefficient: The dot product of the user's embedding vector and the relation embedding vector represents the importance of the relation to the user. In the knowledge graph, the edge connecting the head and tail nodes is the weight. The weight coefficient is expressed as follows:
[0039]
[0040] Where e u and e r Let u and r represent the embedding vectors of user u and relation r, respectively. The weight coefficients are normalized using the softmax function, as shown below:
[0041]
[0042] in These are the normalized weight coefficients, and N(v) represents the set of neighboring nodes of node v.
[0043] Step S2, Feature Propagation and Aggregation: Propagate the feature vector to all neighbor nodes of all relation types, and sum the nodes by weight to obtain the feature vector of the entity neighborhood. The feature vector is represented as follows:
[0044]
[0045] The BI-Interaction aggregation function first adds the two vectors and performs a non-linear transformation, then performs a non-linear transformation by multiplying the elements of the two vectors, and finally adds the two vectors together, as shown below:
[0046]
[0047] Where W1, W2 ∈ R d′×d and b1, b2 ∈ R d Let be the trainable weight matrix and bias, σ be the ReLU activation function, and ⊙ denote the dot product.
[0048] Compared with the prior art, the present invention has the following beneficial effects:
[0049] (1) This invention makes full use of the domain knowledge graph knowledge, and provides accurate semantic association information for the recommendation system by its rich semantic relationships, which makes up for the defect of the spatial vector model in losing the relationship information between entity classes.
[0050] (2) In this invention, the CTransD module for knowledge representation learning reduces the number of entity projections through clustering algorithms, alleviating computational pressure and making it more applicable to large knowledge graphs. It also converts the distance relationships between entity classes into probabilistic representations, addressing the deficiency of no connection between entity representations after clustering. Experimental results on entity link prediction in knowledge graphs of various domains on three datasets show that the CTransD module improves both MeanRank and Hits@10 metrics. Therefore, the CTransD module provides accurate semantic association information and interpretability for subsequent recommendation algorithms.
[0051] (3) The CTransD-GAT module of this invention captures the attention of different users to different relationships with items through an attention mechanism. Entity nodes transmit feature information to neighboring nodes according to weight coefficients, and embed and aggregate entity nodes with the propagated neighboring nodes to generate new node representations containing more information. This solves the problem that recommendation modules ignore the different levels of importance that users attach to different relationships with items. Extensive comparative and ablation experiments on three real datasets show that the proposed module has a significant performance improvement compared to other state-of-the-art models. Attached Figure Description
[0052] Figure 1 This is a schematic diagram of the system framework of the present invention.
[0053] Figure 2 This is a schematic diagram of the knowledge graph construction module in the field of this invention.
[0054] Figure 3 This is a schematic diagram of the CTransD module for knowledge representation learning in this invention.
[0055] Figure 4 This is a schematic diagram of the CTransD-GAT graph attention network module of the present invention.
[0056] Figure 5 This is an experimental result diagram of the Top-k recommendation of the CTransD-GAT module of the graph attention network in this invention.
[0057] (a) is the accuracy of each model on the MoocCube dataset, (b) is the accuracy of each model on the MovieLens-25M dataset, (c) is the accuracy of each model on the Book-Crossing dataset, (d) is the recall of each model on the MoocCube dataset, (e) is the recall of each model on the MovieLens-25M dataset, and (f) is the recall of each model on the Book-Crossing dataset. Detailed Implementation
[0058] The following figures and embodiments further illustrate the present invention, and the implementation of the present invention includes, but is not limited to, the following embodiments.
[0059] Example 1
[0060] like Figure 1As shown, a course recommendation system based on knowledge graphs and graph attention networks includes a domain knowledge graph construction module, a knowledge representation learning (CTransD) module, a graph attention network (CTransD-GAT) module, and a rating prediction module. In the domain knowledge graph construction module, this invention adopts a top-down construction approach, abstracting and summarizing domain knowledge to obtain entity concepts of the domain knowledge graph. For each entity concept in the domain, entity class, object attributes, data attributes, value range, and constraints are defined to construct a domain knowledge graph ontology. Data is obtained from the dataset to extract the necessary elements of the knowledge graph (entities, attributes, and relationships), instantiating the ontology and forming structured knowledge stored in the knowledge graph. In the knowledge representation learning (CTransD) module, this invention embeds entities and relationships from the knowledge graph into a continuous, dense, low-dimensional vector space, forming users, courses, and relationships. The initial embedding vector is used to characterize the semantic information of the courses in the recommendation system; the graph attention network CTransD-GAT module calculates the weight of the relationship to the user in the knowledge graph through the attention mechanism. The inner product of the user's embedding vector and the relationship embedding vector represents the importance of the relationship to the user. The entity node transmits the feature information to the neighboring nodes according to the weight coefficient, and the entity node and the propagated neighboring nodes are embedded and aggregated to generate a new node representation containing more information; the rating prediction module takes the inner product of the user's embedding vector and the aggregated course embedding vector as the probability value of the user clicking on the course.
[0061] The domain knowledge graph construction module of this invention acquires knowledge from domain datasets, obtaining semi-structured and unstructured data. Then, it cleans the data, performs preprocessing and manual verification to fill in missing values, abstracts and summarizes domain knowledge, and constructs an educational domain knowledge graph ontology. Through knowledge extraction, it instantiates the ontology and attributes in the ontology and stores the data in a Neo4j database, completing the construction of the domain knowledge graph. Specifically, as follows... Figure 2 As shown.
[0062] The framework of the CTransD module for knowledge representation learning is as follows: Figure 3 As shown, this invention uses a clustering algorithm to cluster entities to reduce the number of entity projections, making it more suitable for large knowledge graphs. Then, this invention converts the distance relationships between entity classes into probabilistic representations, addressing the deficiency of no connection between entity representations after clustering. The specific process is as follows:
[0063] Triple extraction: Converting data in a knowledge graph into a triple structure;
[0064] Constructing the triplet scoring function: For each triple (h, r, t), h is the head entity vector, r is the relation vector, and t is the tail entity vector. Using the K-Means clustering algorithm, entity vectors are clustered into k classes based on their similarity. Each entity vector belongs to exactly one cluster whose distance to its cluster center is minimized. The arithmetic mean method is used to calculate the average of the clusters, and this average is used as the entity class center. The center of the head entity is denoted as... The neighborhood composed of head entities The center of the tail entity is denoted as Neighborhood composed of tail entities The head and tail entity class centers are defined respectively.
[0065]
[0066] After the head and tail entities are clustered, the head and tail projection matrix M is obtained. rh and M rt They are represented as follows:
[0067]
[0068]
[0069] The projected head entity h in relation space ⊥ Combined tail entity t ⊥ They are respectively represented as
[0070] h ⊥ =M rh h, t ⊥ =M rt t
[0071] Head entity h projected onto relation r plane ⊥ Combined tail entity t ⊥ Satisfy h ⊥ +rt ⊥ ≈0, the triplet score function is
[0072]
[0073] Constructing negative triplets: For a given triplet, replace the head entity with probability P and the tail entity with probability 1-P to generate negative triplets, where probability P is...
[0074]
[0075] Where, N tph N represents the average number of tail entities corresponding to each head entity. hpt This represents the average number of head entities corresponding to each tail entity.
[0076] Constructing entity class centers and entity projection similarity: Entity class centers are used to represent the entire entity class for class distance calculation. The similarity of entity class centers is measured using Euclidean distance. Entity class center similarity... for:
[0077]
[0078] The Euclidean distance is transformed into a probability representation of similarity using the normal distribution function. Select based on conditions Entity class center similarity probability Defined as:
[0079]
[0080] Entity Center Corresponding projection vector by Select based on conditions Entity projection vector similarity probability Defined as:
[0081]
[0082] By symmetrizing the conditional probability in the above equation, we obtain the symmetrized entity class center similarity probability. Similarity probability with entity projection vector Defined as:
[0083]
[0084]
[0085] Gradient updates are performed based on the objective function: the triplet loss function and the KL divergence loss function are used as the objective function for the samples. The objective function is:
[0086]
[0087] Where (h,r,t)∈S represents the set of positive triples, and (h',r,t')∈S' represents the set of negative triples, generated by the negative triple construction strategy. The objective function uses the stochastic gradient descent algorithm to update the model parameters. Each Bernoulli sampling extracts a portion of triples, generating negative triples which are added to the triple dataset. γ represents the distance between the scores of positive and negative triples. The entities and relations in the set are normalized in their respective vector spaces, and the model is trained using the normalized vector data.
[0088] The graph attention network CTransD-GAT module, such as Figure 4As shown, this invention uses the initial vector obtained from knowledge graph representation learning to calculate user weight coefficients through a graph attention network. Based on these weight coefficients, it performs propagation and aggregation operations on node information to generate new node representations. The specific process is as follows:
[0089] Calculate user preference weights: The dot product of the user's embedding vector and the relation's embedding vector represents the importance of that relation to the user. In the knowledge graph, the edges connecting the head and tail nodes represent the weights, and the weight coefficients are expressed as follows:
[0090]
[0091] Where e u and e r Let u and r represent the embedding vectors of user u and relation r, respectively. The weight coefficients are normalized using the softmax function, as shown below:
[0092]
[0093] in These are the normalized weight coefficients, and N(v) represents the set of neighboring nodes of node v.
[0094] Feature propagation and aggregation: Propagate the feature vector of the entity neighborhood by summing the weighted sums of the neighboring nodes for all relation types.
[0095]
[0096] The BI-Interaction aggregation function first adds the two vectors and performs a non-linear transformation, then performs a non-linear transformation by multiplying the elements of the two vectors, and finally adds the two vectors together, as shown below:
[0097]
[0098] Where W1, W2 ∈ R d′×d and b1, b2 ∈ R d Let be the trainable weight matrix and bias, σ be the ReLU activation function, and ⊙ denote the dot product.
[0099] The rating prediction module of this invention uses the user embedding vector e u With the aggregated item embedding vector e k Calculate the inner product to represent the probability of a user clicking on an item. It is expressed as follows:
[0100]
[0101] Where the prediction function This is an inner product operation used to describe the predicted rating between user u and course k.
[0102] To verify the feasibility of this invention, the applicant also conducted relevant experiments, as follows:
[0103] Datasets: To verify the performance of the module in this invention, three public experimental datasets from the fields of education, film, and books were used. These are the MoocCube dataset, an open-source large-scale data warehouse serving MOOC-related research; the MovieLens-25M dataset provided by the MovieLens website; and the Book-Crossing dataset, a book rating dataset compiled by Cai-Nicolas Ziegler based on data from bookcrossing.com. Basic information about the three datasets is shown in Table 1.
[0104] Table 1. Basic information about the dataset
[0105]
[0106]
[0107] Comparative Experiment: This invention selects four baseline models with outstanding performance in the field of knowledge representation learning and four baseline models with outstanding performance in the field of recommendation models for comparative experiments.
[0108] The four baseline models in the field of knowledge representation learning are: TransE, TransH, TransR, and TransD.
[0109] The four baseline models that stand out in the recommendation model field are:
[0110] CKE: A model that integrates knowledge graphs and collaborative filtering, while also employing the TransR heterogeneous network embedding method.
[0111] LibFM: A model based on eigenma factorization, which uses stacked gradient descent (SGD) and alternating least squares (ALS) for optimization.
[0112] RippleNet: A water wave network model that introduces preference propagation into a recommendation model that integrates knowledge graphs.
[0113] NGCF: Neural Graph Collaborative Filtering Model, which embeds a bipartite graph representation of user items into the encoding.
[0114] Experimental Setup: To ensure fair comparison, for the baseline model, the parameter settings were first based on the original text, and then the comparison model was optimized as much as possible based on these settings. For the CTransD model, the learning rate ε was set to a range of {0.01, 0.001, 0.0001}, the margin γ was selected from {0.25, 0.5, 1, 2}, the embedding dimensions m and n for entities and relations were selected from {20, 50, 80, 100}, the batch size B was selected from {100, 200, 1000, 1400}, and the number of clusters k was selected from {20, 50, 100, 200}. For the CTransD-GAT model, the number of neighbors and the number of hops for each node were 4 and 2, respectively. Ten experiments were conducted for each combination configuration, with a maximum of 500 iterations. The average of the experimental results was then used to determine the optimal parameter configuration.
[0115] Experimental Results: The knowledge representation learning module of this invention uses a ranking-based approach, a common scenario for link prediction, to evaluate the quality of the module. Two evaluation criteria are used to assess the quality of the model: MeanRank: the average ranking of the correct entity scoring function, and Hits@10: the probability of the correct entity ranking in the top 10.
[0116] This invention's graph attention network module, designed for Top-N recommendation tasks, uses precision@K and recall@K to measure the recommendation system's ability to correctly predict whether a user likes or dislikes a particular item. Assuming N... TP N FP N FN N TN These represent the following: the system recommends the product to the user and the user likes it; the system recommends the product to the user but the user doesn't like it; the user likes it but the system doesn't recommend it; and the user dislikes it and the system doesn't recommend it. Precision is defined as follows:
[0117]
[0118] Recall rate is defined as follows:
[0119]
[0120] This invention's graph attention network module uses AUC and F1 to measure the performance of the recommendation system for click-through rate prediction. AUC, the area under the ROC curve, represents the extent to which the recommendation system can distinguish between items a user likes and dislikes. The definition of AUC is as follows:
[0121]
[0122] F1 score considers both accuracy and recall to comprehensively reflect system performance. The F1 score is defined as follows:
[0123]
[0124] The experimental results of entity link prediction for knowledge graphs in various domains in the three datasets are shown in Table 2. The results show that the CTransD model of this invention improves on both metrics compared to the baseline model, and the CTransD model of this invention has better representation learning ability than other baseline models.
[0125] Table 2 Experimental Results of the CTransD Model
[0126]
[0127] Top-K recommendation and click-through rate prediction experiments were conducted on the baseline model and the CTransD-GAT model of this invention. The precision and recall of each model were obtained on three datasets, as follows: Figure 5 As shown in the figure, the AUC and F1 of each model are shown in Table 3.
[0128] Table 3. Results of the Click-Through Rate Prediction Experiment
[0129]
[0130] The CTransD-GAT model of this invention outperforms other models in both AUC and F1 scores across three datasets. In Top-k recommendation, the precision of all models decreases while the recall increases with the increase of K. Among the three datasets, the LibFM model has slightly lower accuracy compared to other models that integrate knowledge graphs, indicating that introducing knowledge graphs as auxiliary information in recommendation effectively extracts the feature vectors of items and improves the quality of recommendations. The CTransD-GAT model of this invention significantly outperforms other models that only integrate knowledge graphs, demonstrating that incorporating graph attention networks effectively propagates and aggregates neighborhood information based on weight information, improving recommendation accuracy and showcasing the effectiveness of this model.
Claims
1. A course recommendation system based on knowledge graphs and graph attention networks, characterized in that, It includes a domain knowledge graph construction module, a knowledge representation learning module (CTransD), a graph attention network (CTransD-GAT) module, and a rating prediction module; The domain knowledge graph construction module adopts a top-down construction approach, abstracts and summarizes domain knowledge, obtains entity concepts of the domain knowledge graph, defines entity class, object attributes, data attributes, value range and constraints for each entity concept in the domain, constructs the domain knowledge graph ontology library, obtains data from the dataset, extracts the entity, attribute and relation elements required by the knowledge graph, instantiates the ontology library, and forms structured knowledge stored in the knowledge graph; The construction steps of the knowledge representation learning CTransD module are as follows: Step S1, Triple Extraction: Convert the data in the knowledge graph into a triple structure; Step S2: Construct the triplet scoring function: For each triple (h, r, t), h is the head entity vector, r is the relation vector, and t is the tail entity vector. Using the K-Means clustering algorithm, entity vectors are clustered into k classes based on their similarity. Each entity vector belongs to one and only one cluster whose distance to its cluster center is minimized. The arithmetic mean of the clusters is calculated, and this mean is used as the entity cluster center. The center of the head entity is denoted as h. The neighborhood composed of head entities The center of the tail entity is denoted as The neighborhood formed by tail entities For i, j∈{1,2,…,k}, the head and tail entity class centers are defined as follows: , , After the head and tail entities are clustered, the head and tail projection matrix is obtained. and They are represented as follows: , , Head entity projected in relation space Tail-end entity They are represented as follows: , , Head entity projected onto relation r plane Tail-end entity satisfy The triplet scoring function is: , Step S3: Construct negative triplets: For a given triplet, replace the head entity with probability P and the tail entity with probability 1-P to generate negative triplets, where probability P is: , In the formula, This represents the average number of tail entities corresponding to each head entity. This represents the average number of head entities corresponding to each tail entity. Step S4: Construct entity class centers and entity projection similarity: Use entity class centers to replace the entire entity class for class distance calculation, and measure the similarity of entity class centers using Euclidean distance. for: , The Euclidean distance is transformed into a probability representation of similarity using the normal distribution function. Select based on conditions Entity class center similarity probability Defined as: , Entity Center Corresponding projection vector ,by Select based on conditions Entity projection vector similarity probability Defined as: , By symmetrizing the conditional probability in the above equation, we obtain the symmetrized entity class center similarity probability. Similarity probability with entity projection vector Defined as: , , , , Step S5: Perform gradient update based on the objective function: Use the triplet loss function and the KL divergence loss function as the objective function for the samples. The objective function is: , In the formula, Denotes the set of triples in the middle. The set of negative triplets is generated by a negative triplet construction strategy. The objective function updates the model parameters using the stochastic gradient descent algorithm. Each Bernoulli sampling extracts a portion of triplets, generating negative triplets which are added to the triplet dataset. γ represents the distance between the scores of positive and negative triplets. Entities and relations in the set are normalized in their respective vector spaces, and the model is trained using the normalized vector data. The graph attention network CTransD-GAT module calculates the weight of relations to users in the knowledge graph through an attention mechanism. The inner product of the user's embedding vector and the relation's embedding vector represents the importance of the relation to the user. Entity nodes transmit feature information to neighboring nodes according to the weight coefficients, and the entity nodes and the propagated neighboring nodes are embedded and aggregated to generate new node representations containing more information. The construction steps of the CTransD-GAT graph attention network module are as follows: Step S1: Calculate the user weight preference coefficient: The dot product of the user's embedding vector and the relation embedding vector represents the importance of the relation to the user. In the knowledge graph, the edge connecting the head and tail nodes is the weight. The weight coefficient is expressed as follows: , In the formula, and Let u and r represent the embedding vectors of user u and relation r, respectively. The weight coefficients are normalized using the softmax function, as shown below: , In the formula, These are the normalized weight coefficients, and N(v) represents the set of neighboring nodes of node v. Step S2, Feature Propagation and Aggregation: Propagate the feature vector to all neighbor nodes of all relation types, and sum the nodes by weight to obtain the feature vector of the entity neighborhood. The feature vector is represented as follows: , The BI-Interaction aggregation function first adds the two vectors and performs a non-linear transformation, then performs a non-linear transformation by multiplying the elements of the two vectors, and finally adds the two vectors together, as shown below: , In the formula, and Let σ be the trainable weight matrix and bias, and σ be the ReLU activation function. Dot product; The rating prediction module: embeds user vectors With the aggregated course embedding vector Calculate the inner product to represent the probability of a user clicking on an item. , .
Citation Information
Patent Citations
User interest prediction method based on iterative graph attention network and electronic device
CN112380427A
Personalized recommendation method based on knowledge graph
CN114461927A