Course recommendation method based on interactive attention and contrast learning
By combining guided attention and contrastive learning, the problem of unbalanced neighbor weights in graph convolution methods is solved, and the accuracy and robustness of course recommendations on online education platforms are improved, especially in the case of sparse data and user cold start.
Patent Information
- Application Number
- CN202510732682.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-03
- Publication Date
- 2025-09-05
AI Technical Summary
Existing graph convolution methods lack fine-grained distinction of the importance of different neighbors in recommendation systems, resulting in degraded performance in sparse or noisy interaction graphs, and insufficient model robustness and generalization ability when facing user cold starts and changes in interests.
The interactive attention graph convolution module is used to calculate the weights of neighbor nodes through guided attention coefficients, and combined with multi-layer graph convolutional network propagation and contrastive learning optimization to generate personalized learning content recommendations.
It significantly improves the high-order semantic modeling capabilities, enhances the model's robustness and recommendation accuracy in sparse data and cold start scenarios, and is suitable for personalized recommendations on online education platforms.
Smart Images

Figure CN120596740A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of recommendation algorithm technology, and in particular to a recommendation method in a course recommendation scenario, and specifically to a graph collaborative filtering course recommendation method based on interactive attention and contrastive learning. Background Art
[0002] With the rapid development of online education platforms, the number of course resources available to users is increasing. Traditional collaborative filtering-based recommendation methods (such as matrix decomposition and neighbor-based methods) are unable to effectively capture complex user-course interactions, resulting in limited recommendation performance. In recent years, graph neural network (GNN) technology has been introduced into recommendation systems, which can model high-order interaction features through neighbor aggregation and improve recommendation effectiveness. However, existing graph convolutional methods typically treat all neighbors equally and lack fine-grained differentiation of the importance of different neighbors, resulting in performance degradation in sparse or noisy interaction graphs. In addition, traditional methods still suffer from insufficient representation when faced with problems such as user cold starts and changing interests.
[0003] Attention, as an important means of improving feature selection, has been widely used in natural language processing and graph learning. Some recommendation models based on graph attention networks (GATs) have begun to attempt to assign dynamic weights to different neighbors to highlight the information contributions of key neighbors. However, current mainstream methods mostly calculate attention scores based on the target node's own features, ignoring the specific guiding relationships with interacting peer nodes (such as courses or users). Furthermore, existing recommendation methods typically independently optimize a single task and lack a mechanism for comparative learning in the representation space to enhance representation consistency. This results in insufficient robustness and generalization capabilities in the face of dynamic preferences and noise perturbations. Summary of the Invention
[0004] In order to solve the above problems, the present invention discloses a graph collaborative filtering course recommendation method based on interactive attention and contrastive learning, comprising the following steps:
[0005] 1) Collect learning log data of users on the online course platform for registered courses, including course clicks, viewing time, test results, learning paths and other log information;
[0006] 2) Based on the historical interactions between users and learning content, a user-course bipartite graph is constructed. The vertices of the graph include user nodes and course nodes, and the edges represent the user's effective interaction with the course.
[0007] 3) Using the interactive attention graph convolution module, the attention scores of neighboring nodes are calculated for each target node as a guide. The guided attention coefficient is obtained by weighting the vector dot product between the target node and its neighbor nodes and normalizing it with a temperature parameter to enhance the structural information of the neighbor nodes on the target node; thus generating the first-stage structural embedding;
[0008] 4) Perform multi-layer (one or two layers) graph convolutional network propagation operations on the first stage structure embedding, and realize local context information fusion through neighbor embedding aggregation;
[0009] 5) Random noise perturbations are applied to the fused representation to generate enhanced views, and contrastive representation pairs of users and courses are constructed. By maximizing the consistency of positive samples between different views and minimizing the similarity of negative samples, contrastive learning optimization is achieved.
[0010] 6) The final embedded representation is input into the ranking and scoring module, and the ranking loss function is optimized by combining the ranking signals of positive and negative samples in the training set to finally generate a personalized learning content recommendation list.
[0011] Furthermore, the step 2) includes the following sub-steps:
[0012] 2.1) Set the total number of user nodes to U and the total number of course nodes to I, create a two-dimensional sparse interaction matrix freq_matrix of size [U, I], and for each interaction record (u, i) in the training set, set the value of freq_matrix[u][i] to 1;
[0013] 2.2) Construct the adjacency dictionary structures train_data_user and train_data_item for users and courses respectively, where train_data_user[u] records all course numbers interacted by user u, and train_data_item[i] records the user numbers interacted with course i;
[0014] 2.3) Initialize the user embedding matrix embedding_user and the course embedding matrix embedding_item respectively, with dimensions [U, D] and [I, D], where D is a fixed dimension and initialized using a standard normal distribution with a mean of 0 and a standard deviation of 0.1;
[0015] 2.4) Save freq_matrix, embedding_user, and embedding_item in GPU tensors as input for subsequent graph structure propagation.
[0016] Furthermore, the step 3) includes the following sub-steps:
[0017] 3.1) Set the target node to p∈{u,i] and the guide node to g∈{i,u], where u represents the user node and i represents the course node. For each user-course interaction pair (u,i) in the training set, construct two directional edges: one from the user to the course, and one from the course index plus the offset U to the user. These edges are concatenated to form the edge index tensor edge_index.
[0018] (3.2) For each neighbor c∈N of the target node p p , extract the original embedding vector of the guide node g from the first layer embedding And the embedding vector e of the neighbor nodes in the current layer c , calculate the dot product of the two and divide it by the temperature parameter τ, recorded as the unnormalized attention score:
[0019]
[0020] 3.3) For all neighbors c∈N of the target node p p The unnormalized attention scores are softmaxed to obtain the normalized attention weights:
[0021]
[0022] 3.4) Use normalized weight α p,c |g performs weighted aggregation on the current representations of neighbor nodes to obtain the next layer embedding of the target node under the guidance of the guide node g:
[0023]
[0024] 3.5) Repeat the above propagation process for K layers, and average and fuse the node embeddings of all layers to finally obtain the user and course embedding vectors with enhanced structure.
[0025] Furthermore, the graph convolution propagation process in step 4) includes the following steps:
[0026] 4.1) In each layer of propagation, the node embeddings are symmetrically normalized and aggregated using the adjacency graph, and the representation vector of each node is updated;
[0027] 4.2) Save the embedding of each layer output as an intermediate representation of the multi-layer structure information;
[0028] 4.3) After the propagation is completed, the embeddings of all layers are averaged to generate the final fused graph convolutional representation;
[0029] 4.4) Split the fused representation into user and course nodes to obtain updated user embedding and course embedding respectively.
[0030] Furthermore, step 5) includes the following sub-steps:
[0031] 5.1) Apply random noise perturbation to the fused representation of users and courses to generate enhanced views and perturb the representation of users and courses;
[0032] 5.2) Construct contrastive representation pairs of users and courses through a contrastive learning framework, where positive samples consist of different views of the same user or course, and negative samples are generated by randomly selecting different users or courses;
[0033] 5.3) Calculate the contrast loss using the InfoNCE loss function, where the consistency of positive samples is maximized by maximizing their similarity, and the similarity of negative samples is minimized to reduce interference;
[0034] 5.4) For users and courses, calculate the contrastive loss for users and courses respectively, and perform a weighted sum of the two to obtain the final contrastive learning loss;
[0035] Furthermore, the step 6) includes the following steps:
[0036] 6.1) Using the final user embedding and course embedding optimized by contrastive learning, calculate the predicted score of each user for all courses. The predicted score is obtained by the inner product of the vector of the user embedding and the course embedding;
[0037] 6.2) Based on the positive sample interaction data in the training set, a corresponding negative sample is sampled for each user's positive sample. The negative sample is a random course that the user has not interacted with;
[0038] 6.3) Construct a triplet (u, i, j), where u represents the user, i represents the positive sample course that the user has interacted with, and j represents the negative sample course that the user has not interacted with;
[0039] 6.4) A loss function based on Bayesian Personalized Ranking (BPR) is used to calculate the ranking difference between positive and negative sample pairs. The loss function is defined as:
[0040]
[0041] Among them, s ui represents the predicted score of user u for the positive sample course i, S uj represents the predicted score of user u for negative sample course j, σ represents the sigmoid function;
[0042] 6.5) Set the sorting loss L bpr With contrastive learning loss L cl The weighted sum is used as the final optimization target for back propagation and parameter update.
[0043] 6.6) The model is trained by optimizing the objective function and gives the top-N recommended courses.
[0044] The beneficial effects of the present invention are: by introducing a guided interactive attention mechanism, dynamic adjustment of the target node's neighbor information aggregation process is achieved, the high-order semantic modeling capability is significantly improved, and the problem of uniformly averaging neighbor weights in traditional graph neural networks is overcome; further, by introducing a multi-view comparative learning module to construct positive and negative sample pairs and jointly optimizing the InfoNCE loss function, the robustness and discrimination ability of node representation in cold start, data sparsity or interest drift scenarios are improved; in addition, the present invention adopts a joint training framework of structural embedding, graph convolution propagation and ranking supervision to optimize collaborative representation and ranking performance end-to-end, while ensuring the model's expressive ability and maintaining low complexity, and has good engineering deployment adaptability and cross-scenario migration capabilities. It is particularly suitable for recommendation system scenarios with sparse interactive behavior characteristics such as online education, and can significantly improve the accuracy of personalized recommendations and the scalability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 This is a flowchart of the graph collaborative filtering course recommendation method based on interactive attention and contrastive learning.
[0046] Figure 2 This is a model structure diagram of the graph collaborative filtering course recommendation method based on interactive attention and contrastive learning. DETAILED DESCRIPTION
[0047] The present invention will be described in detail below with reference to the accompanying drawings. Unless there is any conflict, the features of the following embodiments and implementations may be combined with each other.
[0048] like Figure 1 As shown, the embodiment of the present invention provides a graph collaborative filtering course recommendation method based on interactive attention and contrastive learning, which includes the following steps:
[0049] Step 1: Collect learning log data of users on the online course platform for their registered courses, such as when and what kind of interaction a user performs on a course.
[0050] Step 2: Construct a user-course bipartite graph structure based on the historical interaction behavior between users and learning content. The vertices of the graph include user nodes and course nodes, and the edges represent the user's effective interaction behavior with the course.
[0051] (2.1) Set the total number of user nodes to U and the total number of course nodes to I, create a two-dimensional sparse interaction matrix freq_matrix of size [U, I], and for each interaction record (u, i) in the training set, set the value of freq_matrix[u][i] to 1;
[0052] (2.2) Construct the adjacency dictionary structures train_data_user and train_data_item for users and courses respectively, where train_data_user[u] records all course numbers interacted by user u, and train_data_item[i] records the user numbers interacted with by course i;
[0053] (2.3) Initialize the user embedding matrix embedding_user and the course embedding matrix embedding_item respectively, with dimensions [U, D] and [I, D], where D is a fixed dimension and is initialized using a standard normal distribution with a mean of 0 and a standard deviation of 0.1;
[0054] (2.4) Save freq_matrix, embedding_user, and embedding_item in GPU tensors as input for subsequent graph structure propagation.
[0055] Step 3: Using the interactive attention graph convolution module, the attention score of each target node is calculated by taking its neighbor nodes as a guide item. The guided attention coefficient is obtained by weighting the vector dot product between the target node and the neighbor nodes and normalizing it with the temperature parameter to enhance the structural information of the neighbor nodes on the target node and generate the first-stage structural embedding.
[0056] 3.1) Set the target node to p∈{u,i} and the guide node to g∈{i,u}, where u represents the user node and i represents the course node. For each user-course interaction pair (u,i) in the training set, construct two directional edges: one from the user to the course, and the other from the course index plus the offset u to the user. These edges are concatenated to form the edge index tensor edge_index.
[0057] 3.2) For each neighbor c∈N of the target node p p , extract the original embedding vector of the guide node g from the first layer embedding And the embedding vector e of the neighbor nodes in the current layer c , calculate the dot product of the two and divide it by the temperature parameter τ, recorded as the unnormalized attention score:
[0058]
[0059] 3.3) For all neighbors c∈N of the target node p p The unnormalized attention scores are softmaxed to obtain the normalized attention weights:
[0060]
[0061] 3.4) Use normalized weight α p,c |g performs weighted aggregation on the current representations of neighbor nodes to obtain the next layer embedding of the target node under the guidance of the guide node g:
[0062]
[0063] Among them, e k represents the k-order feature.
[0064] During this process, the dynamic weight calculation of the user (or course) embedding vector is guided by interactive similarity. This bidirectional interactive attention ensures that high-order feature propagation always revolves around the potential associations between the target user and course pair. For example, when predicting user u's interest in course i, the model prioritizes aggregating the characteristics of users with similar past course selections to i (e.g., aggregating learners of the "Deep Learning" course with those who have taken the "Machine Learning" course), while also strengthening neighboring courses with similar interests to u (e.g., associating the "Python Programming" course with the "Data Analysis" course). Through multi-layer stacking, the representations of the target user and course gradually integrate co-occurrence patterns and semantic associations in the interaction path, ultimately generating an embedding vector containing multi-order collaborative signals, providing a fine-grained discriminant basis for preference prediction.
[0065] Step 4: Perform a multi-layer (one or two layers) graph convolutional network propagation operation on the first stage structure embedding, and realize local context information fusion through neighbor embedding aggregation.
[0066] 4.1) In each layer of propagation, the node embeddings are symmetrically normalized and aggregated using the adjacency graph, and the representation vector of each node is updated;
[0067] 4.2) Save the embedding of each layer output as an intermediate representation of the multi-layer structure information;
[0068] 4.3) After the propagation is completed, the embeddings of all layers are averaged to generate the final fused graph convolutional representation;
[0069] 4.4) Split the fused representation into user and course nodes to obtain updated user embedding and course embedding respectively.
[0070] Step 5: Apply random noise perturbation to the fused representation to generate enhanced views, and construct comparative representation pairs of users and courses. By maximizing the consistency of positive samples between different views and minimizing the similarity of negative samples, comparative learning optimization is achieved.
[0071] (5.1) Apply random noise perturbation to the fusion representation of users and courses to generate enhanced views and perturb the representation of users and courses;
[0072] (5.2) Construct contrastive representation pairs of users and courses through a contrastive learning framework, where positive samples consist of different views of the same user or course, and negative samples are generated by randomly selecting different users or courses;
[0073] (5.3) Compute the contrast loss using the InfoNCE loss function, where the consistency of positive samples is maximized by maximizing their similarity, and the similarity of negative samples is minimized to reduce interference;
[0074] (5.4) For users and courses, calculate the contrastive loss of users and courses respectively, and perform a weighted sum of the two to obtain the final contrastive learning loss;
[0075] Traditional BPR loss only optimizes the ranking relationship between user-course pairs and has difficulty constraining the clustering of similar users / courses in the latent space. Contrastive learning directly improves the intra-class compactness and inter-class discrimination of the embedding space by bringing positive sample pairs (different views of the same entity) closer together and pushing negative sample pairs apart. At the same time, user preferences for courses not only rely on direct interactions but are also implicit in the selection patterns of similar users (such as the co-occurrence groups of "Machine Learning" and "Deep Learning" courses). Contrastive learning explicitly models such high-order collaborative signals through multi-view comparison, extracting robust features from limited interactions and improving the model's cold start accuracy.
[0076] Step 6: Input the final embedded representation into the ranking and scoring module, combine the ranking signals of positive and negative samples in the training set, optimize the ranking loss function, and finally generate a personalized learning content recommendation list.
[0077] (6.1) Using the final user embedding and course embedding optimized by contrastive learning, calculate the predicted score of each user for all courses. The predicted score is obtained by the inner product of the vector of user embedding and course embedding;
[0078] (6.2) Based on the positive sample interaction data in the training set, a corresponding negative sample is sampled for each user's positive sample. The negative sample is a random course that the user has not interacted with;
[0079] (6.3) Construct a triplet (u, i, j), where u represents the user, i represents the positive sample course that the user has interacted with, and jj represents the negative sample course that the user has not interacted with;
[0080] (6.4) The loss function based on Bayesian personalized ranking (BPR) is used to calculate the ranking difference between positive and negative sample pairs. The loss function is defined as:
[0081]
[0082] Among them, s ui represents the predicted score of user u for the positive sample course i, S ujrepresents the predicted score of user u for negative sample course j, σ represents the sigmoid function;
[0083] (6.5) The sorting loss L bpr With contrastive learning loss L cl The weighted sum is used as the final optimization goal for back propagation and parameter update. Therefore, the total loss function is:
[0084] L=L bpr +λL cl (5)
[0085] (6.6) The model is trained by optimizing the objective function, giving the Top - N recommended courses.
[0086] The following specific comparative experiments illustrate the superiority of the course recommendation method provided by the present invention.
[0087] Experimental design
[0088] The control group uses a standard graph convolutional network (GCN) for course recommendation. The model only relies on the adjacency matrix of the user-course interaction graph for information propagation, and does not introduce an attention mechanism or contrastive learning module. Its aggregation method is based on the mean calculation of the neighborhood nodes, and each layer is calculated by the formula
[0089]
[0090] Update the node representation, and finally generate the embedding vectors of users and courses through inter-layer weighted summation. The optimization target only includes Bayesian personalized ranking loss (BPRLoss). In contrast, the experimental group method of the present invention introduces a dynamic attention mechanism and a contrastive learning module based on the graph convolutional neural network: dynamic attention is achieved by fixing the initial embedding of the peer node (such as the initial embedding of the course when the user is aggregated). ), using vector dot product and temperature normalization to filter key neighbor nodes; the contrastive learning module generates noise perturbation samples after multi-layer graph convolution, maximizes the consistency of positive samples through InfoNCE loss, and jointly optimizes with BPR loss (L = L bpr +λL cl ) to improve the model robustness under sparse data.
[0091] Experimental process
[0092] The experiment was conducted on the MOOCCube dataset, an open education platform. The dataset, as shown in Table 1, contains 706 courses, 38,181 instructional videos, 106,056 concepts, and course selection and video viewing records of 199,199 users. After numerical encoding, the dataset was stratified by user ID to ensure no overlap in the training, validation, and test sets. The training, validation, and test sets were split into a 7:2:1 ratio. The control and experimental groups shared the same user-course bipartite graph structure and initial embedding dimension (d = 64). The control group employed a three-layer graph convolutional neural network with a learning rate of 0.001, optimizing only the Backpropagation Prediction (BPR) loss. The experimental group employed a two-layer interactive attention graph convolutional neural network with a temperature parameter τ = 0.5, a contrastive loss weight λ = 0.2, and a noise perturbation strength σ = 0.1. The BPR loss and contrastive learning loss were jointly optimized. Evaluation metrics included Recall@20 and NDCG@20.
[0093] Table 1 MoocCube dataset examples
[0094]
[0095] Test results
[0096] Specifically, the experimental results are shown in Table 2.
[0097] Table 2 Comparative analysis of experimental results
[0098]
[0099] As shown in Table 1, the experimental group comprehensively outperformed the control group's graph convolutional neural network model in recommendation performance: The experimental group's Recall@20 reached 0.562, a 19.1% improvement over the graph convolutional neural network's 0.472. This demonstrates that the interactive attention mechanism effectively captures key course nodes in high-level interactions, significantly improving recommendation coverage. The experimental group's NDCG@20 was 0.341, a 29.2% improvement over the graph convolutional neural network's 0.264. This demonstrates the enhanced ranking quality of contrastive learning, particularly in long-tail course recommendations, which more accurately matches users' potential interests.
[0100] Therefore, the enhanced method combining the interactive attention mechanism and contrastive learning proposed in the present invention screens key interactive relationships through the attention guided by the end nodes, and combines contrastive learning to improve the representation discriminability, which significantly improves the recommendation accuracy in cold start and data sparse scenarios, and is suitable for efficient course recommendations on online education platforms.
[0101] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A graph collaborative filtering course recommendation method based on interactive attention and contrastive learning, characterized by: The steps include: 1) Collect learning log data of users on the online course platform for registered courses, including course clicks, viewing time, test results, course collections and other log information; 2) Based on the historical interactions between users and learning content, a user-course bipartite graph is constructed. The vertices of the graph include user nodes and course nodes, and the edges represent the user's effective interaction with the course. 3) Adopting the interactive attention graph convolution module, the attention scores of neighboring nodes are calculated by taking each target node as a guide. The guided attention coefficient is obtained by weighting the vector dot product between the target node and its neighbor nodes and normalizing it with a temperature parameter. This is used to enhance the structural information of the neighbor nodes on the target node and generate the first-stage structural embedding. 4) Perform multi-layer (one or two layers) graph convolutional network propagation operations on the first stage structure embedding, and realize local context information fusion through neighbor embedding aggregation; 5) Random noise perturbations are applied to the fused representation to generate enhanced views, and contrastive representation pairs of users and courses are constructed. By maximizing the consistency of positive samples between different views and minimizing the similarity of negative samples, contrastive learning optimization is achieved. 6) The final embedded representation is input into the ranking and scoring module. The ranking signals of positive and negative samples in the training set are combined with the BPR ranking loss and contrast loss for multi-task learning. The ranking loss function is optimized, and the candidate courses are sorted in descending order according to the predicted scores. The top-N personalized recommendation list is output.
2. The graph collaborative filtering course recommendation method based on interactive attention and contrastive learning according to claim 1 is characterized in that: The step 2) includes the following sub-steps: 2.1) Set the total number of user nodes to U and the total number of course nodes to I, create a two-dimensional sparse interaction matrix freq_matrix of size [U, I], and for each interaction record (u, i) in the training set, set the value of freq_matrix[u][i] to 1; 2.2) Construct the adjacency dictionary structures train_data_user and train_data_item for users and courses respectively, where train_data_user[u] records all course numbers interacted by user u, and train_data_item[i] records the user numbers interacted with course i; 2.3) Initialize the user embedding matrix embedding_user and the course embedding matrix embedding_item respectively, with dimensions [U, D] and [I, D], where D is a fixed dimension and initialized using a standard normal distribution with a mean of 0 and a standard deviation of 0.1; 2.4) Save freq_matrix, embedding_user, and embedding_item in GPU tensors as input for subsequent graph structure propagation.
3. The graph collaborative filtering course recommendation method based on interactive attention and contrastive learning according to claim 1 is characterized in that: The step 3) includes the following sub-steps: 3.1) Set the target node to p∈{u,i} and the guide node to g∈{i,u], where u represents the user node and i represents the course node. For each user-course interaction pair (u,i) in the training set, construct two directional edges: one from the user to the course, and the other from the course index plus the offset U to the user. These edges are concatenated to form the edge index tensor edge_index. 3.2) For each neighbor c∈N of the target node p p , extract the original embedding vector of the guide node g from the first layer embedding And the embedding vector e of the neighbor nodes in the current layer c , calculate the dot product of the two and divide it by the temperature parameter τ, recorded as the unnormalized attention score: 3.3) For all neighbors c∈N of the target node p p The unnormalized attention scores are softmaxed to obtain the normalized attention weights: 3.4) Use the normalized weight softmax to perform weighted aggregation on the current representations of neighbor nodes to obtain the next layer embedding of the target node under the guidance of the guide node g:
4. The graph collaborative filtering course recommendation method based on interactive attention and contrastive learning according to claim 1 is characterized in that: Step 4) The graph convolution propagation process includes the following steps: 4.1) In each layer of propagation, the node embeddings are symmetrically normalized and aggregated using the adjacency graph, and the representation vector of each node is updated; 4.2) Save the embedding of each layer output as an intermediate representation of the multi-layer structure information; 4.3) After the propagation is completed, the embeddings of all layers are averaged to generate the final fused graph convolutional representation; 4.4) Split the fused representation into user and course nodes to obtain updated user embedding and course embedding respectively.
5. The graph collaborative filtering course recommendation method based on interactive attention and contrastive learning according to claim 1 is characterized in that: Step 5) includes the following sub-steps: 5.1) Apply random noise perturbation to the fused representation of users and courses to generate enhanced views and perturb the representation of users and courses; 5.2) Construct contrastive representation pairs of users and courses through a contrastive learning framework, where positive samples consist of different views of the same user or course, and negative samples are generated by randomly selecting different users or courses; 5.3) Calculate the contrast loss using the InfoNCE loss function, where the consistency of positive samples is maximized by maximizing their similarity, and the similarity of negative samples is minimized to reduce interference; 5.4) For users and courses, calculate the contrastive loss of users and courses respectively, and perform a weighted sum of the two to obtain the final contrastive learning loss.
6. The graph collaborative filtering course recommendation method based on interactive attention and contrastive learning according to claim 1 is characterized in that: The step 6) comprises the following steps: 6.1) Using the final user embedding and course embedding optimized by contrastive learning, calculate the predicted score of each user for all courses. The predicted score is obtained by the inner product of the vector of user embedding and course embedding; 6.2) Based on the positive sample interaction data in the training set, a corresponding negative sample is sampled for each user's positive sample. The negative sample is a random course that the user has not interacted with; 6.3) Construct a triplet (u, i, j), where u represents the user, i represents the positive sample course that the user has interacted with, and j represents the negative sample course that the user has not interacted with; 6.4) A loss function based on Bayesian Personalized Ranking (BPR) is used to calculate the ranking difference between positive and negative sample pairs. The loss function is defined as: Among them, S ui represents the predicted score of user u for the positive sample course i, S uj represents the predicted score of user u for negative sample course j, σ represents the sigmoid function; 6.5) Set the sorting loss L bpr With contrastive learning loss L ci Weighted summation is used as the final optimization target for back propagation and parameter update; 6.6) The model is trained by optimizing the objective function and gives the top-N recommended courses.
Citation Information
Cited By
Recommendation system and method based on adaptive graph contrast learning
CN121167040A
Short video recommendation method and system based on graph contrast learning
CN121210713A
Double hypergraph contrast learning course recommendation method and device fusing education priori knowledge, equipment and storage medium
CN121391564A
Fusion education priori knowledge double hypergraph contrast learning course recommendation method, device and equipment and storage medium
CN121391564B