A course recommendation method of dual-channel contrastive learning and heterogeneous knowledge graph propagation

By employing a dual-channel comparative learning approach and heterogeneous knowledge graph propagation, the problems of data sparsity and insufficient coverage of long-tail courses in course recommendation systems were solved. This enabled accurate recommendations for new users and new courses, improved interpretability, and promoted the development of personalized learning technology.

CN120912390BActive Publication Date: 2026-04-07GUIZHOU UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-23
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing course recommendation systems face problems such as data sparsity, insufficient coverage of long-tail courses, and poor interpretability of recommendations. They are particularly ineffective in recommending new users or new courses, and lack integration of multi-source heterogeneous information, shallow semantic modeling, and weak representation of user and course features under sparse data.

Method used

We employ a dual-channel contrastive learning and heterogeneous knowledge graph propagation approach. By constructing a heterogeneous knowledge graph for courses, we perform multi-hop ripple set expansion and fine-grained aggregation attention network. Combined with multi-layer feature fusion and multimodal semantic contrastive learning, we improve the robustness and interpretability of user-course interaction modeling.

Benefits of technology

It effectively alleviates the data sparsity problem in cold start scenarios, improves the recommendation effect for new users and new courses, significantly increases the coverage of long-tail courses, and generates an interpretable recommendation logic chain, thereby improving the accuracy and interpretability of the recommendation system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120912390B_ABST
    Figure CN120912390B_ABST
Patent Text Reader

Abstract

The application discloses a course recommendation method based on double-channel contrast learning and heterogeneous knowledge graph propagation, relates to the technical field of machine learning and recommendation systems, and comprises the following steps: 1, constructing a course heterogeneous knowledge graph and an initial entity set; 2, collaborative propagation of the course heterogeneous knowledge graph and generation of a ripple set; 3, designing a fine-grained aggregation attention network; 4, double-channel contrast learning; 5, multi-hop path reasoning and multi-view fusion; and 6, prediction score calculation and model optimization. The course recommendation method based on double-channel contrast learning and heterogeneous knowledge graph propagation solves the technical problems of data sparsity, insufficient coverage of long-tail courses and poor interpretability of recommendation results in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of machine learning and recommendation systems, and in particular to a course recommendation method based on dual-channel contrastive learning and heterogeneous knowledge graph propagation. Background Technology

[0002] Course recommendation systems are a core technology of online education platforms, aiming to accurately match educational resources with learners' needs. However, they face three major challenges: data sparsity, insufficient coverage of long-tail courses, and poor interpretability of recommendations.

[0003] Data sparsity stems from reliance on user-course interaction data. Traditional methods are prone to cold starts with new users or courses, suffer from inaccurate feature extraction, and fail to effectively utilize auxiliary information such as course attributes in single-modality learning. Long-tail courses exhibit a "Matthew effect" due to algorithmic bias towards popular topics, resulting in a high proportion of top-performing courses and low coverage of long-tail courses, leading to insufficient semantic correlation mining between courses. In terms of interpretability, deep learning models are "black boxes" lacking transparency, and knowledge graphs are often limited to single-hop approaches, resulting in limited interpretive depth.

[0004] A comprehensive analysis of existing technologies reveals the following main limitations: reliance on a single data source and lack of integration of heterogeneous information from multiple sources; shallow semantic modeling with insufficient deep correlation; weak representation of user and course features under sparse data; and lack of effective cross-modal semantic alignment mechanisms in multimodal fusion. Summary of the Invention

[0005] The purpose of this invention is to provide a course recommendation method based on dual-channel comparative learning and heterogeneous knowledge graph propagation, which solves the technical problems of data sparsity, insufficient coverage of long-tail courses, and poor interpretability of recommendation results in existing technologies.

[0006] To achieve the above objectives, this invention provides a course recommendation method based on dual-channel comparative learning and heterogeneous knowledge graph propagation, comprising the following steps:

[0007] Step 1: Construct a heterogeneous knowledge graph and an initial entity set for the course to establish a basic structure for subsequent knowledge graph propagation;

[0008] Step 2: Collaborative propagation of heterogeneous knowledge graphs and generation of ripple sets;

[0009] By recursively expanding the knowledge graph relationship path through multi-hop associations, we can deeply capture the long-distance dependency relationship between users and courses, construct a deep representation with multi-layer feature fusion, and effectively alleviate the impact of data sparsity on user-course interaction modeling.

[0010] Step 3: Design a fine-grained aggregation attention network to assign dynamic attention weights to different entities based on user preferences, thereby solving the semantic ambiguity problem;

[0011] Each course corresponds to different entities in the knowledge graph through direct or indirect relationship paths; these related entities can be regarded as characteristic attributes of the course, which reflect user preferences to a certain extent; a fine-grained attention network based on user preferences is adopted, which assigns different attention weights to tail entities to reveal their semantic ambiguity in different contexts;

[0012] Step 4: Dual-channel contrastive learning, through data augmentation and intra-layer contrast, improves the robustness and discriminativeness of single-modal embedding;

[0013] Step 5: Multi-hop path reasoning and multi-view fusion to mine multi-hop semantic paths between users and courses, and fuse multi-level features to generate robust representations;

[0014] Step 6: Predictive score calculation and model optimization.

[0015] Furthermore, the specific process of constructing the heterogeneous knowledge graph of the course in step 1, S11, is as follows:

[0016] Let the user set be U = {u1, u2, ..., u...} m The course set is C = {c1, c2, ..., c}. n The course-entity alignment matrix represents the mapping relationship between courses and entities, and the course-entity alignment set is... Where e represents an entity, and E represents an entity set;

[0017] The heterogeneous knowledge graph of the course is constructed in the form of triples, and its expression is:

[0018] G={(h,r,t)|h,t∈E,r∈R};

[0019] In the formula, h is the head entity, t is the tail entity, r is the relationship between entities, and R is the set of relationship types.

[0020] Furthermore, the specific process of constructing the initial entity set in step 1, S12, is as follows:

[0021] The user-course interaction graph is a bipartite graph structure, and its adjacency matrix is ​​Y = {y}. u,c |u∈U,c∈C}∈R m×n , where y u,c =1 indicates that user u has a history of interaction with course c, otherwise it is 0;

[0022] Focusing on the user, we explore their behavioral preferences through collaborative propagation mechanisms; firstly, we extract the set of courses the user has historically interacted with based on the user-course interaction graph:

[0023] C u ={c∣y u,c =1};

[0024] Based on course-entity alignment set To obtain the initial user representation set, the initial entity set for user u is:

[0025]

[0026] Define U as the set of potentially related users who share common course interaction characteristics with the current user u. protention Used to capture group behavior characteristics, U protention The expression is:

[0027] U protention ={c u |u∈{u|y u,c =1}};

[0028] In the formula, c u This represents a collection of courses representing user interaction history.

[0029] Set of potential related users U protention Alignment sets with courses and entities Combined, construct the initial entity set for course c:

[0030]

[0031] This set enables cross-user diffusion of course interests through knowledge entity mapping of collaborative courses, providing initial feature support for knowledge graph-enhanced recommendation models.

[0032] Furthermore, the specific process of step 2 is as follows:

[0033] Initial entity set As a seed node in the heterogeneous knowledge graph of the course, it propagates hierarchically along the multi-relational path of the heterogeneous knowledge graph, extracting multi-hop related knowledge layer by layer. For any entity type o∈{u,c}, the ripple entity set of the l-th layer is:

[0034]

[0035] In the formula, o represents a placeholder symbol for user u or course c; e h Represents the entity head node; e t Indicates the tail node of the entity; The graph represents a heterogeneous knowledge graph of the course; l represents the number of layers traversed from the entity location to the initial entity set; L is a hyperparameter representing the maximum number of hops in the ripple set;

[0036] During each hop of propagation, the algorithm calculates the set of ripple entities at the current level, which can capture knowledge association information over long distances. By adjusting the hyperparameter L, the scope and depth of knowledge propagation can be controlled, balancing computational complexity and semantic information richness.

[0037] Based on the entity set expansion results, the set of slightly rippled associations between the user and the course at the l-th hop is:

[0038]

[0039] This set not only records entity pairs that propagate across layers, but also preserves the semantic information of the relationship r between entities, forming a multi-hop association trajectory with structural features.

[0040] Furthermore, the specific process of step 3 is as follows:

[0041] S31, Triple feature modeling;

[0042] For the triples (e) in the l-th layer of the heterogeneous knowledge graph of the course h ,r l ,e t The definition is as follows:

[0043]

[0044] p l =r1οr2ο...οr l-1 l = 1, 2, ... L;

[0045] In the formula, For the head entity associated with the set of entities; e h Indicates the embedding of the head entity, r l p represents the embedding of the current relation. l Indicates from arrive Relationship path;

[0046] S32. Generate the tail entity attention weight coefficient α through a multi-layer neural network π(·);

[0047] The multilayer neural network π(·) includes ReLU activation and Sigmoid normalization, and its specific expression is as follows:

[0048]

[0049] In the formula, σ represents the vector concatenation operation; σ is the Sigmoid function; ReLU is the non-linear activation function; W and b are the trainable weight matrix and bias term, respectively.

[0050] Therefore, the expression for the tail entity attention weight coefficient α is:

[0051]

[0052] In the formula, N eh This indicates that the head entity is associated with a set of entities;

[0053] S33. Extract the generated ripple set by aggregating multi-hop knowledge propagation;

[0054]

[0055] In the formula, Indicates tail entity embedding;

[0056] S34. The entity representations in the initial entity set can be considered as seeds for knowledge perception and propagation. These representations are highly correlated with the original representations of users and courses; therefore, the initial entity set has a strong correlation with users and courses. The representation of adding the initial entity set to user u or course c is as follows:

[0057]

[0058] In the formula, e o,0 Represents the initial entity of the user / course; Represents the initial set of user / course entities;

[0059] S35. Unlike users, courses have associated entities as their original representation, while users do not; the original associated entities of a course are entities in the knowledge space corresponding to the course itself. The original associated entities of a course are defined as follows:

[0060]

[0061] S36. Mark the feature representations of triples involving high-order cooperative signals and multi-hop knowledge extraction, with the following expressions:

[0062]

[0063] In the formula, This represents the initial user characteristic representation; This indicates the generation of user ripple sets through aggregated multi-hop knowledge extraction; This represents the characteristics of potential users; Indicates the entity associated with a potential user; This represents the initial course characteristics. Indicates the initial associated entity of the course; Representing the characteristics of the potential curriculum; This indicates a potential course-related entity.

[0064] Furthermore, the specific process of step 4 is as follows:

[0065] S41, Data augmentation based on XSimGCL encoder;

[0066] To generate the augmented views required for high-quality contrastive learning, an XSimGCL encoder is introduced. This encoder introduces necessary perturbations while maintaining semantic integrity through orientation-aware noise injection. For any view vector, the augmentation process is expressed as:

[0067]

[0068] In the formula, The view vector is represented by normalize(·), L2 normalization is represented by normalize(·), sign(·) extracts the sign of each dimension, ⊙ represents element-wise multiplication, and ζ is a hyperparameter that controls the noise intensity.

[0069] S42, Single-modal feature enhancement contrastive learning;

[0070] Define the original embeddings of users and courses in layer l as follows: The enhanced correspondences of the original embeddings for users and courses in layer l are as follows:

[0071] Therefore, the contrastive loss for the user embedding at layer l is:

[0072]

[0073] In the formula, sim(·,·) represents the cosine similarity; τ is the temperature parameter; Negative samples within the view; Negative samples between views;

[0074] Therefore, the contrastive loss for the l-th layer course embedding is:

[0075]

[0076] Therefore, the total loss for single-modal feature enhancement contrastive learning is:

[0077]

[0078] In the formula, λ1 is the regularization coefficient of local hierarchical contrastive learning, which is used to adjust the contribution weight of local hierarchical contrastive learning in the overall loss.

[0079] S43, Multimodal semantic contrastive learning;

[0080] While unimodal feature-enhanced contrastive learning improves the representation of a single view, it fails to capture the semantic correspondence between different modalities (users and courses). To address this limitation, we introduce multimodal semantic contrastive learning to explicitly model user-course semantic alignment in different representation spaces.

[0081] Original embedding of users Embedding with corresponding courses They are considered positive sample pairs, reflecting their semantic compatibility in the interaction space;

[0082] Multimodal semantic contrastive learning encourages user-course embeddings with positive interactions to approach each other in the representation space, while pushing away user-course pairs without interaction; therefore, the contrastive loss expression from the user-to-course perspective is:

[0083]

[0084] In the formula, R + This represents a positive set of user-course interactions;

[0085] Therefore, the expression for the contrastive loss from the course's perspective to the user's perspective is:

[0086]

[0087] To capture information from different semantic layers, contrastive learning is performed on all propagation layers, and the aggregated loss function is expressed as follows:

[0088]

[0089] In the formula, λ2 is the regularization coefficient for global hierarchical contrastive learning.

[0090] Furthermore, the specific process of step 5 is as follows:

[0091] S51. Define the k-hop path pattern;

[0092] For two entities e s and e t An effective k-hop path pattern is a relation sequence r1, r2, ..., r k The relation sequence r1,r2,...,r k The condition for constituting a valid k-hop path pattern is: there exists an entity set {e0, e1, ..., e...}. k}, such that the relation sequence r1,r2,...,r k In two entities e s and e t Forming an effective path between them In course recommendation scenarios, typical multi-hop paths include: User → Learned Courses → Knowledge Points → Recommended Courses; User → Area of ​​Interest → Related Skills → Target Course;

[0093] S52. Design a path aggregation function based on attention mechanism;

[0094] Attention networks employ a multi-layered perceptual structure, enabling dynamic evaluation of the importance of different triples in the inference path and achieving adaptive path aggregation. The expression for the attention network is:

[0095] Attention(x)=σ(W3·LeakyReLU(W2·LeakyReLU(W1x+b1)+b2)+b3)

[0096] For a given triple (h,r,t), the attention aggregation process is expressed as:

[0097]

[0098] In the formula, Denotes the set of triples in the i-th layer; α i,j This indicates that the head node h i,j Relationship r i,j Tail node t i,j The weights are calculated using an attention mechanism after concatenation. This represents the normalized attention weights;

[0099] S53, LSTM sequence inference;

[0100] Considering the temporal dependencies and long-distance dependencies in the learning process, we introduce an LSTM module for sequential inference; we then convert the triple sequence (h) into a single, sequential inference module. t ,r t ,t t As time step input:

[0101]

[0102] f t =σ(W f x t +U f h t-1 +b f );

[0103] i t =σ(W i x t +U i h t-1 +b i );

[0104]

[0105] o t =σ(W o x t +U o h t-1 +b o );

[0106] h t =o t ⊙tanh(C t );

[0107] In the formula, x t This indicates that the triplet is used as the input to the LSTM time step; (h t ,r t ,t t W represents the set of triples at time t; f U represents the forget gate weight matrix; f b represents the hidden state weight matrix of the forget gate; f Indicates the LSTM forget gate bias; i t Indicates the input gate; W i U represents the input gate weight matrix; i h represents the input gate hidden state weight matrix; t-1 Indicates a hidden state; b i Indicates input gate bias; Indicates an LSTM memory cell; W C Represents the weight matrix of the memory cells; U C b represents the hidden state weight matrix of the memory unit; C Indicates input gate bias; C t This represents the new memory cell of the LSTM at time t; C t-1 This indicates the memory unit of the LSTM at time t-1; o t Indicates the current state; W o U represents the output gate weight matrix; o b represents the hidden state weight matrix of the output gate; o Indicates output gate bias;

[0108] Obtained by average pooling the LSTM output:

[0109]

[0110] In the formula, e reason This represents the set of entities obtained through reasoning;

[0111] At layer l, the representations of users and courses are updated as follows:

[0112]

[0113] In the formula, u (l) Represents the user-related enhancement triple at layer l; i (l) This represents the enhanced triplet related to the course in layer l; The LSTM inference process yields the user-related augmented triplet representation at layer l. This represents the course-related augmented triplet obtained from the l-th layer through LSTM inference; Represents the set of triples related to the user in the l-th layer; This represents the set of triples associated with the course at level l;

[0114] S54. Establish a multi-view fusion strategy.

[0115] Considering the augmented views generated by contrastive learning, the final user and course representations are obtained by fusing the original embeddings and the augmented embeddings; in order to aggregate the multi-view representations into a single vector, three aggregators are designed to fuse the user and course representations at different levels.

[0116] Furthermore, the specific process of building a multi-view fusion strategy in S54 is as follows:

[0117] S541. The aggregation function first sums the multiple view vectors representing the set, and then performs a nonlinear transformation. The expression is:

[0118]

[0119] In the formula, W a b represents the trainable weight matrix; a Indicates a trainable bias; An embedded representation of a user or course at layer l;

[0120] S542. The pooling aggregation function takes the maximum value of multiple view vectors in the same dimension, and then performs a non-linear transformation. The expression is:

[0121]

[0122] In the formula, pool max This represents the max pooling operation, which captures the most salient features in each dimension.

[0123] S543. The concatenation aggregation function joins multiple view vector representations in a set along the same dimension, and then performs a non-linear transformation. The expression is:

[0124]

[0125] In the formula, || represents the splicing operation, and splicing aggregation can preserve the unique information of each layer;

[0126] S544, Let e u e represents the aggregated feature representation of a user. c The aggregate feature representation of the course, e' u and e' cLet represent the corresponding contrastive learning reinforcement representations, then the final representation vectors for users and courses are respectively:

[0127]

[0128] Furthermore, the specific process of step 6 is as follows:

[0129] S61. Perform an inner product operation on the user's final representation vector and the course's final representation vector to obtain the user's predicted preference score for a specific course. The expression is as follows:

[0130]

[0131] In the formula, σ represents the Sigmoid activation function, which ensures that the predicted score is within the interval [0,1].

[0132] S62. Construct a comprehensive loss function that integrates the main loss of the recommendation task, the local contrastive learning loss, and the global contrastive learning loss. The expression for the comprehensive loss function is as follows:

[0133] L = L rec +γ1·L local +γ2·L global ;

[0134] In the formula, L rec γ represents the recommendation loss; γ1 represents the local hierarchical contrastive learning regularization coefficient, and γ2 represents the global hierarchical contrastive learning regularization coefficient; L local L represents the local hierarchical contrastive learning loss; global This indicates global-level comparative learning;

[0135] The expression for the recommendation loss is:

[0136]

[0137] In the formula, y + Represents the set of positive samples; y - Represents the set of negative samples; y u,i This indicates the user's actual rating of the course; This indicates the user's predicted rating for the course.

[0138] Therefore, the beneficial effects of the course recommendation method based on dual-channel contrastive learning and heterogeneous knowledge graph propagation described above are as follows:

[0139] (1) Solving the problem of data sparsity: Through heterogeneous knowledge graph propagation and multi-hop ripple set expansion, the data sparsity problem in the cold start scenario is effectively alleviated, and the recommendation effect of new users and new courses is improved;

[0140] (2) Improve the coverage of long-tail courses: Based on the semantic association mining of knowledge graph, the recommendation coverage of long-tail courses has been significantly improved.

[0141] (3) Enhance the interpretability of recommendations: Through multi-hop path reasoning and LSTM sequence modeling, an interpretable recommendation logic chain is generated, which allows users to clearly understand the basis for recommendations;

[0142] (4) This invention provides a solution for online education recommendation systems that balances accuracy, diversity and interpretability, and promotes the development of personalized learning technology.

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

[0144] Figure 1 This is an overall flowchart of a course recommendation method based on dual-channel comparative learning and heterogeneous knowledge graph propagation according to the present invention.

[0145] Figure 2 This is a fine-grained attention network diagram according to an embodiment of the present invention;

[0146] Figure 3 This is the HDCL-Rec recommended model framework for embodiments of the present invention;

[0147] Figure 4 This is a SimGCL module diagram according to an embodiment of the present invention;

[0148] Figure 5 This is a schematic diagram of cross-modal contrastive learning according to an embodiment of the present invention;

[0149] Figure 6 This is a flowchart of the path-based reasoning recommendation process according to an embodiment of the present invention. Detailed Implementation

[0150] The following detailed description of embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0151] Please see Figure 1-6 A course recommendation method based on dual-channel comparative learning and heterogeneous knowledge graph propagation includes the following steps:

[0152] Step 1: Construct a heterogeneous knowledge graph and an initial entity set for the course.

[0153] S11. Construct a heterogeneous knowledge graph for courses;

[0154] Let the user set be U = {u1, u2, ..., u...} m The course set is C = {c1, c2, ..., c}. n The course-entity alignment matrix represents the mapping relationship between courses and entities, and the course-entity alignment set is... Where e represents an entity, and E represents an entity set;

[0155] The heterogeneous knowledge graph of the course is constructed in the form of triples, and its expression is:

[0156] G={(h,r,t)|h,t∈E,r∈R};

[0157] In the formula, h is the head entity, t is the tail entity, r is the relationship between entities, and R is the set of relationship types;

[0158] S12. Construct the initial entity set;

[0159] The user-course interaction graph is a bipartite graph structure, and its adjacency matrix is ​​Y = {y}. u,c |u∈U,c∈C}∈R m×n , where y u,c =1 indicates that user u has a history of interaction with course c;

[0160] Extracting the set of courses that a user has interacted with in the past based on the user-course interaction graph:

[0161] C u ={c∣y u,c =1};

[0162] Based on course-entity alignment set To obtain the initial user representation set, the initial entity set for user u is:

[0163]

[0164] Define U as the set of potentially related users who share common course interaction characteristics with the current user u. protention Used to capture group behavior characteristics, U protention The expression is:

[0165] U protention ={c u |u∈{u|y u,c =1}};

[0166] In the formula, c u This represents a collection of courses representing user interaction history.

[0167] Set of potential related users U protention Alignment sets with courses and entities Combined, construct the initial entity set for course c:

[0168]

[0169] Step 2: Collaborative propagation of heterogeneous knowledge graphs and generation of ripple sets.

[0170] Initial entity set As a seed node in the heterogeneous knowledge graph of the course, it propagates hierarchically along the multi-relational path of the heterogeneous knowledge graph, extracting multi-hop related knowledge layer by layer. For any entity type o∈{u,c}, the ripple entity set of the l-th layer is:

[0171]

[0172] In the formula, o represents a placeholder symbol for user u or course c; e h Represents the entity head node; e t Indicates the tail node of the entity; The graph represents a heterogeneous knowledge graph of the course; l represents the number of layers traversed from the entity location to the initial entity set; L is a hyperparameter representing the maximum number of hops in the ripple set;

[0173] The set of slightly rippled associations between the user and the course at the l-th hop is:

[0174]

[0175] Step 3: Design a fine-grained aggregation attention network.

[0176] S31, Triple feature modeling;

[0177] For the triples (e) in the l-th layer of the heterogeneous knowledge graph of the course h ,r l ,e t The definition is as follows:

[0178]

[0179] p l =r1οr2ο...οr l-1 l = 1, 2, ... L;

[0180] In the formula, For the head entity associated with the set of entities; e h Indicates the embedding of the head entity, r l p represents the embedding of the current relation. l Indicates from arrive Relationship path;

[0181] S32. Generate the tail entity attention weight coefficient α through a multi-layer neural network π(·);

[0182] The multilayer neural network π(·) includes ReLU activation and Sigmoid normalization, and its specific expression is as follows:

[0183]

[0184] In the formula, σ represents the vector concatenation operation; σ is the Sigmoid function; ReLU is the non-linear activation function; W and b are the trainable weight matrix and bias term, respectively.

[0185] Therefore, the expression for the tail entity attention weight coefficient α is:

[0186]

[0187] In the formula, This indicates that the head entity is associated with a set of entities;

[0188] S33. Extract the generated ripple set by aggregating multi-hop knowledge propagation;

[0189]

[0190] In the formula, Indicates tail entity embedding;

[0191] S34. The representation of adding an initial entity set for user u or course c is as follows:

[0192]

[0193] In the formula, e o,0 Represents the initial entity of the user / course; Represents the initial set of user / course entities;

[0194] S35. Define the original associated entity of the course as:

[0195]

[0196] S36. Mark the feature representations of triples involving high-order cooperative signals and multi-hop knowledge extraction, with the following expressions:

[0197]

[0198] In the formula, This represents the initial user characteristic representation; This indicates the generation of user ripple sets through aggregated multi-hop knowledge extraction; This represents the characteristics of potential users; Indicates the entity associated with a potential user; This represents the initial course characteristics. Indicates the initial associated entity of the course; Representing the characteristics of the potential curriculum; This indicates a potential course-related entity.

[0199] Step 4: Dual-channel comparative learning.

[0200] S41, Data augmentation based on XSimGCL encoder;

[0201] For any view vector, the enhancement process expression is:

[0202]

[0203] In the formula, The view vector is represented by normalize(·), L2 normalization is represented by normalize(·), sign(·) extracts the sign of each dimension, ⊙ represents element-wise multiplication, and ζ is a hyperparameter that controls the noise intensity.

[0204] S42, Single-modal feature enhancement contrastive learning;

[0205] Define the original embeddings of users and courses in layer l as follows: The enhanced correspondences of the original embeddings for users and courses in layer l are as follows:

[0206] Therefore, the contrastive loss for the user embedding at layer l is:

[0207]

[0208] In the formula, sim(·,·) represents the cosine similarity; τ is the temperature parameter; Negative samples within the view; Negative samples between views;

[0209] Therefore, the contrastive loss for the l-th layer course embedding is:

[0210]

[0211] Therefore, the total loss for single-modal feature enhancement contrastive learning is:

[0212]

[0213] In the formula, λ1 is the regularization coefficient of local hierarchical contrastive learning;

[0214] S43, Multimodal semantic contrastive learning;

[0215] Original embedding of users Embedding with corresponding courses Consider them as positive sample pairs;

[0216] Therefore, the contrastive loss expression from the user's perspective to the course is:

[0217]

[0218] In the formula, R + This represents a positive set of user-course interactions;

[0219] Therefore, the expression for the contrastive loss from the course's perspective to the user's perspective is:

[0220]

[0221] Perform contrastive learning on all propagation layers and aggregate the loss function, expressed as follows:

[0222]

[0223] In the formula, λ2 is the regularization coefficient for global hierarchical contrastive learning.

[0224] Step 5: Multi-hop path reasoning and multi-view fusion.

[0225] S51. Define the k-hop path pattern;

[0226] For two entities e s and e t An effective k-hop path pattern is a relation sequence r1, r2, ..., r k The relation sequence r1,r2,...,r k The condition for constituting a valid k-hop path pattern is: there exists an entity set {e0, e1, ..., e...}. k}, such that the relation sequence r1,r2,...,r k In two entities e s and e t Forming an effective path between them

[0227] S52. Design a path aggregation function based on attention mechanism;

[0228] Attention networks employ a multi-layered perceptual structure, and the expression for an attention network is:

[0229] Attention(x)=σ(W3·LeakyReLU(W2·LeakyReLU(W1x+b1)+b2)+b3)

[0230] For a given triple (h,r,t), the attention aggregation process is expressed as:

[0231]

[0232] In the formula, Denotes the set of triples in the i-th layer; α i,j This indicates that the head node h i,j Relationship r i,j Tail node t i,j The weights are calculated using an attention mechanism after concatenation. This represents the normalized attention weights;

[0233] S53, LSTM sequence inference;

[0234] The triplet sequence (h) t ,r t ,t t As time step input:

[0235]

[0236] f t =σ(W f x t +U f h t-1 +b f );

[0237] i t =σ(W i x t +U i h t-1 +b i );

[0238]

[0239] o t =σ(W o x t +U o h t-1 +b o );

[0240] h t =o t ⊙tanh(C t );

[0241] In the formula, x t This indicates that the triplet is used as the input to the LSTM time step; (h t ,r t ,t t W represents the set of triples at time t; f U represents the forget gate weight matrix; f b represents the hidden state weight matrix of the forget gate; f Indicates the LSTM forget gate bias; i tIndicates the input gate; W i U represents the input gate weight matrix; i h represents the input gate hidden state weight matrix; t-1 Indicates a hidden state; b i Indicates input gate bias; Indicates an LSTM memory cell; W C Represents the weight matrix of the memory cells; U C b represents the hidden state weight matrix of the memory unit; C Indicates input gate bias; C t This represents the new memory cell of the LSTM at time t; C t-1 This indicates the memory unit of the LSTM at time t-1; o t Indicates the current state; W o U represents the output gate weight matrix; o b represents the hidden state weight matrix of the output gate; o Indicates output gate bias

[0242] Obtained by average pooling the LSTM output:

[0243]

[0244] In the formula, e reason This represents the set of entities obtained through reasoning;

[0245] At layer l, the representations of users and courses are updated as follows:

[0246]

[0247] In the formula, u (l) Represents the user-related enhancement triple at layer l; i (l) This represents the enhanced triplet related to the course in layer l; The LSTM inference process yields the user-related augmented triplet representation at layer l. This represents the course-related augmented triplet obtained from the l-th layer through LSTM inference; Represents the set of triples related to the user in the l-th layer; This represents the set of triples associated with the course at level l;

[0248] S54. Establish a multi-view fusion strategy;

[0249] S541. The aggregation function first sums the multiple view vectors representing the set, and then performs a nonlinear transformation. The expression is:

[0250]

[0251] In the formula, W ab represents the trainable weight matrix; a Indicates a trainable bias; An embedded representation of a user or course at layer l;

[0252] S542. The pooling aggregation function takes the maximum value of multiple view vectors in the same dimension, and then performs a non-linear transformation. The expression is:

[0253]

[0254] In the formula, pool max This represents the max pooling operation;

[0255] S543. The concatenation aggregation function joins multiple view vector representations in a set along the same dimension, and then performs a non-linear transformation. The expression is:

[0256]

[0257] In the formula, || represents the splicing operation;

[0258] S544, Let e u e represents the aggregated feature representation of a user. c The aggregate feature representation of the course, e' u and e' c Let represent the corresponding contrastive learning reinforcement representations, then the final representation vectors for users and courses are respectively:

[0259]

[0260] Step 6: Predictive score calculation and model optimization.

[0261] S61. Perform an inner product operation on the user's final representation vector and the course's final representation vector to obtain the user's predicted preference score for a specific course. The expression is as follows:

[0262]

[0263] In the formula, σ represents the Sigmoid activation function;

[0264] S62. Construct the comprehensive loss function. The expression for the comprehensive loss function is as follows:

[0265] L = L rec +γ1·L local +γ2·L global ;

[0266] In the formula, L rec γ represents the recommendation loss; γ1 represents the local hierarchical contrastive learning regularization coefficient, and γ2 represents the global hierarchical contrastive learning regularization coefficient; L localL represents the local hierarchical contrastive learning loss; global This indicates global-level comparative learning;

[0267] The expression for the recommendation loss is:

[0268]

[0269] In the formula, y + Represents the set of positive samples; y - Represents the set of negative samples; y u,i This indicates the user's actual rating of the course; This indicates the user's predicted rating for the course.

[0270] Experiments have shown

[0271] The training process of this invention was conducted under the Ubuntu 20.04 operating system, using CUDA 11.6 and PyTorch 1.12 for model development and training. The experimental environment configuration is as follows:

[0272] GPU: NVIDIA GeForce RTX 3090, 32GB VRAM

[0273] CPU: Intel Core i7-12900f

[0274] RAM: 64GB

[0275] Deep learning framework: PyTorch 1.12

[0276] The neural network model in this invention is trained using a stochastic gradient descent (SGD) optimizer with an initial learning rate of 0.004, a batch size of 2048, and 40 training epochs. L2 regularization is employed to prevent overfitting, and the weight coefficient is 1×10⁻⁶. -4 The model has 64 hidden layer dimensions and a network depth of 2 layers. A contrastive learning mechanism is introduced, with a temperature coefficient set to 0.1, and both the contrastive loss weight and the cross-modal contrastive loss weight set to 1×10⁻⁶. -6 The balance coefficient was set to 1.0, the perturbation threshold to 0.1, and the feature aggregation method adopted was concat. All experiments were repeated three times under the same random seed control, and the average was taken to eliminate the influence of random fluctuations on the results. The final results show that this parameter combination achieved the best performance in the recommender system task.

[0277] We selected four state-of-the-art benchmark methods: collaborative filtering (CF) based methods (BPRMF), embedding-based methods (CKE, RippleNet), path-based methods (PER), and graph neural network (GNN) based methods (KGAT, KGCN, CKAN, and COAT). The following is a brief description of these comparison methods:

[0278] BPRMF (Rendle et al., 2012) is a representative collaborative filtering (CF) based method that optimizes matrix factorization in a Bayesian manner and uses pairwise ranking loss for recommendation optimization.

[0279] CKE (Zhang et al., 2016) is a typical embedding-based recommendation model that learns course representations by combining structural, visual, and textual knowledge, and adopts the knowledge graph embedding loss function from TransR (Lin et al., 2015).

[0280] PER (Yu et al., 2014): is one of the classic path-based methods that treats the knowledge graph as a heterogeneous graph network and extracts latent features based on hand-designed meta-paths to represent the connectivity between users and courses.

[0281] RippleNet (Wang, Zhang, Wang et al., 2018): It is also an embedding-based recommendation model that propagates users’ latent preferences to courses through a memory network along paths in a knowledge graph.

[0282] KGCN (Wang, Zhao et al., 2019) is a state-of-the-art model based on graph neural networks (GNNs) that learns the structure and semantic information of knowledge graphs by aggregating high-order neighborhood information, and selectively captures users' potential preferences.

[0283] KGAT (Wang, He, Cao et al., 2019): It is also a state-of-the-art GNN-based model that recursively propagates the neighbor embeddings of nodes (users, courses, and entities), attempts to adjust the node embeddings, and uses an attention mechanism to distinguish the contributions of neighbors.

[0284] CKAN (Wang et al., 2020) is one of the latest GNN-based models that employs a heterogeneous propagation strategy to combine collaborative signals from user-course interactions and knowledge graph associations. It also uses an attention mechanism to distinguish the importance of different neighbors, thus achieving better performance in recommendation.

[0285] COAT (Dai et al., 2022) is a state-of-the-art GNN-based model that simultaneously models the user-course graph and knowledge graph. It employs efficient graph convolutional networks and personalized knowledge graph attention mechanisms to extract information-rich collaborative signals and capture fine-grained semantics, thereby improving recommendation performance.

[0286] Table 1 Results of Recommended Tasks for HDCL-Rec Course

[0287]

[0288] To verify the key roles of each core component in the HDCL-Rec model, this experiment designed a series of ablation experiments. By progressively removing the model's attention mechanism (att), dual-channel contrastive learning module (CL), and multi-hop inference module (Reasoning), the changes in the model's recommendation performance under different configurations were compared and analyzed. Experimental results show that the absence of any core component leads to a significant decline in the model's core metrics, verifying the complementary contributions of each component to the overall capabilities of the model.

[0289] Table 2 Ablation experiments of key components of HDCL-Rec

[0290]

[0291] Therefore, this invention employs a course recommendation method based on dual-channel comparative learning and heterogeneous knowledge graph propagation. Through heterogeneous knowledge graph propagation and multi-hop ripple set expansion, it effectively alleviates the data sparsity problem in cold start scenarios and improves the recommendation effect for new users and new courses. Semantic association mining based on knowledge graphs significantly improves the recommendation coverage of long-tail courses. Through multi-hop path reasoning and LSTM sequence modeling, an interpretable recommendation logic chain is generated, allowing users to clearly understand the recommendation basis. This invention provides a solution for online education recommendation systems that balances accuracy, diversity, and interpretability, promoting the development of personalized learning technology.

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

Claims

1. A course recommendation method based on dual-channel comparative learning and heterogeneous knowledge graph propagation, characterized in that, Includes the following steps: Step 1: Construct a heterogeneous knowledge graph and an initial entity set for the course; Step 2: Collaborative propagation of heterogeneous knowledge graphs and generation of ripple sets; Step 3: Design a fine-grained aggregation attention network; Step 4: Dual-channel comparative learning; Step 5: Multi-hop path reasoning and multi-view fusion; Step 6: Predictive score calculation and model optimization; The specific process of constructing the heterogeneous knowledge graph of the course in step S11 in step 1 is as follows: Let the user set be The course collection is The course-entity alignment matrix represents the mapping relationship between courses and entities, and the course-entity alignment set is... ,in Represents an entity, Represents an entity set; The heterogeneous knowledge graph of the course is constructed in the form of triples, and its expression is: ; In the formula, For the head entity, For tail entities, For relationships between entities, A set of relation types; The specific process of constructing the initial entity set in step S12 of step 1 is as follows: The user-course interaction graph is a bipartite graph structure, and its adjacency matrix is... ,in Indicates user With courses There is historical interaction behavior; Extracting the set of courses that a user has interacted with in the past based on the user-course interaction graph: ; Based on course-entity alignment set To obtain the initial set of user representations, users The initial set of entities is: ; Define and current user The set of potentially related users who share common course interaction characteristics is Used to capture group behavior characteristics The expression is: ; In the formula, This represents a collection of courses representing user interaction history. Set of potentially related users Alignment sets with courses and entities Combine and construct courses Initial set of entities: ; The specific process of step 2 is as follows: Initial entity set As a seed node in the heterogeneous knowledge graph of the course, it propagates hierarchically along the multi-relational path of the heterogeneous knowledge graph, extracting multi-hop related knowledge layer by layer, for any entity type. , No. The ripple entity set of the layer is: ; In the formula, This indicates that it represents the user. or courses Uniform placeholder symbols; Represents the entity head node; Indicates the tail node of the entity; Represents a heterogeneous knowledge graph of courses; Indicates the number of layers traversed from the entity's location to the initial entity set; This is a hyperparameter representing the maximum number of jumps in the ripple set; The first user and course The ripple association set is: ; The specific process of step 3 is as follows: S31, Triple feature modeling; In the heterogeneous knowledge graph of courses, the first Layer triples The definition is as follows: ; ; In the formula, The head entity is associated with a set of entities; Indicates the embedding of the head entity. Indicates the embedding of the current relation. Indicates from arrive Relationship path; S32, Through multi-layer neural networks Generate tail entity attention weight coefficient ; Among them, multilayer neural networks Including ReLU activation and Sigmoid normalization, the specific expression is: ; In the formula, This represents a vector concatenation operation; It is the Sigmoid function; ReLU is a non-linear activation function; W and b are the trainable weight matrix and bias term, respectively. So, the tail entity attention weight coefficient The expression is: ; In the formula, This indicates that the head entity is associated with a set of entities; S33. Extract the generated ripple set by aggregating multi-hop knowledge propagation; ; In the formula, Indicates tail entity embedding; S34, for users or courses The addition of an initial entity set is represented as follows: ; In the formula, Represents the initial entity of the user / course; Represents the initial set of user / course entities; S35. Define the original associated entity of the course as: ; S36. Mark the feature representations of triples involving high-order cooperative signals and multi-hop knowledge extraction, with the following expressions: ; ; ; ; In the formula, This represents the initial user characteristic representation; This indicates the generation of user ripple sets through aggregated multi-hop knowledge extraction; This represents the characteristics of potential users; Indicates the entity associated with a potential user; This represents the initial course characteristics. Indicates the initial associated entity of the course; Representing the characteristics of the potential curriculum; This indicates a potential course-related entity.

2. The course recommendation method based on dual-channel comparative learning and heterogeneous knowledge graph propagation according to claim 1, characterized in that, The specific process of step 4 is as follows: S41, Data augmentation based on XSimGCL encoder; For any view vector, the enhancement process expression is: ; In the formula, Represents the view vector. Indicates L2 normalization, Extract symbols from each dimension. This represents element-wise multiplication. It is a hyperparameter for controlling noise intensity; S42, Single-modal feature enhancement contrastive learning; Definition of the first The original embeddings of the layer's users and courses are respectively , , No. The enhanced correspondences of the original embeddings of the layer's users and courses are respectively , ; So, the first The contrastive loss for layer user embedding is: ; In the formula, Indicates cosine similarity; It is a temperature parameter; Negative samples within the view; Negative samples between views; So, the first The contrastive loss for layered course embedding is: ; Therefore, the total loss for single-modal feature enhancement contrastive learning is: ; In the formula, It is the regularization coefficient for local hierarchical contrastive learning; S43, Multimodal semantic contrastive learning; Original embedding of users Embedding with corresponding courses Consider them as positive sample pairs; Therefore, the contrastive loss expression from the user's perspective to the course is: ; In the formula, This represents a positive set of user-course interactions; Therefore, the expression for the contrastive loss from the course's perspective to the user's perspective is: ; Perform contrastive learning on all propagation layers and aggregate the loss function, expressed as follows: ; In the formula, It is the regularization coefficient for global hierarchical contrastive learning.

3. The course recommendation method based on dual-channel comparative learning and heterogeneous knowledge graph propagation according to claim 2, characterized in that, The specific process of step 5 is as follows: S51. Define the k-hop path pattern; For two entities and Valid k-hop path patterns are relational sequences. relational sequence The condition for constituting a valid k-hop path pattern is: the existence of a set of entities. , to make the relation sequence In two entities and Forming an effective path between them ; S52. Design a path aggregation function based on attention mechanism; Attention networks employ a multi-layered perceptual structure, and the expression for an attention network is: For a given triple The expression for the attention aggregation process is: ; ; ; In the formula, Indicates the first The set of triples in a layer; Indicates the head node ,relation Tail node The weights are calculated using an attention mechanism after concatenation. This represents the normalized attention weights; S53, LSTM sequence inference; triple sequence As time step input: ; ; ; ; ; ; ; In the formula, This indicates that the triplet is used as the input to the LSTM time step; Denotes the set of triples at time t; Represents the forget gate weight matrix; Represents the weight matrix of the hidden state in the forget gate; Indicates the LSTM forget gate bias; Indicates the input gate; This represents the input gate weight matrix; This represents the input gate hidden state weight matrix; Indicates a hidden state; Indicates input gate bias; Indicates an LSTM memory cell; Represents the weight matrix of the memory cells; This represents the hidden state weight matrix of the memory unit; Indicates input gate bias; This represents the new memory cell of the LSTM at time t; This indicates the memory cell of the LSTM at time t-1; Indicates the current state; This represents the output gate weight matrix; This represents the hidden state weight matrix of the output gate; Indicates output gate bias; Obtained by average pooling the LSTM output: ; In the formula, This represents the set of entities obtained through reasoning; In the The layer, user, and course representations are updated as follows: ; ; ; ; In the formula, Indicates the first Layer-specific and user-related enhancement triples; Indicates the first Layer-specific enhancement triples related to the course; The first one was obtained through LSTM inference. Layer-specific and user-related enhanced triple representation; The first term obtained through LSTM inference is represented as... Layer-specific enhancement triples related to the course; Indicates the first The set of triples related to the layer and the user; Indicates the first A set of triples related to the layer and the course; S54. Establish a multi-view fusion strategy.

4. The course recommendation method based on dual-channel comparative learning and heterogeneous knowledge graph propagation according to claim 3, characterized in that, The specific process of setting up a multi-view fusion strategy in S54 is as follows: S541. The aggregation function first sums the multiple view vectors representing the set, and then performs a nonlinear transformation. The expression is: ; In the formula, This represents a trainable weight matrix; Indicates a trainable bias; For users or courses in the first Layer embedding representation; S542. The pooling aggregation function takes the maximum value of multiple view vectors in the same dimension, and then performs a non-linear transformation. The expression is: ; In the formula, This represents the max pooling operation; S543. The concatenation aggregation function joins multiple view vector representations in a set along the same dimension, and then performs a non-linear transformation. The expression is: ; In the formula, Indicates a splicing operation; S544, Set This represents the aggregated feature representation of the user. The aggregate feature representation of the course, and Let represent the corresponding contrastive learning reinforcement representations, then the final representation vectors for users and courses are respectively: ; 。 5. The course recommendation method based on dual-channel comparative learning and heterogeneous knowledge graph propagation according to claim 4, characterized in that, The specific process of step 6 is as follows: S61. Perform an inner product operation on the user's final representation vector and the course's final representation vector to obtain the user's predicted preference score for a specific course. The expression is as follows: ; In the formula, This represents the Sigmoid activation function; S62. Construct the comprehensive loss function. The expression for the comprehensive loss function is as follows: ; In the formula, Indicates the recommended loss; Represents the local hierarchical contrastive learning regularization coefficient, This represents the global hierarchical contrastive learning regularization coefficient; This represents the local hierarchical contrastive learning loss; This indicates global-level comparative learning; The expression for the recommendation loss is: ; In the formula, Represents the set of positive samples; Represents the set of negative samples; This indicates the user's actual rating of the course; This indicates the user's predicted rating for the course.

Citation Information

Patent Citations

  • Interpretable sequence recommendation method integrating time perception and path reasoning

    CN119415766A