Collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning

Through the collaborative recommendation algorithm of knowledge graph-aware embedding and negative sample comparison learning, high-quality embedded representations are generated using graph convolutional networks and hypergraph neural networks, which solves the problem of signal sparseness and noise in the knowledge graph and improves the accuracy and robustness of the recommendation system.

CN120373351AInactive Publication Date: 2025-07-25HUBEI UNIV
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202510485806.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-17
Publication Date
2025-07-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing recommendation systems have interactions caused by the long-tail distribution of entities in the knowledge graph, which represent sparse signals and noise interference, making it difficult to accurately reflect the real characteristics and user preferences between entities and projects.

Method used

The knowledge graph-aware embedding module, the convolution aggregation enhancement module, the view comparison learning module and the adaptive comparison loss module are used to generate high-quality embedded representations through graph convolutional networks and hypergraph neural networks, filter noise, combine the hard negative sampling mechanism and Bayesian personalized ranking loss, and optimize the recommended model.

Benefits of technology

The quality of embedded representation and recommendation accuracy are significantly improved, the signal sparseness and noise problems are solved, and the sorting accuracy and robustness of the recommendation system are improved. The experimental results show that they are better than mainstream models in the Recall@20 and NDCG@20 indicators.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120373351A_ABST
    Figure CN120373351A_ABST
Patent Text Reader

Abstract

The invention discloses a collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning, which is realized through a knowledge graph perception embedding module, a volume accumulation enhancement module, a view contrast learning module and a self-adaptive contrast loss module, and belongs to the technical field of information recommendation. According to the method, high-order semantics are aggregated through knowledge graph perception embedding and a graph convolutional network, so that the problem of signal sparseness in the knowledge graph is effectively relieved; high-quality sub-views and a hard negative sampling mechanism are screened in combination with view contrast learning, noise interference is suppressed, and embedding representation robustness is improved; experiments show that the method is obviously superior to a mainstream model in Recall (at) 20 and NDCG (at) 20 indexes, and both recommendation accuracy and anti-noise capability are considered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of information recommendation, and in particular to a collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning. Background Art

[0002] Recommendation systems provide personalized recommended items according to user preferences, which can improve the user experience and play a crucial role in solving information overload in online applications. How to effectively capture user preferences from user behavior is a crucial point in personalized recommendation systems.

[0003] The integration of knowledge graphs (KGs) has become an important part of improving the accuracy and performance of recommendation systems. In machine learning, deep learning, and reinforcement learning, using knowledge graphs for recommendation has shown obvious progress. Moreover, using knowledge graphs has significant advantages in terms of improving recommendation performance, enhancing the persuasiveness and interpretability of recommendation systems.

[0004] The adoption of graph contrast learning methods helps to more effectively learn the potential feature correlations in graphs, thereby improving data quality. By comparing the similarities between different views, this method can identify high-quality embedding representations, thereby reducing the adverse effects brought by invalid information and effectively solving problems related to data sparsity and noise.

[0005] Although many neural network-based enhancement methods have been introduced in current recommendation systems, there are still the following problems:

[0006] First, the long-tail distribution of entities in the knowledge graph leads to sparse supervision signals for interaction representations during the knowledge graph enhancement process, making it difficult to accurately reflect the true characteristics of the interaction relationship between entities and items. Second, knowledge graphs often have noise problems, and there are irrelevant interaction noises in entity-item dependency relationships, resulting in entity-item interactions deviating from their true characteristics and hindering the accurate representation of user preferences.

[0007] Based on this, a collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning is proposed. Summary of the Invention

[0008] The purpose of the present invention is to provide a collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning to solve the problems in the background art.

[0009] To achieve the above object, the present invention provides a collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning, including the following steps:

[0010] S1. Knowledge Graph Perception Embedding Module: Generate initial embedding representations for the semantic information of the current item and adjacent entities in the knowledge graph. Use a relational graph convolutional neural network to fuse the information of adjacent entities and update the embedding representation of the current item to obtain knowledge-aware embeddings;

[0011] S2. Convolutional Aggregation Enhancement Module: For the knowledge-aware embeddings, use a graph convolutional network to aggregate the features of adjacent entities highly relevant to the current item to obtain aggregated enhanced embeddings;

[0012] S3. View Contrastive Learning Module: Pass the aggregated enhanced embeddings as input to a hypergraph neural network for information passing, enhancement, and non-linear activation; For the i-th layer embedding of the hypergraph neural network, use a Bernoulli distribution to perform noise reduction and perturbation to generate multiple enhanced views. Utilize the consistency between the enhanced views to filter out noise, and select two optimal enhanced sub-views based on the similarity score for subsequent training;

[0013] S4. Adaptive Contrastive Loss Module: Based on the results of S3 and the hard negative sampling mechanism, define a total loss function to train the model, realize user preference prediction, and complete item recommendation;

[0014] The total loss function is expressed as:

[0015] L = L3 + λ1L1 + λ2∥ω∥ + L2;

[0016] Where L1 is the contrastive learning loss, L2 is the adaptive contrastive loss, L3 is the Bayesian personalized ranking loss, λ1 and λ2 are both weight factors used to balance the contributions of different loss terms in the total loss, ensure that the model achieves a balance in ranking accuracy and robustness, and ∥ω∥ is the norm of all learnable parameters in the model for regularization to prevent overfitting.

[0017] Preferably, S1 is specifically: Through the knowledge graph perception embedding module, generate initial vector representations for adjacent entities and the current item in the knowledge graph, and integrate semantic information into the initial embedding representations; Comprehensively consider the information of the neighbor entities of the current item, and use a relational graph convolutional network to splice the relational information with the item and entity embeddings and update them into the initial embedding representation of the current item to obtain knowledge-aware embeddings.

[0018] Preferably, the knowledge-aware embedding in S1 is expressed as:

[0019]

[0020] Where l i ∈R d is the embedding representation of the current item i, and l e ∈R dis the embedding representation of adjacent entity e, N i is the set of adjacent entities of the current item within a specific range, q(e, r, i) represents the importance weight for each adjacent entity to update the embedding representation of the current item, and r is the interaction relationship between the current item and the adjacent entity;

[0021] Among them, the importance weight is assigned by relationship information, expressed as:

[0022]

[0023] In the formula, exp(·) is the exponential function, LeakyReLU(·) represents the LeakyReLU activation function, which is used to increase non-linear expression, l i ‖l e represents concatenating two vectors into a 2d-dimensional vector, W ∈ R d×2d is a learnable weight matrix of specific parameters, which is used to map the concatenated vector to a new feature space.

[0024] Preferably, the S2 is specifically: for knowledge-aware embedding, the function of the graph convolutional layer in the graph convolutional network is adopted to perform information propagation and feature aggregation, then high-order pooling and attention mechanism are introduced to extract deep structural features, capture the high-order and cross-node dependencies between users and items, aggregate the features of entities highly relevant to the current item, and finally the embedding is updated layer by layer through multi-layer graph convolution and non-linear activation function, so that local information can spread to a wider area to obtain aggregated enhanced embedding;

[0025] Among them, the graph convolutional neural network can expand the existing entities and relationships of the knowledge graph, and make the current item automatically associate with the important information of adjacent entities; the introduced high-order pooling and attention mechanism transform the original graph convolutional neural network into a relational graph neural network, concatenate the embedding representations of entities and items that have stored different relationships, transform them into corresponding tensors for aggregation enhancement, and perform adaptive feature optimization on the feature information obtained from the knowledge graph;

[0026] The aggregated enhanced embedding is expressed as:

[0027] u* = LeakyReLU(T(u1, u')·W') + LeakyReLU(T(u2, u')·W');

[0028] In the formula, T(·, ·) represents similarity calculation, u1 and u2 are two feature representations obtained after different high-order pooling and attention enhancement operations, u' is a three-dimensional tensor formed by concatenating the embeddings of adjacent entities with different relationships to form a high-dimensional representation, and W' represents a new learnable weight matrix;

[0029] Among them, the three-dimensional tensor formed by splicing adjacent entity embeddings is specifically: splicing the entity embeddings based on the head index and the entity embeddings based on the tail index from three-dimensional space, and obtaining the three-dimensional tensor by transforming the embedding relationships between the current item and different adjacent entities.

[0030] Preferably, the S3 is specifically:

[0031] 1) Based on the idea of cross-view learning, adjust the relevant parameters of the knowledge-aware embedding and the aggregation-enhanced embedding to obtain two enhanced knowledge graphs; construct two matrices according to the knowledge graphs, which are the diagonal matrix D of the relationship strength between different entities in the same view e , and the diagonal matrix D of the association strength between entities in different views r ; Pass the aggregation-enhanced embedding to the hypergraph neural network to aggregate the two diagonal matrices containing view information.

[0032] Among them, the normalized propagation matrix for information propagation of the embedding of an entity or item in the hypergraph neural network is expressed as:

[0033]

[0034] In the formula, E is the association matrix between entities and relationships;

[0035] 2) Use the normalized propagation matrix to perform information transfer and enhancement on the embedding α at the (i - 1)-th layer in the hypergraph neural network, and then perform a non-linear transformation using an activation function to obtain the updated embedding α at the i-th layer i-1 ; i ;

