CN116776003A - Knowledge graph recommendation method, system and equipment based on comparison learning and collaborative signals - Google Patents
Knowledge graph recommendation method, system and equipment based on comparison learning and collaborative signals Download PDFInfo
- Publication number
- CN116776003A CN116776003A CN202310832229.0A CN202310832229A CN116776003A CN 116776003 A CN116776003 A CN 116776003A CN 202310832229 A CN202310832229 A CN 202310832229A CN 116776003 A CN116776003 A CN 116776003A
- Authority
- CN
- China
- Prior art keywords
- embedding
- user
- project
- knowledge
- knowledge graph
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 57
- 230000003993 interaction Effects 0.000 claims abstract description 42
- 238000012549 training Methods 0.000 claims abstract description 24
- 230000006870 function Effects 0.000 claims description 65
- 239000011159 matrix material Substances 0.000 claims description 27
- 239000013598 vector Substances 0.000 claims description 21
- 238000010586 diagram Methods 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 14
- 230000004927 fusion Effects 0.000 claims description 10
- 230000002776 aggregation Effects 0.000 claims description 9
- 238000004220 aggregation Methods 0.000 claims description 9
- 238000010276 construction Methods 0.000 claims description 9
- 230000004913 activation Effects 0.000 claims description 6
- 230000007246 mechanism Effects 0.000 claims description 6
- 230000004931 aggregating effect Effects 0.000 claims description 4
- 238000013507 mapping Methods 0.000 claims description 4
- 108091028732 Concatemer Proteins 0.000 claims 1
- 230000002708 enhancing effect Effects 0.000 abstract 1
- 238000000605 extraction Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000000052 comparative effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 235000019800 disodium phosphate Nutrition 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000001914 filtration Methods 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a knowledge graph recommendation method, a system and equipment based on comparison learning and cooperative signals, wherein the method comprises the following steps: the method comprises the steps of constructing a knowledge graph recommendation model based on comparison learning and collaborative signals, training the knowledge graph recommendation model by using the obtained historical interaction sequence of a user in a data set and knowledge information of items and knowledge entities to obtain a trained knowledge graph recommendation model based on the comparison learning and collaborative signals, inputting the historical interaction sequence of the user to be recommended and the knowledge information of the items and the knowledge entities to the trained knowledge graph recommendation model based on the comparison learning and collaborative signals to obtain a target recommendation list, and recommending the target recommendation list to the user. According to the invention, a knowledge graph recommendation method based on contrast learning and collaborative signals is adopted, and knowledge information is extracted based on collaborative signals, multi-view learning users and project embedding and contrast learning tasks are used for enhancing data, so that the problem of low accuracy of the conventional recommendation method is solved fundamentally.
Description
Technical Field
The invention belongs to the field of personalized recommendation, and particularly relates to a knowledge graph recommendation method, system and equipment based on comparison learning and collaborative signals.
Background
With the rapid development of the internet, information technology brings great convenience to people, but at the same time, many troubles are generated for life of people, and the most obvious problem is information overload. The information overload problem makes it difficult for a user to quickly and efficiently screen out contents that are interesting or meaningful to himself among a plurality of contents. For example, when people purchase goods on shopping websites, the people are often interfered by complex and complex goods information, so that more time is spent to find the goods wanted by the people. The recommendation system can be regarded as an information filtering system, and the main purpose of the recommendation system is to present personalized information to a user and recommend commodities possibly interested by the user to the user, so that user experience is optimized, and meanwhile, the recommendation system can connect the user and a merchant in series, so that the merchant can better and more fully display commodities and can purchase commodities more conveniently.
Often the interaction data of the user and the project is quite sparse, and the sparse data can lead to poor performance of the model. The introduction of auxiliary information in the recommendation model can alleviate the above problem, and Knowledge Graph (KG) is often introduced as auxiliary information into the recommendation system because of its rich semantic knowledge. In recent years, contrast learning has achieved remarkable results in the fields of image recognition, natural language processing and the like; in the field of recommendation systems, research on contrast learning is still in the beginning stage. The existing recommendation method based on the knowledge graph rarely relates to data enhancement by using a comparison learning task. The traditional knowledge-graph-based method is highly dependent on the quality of knowledge-graph information, so that high-quality embedded representation is difficult to learn, and two challenges are faced: 1) The long tail distribution of the entity leads to sparse supervision signals represented by KG enhancement projects; 2) The knowledge graph of the real world is typically noisy information such that subject matter between the item and the entity is irrelevant. The sparsity and noise of KG deviate the project-entity dependency relationship from the reflection of the real features, preventing accurate characterization of user preferences. The current recommendation method based on the knowledge graph has the problems of low information recommendation accuracy and low user satisfaction.
Therefore, how to improve the accuracy of information recommendation and the satisfaction of users is a problem to be solved in the art.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a knowledge graph recommendation method, a system and equipment based on comparison learning and cooperative signals. According to the knowledge graph recommendation method based on the contrast learning and the collaborative signal, the knowledge information is extracted based on the collaborative guide signal, the embedding of multi-view learning users and projects and the contrast learning task are enhanced, and the contrast learning task is introduced into the recommendation method, so that the problems of low accuracy and low user satisfaction of the existing recommendation method are fundamentally solved.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
the invention provides a knowledge graph recommendation method based on contrast learning and cooperative signals, which is characterized by comprising the following steps:
s1, constructing a knowledge graph recommendation model based on comparison learning and cooperative signals;
s2, training the knowledge graph recommendation model based on the comparison learning and collaborative signals by using the acquired historical interaction sequence of the user in the data set and knowledge information of the items and the knowledge entities to obtain a trained knowledge graph recommendation model based on the comparison learning and collaborative signals; the step S2 specifically includes the following steps:
Step (1), acquiring a historical interaction sequence of a user and a project and knowledge information of the project and a knowledge entity from the data set, constructing an adjacency matrix of the user and the project based on the historical interaction sequence, and constructing a knowledge graph based on the knowledge information of the project and the knowledge entity, wherein the project is a film or a book;
step (2)Constructing initial embedding of the user and the item according to attribute information of the user and the item; inputting the adjacent matrix, the initial embedding of the user and the project into a two-layer GCN network to obtain the user embeddingAnd project embedding->
Step (3), embedding the userAnd project embedding->Information fusion is carried out to extract a cooperative guidance signal;
step (4), extracting item embedding, relation embedding and entity embedding in the knowledge graph in the step (1), and carrying out dot product operation on the relation embedding and the collaborative guiding signal to obtain a new relation embedding with a collaborative signal; based on the new relation embedding, calculating importance scores from the items to the entities by using a softmax function and an attention mechanism;
step (5), inputting the importance scores, the item embeddings and the entity embeddings in the step (4) to a collaborative knowledge neighborhood aggregation module to obtain a new item embedment
Step (6), integrating the historical interaction sequence of the user and the project obtained in the step (1) and the knowledge information of the project and the knowledge entity to construct a collaborative knowledge graph, wherein the collaborative knowledge graph is in the form of G= { (h, R, t) |h, t epsilon ', R epsilon R', wherein h represents a head entity, t represents a tail entity, R represents a relationship, epsilon '=epsilon U V, and R' =R U { inter }, wherein R represents a relationship set existing in the knowledge graph, and inter represents an interaction relationship between a user and an item in an adjacent matrix of the user and the item;
step (7), calculating to obtain normalized attention weight based on the collaborative knowledge graph;
step (8), multiplying all the neighbor embedded t of the h with the corresponding normalized attention weight, and aggregating the neighborhood of the h; and sum it to obtain N h Embedding h into N h Linear addition to obtain a new h embedding;
step (9), based on the collaborative knowledge graph, stacking a plurality of attention embedding propagation layers, embedding the entity obtained from each layer for concierge operation, obtaining the final embedded representation of each node in the collaborative knowledge graph, and extracting the user embedded representation from the collaborative knowledge graph And project embedding->
Step (10) of embedding the itemAnd project embedding->Adding to obtain local item embedding->User embedding +.>And user embedding->As a facing, the users of different users are embedded +.>And user embedding->As a negative pair; embedding items of the same item +.>And project embedding->As a facing, the items of different items are embedded +.>And project embedding->As a negative pair, performing a contrast learning task, and using an InfoNCE function as a loss function to participate in training;
step (11) of embedding the itemEmbedding with item->Performing concat to obtain final project embedding; embedding the user +.>Is embedded with the user>Performing concat to obtain final user embedding; performing inner product by utilizing the final project embedding and the final user embedding to obtain a final prediction score; generating a final project recommendation list according to the prediction score, wherein a BPR function is selected as a loss function for training a model; and the BPR loss function and the InfoNCE loss function are integrated to obtain a final loss function L.
S3, acquiring a historical interaction sequence of a user to be recommended and knowledge information of a project and a knowledge entity, inputting the historical interaction sequence of the user to be recommended and the knowledge information of the project and the knowledge entity into the trained knowledge graph recommendation model based on the comparison learning and collaborative signals, acquiring a target recommendation list, and recommending the target recommendation list to the user.
Further, in the step (2), the GCN network is a network structure of LightGCN, and includes a message propagation module and a layer information fusion module,
message propagation:
layer information fusion:
wherein ,Nv ,N u Neighbor sets respectively representing the items v and u are obtained from the adjacency matrix of the users and the items; e, e u For initial embedding of vectors by users, e v An initial embedded vector for the item;representing the user embedded vector of the k-th layer,user-embedded vector representing layer k+1,>item embedding vector representing the k-th layer, +.>An item embedding vector representing a k+1th layer; k represents the number of layers of the GCN network, k=2, α k Is a learnable weight coefficient.
Further, in the step (4), the embedding of the relation and the dot product operation of the cooperative guidance signal are performed to obtain a new embedding of the relation with a cooperative signal, specifically:
wherein ,er Representing the embedding of the relationships learned from the knowledge graph S u,v Representing the co-operative guidance signal,representing new relation embedding, N v A neighbor set of the item v in a adjacency matrix of the user and the item;
the importance score from the item to the entity is calculated by utilizing a softmax function and an attention mechanism based on the new relation embedding, and specifically comprises the following steps:
wherein ,N′v The method comprises the steps that a neighbor set of a project v in a project-entity diagram is obtained, the project-entity diagram is a two-part diagram of the project and the entity, the project-entity diagram is a subset of a knowledge graph, a LeakyRelu function is an activation function, I represents concat splicing operation, W represents a learnable parameter matrix and is used for unifying vector embedded dimensions, alpha (v, r, t) is an importance score, and importance of the entity t to the project v is represented.
Further, in step (5), the importance score, the item embedding and the entity embedding in step (4) are input to a collaborative knowledge neighborhood aggregation module to obtain a new item embeddingThe method comprises the following steps:
wherein ,ev For embedding items, e t For entity embedding, α (v, r, t) is an importance score, N' v Is the neighbor set of item v in the item-entity graph.
Further, in the step (7), based on the collaborative knowledge graph, a normalized attention weight is calculated, which specifically includes:
using a matrix W of learnable parameters r Mapping the h embedding and the t embedding to the same dimension as the relation embedding r;
after the mapped h embedding and the mapped r embedding are added, the mapped h embedding and the mapped t embedding are added to obtain the attention fraction pi (h, r, t) of h-t:
π(h,r,t)=(W r e t )T(W r e h +e r );
wherein ,Wr As a matrix of learnable parameters e h Representing h embedding, e t Representing t embedding, e r Representing r embedding; normalizing the attention score pi (h, r, t) to obtain a normalized attention weight pi (h, r, t)'.
wherein ,Nh Denoted is an h-embedded neighbor set.
Further, in step (9), based on the collaborative knowledge graph, stacking a plurality of attention embedding propagation layers, embedding the entity obtained in each layer to perform concat operation, and obtaining a final embedded representation of each node in the collaborative knowledge graph, which specifically includes:
wherein ,Nh Is the set of h embedded neighbors,h-embedded in the first and/or the l+1 layers, respectively,>t-insert representing layer i; and the I is a concat splicing operation.
Further, the InfoNCE function is specifically:
where S (·) is a cosine similarity function,representing right direction and left direction>Representing a negative pair, n representing a user or item embedding, τ being a temperature coefficient.
Further, in step (11), the final project embedding and the final user embedding are subjected to inner product to obtain a final prediction score, specifically:
wherein ,is a predictive score;
the BPR function is specifically:
where σ (·) is the activation function, U is the set of users, N u For the set of items interacted with by user u,predictive score representing the presence of interactions between u and v in the dataset,/for the data set>A predictive score representing the absence of interactions between u and v' in the dataset;
the final loss function is specifically:
L=L BPR +λL InfoNCE
wherein λ is a weight coefficient for controlling the influence coefficients of the two loss functions.
The invention also provides a knowledge graph recommendation system based on the comparison learning and cooperative signals, which is characterized in that the knowledge graph recommendation system executes the knowledge graph recommendation method based on the comparison learning and cooperative signals, and the knowledge graph recommendation system comprises the following steps: knowledge graph recommendation model construction module, knowledge graph recommendation model training module and project recommendation module;
the knowledge graph recommendation model construction module is used for constructing a knowledge graph recommendation model based on comparison learning and cooperative signals;
the knowledge graph recommendation model training module is used for training the knowledge graph recommendation model based on the contrast learning and cooperative signals by utilizing the obtained historical interaction sequences of the users in the data set and knowledge information of the items and the knowledge entities, so that a trained knowledge graph recommendation model based on the contrast learning and cooperative signals is obtained;
the project recommending module is used for acquiring a historical interaction sequence of a user to be recommended and knowledge information of a project and a knowledge entity, inputting the historical interaction sequence of the user to be recommended and the knowledge information of the project and the knowledge entity into the trained knowledge graph recommending model based on the comparison learning and collaborative signals, acquiring a target recommending list, and recommending the target recommending list to the user.
The invention also provides a computer device, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the method when executing the computer program.
Compared with the prior art, the method has the following beneficial effects:
according to the knowledge graph recommendation method based on the contrast learning and the collaborative signal, the knowledge information is extracted based on the collaborative guide signal, the multi-view learning user and the project are embedded and the contrast learning task is enhanced, and the contrast learning task is introduced into the recommendation method, so that the accuracy and the robustness of the recommendation method are improved, and the user experience is further improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of a knowledge graph recommendation method based on contrast learning and collaborative signals according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a knowledge graph recommendation model based on contrast learning and cooperative signals according to an embodiment of the present invention.
Fig. 3 is a schematic diagram of collaborative knowledge neighborhood aggregation provided in an embodiment of the present invention.
Fig. 4 is a schematic diagram of a knowledge extraction layer according to an embodiment of the present invention.
Fig. 5 is a schematic diagram of a comparative learning task according to an embodiment of the present invention.
Fig. 6 is a schematic diagram of a knowledge graph recommendation system based on contrast learning and collaborative signals according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The invention is further described below with reference to the drawings and specific examples, which are not intended to be limiting.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
The invention discloses a knowledge graph recommendation method based on comparison learning and cooperative signals. As shown in fig. 1, the knowledge graph recommendation method based on the contrast learning and the cooperative signal includes the following steps S1 to S3.
S1, constructing a knowledge graph recommendation model based on comparison learning and cooperative signals, wherein the knowledge graph recommendation model based on the comparison learning and cooperative signals is shown in a figure 2;
s2, training the knowledge graph recommendation model based on the comparison learning and collaborative signals by using the acquired historical interaction sequence of the user in the data set and knowledge information of the items and the knowledge entities to obtain a trained knowledge graph recommendation model based on the comparison learning and collaborative signals; the step S2 specifically includes the following steps:
Step (1), acquiring a historical interaction sequence of a user and an item and knowledge information of the item and a knowledge entity from the data set, constructing an adjacency matrix of the user and the item based on the historical interaction sequence, and constructing a knowledge graph based on the knowledge information of the item and the knowledge entity, wherein the item is a film or a book.
Specifically, for a historical interaction sequence of a user and an item, let U be a user set and V be an item set, where u= { U 1 ,u 2 ,...,u M },V={v 1 ,v 2 ,...,v N Adjacency matrix Y E R of users and items M×N ,y uv =1 means that user u interacted with item v, y uv =0 indicates that user u has not interacted with item v.
For knowledge graph construction, a triplet (h, R, t) is used to represent knowledge graph information, wherein h, t epsilon, R epsilon R, epsilon represents entity sets, and R represents relation sets.
Step (2), constructing initial embedding of the user and the project according to attribute information of the user and the project; inputting the adjacent matrix, the initial embedding of the user and the project into a two-layer GCN network to obtain the user embeddingAnd project embedding->
In one embodiment, an initial embedding of the user and the item with an embedding dimension d is constructed according to information such as ID attribute of the user and the itemThe embedded representation of a particular user and item is looked up using a look up operation. The initial embedded representation E and interaction matrix Y of the user and item are entered into the two-layer GCN network.
Further, the GCN network is a network structure of the LightGCN and comprises a message propagation module and a layer information fusion module,
message propagation:
layer information fusion:
wherein ,Nv ,N u Neighbor sets respectively representing the items v and u are obtained from the adjacency matrix of the users and the items; e, e u For initial embedding of vectors by users, e v An initial embedded vector for the item;representing the user embedded vector of the k-th layer,user-embedded vector representing layer k+1,>item embedding vector representing the k-th layer, +.>An item embedding vector representing a k+1th layer; k represents the number of layers of the GCN network, k=2, α k Is a learnable weight coefficient.
It should be noted that the user and item entered are initially embedded as layer 0 of the GCN, denoted as After two layers of GCN, user embedding +.>And project embedding->
Step (3), embedding the userAnd project embedding->And (5) information fusion is carried out to extract the cooperative guidance signal.
Specifically, the user is embeddedAnd project embedding->Form a cooperative guidance signal s by integrating information of (a) u,v The method is used for subsequent knowledge information extraction, so that the knowledge information extraction is more personalized;
where f is an information fusion function, and the alternative scheme is to linearly add and take the maximum value of each element in the two embeddings.
Step (4), extracting item embedding, relation embedding and entity embedding in the knowledge graph in the step (1), and carrying out dot product operation on the relation embedding and the collaborative guiding signal to obtain a new relation embedding with a collaborative signal; and calculating an item-to-entity importance score using a softmax function and an attention mechanism based on the new relationship embedding.
Specifically, representation learning is performed according to ID information of the item, entity and relationship, and an embedded representation e of the item, entity and relationship is obtained v ,e t and er And mapping the three to the same dimension, wherein the relation between the project v and the entity t is represented by r (for example, wu Jing, the movie, the entity is Wu Jing, and the entity is represented by the relation between the project v and the entity t, wherein the embedding of the project is head embedding, and the embedding of the entity is tail embedding).
Further, in the step (4), the embedding of the relation and the dot product operation of the cooperative guidance signal are performed to obtain a new embedding of the relation with a cooperative signal, specifically:
wherein ,er Representing the embedding of the relationships learned from the knowledge graph S u,v Representing the co-operative guidance signal,representing new relation embedding, N v A neighbor set of the item v in a adjacency matrix of the user and the item;
Wherein the user-item graph in fig. 2 is stored in a contiguous matrix of said users and items, both being equivalent.
The importance score from the item to the entity is calculated by utilizing a softmax function and an attention mechanism based on the new relation embedding, and specifically comprises the following steps:
wherein ,N′v The method comprises the steps that a neighbor set of a project v in a project-entity diagram is obtained, the project-entity diagram is a two-part diagram of the project and the entity, the project-entity diagram is a subset of a knowledge graph, a LeakyRelu function is an activation function, I represents concat splicing operation, W represents a learnable parameter matrix and is used for unifying vector embedded dimensions, alpha (v, r, t) is an importance score, and importance of the entity t to the project v is represented.
Further, the item-entity graph can be understood as a two-part graph of the item and the entity, and can be regarded as a subset of the knowledge graph; all nodes in the knowledge graph are represented in the form of entities, such as the head entity, the tail entity, etc. above.
Step (5), inputting the importance scores, the item embeddings and the entity embeddings in the step (4) to a collaborative knowledge neighborhood aggregation module to obtain a new item embedmentA schematic diagram of the collaborative knowledge neighborhood aggregation module is shown in FIG. 3.
Further, in step (5), embedding the importance scores α (v, r, t) and items in step (4) into e v And entity embedded input e t To a collaborative knowledge neighborhood aggregation module to obtain new project embeddingThe method comprises the following steps:
wherein ,ev For embedding items, e t For entity embedding, α (v, r, t) is an importance score, N' v Is the neighbor set of item v in the item-entity graph.
The above step (4) and step (5) can be regarded as a knowledge extraction layer, as shown in fig. 4.
Step (6), integrating the historical interaction sequence of the user and the project obtained in the step (1) and the knowledge information of the project and the knowledge entity to construct a collaborative knowledge graph, wherein the collaborative knowledge graph is in the form of G= { (h, R, t) |h, t epsilon ', R epsilon R', wherein h represents a head entity, t represents a tail entity, R represents a relationship, ε '=ε U V, and R' =R { inter }, wherein R represents a relationship set existing in the knowledge graph, and inter represents an interaction relationship between a user and an item in an adjacent matrix of the user and the item.
And (7) calculating to obtain normalized attention weights based on the collaborative knowledge graph. The method comprises the following steps:
using a matrix W of learnable parameters r Mapping the h embedding and the t embedding to the same dimension as the relation embedding r;
after the mapped h embedding and the mapped r embedding are added, the mapped h embedding and the mapped t embedding are added to obtain the attention fraction pi (h, r, t) of h-t:
π(h,r,t)=(W r e t )T(W r e h +e r );
wherein ,Wr E is a parameter matrix which can be learned h Representing h embedding, e t Representing t embedding, e r Representing r embedding;
normalizing the attention score pi (h, r, t) to obtain a normalized attention weight pi (h, r, t)'.
wherein ,Nh Denoted is an h-embedded neighbor set. The normalized attention weight pi (h, r, t)' has a value ranging from 0 to 1, with a larger score indicating a greater impact of t on h.
Step (8), multiplying all the neighbor embedded t of the h with the corresponding normalized attention weight, and aggregating the neighborhood of the h; and sum it to obtain N h Embedding h into N h Linear addition, a new h-embedding is obtained.
Specifically, in step (8), the aggregated knowledge is embedded into the neighborhood information in the propagation layer, and the embedded representation of the entity is updated, specifically including the following steps:
all neighbors of h embedding are embedded by multiplying their corresponding normalized attention weights by t and aggregating the neighbors of h, a process known as information aggregation. And linearly adding the aggregated neighborhood with the embedding of h to obtain updated head embedding h'.
wherein Nh Denoted is an h-embedded neighbor set.
In particular, the above steps (8) to (9) can be regarded as a attention embedding propagation layer.
Step (9), based on the collaborative knowledge graph, stacking a plurality of attention embedding propagation layers to performPerforming concat operation on the entity embedding obtained in each layer, obtaining the final embedded representation of each node in the collaborative knowledge graph, and extracting the user embedding from the collaborative knowledge graphAnd project embedding->
Shallow neighborhood information is often insufficient, so in order to mine high-order neighborhood information, multiple attention embedding propagation layers are stacked, and each layer can be completely embedded by a new entity.
Further, in step (9), based on the collaborative knowledge graph, stacking a plurality of attention embedding propagation layers, embedding the entity obtained in each layer to perform concat operation, and obtaining a final embedded representation of each node in the collaborative knowledge graph, which specifically includes:
wherein ,Nh Is the set of neighbors that are embedded in h,h-embedded in the first and/or the l+1 layers, respectively,>t-insert representing layer i; and the I is a concat splicing operation.
Extraction from collaborative knowledge graph to user embeddingProject embedding->
Wherein extract (·) represents the extraction from the collaborative knowledge graph to the embedding of the user and the item.
Step (10) of embedding the itemAnd project embedding->Adding to obtain local item embedding->User embedding +.>And user embedding->As a facing, the users of different users are embedded +.>And user embedding->As a negative pair; embedding items of the same item +.>And project embedding->As a facing, the items of different items are embedded +.>And project embedding->As a negative pair, a contrast learning task is performed and the InfoNCE function is used as a loss function to participate in training.
And data enhancement is performed by contrast learning, so that the recommendation accuracy is improved. For contrast learning tasks, the key problem is the construction of positive and negative contrast entities. The process of positive and negative pair construction in the contrast learning task is shown in fig. 5. In addition, the contrast learning task only participates in training, and does not participate in prediction. The contrast learning task is equivalent to data enhancement and is only effective in the training phase.
In one embodiment, the InfoNCE function is specifically:
where S (·) is a cosine similarity function,representing right direction and left direction>Representing a negative pair, n representing a user or item embedding, τ being a temperature coefficient.
The purpose of the InfoNCE function is to make the similarity between pairs larger and the similarity between negative pairs smaller. The user's embedding and the embedding of the item may be represented, determined according to fig. 5.
The InfoNCE function is used as a loss function to participate in training to achieve the purpose of data enhancement.
Step (11) of embedding the itemEmbedding with item->Performing concat to obtain final project embedding; embedding the user +.>Is embedded with the user>Performing concat to obtain final user embedding; performing inner product by utilizing the final project embedding and the final user embedding to obtain a final prediction score; generating a final project recommendation list according to the prediction score, wherein a BPR function is selected as a loss function for training a model; and the BPR loss function and the InfoNCE loss function are integrated to obtain a final loss function L. The method specifically comprises the following steps:
first, the item is embeddedEmbedding with item->Concat is carried out to obtain the final project embedded e v The method comprises the steps of carrying out a first treatment on the surface of the Embedding the user +.>Is embedded with the user>Concat is carried out to obtain the final user embedded e u :
Where is the concat splice operation.
Secondly, the final project embedding and the final user embedding are subjected to inner product to obtain a final prediction score, specifically:
wherein ,Is a predictive score;
the BPR loss function is specifically:
where σ (·) is the activation function, U is the set of users, N u For the set of items interacted with by user u,predictive score representing the presence of interactions between u and v in the dataset,/for the data set>A predictive score representing the absence of interactions between u and v' in the dataset.
And selecting the BPR function as a loss function for training the model, so that the result is more accurate.
Furthermore, in order to combine the recommended task with the contrast learning task, the recommended task and the contrast learning task are jointly trained by utilizing a multi-task learning strategy, and the BPR loss function and the InfoNCE loss function are combined to obtain a final loss function L.
L=L BPR +λL InfoNCE
Where λ is a weight coefficient for controlling the influence coefficients of the two loss functions.
Specifically, the final loss function L is adopted in the whole training process of the knowledge graph recommendation model based on comparison learning and cooperative signals; the loss function L has two parts, the first part is the loss function of the recommended task, and the second part is the loss function of the comparison learning task.
S3, acquiring a historical interaction sequence of a user to be recommended and knowledge information of a project and a knowledge entity, inputting the historical interaction sequence of the user to be recommended and the knowledge information of the project and the knowledge entity into the trained knowledge graph recommendation model based on the comparison learning and collaborative signals, acquiring a target recommendation list, and recommending the target recommendation list to the user.
Specifically, the historical interaction sequence of the user to be recommended and knowledge information of the items and the knowledge entities are input into the trained knowledge graph recommendation model based on comparison learning and collaborative signals, prediction scores are obtained, the prediction scores are ranked, and a final item recommendation list is generated based on the ranking results. In one embodiment, the predictive scores are ranked from high to low, a project recommendation list is generated from the top ten projects of the ranking, and the target recommendation list is recommended to the user.
Fig. 6 is a knowledge graph recommendation system based on contrast learning and collaborative signals according to an embodiment of the present invention. As shown in FIG. 6, the knowledge graph recommendation system based on the comparison learning and collaborative signals comprises a knowledge graph recommendation model construction module, a knowledge graph recommendation model training module and a project recommendation module.
The knowledge graph recommendation model construction module is used for constructing a knowledge graph recommendation model based on comparison learning and cooperative signals;
the knowledge graph recommendation model training module is used for training the knowledge graph recommendation model based on the contrast learning and cooperative signals by utilizing the obtained historical interaction sequences of the users in the data set and knowledge information of the items and the knowledge entities, so that a trained knowledge graph recommendation model based on the contrast learning and cooperative signals is obtained;
The project recommending module is used for acquiring a historical interaction sequence of a user to be recommended and knowledge information of a project and a knowledge entity, inputting the historical interaction sequence of the user to be recommended and the knowledge information of the project and the knowledge entity into the trained knowledge graph recommending model based on the comparison learning and collaborative signals, acquiring a target recommending list, and recommending the target recommending list to the user.
The knowledge graph recommendation system based on the comparison learning and synergy signals described above may be implemented in the form of a computer program that is executable on a computer device.
The computer device may be a server, where the server may be a stand-alone server, or may be a server cluster formed by a plurality of servers.
The computer device includes a processor, memory, and a network interface connected by a system bus, where the memory may include a non-volatile storage medium and an internal memory.
The non-volatile storage medium may store an operating system and a computer program. The computer program comprises program instructions that, when executed, cause the processor to perform a knowledge graph recommendation method based on the comparison learning and collaboration signals.
The processor is used to provide computing and control capabilities to support the operation of the entire computer device.
The internal memory provides an environment for the execution of a computer program in a non-volatile storage medium, which when executed by a processor causes the processor to perform a knowledge graph recommendation method based on the comparison learning and collaboration signals.
The network interface is for network communication with other devices. It will be appreciated by persons skilled in the art that the computer device structures described above are merely partial structures relevant to the present inventive arrangements and do not constitute a limitation of the computer device to which the present inventive arrangements are applied, and that a particular computer device may include more or less components than those shown in the drawings, or may combine certain components, or have a different arrangement of components.
The processor is configured to run a computer program stored in the memory, where the computer program implements the knowledge graph recommendation method based on the comparison learning and collaboration signals according to the first embodiment.
It should be appreciated that in embodiments of the application, the processor may be a central processing unit (Central Processing Unit, CPU), which may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Those skilled in the art will appreciate that all or part of the flow in a method embodying the above described embodiments may be accomplished by computer programs instructing the relevant hardware. The computer program comprises program instructions, and the computer program can be stored in a storage medium, which is a computer readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
The invention also provides a storage medium. The storage medium may be a computer readable storage medium. The storage medium stores a computer program, wherein the computer program when executed by a processor causes the processor to perform a knowledge graph recommendation method based on contrast learning and collaboration signals as described in embodiment one.
The storage medium may be a U-disk, a removable hard disk, a Read-only memory (ROM), a magnetic disk, or an optical disk, or other various computer-readable storage media that may store program codes.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be combined, divided and deleted according to actual needs. In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The integrated unit may be stored in a storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a terminal, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.
Claims (10)
1. The knowledge graph recommendation method based on the comparison learning and the cooperative signals is characterized by comprising the following steps:
s1, constructing a knowledge graph recommendation model based on comparison learning and cooperative signals;
s2, training the knowledge graph recommendation model based on the comparison learning and collaborative signals by using the acquired historical interaction sequence of the user in the data set and knowledge information of the items and the knowledge entities to obtain a trained knowledge graph recommendation model based on the comparison learning and collaborative signals; the step S2 specifically includes the following steps:
Step (1), acquiring a historical interaction sequence of a user and a project and knowledge information of the project and a knowledge entity from the data set, constructing an adjacency matrix of the user and the project based on the historical interaction sequence, and constructing a knowledge graph based on the knowledge information of the project and the knowledge entity, wherein the project is a film or a book;
step (2), constructing initial embedding of the user and the project according to attribute information of the user and the project; inputting the adjacent matrix, the initial embedding of the user and the project into a two-layer GCN network to obtain the user embeddingAnd project embedding->
Step (3), embedding the userAnd project embedding->Information fusion is carried out to extract a cooperative guidance signal;
step (4), extracting item embedding, relation embedding and entity embedding in the knowledge graph in the step (1), and carrying out dot product operation on the relation embedding and the collaborative guiding signal to obtain a new relation embedding with a collaborative signal; based on the new relation embedding, calculating importance scores from the items to the entities by using a softmax function and an attention mechanism;
step (5), inputting the importance scores, the item embeddings and the entity embeddings in the step (4) to a collaborative knowledge neighborhood aggregation module to obtain a new item embedment
Step (6), integrating the historical interaction sequence of the user and the project obtained in the step (1) and the knowledge information of the project and the knowledge entity to construct a collaborative knowledge graph, wherein the collaborative knowledge graph is in the form of G= { (h, R, t) |h, t epsilon ', R epsilon R', wherein h represents a head entity, t represents a tail entity, R represents a relationship, epsilon '=epsilon U V, and R' =R U { inter }, wherein R represents a relationship set existing in the knowledge graph, and inter represents an interaction relationship between a user and an item in an adjacent matrix of the user and the item;
step (7), calculating to obtain normalized attention weight based on the collaborative knowledge graph;
step (8), multiplying all the neighbor embedded t of the h with the corresponding normalized attention weight, and aggregating the neighborhood of the h; and sum it to obtain N h Embedding h into N h Linear addition to obtain a new h embedding;
step (9), based on the collaborative knowledge graph, stacking a plurality of attention embedding propagation layers, embedding the entity obtained from each layer for concierge operation, obtaining the final embedded representation of each node in the collaborative knowledge graph, and extracting the user embedded representation from the collaborative knowledge graph And project embedding->
Step (10) of embedding the itemAnd project embedding->Adding to obtain local item embedding->User embedding +.>And user embedding->As a facing, the users of different users are embedded +.>And user embedding->As a negative pair; embedding items of the same item +.>And project embedding->As a facing, the items of different items are embedded +.>And project embedding->As a negative pair, performing a contrast learning task, and using an InfoNCE function as a loss function to participate in training;
step (11) of embedding the itemEmbedding with item->Performing concat to obtain final project embedding; embedding the user +.>Is embedded with the user>Performing concat to obtain final user embedding; performing inner product by utilizing the final project embedding and the final user embedding to obtain a final prediction score; generating a final project recommendation list according to the prediction score, wherein a BPR function is selected as a loss function for training a model; the BPR loss function and the InfoNCE loss function are integrated to obtain a final loss function L;
s3, acquiring a historical interaction sequence of a user to be recommended and knowledge information of a project and a knowledge entity, inputting the historical interaction sequence of the user to be recommended and the knowledge information of the project and the knowledge entity into the trained knowledge graph recommendation model based on the comparison learning and collaborative signals, acquiring a target recommendation list, and recommending the target recommendation list to the user.
2. The method of claim 1, wherein in the step (2), the GCN network is a network structure of a LightGCN, and comprises a message propagation module and a layer information fusion module,
message transmissionSowing:
layer information fusion:
wherein ,Nv ,N u Neighbor sets respectively representing the items v and u are obtained from the adjacency matrix of the users and the items; e, e u For initial embedding of vectors by users, e v An initial embedded vector for the item;user-embedded vector representing the k-th layer, +.>User-embedded vector representing layer k+1,>item embedding vector representing the k-th layer, +.>An item embedding vector representing a k+1th layer; k represents the number of layers of the GCN network, k=2, α k Is a learnable weight coefficient.
3. The method according to claim 1, wherein in the step (4), the dot product operation is performed on the relation embedding and the collaboration guidance signal to obtain a new relation embedding with collaboration signals, specifically:
wherein ,er Representing the embedding of the relationships learned from the knowledge graph S u,v Representing the co-operative guidance signal,representing new relation embedding, N v A neighbor set of the item v in a adjacency matrix of the user and the item;
the importance score from the item to the entity is calculated by utilizing a softmax function and an attention mechanism based on the new relation embedding, and specifically comprises the following steps:
wherein ,N′v The method comprises the steps that a neighbor set of a project v in a project-entity diagram is obtained, the project-entity diagram is a two-part diagram of the project and the entity, the project-entity diagram is a subset of a knowledge graph, a LeakyRelu function is an activation function, I represents concat splicing operation, W represents a learnable parameter matrix and is used for unifying vector embedded dimensions, alpha (v, r, t) is an importance score, and importance of the entity t to the project v is represented.
4. The method of claim 1, wherein in step (5), the importance scores, item embeddings, and entity embeddings in step (4) are input to a collaborative knowledge neighborhood aggregation module to obtain a new item embedmentThe method comprises the following steps:
wherein ,ev For embedding items, e t For entity embedding, α (v, r, t) is an importance score, N' v Is the neighbor set of item v in the item-entity graph.
5. The method according to claim 1, wherein in step (7), based on the collaborative knowledge graph, a normalized attention weight is calculated, specifically:
using a matrix W of learnable parameters r Mapping the h embedding and the t embedding to the same dimension as the relation embedding r; after the mapped h embedding and the mapped r embedding are added, the mapped h embedding and the mapped t embedding are added to obtain the attention fraction pi (h, r, t) of h-t:
π(h,r,t)=(W r e t ) T (W r e h +e r );
wherein ,Wr As a matrix of learnable parameters e h Representing h embedding, e t Representing t embedding, e r Representing r embedding; normalizing the attention score pi (h, r, t) to obtain a normalized attention weight pi (h, r, t)'.
wherein ,Nh Denoted is an h-embedded neighbor set.
6. The method according to claim 1, wherein in step (9), based on the collaborative knowledge graph, a plurality of attention embedding propagation layers are stacked, and a concatemer operation is performed on the entity embedding obtained in each layer, so as to obtain a final embedded representation of each node in the collaborative knowledge graph, specifically:
wherein ,Nh Is the set of neighbors that are embedded in h,h-embedded in the first and/or the l+1 layers, respectively,>t-insert representing layer i; and the I is a concat splicing operation.
7. The method according to claim 1, wherein in step (10), the InfoNCE function is specifically:
where S (·) is a cosine similarity function,representing right direction and left direction>Representing a negative pair, n representing a user or item embedding, τ being a temperature coefficient.
8. The method according to claim 1, wherein in step (11), the final item embedding and the final user embedding are inner-product yielding a final prediction score, in particular:
wherein ,is a predictive score;
the BPR loss function is specifically:
where σ (·) is the activation function, U is the set of users, N u For the set of items interacted with by user u,predictive score representing the presence of interactions between u and v in the dataset,/for the data set>A predictive score representing the absence of interactions between u and v' in the dataset;
the final loss function is specifically:
L=L BPR +λL InfoNCE
wherein λ is a weight coefficient for controlling the influence coefficients of the two loss functions.
9. A knowledge graph recommendation system based on contrast learning and collaboration signals, wherein the knowledge graph recommendation system performs the knowledge graph recommendation method based on contrast learning and collaboration signals as claimed in claim 1, comprising: knowledge graph recommendation model construction module, knowledge graph recommendation model training module and project recommendation module;
the knowledge graph recommendation model construction module is used for constructing a knowledge graph recommendation model based on comparison learning and cooperative signals;
the knowledge graph recommendation model training module is used for training the knowledge graph recommendation model based on the contrast learning and cooperative signals by utilizing the obtained historical interaction sequences of the users in the data set and knowledge information of the items and the knowledge entities, so that a trained knowledge graph recommendation model based on the contrast learning and cooperative signals is obtained;
The project recommending module is used for acquiring a historical interaction sequence of a user to be recommended and knowledge information of a project and a knowledge entity, inputting the historical interaction sequence of the user to be recommended and the knowledge information of the project and the knowledge entity into the trained knowledge graph recommending model based on the comparison learning and collaborative signals, acquiring a target recommending list, and recommending the target recommending list to the user.
10. A computer device, characterized in that the device comprises a memory and a processor, the memory having stored thereon a computer program, which when executed by the processor implements the method according to any of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310832229.0A CN116776003A (en) | 2023-07-07 | 2023-07-07 | Knowledge graph recommendation method, system and equipment based on comparison learning and collaborative signals |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310832229.0A CN116776003A (en) | 2023-07-07 | 2023-07-07 | Knowledge graph recommendation method, system and equipment based on comparison learning and collaborative signals |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116776003A true CN116776003A (en) | 2023-09-19 |
Family
ID=87989428
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310832229.0A Pending CN116776003A (en) | 2023-07-07 | 2023-07-07 | Knowledge graph recommendation method, system and equipment based on comparison learning and collaborative signals |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116776003A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117312679A (en) * | 2023-11-28 | 2023-12-29 | 江西财经大学 | Long-tail recommendation method and system with cooperative enhancement of double-branch information |
-
2023
- 2023-07-07 CN CN202310832229.0A patent/CN116776003A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117312679A (en) * | 2023-11-28 | 2023-12-29 | 江西财经大学 | Long-tail recommendation method and system with cooperative enhancement of double-branch information |
CN117312679B (en) * | 2023-11-28 | 2024-02-09 | 江西财经大学 | Long-tail recommendation method and system with cooperative enhancement of double-branch information |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021223567A1 (en) | Content processing method and apparatus, computer device, and storage medium | |
Shi et al. | Transductive semi-supervised deep learning using min-max features | |
WO2021179640A1 (en) | Graph model-based short video recommendation method, intelligent terminal and storage medium | |
CN110619081B (en) | News pushing method based on interactive graph neural network | |
CN112119388A (en) | Training image embedding model and text embedding model | |
CN111061946A (en) | Scenario content recommendation method and device, electronic equipment and storage medium | |
WO2023039901A1 (en) | Text recommendation method and apparatus, model training method and apparatus, and readable storage medium | |
WO2023065859A1 (en) | Item recommendation method and apparatus, and storage medium | |
US20230244849A1 (en) | Content aware font recommendation | |
CN112074828A (en) | Training image embedding model and text embedding model | |
CN115114542B (en) | Object recommendation method, system, training method, medium and computer equipment | |
CN116776003A (en) | Knowledge graph recommendation method, system and equipment based on comparison learning and collaborative signals | |
Huang et al. | On the improvement of reinforcement active learning with the involvement of cross entropy to address one-shot learning problem | |
WO2023029350A1 (en) | Click behavior prediction-based information pushing method and apparatus | |
CN117216281A (en) | Knowledge graph-based user interest diffusion recommendation method and system | |
CN113095901B (en) | Recommendation method, training method of related model, electronic equipment and storage device | |
CN114528490A (en) | Self-supervision sequence recommendation method based on long-term and short-term interests of user | |
CN116910375B (en) | Cross-domain recommendation method and system based on user preference diversity | |
CN114330514A (en) | Data reconstruction method and system based on depth features and gradient information | |
CN112541128A (en) | Personalized news recommendation method based on characteristic bidirectional dynamic cooperation | |
CN110347916B (en) | Cross-scene item recommendation method and device, electronic equipment and storage medium | |
CN115564013B (en) | Method for improving learning representation capability of network representation, model training method and system | |
CN115409579A (en) | Meta-learning-based responsive recommendation method, system and equipment | |
KR20230148523A (en) | Multimedia recommendation method and system preserving the unique characteristics of modality | |
CN114510642A (en) | Book recommendation method, system and equipment based on heterogeneous information network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |