Information recommendation method and device based on knowledge graph and adjacency graph collaborative sampling

By constructing a collaborative knowledge graph and a multi-head graph attention network, generating difficult negative samples and training them, we solved the problems of sparsity of user-item interactions and non-capture of high-order semantic information, improved the accuracy and generalization ability of the recommendation system, and achieved efficient modeling of users' implicit preferences and complex item associations.

CN120561384BActive Publication Date: 2025-10-10HUAQIAO UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511062405.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-31
Publication Date
2025-10-10
Estimated Expiration
2045-07-31

AI Technical Summary

Technical Problem

Existing recommendation systems suffer from the sparsity of user-item interactions, insufficient capture of high-order semantic information in knowledge graphs, and the interference of false negative examples and insufficient sample discrimination in traditional negative sampling methods, which affect the modeling of user implicit preferences and complex item associations.

Method used

By constructing a collaborative knowledge graph, combining multi-hop neighbor sampling and multi-head graph attention network, generating difficult negative samples and training them, explicitly modeling many-to-one relationships, using biased random walks and linear interpolation to generate negative samples close to the decision boundary, and adopting a triple loss optimization mechanism to improve the model's ability to distinguish fine-grained semantics.

Benefits of technology

It significantly improves the recommendation system's ability to perceive users' implicit preferences and complex item associations, improves the accuracy and generalization of recommendations, avoids false negative interference and feature redundancy, and achieves efficient capture of high-order semantic information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120561384B_ABST
    Figure CN120561384B_ABST
Patent Text Reader

Abstract

The application provides an information recommendation method and device based on knowledge graph and adjacency graph collaborative sampling, and relates to the technical field of information recommendation. The application constructs a triple by obtaining user historical interaction data, and fuses the triple with a project attribute graph to construct a collaborative knowledge graph; an initial embedding representation is obtained by projection transformation; a multi-hop neighbor set is obtained by multi-hop neighbor sampling through biased random walk; the neighbor most similar to the embedding representation of the positive sample project is determined as an anchor neighbor; then linear interpolation is performed to synthesize the embedding representation of the difficult negative sample; the positive sample and the synthesized difficult negative sample are used for training based on a multi-head graph attention network, and an updated embedding representation is aggregated; and an interaction probability is calculated based on the updated embedding representation to generate a recommended project for the user. The application effectively solves the user-project interaction sparsity and false negative interference problems, and provides stronger semantic understanding and generalization ability for the recommendation system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence and information recommendation technology, and in particular to an information recommendation method and device based on collaborative sampling of knowledge graphs and adjacency graphs. Background Art

[0002] Recommender systems, as a core technology for addressing information overload, are widely used in scenarios such as e-commerce and social networks. Traditional collaborative filtering algorithms analyze user historical behavior to discover preferences, but their performance degrades significantly when user-item interactions are sparse. Knowledge graphs depict complex relationships between entities through structured semantic networks, providing rich auxiliary information for recommendation systems and helping to improve the diversity and interpretability of recommendations.

[0003] Recommendation methods based on knowledge graphs are mainly categorized into two types: embedding learning and path reasoning. Embedding methods (such as TransE and TransR) enrich semantic information through representation learning but ignore explicit connections between entities. Path methods (such as Meta-path) exploit multi-hop relational paths to mine latent associations, but suffer from drawbacks such as high computational complexity and difficulty in model optimization. To combine the strengths of both approaches, H. Wang et al. proposed the RippleNet model, which uses a preference propagation mechanism to gradually extend the ripple effect of user interests within the knowledge graph, combining embedding and path information to enhance recommendation effectiveness. However, RippleNet does not explicitly model the overall topological structure of the knowledge graph, which may result in insufficient capture of high-order semantic relationships. X. Wang et al. further proposed the KGAT model, which fuses the user-item interaction graph with the knowledge graph and employs a graph attention network to aggregate multi-hop neighborhood information, enabling fine-grained representation learning. However, the complex network structure of KGAT can easily dilute user preference information during parameter updates, and the reliability of attention weight allocation is limited in sparse scenarios. To address these issues, KGIN introduces a user intent-aware graph interaction mechanism, decomposing user behavior into multiple intent-driven subspaces and dynamically aggregating heterogeneous information using relational path attention. While KGIN has achieved breakthroughs in intent modeling, it still fails to adequately capture fine-grained behavioral patterns in historical user interaction sequences. Furthermore, the multi-intent decoupling process can introduce noise, impacting recommendation accuracy.

[0004] Therefore, how to effectively integrate user behavior patterns and item semantic information in knowledge graph recommendations while avoiding false negative interference and feature redundancy has become a technical challenge that needs to be solved urgently. In view of this, this application is specially filed. Summary of the Invention

[0005] The present invention aims to provide an information recommendation method, apparatus, device and medium based on collaborative sampling of knowledge graph and adjacency graph, so as to solve the problems existing in existing recommendation systems such as sparse user-item interactions, insufficient capture of high-order semantic information of knowledge graph, false negative interference and insufficient sample discrimination in traditional negative sampling methods, and achieve efficient modeling of user implicit preferences and complex item associations.

[0006] In order to solve the above technical problems, the present invention is implemented through the following technical solutions:

[0007] An information recommendation method based on collaborative sampling of knowledge graph and adjacency graph, comprising:

[0008] Obtain historical user interaction data, construct triples containing users, items, and relationships, and fuse them with pre-built item attribute graphs to construct collaborative knowledge graphs;

[0009] Based on the collaborative knowledge graph, representation alignment is performed through projection transformation of the constrained relational space to obtain a pre-trained initial embedding representation;

[0010] Based on the user historical interaction data, multi-hop neighbor sampling is performed through a biased random walk to obtain a multi-hop neighbor set; wherein the number of hops of the biased random walk is dynamically adjusted according to the current number of training rounds;

[0011] In the multi-hop neighbor set, determine the neighbor that is most similar to the embedding representation of the positive sample item as the anchor neighbor;

[0012] Linearly interpolating the embedding representation of the positive sample item with the embedding representation of the anchor point neighbor to synthesize the embedding representation of the hard negative sample;

[0013] Based on a multi-head graph attention network, the initial embedding representation is trained with positive samples and synthetic hard negative samples to capture high-level information of the knowledge graph and aggregate it to obtain an updated embedding representation;

[0014] The interaction probability is calculated based on the updated embedding representation to generate recommended items for the user.

[0015] Preferably, the initial embedding representation is obtained by the following steps:

[0016] For each inter-entity relationship in the collaborative knowledge graph, the projection matrix is ​​initialized, and the following relationship exists:

[0017] ;

[0018] in, Represents the projection matrix corresponding to the relationship r between entities, The vector representation of the head entity h, that is, the vector representation of the user entity; A vector representation of the relationship r between entities; The vector representation of the tail entity t, that is, the vector representation of the item entity;

[0019] Based on the projection matrix , map the head entity and tail entity in the triple from the entity space to the relation space, and construct a score function, that is, the initial embedding representation, which is used to measure the rationality of the triple. The expression is:

[0020] ;

[0021] in, represents the L2 norm; It represents the score function, that is, the distance between the projected head entity plus the relationship vector and the projected tail entity. The lower the score, the more the triple conforms to the projection relationship in the collaborative knowledge graph.

[0022] Preferably, the multi-hop neighbor sampling process includes:

[0023] Define fixed window sliding size , based on the user's historical interaction data, the interaction data sequence in each window is obtained, and the expression is:

[0024] ;

[0025] in, express User historical interaction data sequence of window size; express The item in the cth window in the sequence; Indicates the total number of windows; represents the time variable in a single window; express The cth window in the sequence projects; express Items in a sequence The item in the next △ position Establish undirected edge connections; express in sequence Establish undirected edge connections between items in each window;

[0026] For each positive sample item node within the fixed window , a biased random walk method is used for sampling, that is, the next node is selected according to the sampling probability, and the upper and lower thresholds of the number of neighbors are constrained to obtain a set of multi-hop neighbors , thus obtaining a multi-hop neighbor set;

[0027] The expression of the sampling probability is:

[0028] ;

[0029] in, Representation node Sampling to select the next node The sampling probability of Representation node The out-degree of Represents a positive sample project node The set of neighbors from 1 hop to K hops away.

[0030] Preferably, the number of hops of the biased random walk is dynamically adjusted according to the current number of training rounds during the training process, and the number of hops of the biased random walk is dynamically adjusted according to the current number of training rounds, and the number of hops increases with the increase of the number of training rounds until it reaches a preset maximum number of hops. The expression is:

[0031] ;

[0032] in, Indicates the preset maximum number of hops. is the current training round number, is the initial hop count, is the adjustment step size.

[0033] Preferably, the expression of the anchor point neighbor is:

[0034] ;

[0035] in, is the anchor point neighbor; Represents the positive sample item node in the multi-hop neighbor set The corresponding neighbor set; express Nodes in 、 Represents nodes respectively , the corresponding embedding representation of j; T represents the transposed symbol.

[0036] Preferably, the linear interpolation synthesis process of the difficult negative samples is:

[0037] ;

[0038] in, Embedding representation for difficult negative samples; is the embedding representation of the neighbors of the anchor point; is the embedding representation of the positive sample item; is the mixing coefficient, which takes values ​​in the interval [0,1].

[0039] Preferably, it also includes using contrast loss To distinguish positive samples from synthetic difficult negative samples, contrast loss The expression is:

[0040] ;

[0041] in, is the number of negative samples, is the user’s embedded representation; is the embedding representation of the positive sample item; is the embedding representation of the hard negative sample; T represents the transposed symbol.

[0042] Preferably, the multi-head graph attention network is based on positive samples and synthetic difficult negative samples to train the initial embedding representation, specifically:

[0043] First, the entity embedding representation of the collaborative knowledge graph is regarded as a node of the graph attention network. For each entity relationship, its projection matrix Split into indivual ; The projection matrix of the relationship r between entities on the i-th head is used to project the d-dimensional entity onto dimensional relational space;

[0044] Then the relation embedding is split into multiple heads to obtain the initial multi-head embedding representation of the relation:

[0045] ;

[0046] in, is the number of heads in the multi-head graph attention network, 0 represents the initial 0th layer embedding representation; The initial layer 0 embedding representation of the relationship; Indicates the initial relationship Head embedding representation;

[0047] For any triple in the collaborative knowledge graph, the head node and the tail node are embedded into the k-th head relation multi-head space, which can be expressed as:

[0048] ; ;

[0049] in, Represents the head node; Represents the tail node; is the head entity, is the tail entity; is the projection matrix of the inter-entity relation r on the kth head;

[0050] Then the initial adjacency matrix is constructed, and the adjacency matrix is normalized according to the relation type , the expression is:

[0051] ; ;

[0052] wherein, denotes the adjacency matrix of type r; is the normalized adjacency matrix of type r; D is the degree matrix; is the number of relation types;

[0053] The element of is the attention score , the attention score of the triple for the kth head is expressed as:

[0054] ;

[0055] wherein, is the triple attention score of the kth head; is an activation function; denotes the relation of the kth head;

[0056] According to the attention score, the forward adjacency matrix and the reverse adjacency matrix are constructed for each attention head k respectively, and the neighbor aggregation representation of each node for each head, i.e. the attention network, is obtained by bidirectional information aggregation, expressed as:

[0057] ;

[0058] wherein, denotes the attention network of the kth head of the node h; denotes the set of triples with entity h as the head node; denotes the tail entity of the kth head; denotes the forward propagation attention score; denotes the reverse propagation attention score;

[0059] Then, the final representation of the entity node h on the kth head is generated through residual connection and feature interaction , the expression is:

[0060] ;

[0061] wherein, is a trainable parameter matrix; is an activation function;

[0062] After bidirectional multi-head aggregation, the multi-head of the entity is spliced ​​to obtain the entity embedding representation of the current layer , the expression is:

[0063] ;

[0064] in, Indicates the number of heads in the multi-head attention network; Indicates that the entity node h is in The final representation of the head; For splicing operation;

[0065] After recursive aggregation through multiple layers of the network, high-level features of the nodes are captured to obtain the updated entity embedding representation, that is, the updated user embedding representation and item embedding representation.

[0066] Preferably, the interaction probability is calculated based on the updated user embedding representation and item embedding representation to generate recommended items for the user, specifically as follows:

[0067] Based on the updated user embedding representation and item embedding representation, a user-entity interaction score function is constructed through inner product operation, and the expression is:

[0068] ;

[0069] in, Indicates the user's preference strength for the entity, that is, the interaction probability. The higher the score, the greater the interaction probability. represents the updated user embedding representation; Represents item embedding representation; represents the transpose symbol;

[0070] Then, the overall preference strength of the positive sample entity set pose in the user's historical interaction data Quantized to:

[0071] ;

[0072] in, Nodes representing the set of positive sample entities; represents the embedding representation of node i;

[0073] According to the calculated interaction probability, all items are sorted and items with interaction probability greater than the set threshold are recommended to users;

[0074] The user preference feature representation loss function is used to train the interaction probability. The user preference feature representation loss function The expression is:

[0075] ;

[0076] ;

[0077] ;

[0078] ;

[0079] ;

[0080] in, The Bayesian personalized ranking loss is used to ensure that non-interacted entities are far away from the user preference space; is the Sigmoid function; A reconciliation parameter representing the total number of user entities and the total number of project entities; is the preference strength of the positive sample set; is the preference strength of the negative sample set;

[0081] It is the margin loss, which is used to constrain the gap between the positive sample score and the negative sample score; Preset interval thresholds for hyperparameters;

[0082] is the regularization loss, which is used to constrain the embedding vector modulus to prevent overfitting; is the regularization coefficient; represents the matrix Frobenius norm; represents the n-th user embedding representation.

[0083] The present invention also provides an information recommendation device based on collaborative sampling of knowledge graph and adjacency graph, comprising:

[0084] Collaborative knowledge graph construction unit, used to obtain user historical interaction data, construct triples containing users, projects and relationships, and fuse them with pre-built project attribute graphs to construct collaborative knowledge graphs;

[0085] An initial embedding representation unit, configured to perform representation alignment based on the collaborative knowledge graph through a projection transformation of the constrained relational space to obtain a pre-trained initial embedding representation;

[0086] A multi-hop neighbor set unit, configured to perform multi-hop neighbor sampling based on the user historical interaction data through a biased random walk to obtain a multi-hop neighbor set; wherein the number of hops in the biased random walk is dynamically adjusted according to the current number of training rounds;

[0087] An anchor neighbor unit, configured to determine, in the multi-hop neighbor set, a neighbor that is most similar to the embedding representation of the positive sample item as an anchor neighbor;

[0088] a hard negative sample synthesis unit, configured to linearly interpolate the embedding representation of the positive sample item with the embedding representation of the anchor point neighbor to synthesize the embedding representation of the hard negative sample;

[0089] A multi-head graph attention unit is used to train the initial embedding representation based on a multi-head graph attention network using positive samples and synthetic hard negative samples to capture high-level information of the knowledge graph and aggregate it to obtain an updated embedding representation;

[0090] A recommendation generation unit is used to calculate the interaction probability based on the updated embedding representation and generate recommended items for the user.

[0091] The present invention also provides an information recommendation device based on collaborative sampling of knowledge graph and adjacency graph, including a processor and a memory, wherein the memory stores a computer program, and the computer program can be executed by the processor to implement the above-mentioned information recommendation method based on collaborative sampling of knowledge graph and adjacency graph.

[0092] The present invention also provides a computer-readable storage medium, on which computer-readable instructions are stored. When the computer-readable instructions are executed by the processor of the device where the computer-readable storage medium is located, an information recommendation method based on collaborative sampling of knowledge graph and adjacency graph is implemented as described above.

[0093] In summary, compared with the prior art, the present invention has the following beneficial effects:

[0094] First, by constructing a collaborative knowledge graph, this paper organically integrates user behavior data with the project attribute graph, forming a dual semantic network that encompasses both static attribute associations and dynamic interaction patterns. This provides key topological constraints for subsequent embedding learning. Furthermore, during the initialization phase of knowledge graph embedding, a relationship-specific projection matrix mechanism is designed to explicitly model the representation alignment problem in many-to-one relationships.

[0095] The present invention generates difficult negative samples through the NbrGCF adjacency graph collaborative sampling technology. During the sampling process, progressive multi-hop neighbor sampling is implemented, and the number of hops can be increased with the training rounds to increase the sample difficulty. The most similar anchor points are selected for linear interpolation mixing to generate synthetic negative examples that directly approach the decision boundary, significantly improving the model's ability to distinguish fine-grained semantics.

[0096] The present invention performs recursive propagation through a bidirectional graph attention network with a multi-head projection mechanism, orthogonally decomposing the relational projection matrix and embedding along the feature dimension into multiple attention heads, thereby achieving efficient capture of high-order semantic information.

[0097] During the training optimization stage, the present invention maximizes the difference probability of positive and negative samples through a triple loss optimization mechanism, forces the separation of decision boundaries, suppresses overfitting, and improves the ability to perceive users' implicit preferences and complex item associations, providing the recommendation system with more powerful semantic understanding and generalized recommendation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0098] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

[0099] Figure 1 A schematic diagram of an information recommendation method based on collaborative sampling of knowledge graph and adjacency graph provided in Example 1.

[0100] Figure 2 This is the NbrGCF model diagram of the adjacency graph collaborative sampling method provided in Example 1.

[0101] Figure 3 This is a flowchart of the adjacency graph collaborative sampling method NbrGCF provided in Example 1.

[0102] Figure 4 A schematic diagram of an information recommendation device based on collaborative sampling of knowledge graph and adjacency graph provided in Example 2.

[0103] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments. DETAILED DESCRIPTION

[0104] In order to make the purpose, 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 in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the invention for which protection is sought, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0105] Example 1

[0106] Embodiment 1 of the present invention provides an information recommendation method based on collaborative sampling of knowledge graphs and adjacency graphs, which can be implemented by an information recommendation device based on collaborative sampling of knowledge graphs and adjacency graphs (hereinafter referred to as the information recommendation device), and in particular, executed by one or more processors in the information recommendation device.

[0107] In this embodiment, the information recommendation device may be an electronic device equipped with a processor, which carries a computer program of the information recommendation method based on collaborative sampling of knowledge graph and adjacency graph and can be executed, such as a computer, a smart phone, a smart tablet, a workstation, etc., which is not limited here.

[0108] like Figure 1 As shown, an information recommendation method based on collaborative sampling of knowledge graph and adjacency graph includes steps S1 to S7.

[0109] S1, obtains user historical interaction data, constructs triples containing users, items and relationships, and integrates them with the pre-built item attribute graph to construct a collaborative knowledge graph.

[0110] In this step, we collect historical user interaction information on various platforms, such as product purchases, movie ratings, and news browsing history. This data contains user interactions with various items (e.g., products, movies, news), or we can download existing user interaction datasets from official websites. Based on this historical user interaction data (i.e., item ratings), we obtain pre-trained embedding representations of users and entities on the knowledge graph, which serve as the basis for subsequent aggregation.

[0111] Based on the user's rating data for the project, a strict data cleaning process is first performed: invalid interaction records are filtered out (including but not limited to records with missing user ID or project ID, outliers outside the preset rating range, and repeated rating records of the same user for the same project).

[0112] After cleaning, each valid rating record is structured and converted to a triple data structure with the user as the head entity, the item as the tail entity, and the user's rating for the item as the relationship. For example, user U's rating of 4 on item I generates the triple (U, rated_with_4, I). The original user-item interaction data is filtered, retaining valid interaction records.

[0113] These filtered rating triplets are integrated into the pre-built project attribute graph dataset.

[0114] The pre-built item attribute graph dataset contains relationships between item attributes, typically semantic relationships such as "belongs_to_category" indicating category affiliation, "produced_by" indicating manufacturer association, and "contains_ingredient" indicating ingredient composition. Examples include product category, price range, and brand, and film genre, director, and actor. By integrating the previously constructed triples containing user-item interaction relationships with the item attribute graph, the knowledge graph not only encompasses the interactions between users and items but also encompasses the rich attribute information of the items themselves, thereby constructing a more comprehensive and information-rich collaborative knowledge graph.

[0115] In the knowledge graph, the triple is represented as: the user (head entity) is associated with the item (tail entity) through a specific rating relationship.

[0116] The fusion operation adds two key elements: the introduction of user entity nodes at the entity layer and the addition of rating relationship edges between users and projects at the relationship layer. The resulting collaborative knowledge graph possesses dual-perspective semantic representation capabilities: it preserves the static semantic network of inherent attribute associations between projects while also incorporating dynamic interaction patterns driven by user behavior. Of particular note is the inherent many-to-one nature of rating relationships, meaning that multiple users can be connected to the same project entity through the same or different rating relationships. This topological property will be explicitly modeled through the projection transformation design of the subsequent embedding initialization mechanism.

[0117] S2, based on the collaborative knowledge graph, representation alignment is performed through projection transformation of the constrained relational space to obtain a pre-trained initial embedding representation.

[0118] In the initialization stage of knowledge graph representation, we convert the relations and nodes in the knowledge graph into vector embedding representations.

[0119] Map the entities (including user entities and project entities) and relationships in the collaborative knowledge graph to a d-dimensional continuous vector space. Assign a unique embedding vector to each entity (user entity is represented by ∈ , the project entity is represented as ∈ ), initialize the relationship vector for each relationship type r (including the original item attributes and the newly added rating relationship) ∈ and relation-specific projection matrix ∈ , R is a real number. For any real triple (h, r, t) (h is the head entity, r is the relation, t is the tail entity), the entity is mapped from the original space to the relation space through the relation-specific projection matrix, so that it satisfies:

[0120] ;

[0121] in, Represents the projection matrix corresponding to the relationship r between entities, The vector representation of the head entity h, that is, the vector representation of the user entity; A vector representation of the relationship r between entities; Represents the vector representation of the tail entity t, that is, the vector representation of the item entity.

[0122] This embedding method of the projection matrix has significant advantages. It fully considers the characteristics of the head and tail entities and cleverly captures the many-to-one relationship characteristics.

[0123] The so-called many-to-one relationship may exist at the same time Such triples, where different head entities and Connected to the same tail entity t through the same relation r. The mapping, although the header entity and The representations in the original space may be quite different, but in the relational space defined by the relation r, their representations will tend to be close. This means that the projection matrix can transform the head entities with different features in the original space from the perspective of a specific relation, so that they show consistency and relevance with the relation in the relational space. 、 When connected to the same tail entity t through the same relationship r (i.e., there is ( , r, t) and ( , r, t)), projection matrix Able to transform the original space with large differences 、 Achieve representation alignment in the relational space, ensuring that they all satisfy and , thus deriving The relational space equivalence.

[0124] Based on the projection matrix , the head entity and the tail entity of the triple consisting of the user entity, the item entity and the relationship between the entities are mapped from the entity space to the relationship space, and a scoring function is constructed to measure the rationality of the triple. The expression is:

[0125] ;

[0126] in, represents the L2 norm; It represents the score function, that is, the distance between the projected head entity plus the relationship vector and the projected tail entity. The lower the score, the more the triple conforms to the projection relationship in the collaborative knowledge graph, and the more likely it is to be true.

[0127] Through the above-mentioned projection transformation and constraint operations, the user entities, project entities and relationships in the collaborative knowledge graph are converted into low-dimensional vector representations. These vector representations are the pre-trained initial embedding representations, which provide the basis for subsequent learning and reasoning.

[0128] If only the positive sample set pose is optimized, the training loss function may be simplified to:

[0129] ;

[0130] minimize This will cause all head and tail entities to be projected onto similar vectors, causing the embedding space to collapse near the origin (i.e. , , ). At this point, the model scores all triplets close to zero and cannot distinguish between real and fake.

[0131] Therefore, introducing negative samples is a key strategy for enhancing model robustness. For false or erroneous triplets, the model should ensure that they strictly violate the projection relationship—that is, ensure that the sum of the projected head entity and the relationship vector is sufficiently far from the tail entity in the embedding space. In this process, the quality of negative samples, especially the strategy for generating difficult negative samples, directly determines the upper limit of model learning.

[0132] S3, based on the user historical interaction data, perform multi-hop neighbor sampling through biased random walk to obtain a multi-hop neighbor set; wherein the number of hops of the biased random walk is dynamically adjusted according to the current number of training rounds.

[0133] To overcome the bottlenecks of false negatives and insufficient sample discrimination in traditional negative sampling, this paper proposes Neighbor-based Graph Collaborative Filtering (NbrGCF). This method uses graph-structure-aware negative sample synthesis technology to fuse multi-hop neighbor semantics with positive sample information to generate difficult negative samples close to the decision boundary. This method significantly improves the model's ability to distinguish fine-grained semantics while avoiding false negatives.

[0134] Specifically, we first construct a graph structure. Define user historical interaction data as , Indicates the Projects, building weighted behavior graphs .

[0135] Define fixed window sliding size , based on the user's historical interaction data, the interaction data sequence in each window is obtained, and the expression is:

[0136] ;

[0137] in, express The window size is the user historical interaction data sequence; c represents the cth window in the user historical interaction data sequence; Indicates the total number of windows; represents the time variable in a single window; Represents the c+th interactive data sequence items, △∈[1,ω]. Represents the item at position c in the sequence , and the item in the next △ position Establish undirected edge connections; express in sequence The items in the window are connected by undirected edges.

[0138] For each positive sample item node within the fixed window , a biased random walk method is used for sampling to explore its multi-hop neighbors to capture high-order semantic information, that is, each step of sampling selects the next node according to the sampling probability to obtain a set of multi-hop neighbors , thereby obtaining a multi-hop neighbor set; wherein, the expression of the sampling probability is:

[0139] ;

[0140] in, Representation node Sampling to select the next node The sampling probability of Representation node The out-degree of Represents a positive sample project node The set of neighbors from 1 hop to K hops away.

[0141] In this step, unlike ordinary random walks, the random walk here is biased, that is, it tends to select certain neighbor nodes according to a certain probability, making it more likely to visit neighbor nodes that are closely related to the current entity and more valuable for recommendation.

[0142] In order to avoid the surge in computational complexity and long-tail problems caused by overly dense graph structures, a dual constraint strategy is implemented to limit the maximum number of neighbors for each node i. , that is, the number of neighbors exceeds the upper threshold Only the nodes with the highest weight are retained edges (edge ​​weight is determined by co-occurrence frequency); at the same time, for insufficient number of neighbors Nodes, randomly add some non-neighbor nodes as supplements to ensure that each node has at least This balanced graph construction strategy significantly improves the scalability and representation capabilities of the graph while preserving the local structural characteristics of the behavior sequence.

[0143] During the training process, the number of hops of the biased random walk can also be dynamically adjusted according to the current number of training rounds. The number of hops increases with the increase of the number of training rounds until it reaches the preset maximum number of hops. The expression is:

[0144]

[0145] in, Indicates the preset maximum number of hops (for example, set to 4). is the current training round number, is the initial hop count, is to adjust the step size (such as adding 1 jump every 5 rounds).

[0146] This mechanism can achieve progressive difficulty control, focusing on capturing the semantics of immediate neighbor items in the early stage of training (K is small), and focusing on capturing the semantics of immediate neighbor items in the later stage of training (K increases to ) Introducing high-order indirect correlation items, the difficulty of negative samples increases with the improvement of model capabilities, and after completing the walk, the sampled multi-hop neighbor set Perform uniform downsampling and output a fixed-size set.

[0147] Multi-hop neighbor sampling allows us to explore nodes in the knowledge graph that are distant from the starting entity but connected to it through a series of relationships. These multi-hop neighbor nodes contain richer contextual information, providing a more comprehensive reference for subsequent recommendations. As training progresses, we gradually explore more distant neighbors, thereby synthesizing more challenging negative samples.

[0148] S4, in the multi-hop neighbor set, determining the neighbor that is most similar to the embedding representation of the positive sample item as the anchor neighbor.

[0149] In this embodiment, positive sample items refer to items that the user has actually interacted with, such as products purchased by the user, movies watched by the user, etc. These items reflect the user's real interests.

[0150] After obtaining the multi-hop neighbors, NbrGCF needs to mix the positive sample information with the neighbor information to synthesize a hard negative sample. During the synthesis process, it is necessary to find the anchor neighbors. We first select an anchor item from the multi-hop neighbors. The selection is based on and positive sample project nodes The similarity of the items that the user actually interacts with is calculated by the inner product. Then, the expression of the anchor point neighbor is:

[0151] ;

[0152] in, is the anchor point neighbor; Represents the positive sample item node in the multi-hop neighbor set The corresponding neighbor set; express Nodes in 、 Represents nodes respectively , the corresponding embedding representation of j; T represents the transposed symbol.

[0153] The neighbors of the anchor point are used as reference points for synthesizing negative samples. is the nearest neighbor of the positive sample and is most likely a potential difficult negative sample.

[0154] S5, linearly interpolating the embedding representation of the positive sample item with the embedding representation of the anchor point neighbor to synthesize the embedding representation of the difficult negative sample.

[0155] Specifically, the linear interpolation synthesis process of the difficult negative samples is:

[0156] ;

[0157] in, Embedding representation for difficult negative samples; is the embedding representation of the neighbors of the anchor point; is the embedding representation of the positive sample item; is the mixing coefficient, which takes values ​​in the interval [0,1].

[0158] This blending operation creates a point in the embedding space between the positive example and its nearest neighbor. The synthesized negative example lies between the positive example and its nearest neighbor, close to the decision boundary, forcing the model to learn more refined distinguishing features, making it more likely to be a hard negative example. This avoids the simplicity of random negative examples (for example, non-interacted items may be inherently unrelated), reduces the incidence of false negatives, improves the model's ability to distinguish similar items (such as competing products in the same category), and enhances recommendation accuracy.

[0159] Specifically, in a preferred embodiment, Figure 2 The process of NbrGCF is shown:

[0160] For positive samples, neighbor nodes are randomly selected from the current window sequence data according to the sampling probability 、 and ;

[0161] Calculate separately 、 and and similarity;

[0162] Select the neighbor node with the highest similarity as anchor neighbors;

[0163] Anchor point neighbors With positive samples Perform linear interpolation mixing to generate difficult negative samples .

[0164] Specifically, in another preferred embodiment, Figure 3 The process of NbrGCF is shown:

[0165] Based on the user interaction sequence Construct a neighbor set;

[0166] Select a positive sample from the neighbor set , the embedding vector is expressed as , initialize the hop count k=1;

[0167] Select k-hop neighbors by random walk based on sampling probability , calculate the positive sample With neighbors Similarity (can be calculated using inner product);

[0168] Then perform k++ and continuously recursively calculate the similarity until the maximum number of hops K is reached;

[0169] Select the k-hop neighbors with the highest similarity as the anchor neighbors ;

[0170] Anchor point neighbors With positive samples Perform linear interpolation mixing to generate difficult negative samples .

[0171] During training, contrast loss can be used To distinguish positive samples from synthetic difficult negative samples, contrast loss The expression is:

[0172] ;

[0173] in, is the number of negative samples, is the user’s embedded representation; is the embedding representation of the positive sample item; is the embedding representation of the hard negative sample; T represents the transposed symbol.

[0174] This loss function forces the user to embed In the vector space, it is close to the positive sample and far away from the synthetic negative sample.

[0175] S6, based on a multi-head graph attention network, uses positive samples and synthetic difficult negative samples to train the initial embedding representation to capture the high-order information of the knowledge graph and aggregate to obtain an updated embedding representation.

[0176] In this step, we improve on the graph convolutional network by recursively propagating the embedded representation through high-order connectivity to obtain the multi-hop connection information of the nodes. We also use the idea of ​​a multi-head graph attention network to project the nodes into different subspaces and capture complex graph features through the aggregation of multiple heads.

[0177] The Multi-Head Graph Attention Network is a neural network model specifically designed for processing graph-structured data. It uses multiple attention heads to assign attention weights to different nodes and relationships in a knowledge graph, thereby focusing on information that is more important for the current task (recommendation).

[0178] Specifically:

[0179] The entity embedding (user entity and item entity) of the collaborative knowledge graph is regarded as the node of the graph attention network. For each relationship between entities, its projection matrix Split into indivual ; The projection matrix of the relationship r between entities on the i-th head is used to project the d-dimensional entity onto dimensional relational space.

[0180] An improved multi-head graph attention network is used to capture multi-hop semantic associations. First, the relationship embedding is split into multiple heads to obtain the initial multi-head embedding representation of the relationship:

[0181] ;

[0182] in, is the number of heads in the multi-head graph attention network, 0 represents the initial 0th layer embedding representation; The initial layer 0 embedding representation of the relationship; Indicates the initial relationship Head embedding representation;

[0183] For any triple (h, r, t) in the knowledge graph, the head node and tail node are embedded into the k-th head relation multi-head space, expressed as:

[0184] ; ;

[0185] in, Represents the head node; Represents the tail node; is the head entity, is the tail entity; is the projection matrix of the inter-entity relationship r on the kth head.

[0186] This operation transforms the original entity embeddings into a low-dimensional semantic subspace defined by the relation r at the k-th head.

[0187] Next, construct the initial adjacency matrix Represents the user-entity connection relationship and normalizes the adjacency matrix according to the relationship type , that is, generate a type-specific adjacency matrix for each type of relationship r , after calculating the degree matrix D, perform symmetric normalization, the expression is:

[0188] ; ;

[0189] in, represents the adjacency matrix of type r; is the normalized adjacency matrix of type r; D is the degree matrix; is the number of relationship types; is the number of users.

[0190] definition Each attention score is (i.e., the adjacency matrix ), indicating how much information a node can carry to its neighboring nodes through this edge during the aggregation process. For the k-th head, the calculation formula for the attention score of the triple (h, r, t) is:

[0191] ;

[0192] in, is the triplet attention score of the k-th head; is an activation function used to enhance nonlinear expression capabilities; Represents the relationship of the k-th head.

[0193] Based on the above attention mechanism, bidirectional information aggregation is implemented to fully capture the semantics of the graph structure. For each attention head k, the forward adjacency matrix and the reverse adjacency matrix are constructed. For the kth head, Represents the forward adjacency matrix, that is, the original direction (head node to tail node), Represents the inverse matrix, that is, the reverse edge (tail node to head node).

[0194] For the triple set with entity h as the head node , the neighbor aggregation representation of the k-th head is calculated as:

[0195] ;

[0196] in, represents the attention network of the k-th head of node h; represents a set of triples with entity h as the head node; represents the tail entity of the k-th head; represents the attention score of forward propagation; represents the back-propagated attention score.

[0197] This formula simultaneously integrates the semantic information of forward propagation and back propagation.

[0198] Then, the final representation of node h in the kth head is generated through residual connection and feature interaction for:

[0199] ;

[0200] in, is a trainable parameter matrix; * represents element-by-element multiplication, is the activation function (the negative slope coefficient is set to 0.2 to retain negative information). This design not only preserves the node's own characteristics, but also strengthens its interaction characteristics with neighboring nodes.

[0201] After bidirectional multi-head aggregation, entity h has the multi-dimensional features of the tail entity t. Then, the multi-head of the entity is spliced ​​along the feature dimension to obtain the entity embedding of the current layer:

[0202] ;

[0203] in, Indicates the number of heads in the multi-head attention network; Indicates that the entity node h is in The final representation of the head; For splicing operation.

[0204] By stacking multiple layers of the network and recursively executing the aforementioned aggregation process, high-level node embeddings gradually incorporate multi-hop neighbor semantics, ultimately obtaining entity representations that incorporate complex graph structural features and high-order connectivity patterns. This results in updated entity embeddings, namely updated user and item embeddings. These updated embeddings better reflect user interests, item characteristics, and the complex relationships between them.

[0205] This architecture significantly improves the recommendation system's ability to perceive implicit associations. For example, through three-layer propagation, it can capture the potential preference associations of the four-order path of user-item-category-brand.

[0206] S7: Calculate the interaction probability based on the updated embedding representation and generate recommended items for the user.

[0207] In this step, based on the user embedding vector and the entity embedding vector, a user-entity interaction probability prediction model is constructed through the inner product operation in the vector space.

[0208] Specifically, the interaction probability is calculated based on the updated user embedding representation and item embedding representation, and the user-entity interaction probability score function is constructed through the inner product operation, which is expressed as:

[0209] ;

[0210] in, Indicates the user's preference strength for the entity, that is, the interaction probability. The higher the score, the greater the interaction probability. represents user embedded representation; Representation item embedding representation; Represents the transposed symbol. This score function represents the semantic relevance between users and entities in the d-dimensional embedding space. Higher values ​​indicate stronger interaction tendency.

[0211] For the positive sample entity set pose in the user's historical interaction data, its overall preference strength is quantified as:

[0212] ;

[0213] According to the calculated interaction probability, all items are sorted, and a portion of items with an interaction probability greater than a set threshold are selected as recommended items to be displayed to users, thereby achieving personalized information recommendation.

[0214] During training, the user preference feature representation loss function is used to train the interaction probability. The user preference feature representation loss function The expression is:

[0215] ;

[0216] ;

[0217] ;

[0218] ;

[0219] ;

[0220] in, The Bayesian personalized ranking loss is used to maximize the probability likelihood of the difference between positive and negative sample scores. This ensures that non-interacted entities are kept away from the user preference space, while historically interacted entities are clustered in the user feature neighborhood. is the Sigmoid function; A reconciliation parameter representing the total number of user entities and the total number of project entities; is the preference strength of the positive sample set; is the preference strength of the negative sample set;

[0221] It is the margin loss, which is used to constrain the gap between the positive sample score and the negative sample score, forcing the positive sample score to be at least higher than the negative sample score. Through the dynamic attenuation mechanism, we can strictly separate the boundaries in the early stage of training and fine-tune the embedding position in the later stage, so that the items that match the user's preference representation and have been interacted with are close to each other, and the items that have not been interacted with are far away from the user; Preset interval thresholds for hyperparameters;

[0222] It is a regularization loss used to constrain the embedding vector modulus to prevent overfitting in high-dimensional embedding space; is the regularization coefficient; represents the matrix Frobenius norm; represents the n-th user embedding representation.

[0223] In summary, this embodiment proposes a recommendation method that deeply integrates knowledge graphs and collaborative filtering, which achieves accurate personalized recommendations through a systematic technology chain.

[0224] First, by constructing a collaborative knowledge graph, user behavior data and the item attribute graph are organically integrated. Specifically, semantic triples (user-rating relationship-item) are modeled on the cleaned user rating data. This is then combined with the pre-built item knowledge graph (including multiple relationships such as category and manufacturer) to form a dual semantic network that encompasses both static attribute associations and dynamic interaction patterns. The many-to-one relationship between user and item ratings in this graph provides key topological constraints for subsequent embedding learning.

[0225] Then, during the initialization phase of knowledge graph embedding, a relationship-specific projection matrix mechanism is designed. Specifically, each relationship type has its own independent relationship vector and projection matrix. By constraining the projection transformation in the relationship space to "head entity + relationship ≈ tail entity," this explicitly models the representation alignment problem in many-to-one relationships.

[0226] To avoid embedding space collapse, we introduce a positive-negative sample comparison mechanism based on a scoring function, and further propose a groundbreaking NbrGCF difficult negative sample synthesis technique. Specifically, by dynamically constructing a user behavior graph, implementing progressive multi-hop neighbor sampling (increasing the number of hops with each training round to increase sample difficulty), and selecting the most similar anchor points for linear interpolation and mixing, we generate synthetic negative examples that directly approximate the decision boundary, significantly improving the discriminative ability of contrastive learning.

[0227] To capture high-level semantic associations, an improved multi-head graph attention network is used for recursive propagation. Specifically, the relationship projection matrix and embedding are orthogonally decomposed into multiple attention heads along the feature dimension, ensuring that each head captures complementary semantics. A bidirectional normalized adjacency matrix is ​​constructed, and attention weights are calculated in the relationship subspace to achieve collaborative aggregation of forward and backward information. Residual connections are combined with feature interactions to enable node representations to incorporate complex graph structural features during multi-hop propagation. Finally, through multi-layer cascading, the implicit association paths between users, items, and attributes are effectively mined.

[0228] At the prediction optimization level, a triple loss mechanism is comprehensively applied: specifically, the user-item preference score is calculated based on the inner product, and the Bayesian personalized ranking loss (BPR) is used to maximize the difference probability of positive and negative samples; the margin loss is added to force the separation of decision boundaries; and the Frobenius norm regularization is combined to suppress overfitting.

[0229] The entire system significantly improves the ability to perceive users' implicit preferences and complex item associations through the synergistic effect of knowledge structure constraints, behavioral pattern enhancement, high-order relationship propagation and refined loss optimization, providing the recommendation system with more powerful semantic understanding and generalized recommendation efficiency.

[0230] In actual application scenarios, this method is mainly used in scenarios such as e-commerce platforms or social networks that need to solve the problem of information overload, such as recommending products, books or video content to users.

[0231] In another preferred embodiment, the present invention conducted an experimental comparison with traditional methods and models in the Amazon book knowledge graph recommendation task based on the RecBole recommendation framework. The experimental setup strictly adhered to the principle of reproducibility. Specifically, the interaction data was filtered for high-value records with ≥10 user-item interactions, the knowledge graph retained strongly correlated triples with a frequency of ≥5, and the baseline models, including KGAT, KGIN, and RippleNet (for a detailed introduction to these three baseline models, see Background Art), all adopted the optimal parameter configuration officially recommended by RecBole.

[0232] The experimental results are shown in Table 1. Our model significantly outperforms other existing models, especially in the core indicators recall@20 and ndcg@20, which are 0.2135 and 0.1266, respectively, and are 9.2% and 19.8% higher than the optimal baseline model KGIN. This significant advantage stems from the systematic innovation of the deep fusion architecture of the collaborative knowledge graph, the NbrGCF difficult negative sample generation strategy, and the multi-granularity graph attention propagation mechanism. By dynamically integrating user behavior patterns with item knowledge semantics, the present invention explicitly models many-to-one relationship constraints in the projected space; utilizes adaptive difficulty negative samples to strengthen decision boundary separation; and relies on the orthogonal multi-head attention mechanism to efficiently capture high-order connected paths. Ultimately, it solves the bottleneck problems of insufficient capture of long-tail preferences and amplification of relationship transmission noise in traditional knowledge graph recommendations, providing more robust technical support for accurate personalized recommendations in e-commerce scenarios.

[0233] Table 1 Experimental results

[0234]

[0235] The core indicator recall@20 represents the top 20 recall rate, that is, the proportion of correctly predicted items to all truly relevant items in the top 20 recommendation results.

[0236] mrr@20: represents the average reciprocal ranking of the top 20, that is, the reciprocal ranking of the first relevant item in the top 20 recommendation results (if there is no relevant item in the top 20, it is recorded as 0);

[0237] ndcg@20: represents the top 20 normalized discounted cumulative gains. This means that the top 20 recommendation results are weighted by position (the higher the ranking, the greater the weight), and then normalized with the ideal ranking DCG.

[0238] hit@20: indicates the top 20 hit rates. That is, if the top 20 recommendation results contain at least one relevant item, the hit rate is 1, otherwise it is 0;

[0239] precision@20: indicates the top 20 precision, that is, the proportion of correctly predicted items in the top 20 recommendation results to the total number of recommendations.

[0240] The following is the core pseudo code of the method model of the present invention:

[0241]

[0242] In summary, compared with the prior art, the present invention has the following beneficial effects:

[0243] This paper achieves efficient modeling of user implicit preferences and complex item associations. It generates difficult negative samples through NbrGCF adjacency graph collaborative sampling technology, significantly improving the model's ability to distinguish fine-grained semantics. It also achieves efficient capture of high-level semantic information through a bidirectional graph attention network with a multi-head projection mechanism. Furthermore, it maximizes the difference between positive and negative samples through a triple loss optimization mechanism, forcing the decision boundary to separate and suppress overfitting.

[0244] Example 2

[0245] like Figure 4 As shown, the second embodiment of the present invention further provides an information recommendation device based on collaborative sampling of knowledge graph and adjacency graph, comprising:

[0246] Collaborative knowledge graph construction unit, used to obtain user historical interaction data, construct triples containing users, projects and relationships, and fuse them with pre-built project attribute graphs to construct collaborative knowledge graphs;

[0247] An initial embedding representation unit, configured to perform representation alignment based on the collaborative knowledge graph through a projection transformation of the constrained relational space to obtain a pre-trained initial embedding representation;

[0248] A multi-hop neighbor set unit, configured to perform multi-hop neighbor sampling based on the user historical interaction data through a biased random walk to obtain a multi-hop neighbor set; wherein the number of hops in the biased random walk is dynamically adjusted according to the current number of training rounds;

[0249] An anchor neighbor unit, configured to determine, in the multi-hop neighbor set, a neighbor that is most similar to the embedding representation of the positive sample item as an anchor neighbor;

[0250] a hard negative sample synthesis unit, configured to linearly interpolate the embedding representation of the positive sample item with the embedding representation of the anchor point neighbor to synthesize the embedding representation of the hard negative sample;

[0251] A multi-head graph attention unit is used to train the initial embedding representation based on a multi-head graph attention network using positive samples and synthetic hard negative samples to capture high-level information of the knowledge graph and aggregate it to obtain an updated embedding representation;

[0252] The recommendation generation unit is configured to calculate an interaction probability based on the updated embedding representation and generate a recommended item for the user.

[0253] Embodiment three

[0254] The third embodiment of the present application further provides an information recommendation device based on collaborative sampling of a knowledge graph and an adjacency graph, comprising a memory and a processor, the memory storing a computer program, the computer program being executable by the processor to implement the information recommendation method based on collaborative sampling of a knowledge graph and an adjacency graph as described above.

[0255] Embodiment four

[0256] The fourth embodiment of the present application further provides a computer readable storage medium, the computer readable storage medium storing computer readable instructions, the computer readable instructions being executed by a processor of a device in which the computer readable storage medium is located to implement the information recommendation method based on collaborative sampling of a knowledge graph and an adjacency graph as described above.

[0257] In several embodiments provided by the embodiments of the present application, it should be understood that the disclosed apparatus and method can also be implemented by other means. The apparatus and method embodiments described above are only illustrative, for example, the flowchart in the accompanying drawings shows the possible implementation architecture, function and operation of the apparatus, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the accompanying drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for executing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0258] In addition, each functional module in the various embodiments of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0259] If the functions are implemented in the form of software modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, electronic device, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage media include various media that can store program code, such as USB flash drives, mobile hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks. It should be noted that, in this document, the terms "comprise," "include," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or device that includes a series of elements includes not only those elements but also other elements not explicitly listed, or also includes elements inherent to such process, method, article, or device. Without further constraints, an element defined by the phrase "comprises a..." does not preclude the existence of additional identical elements in the process, method, article or apparatus that includes the element.

[0260] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms "a", "an", "the" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise.

[0261] It should be understood that the term "and / or" as used herein is merely a description of the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the associated objects are in an "or" relationship.

[0262] The word "if," as used herein, may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to the determination" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)," depending on the context.

[0263] The "first / second" mentioned in the embodiments are only to distinguish similar objects, and do not represent a specific order for the objects. Understandably, the "first / second" can be interchanged in a specific order or sequence as appropriate. It should be understood that the objects distinguished by "first / second" can be interchanged as appropriate, so that the embodiments described herein can be implemented in an order other than those illustrated or described herein.

[0264] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. Those skilled in the art can make various modifications and changes to the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. An information recommendation method based on collaborative sampling of knowledge graph and adjacency graph, characterized in that: include: Obtain historical user interaction data, construct triples containing users, items, and relationships, and fuse them with pre-built item attribute graphs to construct collaborative knowledge graphs; Based on the collaborative knowledge graph, representation alignment is performed through projection transformation of the constrained relational space to obtain a pre-trained initial embedding representation; Based on the user historical interaction data, multi-hop neighbor sampling is performed through a biased random walk to obtain a multi-hop neighbor set; wherein the number of hops of the biased random walk is dynamically adjusted according to the current number of training rounds; In the multi-hop neighbor set, determine the neighbor that is most similar to the embedding representation of the positive sample item as the anchor neighbor; Linearly interpolating the embedding representation of the positive sample item with the embedding representation of the anchor point neighbor to synthesize the embedding representation of the hard negative sample; Based on a multi-head graph attention network, the initial embedding representation is trained using positive samples and synthetic difficult negative samples to capture high-order information of the knowledge graph and aggregate to obtain an updated embedding representation; the multi-head graph attention network is trained using positive samples and synthetic difficult negative samples to train the initial embedding representation, specifically: First, the entity embedding representation of the collaborative knowledge graph is regarded as a node of the graph attention network. For each entity relationship, its projection matrix Split into indivual ; The projection matrix of the relationship r between entities on the i-th head is used to project the d-dimensional entity onto dimensional relational space; Then the relation embedding is split into multiple heads to obtain the initial multi-head embedding representation of the relation: ; in, is the number of heads in the multi-head graph attention network, 0 represents the initial 0th layer embedding representation; The initial layer 0 embedding representation of the relationship; Indicates the initial relationship Head embedding representation; For any triple in the collaborative knowledge graph, the head node and the tail node are embedded into the k-th head relation multi-head space, which can be expressed as: ; ; in, Represents the head node; Represents the tail node; is the head entity, is the tail entity; is the projection matrix of the relationship r between entities on the kth head; Then construct the initial adjacency matrix and normalize the adjacency matrix according to the relationship type , the expression is: ; ; in, represents the adjacency matrix of type r; is the normalized adjacency matrix of type r; D is the degree matrix; is the number of relationship types; definition The element is the attention score , for the k-th head, the attention score of the triplet is expressed as: ; in, is the triplet attention score of the k-th head; is the activation function; represents the relationship of the k-th head; According to the attention score, a forward adjacency matrix and a reverse adjacency matrix are constructed for each attention head k. After bidirectional information aggregation, the neighbor aggregation representation of each node and each head is obtained, namely the attention network, which is expressed as: ; in, represents the attention network of the k-th head of node h; represents a set of triples with entity h as the head node; represents the tail entity of the k-th head; represents the attention score of forward propagation; represents the back-propagated attention score; The interaction probability is calculated based on the updated embedding representation to generate recommended items for the user.

2. The information recommendation method based on collaborative sampling of knowledge graph and adjacency graph according to claim 1 is characterized in that: The initial embedding representation is obtained by the following steps: For each inter-entity relationship in the collaborative knowledge graph, the projection matrix is ​​initialized, and the following relationship exists: ; in, Represents the projection matrix corresponding to the relationship r between entities, The vector representation of the head entity h, that is, the vector representation of the user entity; A vector representation of the relationship r between entities; The vector representation of the tail entity t, that is, the vector representation of the item entity; Based on the projection matrix , map the head entity and tail entity in the triple from the entity space to the relation space, and construct a score function, that is, the initial embedding representation, which is used to measure the rationality of the triple. The expression is: ; in, represents the L2 norm; It represents the score function, that is, the distance between the projected head entity plus the relationship vector and the projected tail entity. The lower the score, the more the triple conforms to the projection relationship in the collaborative knowledge graph.

3. The information recommendation method based on collaborative sampling of knowledge graph and adjacency graph according to claim 1 is characterized in that: The multi-hop neighbor sampling process includes: Define fixed window sliding size , based on the user's historical interaction data, the interaction data sequence in each window is obtained, and the expression is: ; in, express User historical interaction data sequence of window size; express The item in the cth window in the sequence; Indicates the total number of windows; represents the time variable in a single window; express The cth window in the sequence projects; express Items in a sequence The item in the next △ position Establish undirected edge connections; express in sequence Establish undirected edge connections between items in each window; For each positive sample item node within the fixed window , a biased random walk method is used for sampling, that is, the next node is selected according to the sampling probability, and the upper and lower thresholds of the number of neighbors are constrained to obtain a set of multi-hop neighbors , thus obtaining a multi-hop neighbor set; The expression of the sampling probability is: ; in, Representation node Sampling to select the next node The sampling probability of Representation node The out-degree of Represents a positive sample project node The set of neighbors from 1 hop to K hops away.

4. The information recommendation method based on collaborative sampling of knowledge graph and adjacency graph according to claim 3 is characterized in that: The number of hops of the biased random walk is dynamically adjusted according to the current number of training rounds during the training process. The number of hops of the biased random walk is dynamically adjusted according to the current number of training rounds. The number of hops increases with the increase of the number of training rounds until it reaches a preset maximum number of hops. The expression is: ; in, Indicates the preset maximum number of hops. is the current training round number, is the initial hop count, is the adjustment step size.

5. The information recommendation method based on collaborative sampling of knowledge graph and adjacency graph according to claim 1 is characterized in that: The expression of the anchor point neighbor is: ; in, is the anchor point neighbor; Represents the positive sample item node in the multi-hop neighbor set The corresponding neighbor set; express Nodes in 、 Represents nodes respectively , the corresponding embedding representation of j; T represents the transposed symbol.

6. The information recommendation method based on collaborative sampling of knowledge graph and adjacency graph according to claim 1, characterized in that: The linear interpolation synthesis process of the difficult negative samples is: ; in, Embedding representation for difficult negative samples; is the embedding representation of the neighbors of the anchor point; is the embedding representation of the positive sample item; is the mixing coefficient, which takes values ​​in the interval [0,1].

7. The information recommendation method based on collaborative sampling of knowledge graph and adjacency graph according to claim 1 is characterized in that: Also included is the use of contrast loss To distinguish positive samples from synthetic difficult negative samples, contrast loss The expression is: ; in, is the number of negative samples, is the user’s embedded representation; is the embedding representation of the positive sample item; is the embedding representation of the hard negative sample; T represents the transposed symbol.

8. The information recommendation method based on collaborative sampling of knowledge graph and adjacency graph according to claim 1 is characterized in that: The multi-head graph attention network is based on the positive samples and the synthetic difficult negative samples to train the initial embedding representation, and further includes: Generate the final representation of entity node h in the kth head through residual connection and feature interaction , the expression is: ; in, is the trainable parameter matrix; is the activation function; After bidirectional multi-head aggregation, the multi-head of the entity is spliced ​​to obtain the entity embedding representation of the current layer , the expression is: ; in, Indicates the number of heads in the multi-head attention network; Indicates that the entity node h is in The final representation of the head; For splicing operation; After recursive aggregation through multiple layers of the network, high-level features of the nodes are captured to obtain the updated entity embedding representation, that is, the updated user embedding representation and item embedding representation.

9. The information recommendation method based on collaborative sampling of knowledge graph and adjacency graph according to claim 2, characterized in that: The interaction probability is calculated based on the updated user embedding representation and item embedding representation, and recommended items are generated for the user, specifically: Based on the updated user embedding representation and item embedding representation, a user-entity interaction score function is constructed through inner product operation, and the expression is: ; in, Indicates the user's preference strength for the entity, that is, the interaction probability. The higher the score, the greater the interaction probability. represents the updated user embedding representation; Represents item embedding representation; represents the transpose symbol; Then, the overall preference strength of the positive sample entity set pose in the user's historical interaction data Quantized as: ; in, Nodes representing the set of positive sample entities; represents the embedding representation of node i; According to the calculated interaction probability, all items are sorted and items with interaction probability greater than the set threshold are recommended to users; The user preference feature representation loss function is used to train the interaction probability. The user preference feature representation loss function The expression is: ; ; ; ; ; in, The Bayesian personalized ranking loss is used to ensure that non-interacted entities are far away from the user preference space; is the Sigmoid function; A reconciliation parameter representing the total number of user entities and the total number of project entities; is the preference strength of the positive sample set; is the preference strength of the negative sample set; It is the margin loss, which is used to constrain the gap between the positive sample score and the negative sample score; Preset interval thresholds for hyperparameters; is the regularization loss, which is used to constrain the embedding vector modulus to prevent overfitting; is the regularization coefficient; represents the matrix Frobenius norm; represents the n-th user embedding representation.

10. An information recommendation device based on collaborative sampling of knowledge graph and adjacency graph, used to implement the information recommendation method based on collaborative sampling of knowledge graph and adjacency graph according to any one of claims 1 to 9, characterized in that: include: Collaborative knowledge graph construction unit, used to obtain user historical interaction data, construct triples containing users, projects and relationships, and fuse them with pre-built project attribute graphs to construct collaborative knowledge graphs; An initial embedding representation unit, configured to perform representation alignment based on the collaborative knowledge graph through a projection transformation of the constrained relational space to obtain a pre-trained initial embedding representation; A multi-hop neighbor set unit, configured to perform multi-hop neighbor sampling based on the user historical interaction data through a biased random walk to obtain a multi-hop neighbor set; wherein the number of hops in the biased random walk is dynamically adjusted according to the current number of training rounds; An anchor neighbor unit, configured to determine, in the multi-hop neighbor set, a neighbor that is most similar to the embedding representation of the positive sample item as an anchor neighbor; a hard negative sample synthesis unit, configured to linearly interpolate the embedding representation of the positive sample item with the embedding representation of the anchor point neighbor to synthesize the embedding representation of the hard negative sample; A multi-head graph attention unit is used to train the initial embedding representation based on a multi-head graph attention network using positive samples and synthetic hard negative samples to capture high-level information of the knowledge graph and aggregate it to obtain an updated embedding representation; A recommendation generation unit is used to calculate the interaction probability based on the updated embedding representation and generate recommended items for the user.

Citation Information

Patent Citations

  • Recommendation method based on knowledge graph and attention mechanism

    CN112507132A

  • Hybrid dynamic negative sampling method for knowledge graph recommendation model

    CN116340501A