[0036] 3) Generate a mask matrix using the Bernoulli distribution, multiply the mask matrix by the updated embedding at the i-th layer and then perform screening to obtain multiple enhanced views and construct multiple enhanced sub-views. The enhanced view is expressed as:

[0037] G′ k =α i ⊙Z;

[0038] In the formula, ⊙ represents element-wise multiplication, and Z is the mask matrix;

[0039] 4) Use the similarity between the embedding at the i-th layer and different enhanced sub-views to judge the noise level of the enhanced sub-views, and select two high-quality enhanced sub-views with high similarity scores and less noise for the subsequent contrast learning loss.

[0040] Preferably, in the S3, the embedding at the i-th layer of the hypergraph neural network is expressed as:

[0041] α i =α i-1 +σ(W1·αi-1 ·B i +a i );

[0042] In the formula, α i is the i-th layer embedding of the hypergraph neural network, σ is the sigmoid activation function, W1 is the normalized propagation matrix, and B i is the mapping matrix of the i-th layer, which is used for linear transformation and feature fusion;

[0043] The similarity score uses the consistency between views to filter noise, further guiding the selection of high-quality representations, and realizing the prediction of the items that the user ultimately wants to interact with. The similarity score is expressed as:

[0044] x i = d(‖α i - G k1 ‖, ‖α i - G k2 ‖);

[0045] In the formula, d(·) is the similarity calculation function, which is used to convert the distance into a similarity score. Both G k1 and G k2 are enhancer views constructed from G' k , representing feature representations from different perspectives or under random masks, and ∥·∥ represents the norm.

[0046] Preferably, in S4, the calculation process of the contrastive learning loss is as follows:

[0047] 1) Based on the similarity score, calculate the relationship loss rate between the user and the item, perform random edge dropping, learn the user preference, and enhance the contrastive learning process; Random edge dropping specifically means: while retaining the basic relationship information related to the user and the item, a certain user-item interaction probability is discarded;

[0048] 2) Use the attention weight matrix to aggregate the relationship between the user and the item, facilitating the capture of the semantic correlation and mutual dependence between the user and the item, and obtaining the aggregated embedding representations of the user and the item respectively;

[0049] The aggregated embedding representations of the user and the item can integrate the semantic information of the knowledge dependence within the user-item interaction graph into the user preference learning model. On the basis of the original enhanced view, important relationships are screened through the attention weight matrix to reconstruct two interactive enhanced contrast views. This dual combination of semantic information and user preference amplifies the contrastive learning effect and improves the learning quality;

[0050] 3) Based on step 2), positive samples and negative samples are defined for contrastive learning, so that the representations of the same user-item pair under different views are as close as possible, and different pairs are as distinguishable as possible, obtaining the contrastive learning loss;

[0051] Among them, the positive sample is the representation of the same user-item interaction extracted from the augmented view, and the negative sample is the representation of the non-interaction.

[0052] Preferably, the calculation formula of the relationship loss rate is:

[0053] c u,i = Θ·μ·v′ u,i ;

[0054] In the formula, both Θ and μ are adjustment parameters, and v' u,i is the normalized user-item interaction weight, v max is the maximum value of all v u,i in the current training batch, and v u,i is the initial weight of the user-item interaction, and v u,i = exp(x i );

[0055] The aggregated embedded representations of the user and the item are respectively:

[0056]

[0057] In the formula, y u and y i are the embedded representations of the user and the item respectively, M i represents the set of items associated with the user, and M u represents the set of users associated with the item.

[0058] Preferably, the contrastive learning loss is expressed as:

[0059]

[0060] In the formula, u represents the user, s(·) represents the cosine similarity, which measures the similarity difference between the user and the item between the positive sample and the negative sample, (z u , z i ) represents the representations of the same user and item under two views, τ is the hard negative sampling intensity parameter, which controls the smoothness of the distribution, and (z' u , z' i ) represents the representations of different users and items under two views.

[0061] Preferably, in S4, the calculation process of the adaptive contrast loss is:

[0062] 1) Use the hard negative sample supervised contrastive learning method to reclassify samples. Based on the selection function, select the discriminative hard negative samples from all candidate negative samples and construct the probability distribution of the hard negative samples. The hard negative samples are defined as the negative samples that are relatively close to the positive sample pairs and difficult to distinguish.

[0063] Among them, the screening condition is: use the cosine similarity to measure the similarity between the candidate negative sample and the embedded representation y of a certain user-item interaction. If a candidate negative sample has a high similarity, it is regarded as a hard negative sample.

[0064] The selection function is expressed as H(y - ∣F(y,B(β),τ));

[0065] Among them, F(y,B(β),τ) represents a set of conditions. The selection function maps and screens the candidate negative samples based on the regularization hyperparameter β and the hard negative sampling intensity parameter τ. y - represents the candidate negative sample. When the condition is met, the function H(·) will return the weight of the current candidate negative sample in the entire negative sample set, otherwise it returns 0, so as to ensure that only the negative samples that are similar to y and difficult to distinguish are selected.

[0066] 2) Perform hard negative sampling on the negative samples to construct an adaptive contrast loss.

[0067] Preferably, the adaptive contrast loss is expressed as:

[0068]

[0069] In the formula, represents the expectation of the candidate negative sample y - on the distribution Q. Φ(y,y + ,y - ,B(β)) represents the similarity difference function between the positive sample and the negative sample, which makes the model pull the positive sample closer and push the negative sample farther away.

[0070] Among them, Q is the probability distribution of the negative samples constructed according to the selection function, which is expressed as:

[0071]

[0072] The similarity difference function between the positive sample and the negative sample is expressed as:

[0073]

[0074] In the formula, y is the embedded representation of the user-item interaction, y + is the positive sample, and N is the total number of negative samples.

[0075] Preferably, in the S4, the Bayesian personalized ranking loss is expressed as:

[0076]

[0077] Wherein, U is the user set, i' represents an item that has not interacted with the user, and p u,i represents the predicted interaction score between the user and the item, which is obtained from the dot product of the user and item embedding representations, and p u,i ' represents the predicted interaction score between the user and the un-interacted item.

[0078] Therefore, a collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning of the present invention has the following beneficial effects:

[0079] (1) Through the knowledge graph perception embedding module, the semantic information and relationship features of adjacent entities are fused, and the attention mechanism is used to dynamically allocate entity weights, enhancing the supervision signal of user-item interaction. Combining the high-order feature aggregation ability of the graph convolutional network (GCN), the cross-node dependence relationship is captured, significantly improving the embedding representation quality in the long-tail entity and sparse interaction scenarios, and solving the problem of signal sparsity caused by the long-tail distribution of entities in the knowledge graph.

[0080] (2) The view contrast learning module generates multiple enhanced views by randomly perturbing with the Bernoulli distribution, uses the hypergraph neural network to screen sub-views with high similarity and low noise, and combines cosine similarity calculation and consistency constraint to filter out irrelevant entity-item interaction noise; the adaptive contrast loss module introduces a hard negative sampling mechanism to enhance the robustness of the model to noise, ensuring that the embedding space can accurately represent the true preferences of users, and significantly reducing the negative impact of noise on the recommendation results.

[0081] (3) Combining the Bayesian personalized ranking loss and the adaptive contrast loss, through multi-task joint optimization, the sorting accuracy and feature discrimination are balanced. Experiments show that this method is superior to the mainstream baseline models on multiple public datasets, and the Recall@20 and NDCG@20 metrics are significantly improved, verifying its excellent performance in dealing with sparse data and high-noise scenarios.

[0082] Next, through the drawings and embodiments, the technical solutions of the present invention will be further described in detail. Description of the Drawings

[0083] Figure 1 It is a schematic flowchart of an embodiment of the present invention. Detailed Embodiments

[0084] The technical solutions of the present invention will be further described below through the drawings and embodiments.

[0085] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention.

[0086] As Figure 1 shown, a collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning provided by the present invention is implemented through the following four modules:

[0087] 1) Knowledge graph perception embedding module: Construct an initial high-quality embedding representation to provide a rich semantic basis for subsequent graph convolution and contrast learning;

[0088] 2) Convolution aggregation enhancement module: Used to capture high-order semantics and global structure information to further improve the quality of the embedding representation;

[0089] 3) View contrast learning module: Generate multiple different enhanced views, and capture stable user-item interaction features through contrast learning while filtering out noise information;

[0090] 4) Adaptive contrast loss module: By comparing the similarity between positive samples and negative samples and combining the hard negative sampling mechanism, the model can learn more discriminative embedding representations in contrast learning and improve the accuracy of recommendations.

[0091] Embodiment

[0092] To verify the recommendation effect of the collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning provided by the present invention, this method is compared with multiple advanced recommendation methods to comprehensively evaluate the effectiveness and capabilities of the present invention, as follows:

[0093] 1) Comparative experiment:

[0094] ① Dataset selection: For a thorough evaluation, three different and publicly available datasets from real-life platforms are used: Last-FM, Alibaba-iFashion, and Amazon-book. These datasets can represent different data volumes and data sparsity levels and reflect the complexity of the real world. Table 1 shows the statistical information of the three datasets.

[0095] Table 1 - Statistical information of the experimental datasets

[0096]

[0097] ② Evaluation Protocol: For fair comparison, a complete ranking strategy is adopted, and the non-interacted items of each user are used as negative samples to infer user preferences. Two metrics are used for evaluation: Recall@N and NDCG@N, which evaluate the accuracy of the top N recommended items. By default, N = 20;

[0098] ③ Comparison Baselines: The algorithm provided by the present invention is uniformly benchmarked against 10 popular recommendation system techniques, and Recall@20 and NDCG@20 are used for measurement. The 10 recommendation system techniques are as follows: BPR, a personalized ranking method based on implicit feedback; GC-MC, an application of matrix completion method based on graph convolutional neural network; LightGCN, a simplified convolutional neural network model; SGL, a self-supervised learning method; CKE, a hybrid recommendation system framework based on knowledge graph and neural network; and also 5 knowledge graph enhanced recommendation algorithms based on graph neural network: KGCN, KGAT, KGIN, CKAN, KGCL.

[0099] ④ Experimental Parameter Settings: The embedding dimension of all methods is fixed at 64, and the model is optimized with a learning rate of 1e -3 and a batch size of 2048. In the present invention, to test the influence of the adaptive contrast loss regularization coefficient β and the hard negative sampling intensity parameter τ on the model, the ranges of the two parameters are respectively set as (10 -3 , 10 -2 , 10 -1 ) and (0.1, 0.2, 0.3, 0.4, 0.5), and the influence of different parameters on the performance of the recommendation system is analyzed.

[0100] ⑤ Experimental Results are shown in Table 2:

[0101] Table 2 presents the comprehensive performance of this algorithm and the other 10 popular recommendation algorithms in terms of Recall@20 and NDCG@20.

[0102] Table 2 - Experimental Results

[0103]

[0104] Through comparative analysis of experimental data, it can be concluded that, compared with other popular recommendation systems, this algorithm has superior performance in all evaluation scenarios. It proves the effectiveness of the convolutional enhanced graph relation representation and the knowledge graph contrast learning method in selecting high-quality embedding representations, has versatility and flexibility, and demonstrates the adaptability to various evaluation datasets of knowledge graphs with different sparsities, different features, and recommendation scenarios. It confirms the effectiveness of the knowledge edge graph contrast learning method in solving the sparsity and noise problems in recommendation systems. Excellent graph attention networks and effective information aggregation schemes can better reduce the intrusion of noise information during the large-scale experimental training process; they can capture user-item dependencies and high-order links, obtain higher-quality interactive embedding representations, and effectively support subsequent evaluation work; it also shows that the rich entity-item interactions and semantic information in the knowledge graph may lead to information redundancy and noise marginalization, affecting learning efficiency and introducing user interest biases.

[0105] 2) Ablation experiment:

[0106] In this algorithm, the two most important parameters are the adaptive contrast loss regularization coefficient β and the hard negative sampling intensity parameter τ. Different combinations of the two parameters are experimentally analyzed to study the impact of the two parameters on the model. The final results are shown in Table 3:

[0107] Table 3 - Impact of Parameter Combinations of β and τ on Model Performance in the Alibaba-iFashion Dataset

[0108]

[0109] As can be seen from Table 3, when the parameter β value is 10 -2 , and the parameter τ value is 0.2, the model has the best performance. When changing the values of these two parameters, it can be observed that the model performance will significantly decline. It can be seen from the table that the model is more sensitive to changes in τ. A smaller τ is beneficial for the model to converge faster, while β shows monotonicity in most cases, and a smaller β may improve performance.

[0110] In summary, the present invention proposes a collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning. Using graph convolution, it strengthens the triple embedding representation of the knowledge graph and designs contrast views using graph contrast learning to explore the connections between heterogeneous graph entities. To a certain extent, it alleviates the problems of noise and data sparsity and also achieves excellent results on three publicly available datasets.

[0111] Therefore, the collaborative recommendation algorithm of the present invention based on knowledge graph enhancement and negative sample contrast learning effectively alleviates the signal sparsity problem in the knowledge graph by means of knowledge graph-aware embedding and graph convolutional network aggregation of high-order semantics; combines view contrast learning to screen high-quality sub-views and a hard negative sampling mechanism to suppress noise interference and improve the robustness of the embedding representation; experiments show that this method is significantly better than mainstream models in terms of Recall@20 and NDCG@20 metrics, taking into account both recommendation accuracy and noise resistance.

[0112] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that they can still modify or equivalently replace the technical solutions of the present invention, and these modifications or equivalent replacements do not enable the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.

Claims

1. A collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning, characterized in that, It includes the following steps: S1. Knowledge Graph Perception Embedding Module: Generate an initial embedding representation for the semantic information of the current item and adjacent entities in the knowledge graph. Use a relational graph convolutional neural network to fuse the information of adjacent entities and update the embedding representation of the current item to obtain knowledge-aware embedding; S2. Convolutional Aggregation Enhancement Module: For the knowledge-aware embedding, use a graph convolutional network to aggregate the features of adjacent entities highly relevant to the current item to obtain aggregated enhanced embedding; S3. View Contrastive Learning Module: Pass the aggregated enhanced embedding as input to a hypergraph neural network for information transmission, enhancement, and non-linear activation; For the i-th layer embedding of the hypergraph neural network, use the Bernoulli distribution to perform noise reduction and perturbation to generate multiple enhanced views, and select two optimal enhanced sub-views based on the similarity score; S4. Adaptive Contrastive Loss Module: Based on the results of S3 and the hard negative sampling mechanism, define a total loss function to train the model, realize user preference prediction, and complete item recommendation; The total loss function is expressed as: L = L3 + λ1L1 + λ2∥ω∥ + L2; In the formula, L1 is the contrastive learning loss, L2 is the adaptive contrastive loss, L3 is the Bayesian personalized ranking loss, both λ1 and λ2 are weight factors, and ∥ω∥ is the norm of all learnable parameters in the model.

2. The collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning according to claim 1, wherein The knowledge-aware embedding in S1 is expressed as: where \(l\) i \(\in\mathbb{R}\) d is the embedding representation of the current item \(i\), and \(l\) e \(\in\mathbb{R}\) d is the embedding representation of the adjacent entity \(e\), \(N\) i is the set of adjacent entities of the current item within a specific range, \(q(e, r, i)\) represents the importance weight for each adjacent entity to update the embedding representation of the current item, and \(r\) is the interaction relationship between the current item and the adjacent entity; Among them, the importance weight is expressed as: where exp(·) is the exponential function, LeakyReLU(·) represents the LeakyReLU activation function, ∥ represents the vector concatenation operation, and W ∈ R d×2d is the learnable weight matrix.

3. A collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning according to claim 1, characterized in that The specific content of S2 is: For the knowledge-aware embedding, use a graph convolutional network for information propagation and feature aggregation, and then introduce high-order pooling and attention mechanism to extract deep structural features to obtain aggregated enhanced embedding; The aggregated enhanced embedding is expressed as: u * = LeakyReLU(T(u1, u') · W') + LeakyReLU(T(u2, u') · W'); In the formula, T(·,·) represents similarity calculation, u1 and u2 are two feature representations obtained after different high-order pooling and attention enhancement operations, u' is a three-dimensional tensor formed by splicing the embeddings of adjacent entities with different relationships, and W' is a new learnable weight matrix.

4. A collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning according to claim 1, characterized in that, In S3, the i-th layer embedding of the hypergraph neural network is expressed as: α i = α i-1 + σ(W1 · α i-1 · B i + a i ); where α i is the embedding of the i-th layer of the hypergraph neural network, σ is the sigmoid activation function, W1 is the normalized propagation matrix, and B i is the mapping matrix of the i-th layer; The similarity score is expressed as: x i = d(||α i - G k1 ||, ||α i - G k2 ||); where d(·) is the similarity calculation function, and G k1 and G k2 are both enhancer views, and ||·|| represents the norm.

5. A collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning according to claim 1, characterized in that, In S4, the calculation process of the contrastive learning loss is: 1) Based on the similarity score, calculate the relationship loss rate between the user and the item, perform random edge dropping, and learn user preferences; 2) Use the attention weight matrix to aggregate the relationship between the user and the item, and obtain the aggregated embedding representations of the user and the item respectively; 3) Based on step 2), define positive samples and negative samples for contrastive learning to obtain the contrastive learning loss; Among them, the positive sample is the representation of the same user-item interaction extracted from the enhanced view, and the negative sample is the non-interacted representation.

6. The collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning according to claim 5, characterized in that, The calculation formula of the relationship loss rate is: c u,i = Θ·μ·v' u,i ; where Θ and μ are both adjustment parameters, and v' u,i is the normalized user-item interaction weight, v max is the maximum value of all v u,i in the current training batch, and v u,i is the initial weight of the user-item interaction, v u,i = exp(x i ); The aggregated embedding representations of the user and the item are respectively: where y u and y i are the embedding representations of the user and the item respectively, M i represents the set of items associated with the user, and M u represents the set of users associated with the item.

7. A collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning according to claim 5, characterized in that The contrastive learning loss is expressed as: where \(u\) represents a user, \(s(\cdot)\) represents cosine similarity, \((z u ,z i )\) represents the representations of the same user and item under two views, \(\tau\) is the hard negative sampling intensity parameter, \((z' u ,z' i )\) represents the representations of different users and items under two views.

8. A collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning according to claim 1, characterized in that, In S4, the calculation process of the adaptive contrastive loss is: 1) Based on the selection function, screen out hard negative samples from all candidate negative samples and construct the probability distribution of the hard negative samples; The hard negative sample is defined as a negative sample that is relatively close to the positive sample and difficult to distinguish; 2) Perform hard negative sampling on the negative samples to construct the adaptive contrastive loss.

9. A collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning according to claim 8, characterized in that, The adaptive contrastive loss is expressed as: wherein denotes the expectation of the negative sample y - over the distribution Q, and Φ(y, y + , y - , B(β)) represents the similarity difference function between the positive sample and the negative sample; Among them, the similarity difference function between the positive sample and the negative sample is expressed as: where y is the embedded representation of user-item interaction, y + is the positive sample, N is the total number of negative samples, and β is the regularization coefficient.

10. A collaborative recommendation algorithm based on knowledge graph enhancement and negative sample contrast learning according to claim 1, characterized in that In the above S4, the Bayesian personalized ranking loss is expressed as: Wherein, U is the user set, i' represents an item that has not interacted with the user, and p u,i represents the predicted interaction score between the user and the item, and p u,i ' represents the predicted interaction score between the user and the non-interacted item.

Citation Information

Cited By

  • Knowledge graph and contrast learning fusion-based intention perception recommendation method

    CN120611100A

  • Cross-domain recommendation method, system and device based on comparative learning and storage medium

    CN121051306A

  • Recommendation method and system based on large language model enhancement and structured alignment

    CN121188292A

  • Post personnel recommendation method based on relation perception weighted loss

    CN121212726A