Food recommendation method based on neighborhood network and role network pairwise representation learning
By adopting a pairing representation learning method based on neighborhood network and role network in the food recommendation system, the problems of insufficient recommendation accuracy and user satisfaction in the existing recommendation methods are solved, and more accurate and personalized recommendations are achieved.
Patent Information
- Application Number
- CN202411597986.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-11
AI Technical Summary
The existing food recommendation methods have shortcomings in recommendation accuracy and user satisfaction, mainly due to the failure to fully consider the user's role attributes and personalized needs.
The food recommendation method based on pairing representation learning of neighborhood network and role network is adopted. A neighborhood network and role network are built by obtaining user data, combining independent learning and mutual learning modules, user vector representation is optimized, and a food recommendation list is generated based on similarity calculation.
It improves the accuracy and user satisfaction of food recommendations, and combines the user's interactive information and role attributes to more accurately meet users' personalized needs.
Smart Images

Figure CN119537695A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of personalized recommendation, and in particular relates to a food recommendation method based on paired representation learning of a neighborhood network and a role network. Background Art
[0002] With the rapid development of Internet technology, various emerging technologies are profoundly changing people's lifestyles, such as online shopping, online social networking, online learning, etc. Accurate recommendations can significantly improve the user experience because it ensures the high relevance of the recommended content. When these online platforms can accurately identify user portraits and meet these needs through personalized recommendations, the user experience will be significantly improved, and the platform can also optimize the design according to user needs, thereby improving the platform's competitiveness and market share.
[0003] However, most current food recommendation methods focus on the analysis of interactive information such as location and evaluation, that is, neighborhood information. For example, recommendations are made based on the user's consumption preferences. Although such recommendation methods can meet the basic needs of users to a certain extent, they fail to fully consider the role attributes of the user group itself (such as occupation, birthplace, etc.), so their recommendation results often have strong regional limitations. If recommendations are made based only on the user's role attributes, it is easy to ignore the personalized needs of this user group, such as the influencing factors of new social characteristics such as consumption concepts and values. In fact, if users have social relationships, they will also have an important impact on each other's dietary choices. In other words, the existing food recommendation methods have the problems of low recommendation accuracy and low user satisfaction.
[0004] Therefore, how to improve the accuracy of food recommendations and enhance user satisfaction is a problem that needs to be solved urgently in this field. Summary of the invention
[0005] The purpose of the present invention is to provide a method for recommending food based on paired representation learning of neighborhood network and role network in view of the defects of the prior art. The method for recommending food based on paired representation learning of neighborhood network and role network obtains user data; constructs a neighborhood network based on the user data; constructs a role network based on the neighborhood network; inputs the neighborhood network and the role network into the autonomous learning module and the mutual learning module respectively to obtain the representation of the neighborhood network, the representation of the role network and the common representation shared by the two networks; optimizes the vector representation by enhancing the difference between the representation of the neighborhood network and the representation of the role network and the consistency of the common representation, and obtains the vector representation of the user; performs similarity calculation on the obtained user vector, and generates a food recommendation list based on the similarity result, and recommends it to the user; thereby solving the problems of low recommendation accuracy and low user satisfaction of the existing food recommendation method.
[0006] In order to achieve the above purpose, the present invention adopts the following technical solutions:
[0007] A food recommendation method based on paired representation learning of neighborhood network and role network, characterized by comprising the steps of:
[0008] S1. Obtain user data;
[0009] Specifically, user data includes user interactions (v i , v j ) and user attribute x i =(x i,1 , x i,2 , ..., x i,d ), where (v i , v j ) indicates that user i and user j are geographically close and have interactions, x i are the d basic attributes of user i, including the user's gender, age, occupation, hobbies, and birthplace;
[0010] S2. Building a neighborhood network based on the user data;
[0011] Specifically, the form of the neighborhood network is G n =(V, E, X), where V is the set of user nodes in the network and the number of users is |V|; E = {e u,v |u, v∈V} is the edge set of the network, e u,v Indicates that there is an interaction between user u and user v; X = {x1, x2, ..., x |V|} is the basic attribute set of all nodes;
[0012] S3, constructing a role network based on the neighborhood network;
[0013] Step S3 specifically includes:
[0014] S31, calculating the role structure factor of the network according to the neighborhood network;
[0015] S32, analyzing the role structure mode of the network according to the neighborhood network;
[0016] S33, based on the role structure factors and the role structure model, construct a role network; the role network is in the form of G r =(V, E r , X), where V is the user node set and the number of users is |V|; E r ={e r u,v |u, v∈V} is the edge set of the role network, Indicates that there is a role similarity between user u and user v, X = {x1, x2, ..., x |V|} is the basic attribute set of the node;
[0017] S4, inputting the neighborhood network and the role network into the autonomous learning module and the mutual learning module respectively, to obtain a representation of the neighborhood network, a representation of the role network and a common representation shared by the two networks;
[0018] Step S4 specifically includes the following steps:
[0019] S41, inputting the neighborhood network and into an autonomous learning module to perform autonomous learning of the neighborhood network to obtain a representation of the neighborhood network;
[0020] S42, inputting the role network and into an autonomous learning module to perform autonomous learning of the role network to obtain a representation of the role network;
[0021] S43, inputting the neighborhood network and the role network into a mutual learning module, performing mutual learning between the neighborhood network and the role network, and obtaining a common representation shared by the two networks;
[0022] S5. By enhancing the difference between the representation of the neighborhood network and the representation of the role network and the consistency of the common representation, the vector representation is optimized to obtain the vector representation of the user;
[0023] Step S5 specifically includes:
[0024] S51. Enhance the representation of neighborhood networks through the Hilbert-Schmidt independence criterion HSIC n,k and the representation of the role network H r,k The differences between
[0025] S52, mutual information maximization enhances complementary information H n-rc,k and H r-nc,k consistency between
[0026] S53, determining a vector representation of the user;
[0027] S6. Perform similarity calculation on the obtained user vectors, and generate a food recommendation list based on the similarity results, and recommend it to the user.
[0028] Furthermore, step S3 specifically includes:
[0029] S31, calculating the role structure factor of the network according to the neighborhood network;
[0030] Specifically, calculate the role structure factor S of the entire network f, including the node degree, clustering coefficient and the edge relationship between its neighboring nodes; assuming that node v i represents user i, v i ∈V indicates that the node is in the neighborhood network G n In the node set V of i The neighbor node set of is defined as N(i) = {v j |e i,j ∈E}}, where E is the edge set of the graph; if v i The role structure factor is The calculation is as follows:
[0031]
[0032] where k i For node v i Degree, C i For node v i The clustering coefficient, For node v i The number of edges with all its neighbor nodes, For node v i The sum of the degrees of neighboring nodes, ed i =ec i / dc i For node v i The ratio of the number of edges and degrees of neighbors, od i =(dc i -ec i ) / dc i For node v i The ratio of the neighbors’ out-degree to their in-degree;
[0033] Node v i of Updates are made by the aggregation itself and neighbor node v j ∈N(i) To achieve, that is:
[0034]
[0035]
[0036] In this way, the role structure factor of the entire network is composed of the role structure factor of each node, that is,
[0037] S32, analyzing the role structure mode of the network according to the neighborhood network;
[0038] Calculate the role semantic information of nodes through the pattern subgraph;
[0039] Pattern subgraph Ps =(V m , E m ) is a subset of m nodes in the original network G And m nodes are in this subset V m and edge The pattern subgraph is composed of multiple connected subgraphs; and the pattern subgraph is composed of pattern units P u For a pattern subgraph P consisting of m nodes s =(V m , E m ), V m The nodes involved are divided into asymmetric pattern units P u , to describe the nodes in the pattern subgraph P s The modes available in
[0040] According to the above definition, the role structure model of the network Indicates that node v i With mode unit P u ,otherwise
[0041] S33, based on the role structure factors and the role structure model, construct a role network; the role network is in the form of G r =(V, E r , X), where V is the user node set, E r ={e r u,v |u, v∈V} is the edge set of the role network, Indicates that there is a similarity in roles between user u and user v;
[0042] Specifically, get the node's S f and S p Finally, the role structure coefficients and role structure patterns of the nodes are concatenated, and PCA is used to process the acquired node features to obtain the role features R of all nodes:
[0043]
[0044] After obtaining the role feature R, the cosine similarity is used to calculate the role similarity of the node to construct the role matrix A r ; The calculation formula for role similarity is as follows:
[0045]
[0046] Among them, · represents the dot product operation, R and |R| represent the role features and the modulus of the role features constructed previously, Sim is the role similarity matrix between nodes, Sim i,jFor node v i With node v j similarity of roles;
[0047] After getting the role similarity Sim, select node v i The nodes corresponding to the first k Sim values are taken as nodes v i Similar role nodes, that is, for the role matrix like Description point i and node v j Is a similar role, otherwise Therefore, according to the role matrix A r , determine the edge relationship E of the nodes in the role network r ={e r u,v |u, v∈V}, thus obtaining the role network G r =(V, E r , X).
[0048] Furthermore, step S4 specifically includes the following steps:
[0049] S41, inputting the neighborhood network and into an autonomous learning module to perform autonomous learning of the neighborhood network to obtain a representation of the neighborhood network;
[0050] Specifically, for the representation of the neighborhood network H n,k , the process of autonomous learning is as follows:
[0051]
[0052] where ε s (·) is the self-learning encoder, A is the neighborhood matrix, is the symmetric normalized Laplacian matrix of the neighborhood matrix, is the Laplace matrix The degree matrix, H n,k is the node representation of the neighborhood network after the kth layer encoding; when the number of layers is 0, H n,0 =(A, X), where X is the attribute information of the node, W n,k is the weight parameter of the kth layer of the encoder, σ is the nonlinear activation function; H n,k-1 It is the node representation of the neighborhood network after the k-1th layer encoding;
[0053] S42, inputting the role network and into an autonomous learning module to perform autonomous learning of the role network to obtain a representation of the role network;
[0054] For the representation of the role network H r,k, the autonomous learning process is as follows: The learning process also uses the autonomous learning encoder ε s (·):
[0055]
[0056] Among them, ε s (·) is the self-learning encoder, A r is the role matrix, is the symmetric normalized Laplacian matrix of the role matrix, is the Laplace matrix The degree matrix, W r,k is the weight parameter of the kth layer of the encoder, σ is the nonlinear activation function, H r,0 =(A r , X), X is the attribute information of the node; H r,k-1 It is the node representation of the neighborhood network after the k-1th layer encoding;
[0057] S43, inputting the neighborhood network and the role network into a mutual learning module, performing mutual learning between the neighborhood network and the role network, and obtaining a common representation shared by the two networks;
[0058] For the common representation H of the two networks m,k , using the encoder ε with shared weights m (·) Learning the neighborhood-role complementary information H based on the neighborhood network n-rc,k And the role-neighborhood complementary information H based on the role network r-nc,k , the specific learning process is as follows:
[0059]
[0060]
[0061] Where W m,k is the shared weight parameter of the GCN encoder; according to the neighborhood-role complementary information H n-rc,k and role-neighborhood complementary information H r-nc,k , use the attention mechanism to learn its corresponding importance:
[0062] (α n ,α r )=att(H n-rc,k , H r-nc,k )
[0063] where α n and α r H n-rc,k and H r-bc,k The attention coefficient for node vi Domain-role complementary information representation and node v i Role-neighborhood complementary information representation Need to first and Perform a nonlinear transformation and then use a shared attention vector q to obtain and The attention parameter and
[0064]
[0065] Where W att is the attention weight matrix, b is the bias vector; then the softmax function is used to normalize the attention score to obtain The attention weight and h r-nc,k的 Attention Weight
[0066]
[0067] Under mutual learning, the attention weight vectors of the complementary information of the nodes are and At this point, the common information representation of the two networks can be obtained:
[0068] H m,k =α n H n-rc,k +α r H r-nc,k
[0069] Based on the above learning process of message passing from layer 1 to layer k, until finally reaching layer k, the network learning is completed and the final common information H is obtained. m,k , and the neighborhood-role complementary information h n-rc,k and role-neighborhood complementary information h r -nc,k .
[0070] Furthermore, step S5 specifically includes:
[0071] S51. Enhance the representation of neighborhood networks through the Hilbert-Schmidt independence criterion HSIC n,k and the representation of the role network H r,k The differences between
[0072] By increasing H n,k and H n-rc,k The difference between n,k and Hr,k The differences between them are as follows:
[0073] HISC(H n,k , H n-rc,k )=(|V|-1) -2 tr(RK n R n-rc );
[0074] Where K n and K n-rc is the gram matrix, K n =f(H n,k , (H n,k ) T ), K n-rc =f(H n-rc,k , (H n-rc,k ) T ), f(·) is the inner product function, Where is the identity matrix, e is a single-column vector with all 1s, and tr(·) is the rank of the matrix;
[0075] For H r,k , also by increasing H r,k and H r-nc,k The difference between r,k and H n,k The differences between them are as follows:
[0076] HISC(H r,k , H r-nc,k )=(|V|-1) -2 tr(RK r R r-nc );
[0077] Where K r and K r-nc is the gram matrix, K r =f(H r,k , (H r,k ) T ), K r-nc =f(H r-nc,k , (H r-nc,k ) T );
[0078] Based on the above differences, the difference training function of specific information is designed as follows:
[0079] L s =[HISC(H n,k , H n-rc,k )+HISC(H r,k , H r-nc,k )] / 2;
[0080] S52, mutual information maximization enhances complementary information H n-rc,k and H r-nc,k consistency between
[0081] The binary cross entropy loss for the discriminator is used to maximize the mutual information of the two complementary information as follows:
[0082]
[0083]
[0084] Where |V| represents the number of nodes in the network, and The nodes v i The k-th layer of neighbor-role complementary information and role-neighbor complementary information obtained through mutual learning, s n-rc,k and r-nc,k Respectively and The global representation of s n-rc,k =pooling(A,H n-rc,k) ,s r-nc,k =pooling(A,H r-nc,k ), where pooling() is the pooling operation, σ is the nonlinear activation function, and the discriminator D(·) is the dot product between the two representation vectors. The consistency training function of complementary information is as follows:
[0085]
[0086] in and 1 is the positive sample set, and is a negative sample set; negative samples are obtained by randomly perturbing the attribute information X of the network nodes, that is:
[0087]
[0088] According to the perturbed properties And build a neighborhood network G n Negative sample network and the role network G r Negative sample network Input it into the paired learning module to obtain a specific representation H n,k and H r,k Negative samples and Complementary expression H n-rc,k and H r-nc,k Negative samples and and together represent H m Negative samples The specific method is as follows:
[0089]
[0090] S53, determining a vector representation of the user;
[0091] The loss function of paired learning is the weighted sum of the autonomous learning objective function and the mutual learning objective function:
[0092] L=λL s +(1-λ)L m ;
[0093] The model is trained based on the above loss function. After the training is completed, the user's vector is represented as:
[0094] Z=H n,k ||H n,k| |H r,k .
[0095] Furthermore, step S6 is specifically as follows:
[0096] After obtaining the user's vector representation Z, the formula for calculating the similarity of the user's vector representation is as follows:
[0097]
[0098] Where Z i For user v i The vector representation in the network, Z j For user v j The vector representation in the network, · represents the dot product operation, |Z i | and |Z j |respectively represent vector Z i and Z j Sim i,j Represents user v i and user v j similarity;
[0099] Through this similarity calculation method, user v i Calculate the similarity with all user nodes in the network and get the final user v i Similarity vector Sim with other users i ; According to the similarity vector, select the first k users in descending order, read the historical food of these k users, and generate a recommendation list for user v i .
[0100] The present invention also proposes a food recommendation system based on neighborhood network and role network pair representation learning, the food recommendation system executes the food recommendation method based on neighborhood network and role network pair representation learning, including: a user data acquisition module, a neighborhood network construction module, a role network construction module, a network representation acquisition module, a user vector representation determination module and a food recommendation module;
[0101] User data acquisition module, to acquire user data;
[0102] A neighborhood network construction module, which constructs a neighborhood network according to the user data;
[0103] A role network construction module, which constructs a role network according to the neighborhood network;
[0104] A network representation acquisition module inputs the neighborhood network and the role network into an autonomous learning module and a mutual learning module, respectively, to obtain a representation of the neighborhood network, a representation of the role network, and a common representation shared by the two networks;
[0105] The user vector representation determination module optimizes the vector representation by enhancing the difference between the representation of the neighborhood network and the representation of the role network and the consistency of the common representation to obtain the vector representation of the user;
[0106] The food recommendation module calculates the similarity of the obtained user vectors, generates a food recommendation list based on the similarity results, and recommends it to the user.
[0107] The present invention further provides a computer device, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.
[0108] Compared with the prior art, it has the following beneficial effects:
[0109] The food recommendation method based on paired representation learning of neighborhood network and role network of the present invention constructs a neighborhood network according to user data; constructs a role network according to the neighborhood network; inputs the neighborhood network and the role network into an autonomous learning module and a mutual learning module respectively to obtain the representation of the neighborhood network, the representation of the role network and the common representation shared by the two networks; optimizes the vector representation by enhancing the difference between the representation of the neighborhood network and the representation of the role network and the consistency of the common representation to obtain the vector representation of the user; performs similarity calculation on the obtained user vector, and generates a food recommendation list according to the similarity result, and recommends it to the user; wherein, the neighborhood network focuses on capturing the interaction between users, and the role network focuses on the social role attributes of the user, and by analyzing the user's occupation, hobbies, etc., the present invention improves the accuracy of food recommendation through paired learning of the neighborhood network and the role network, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0110] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0111] Figure 1 A schematic diagram of a food recommendation method based on paired representation learning of neighborhood networks and role networks provided in an embodiment of the present invention.
[0112] Figure 2 A model framework diagram for learning paired representations based on neighborhood networks and role networks provided in an embodiment of the present invention.
[0113] Figure 3 A framework diagram of a food recommendation method based on paired representation learning of neighborhood networks and role networks provided in an embodiment of the present invention.
[0114] Figure 4 A schematic diagram of a model unit and a mode sub-diagram provided for an embodiment of the present invention.
[0115] Figure 5 A diagram of the autonomous learning process provided by an embodiment of the present invention.
[0116] Figure 6 A diagram of the mutual learning process provided by an embodiment of the present invention.
[0117] Figure 7 Schematic diagram of a food recommendation system based on neighborhood network and role network pair representation learning provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0118] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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 creative work are within the scope of protection of the present invention.
[0119] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0120] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.
[0121] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0122] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0123] The present invention proposes a food recommendation method based on paired representation learning of neighborhood network and role network. Figure 1 As shown in FIG. 1 , the food recommendation method based on the paired representation learning of the neighborhood network and the role network includes the following steps S1 to S6. The model framework diagram based on the paired representation learning of the neighborhood network and the role network is shown in FIG. Figure 2 As shown in the figure; the framework diagram of the food recommendation method based on the learning of paired representations of neighborhood networks and role networks is shown in Figure 3 shown.
[0124] S1. Obtain user data;
[0125] Specifically, user data includes user interactions (v i , v j ) and user attribute x i =(x i,1 , x i,2 , ..., x i,d ), where (v i , v j ) indicates that user i and user j are geographically close and have interactions, x i are the d basic attributes of user i, including the user's gender, age, occupation, hobbies, and birthplace. Furthermore, the user attributes also include education, university major, marital status, etc.
[0126] S2. Building a neighborhood network based on the user data;
[0127] Specifically, the form of the neighborhood network is G n =(V, E, X), where V is the set of user nodes in the network and the number of users is |V|; E = {e u,v |u, v∈V} is the edge set of the network, e u,v Indicates that there is an interaction between user u and user v; X = {x1, x2, ..., x |V|} is the basic attribute set of all nodes;
[0128] S3, constructing a role network based on the neighborhood network;
[0129] Step S3 specifically includes:
[0130] S31, calculating the role structure factor of the network according to the neighborhood network;
[0131] S32, analyzing the role structure mode of the network according to the neighborhood network;
[0132] S33, based on the role structure factors and the role structure model, construct a role network; the role network is in the form of G r =(V, E r , x), where V is the user node set and the number of users is |V|; E r ={e r u,v |u, v∈V} is the edge set of the role network, Indicates that there is a role similarity between user u and user v, X = {x1, x2, ..., x |V|} is the basic attribute set of the node.
[0133] Furthermore, step S3 specifically includes:
[0134] S31, calculating the role structure factor of the network according to the neighborhood network;
[0135] Specifically, calculate the role structure factor S of the entire network f , including the node degree, clustering coefficient and the edge relationship between its neighboring nodes; assuming that node v i represents user i, v i ∈V indicates that the node is in the neighborhood network G n In the node set V of i The neighbor node set of is defined as N(i) = {v j |e i,j ∈E}}, where E is the edge set of the graph; if v i The role structure factor is The calculation is as follows:
[0136]
[0137] where k i For node v i Degree, C i For node v i The clustering coefficient, For node v i The number of edges with all its neighbor nodes, For node v i The sum of the degrees of neighboring nodes, edi =ec i / dc i For node v i The ratio of the number of edges and degrees of neighbors, od i =(dc i -ec i ) / dc i For node v i The ratio of the neighbors’ out-degree to their in-degree;
[0138] Node v i of Updates are made by the aggregation itself and neighbor node v j ∈N(i) To achieve, that is:
[0139]
[0140]
[0141] In this way, the role structure factor of the entire network is composed of the role structure factor of each node, that is,
[0142] S32, analyzing the role structure mode of the network according to the neighborhood network;
[0143] Calculate the role semantic information of nodes through the pattern subgraph;
[0144] Pattern subgraph P s =(V m , E m ) is a subset of m nodes in the original network G And m nodes are in this subset V m and edge The pattern subgraph is composed of multiple connected subgraphs; and the pattern subgraph is composed of pattern units P u Composition, such as Figure 4 As shown, for a pattern subgraph P consisting of m nodes s =(V m , E m ), V m The nodes involved are divided into asymmetric pattern units P u , to describe the nodes in the pattern subgraph P s The modes available in
[0145] According to the above definition, the role structure model of the network Indicates that node v i With mode unit P u ,otherwise
[0146] S33, based on the role structure factors and the role structure model, construct a role network; the role network is in the form of G r =(V, E r , X), where V is the user node set, E r ={e r u,v |u, v∈V} is the edge set of the role network, Indicates that there is a similarity in roles between user u and user v;
[0147] Specifically, get the node's S f and S p Finally, the role structure coefficients and role structure patterns of the nodes are concatenated, and PCA is used to process the acquired node features to obtain the role features R of all nodes:
[0148]
[0149] After obtaining the role feature R, the cosine similarity is used to calculate the role similarity of the node to construct the role matrix A r ; The calculation formula for role similarity is as follows:
[0150]
[0151] Among them, · represents the dot product operation, R and |R| represent the role features and the modulus of the role features constructed previously, Sim is the role similarity matrix between nodes, Sim i,j For node v i With node v j similarity of roles;
[0152] After getting the role similarity Sim, select node v i The nodes corresponding to the first k Sim values are taken as nodes v i Similar role nodes, that is, for the role matrix like Description point i and node v j Is a similar role, otherwise Therefore, according to the role matrix A r , determine the edge relationship E of the nodes in the role network r ={e r u,v |u, v∈V}, thus obtaining the role network G r =(V, E r , X).
[0153] S4, inputting the neighborhood network and the role network into the autonomous learning module and the mutual learning module respectively, to obtain the representation of the neighborhood network, the representation of the role network and the common representation shared by the two networks; wherein the autonomous learning process is as follows Figure 5 As shown in Figure 6 shown.
[0154] Step S4 specifically includes the following steps:
[0155] S41, inputting the neighborhood network and into an autonomous learning module to perform autonomous learning of the neighborhood network to obtain a representation of the neighborhood network;
[0156] S42, inputting the role network and into an autonomous learning module to perform autonomous learning of the role network to obtain a representation of the role network;
[0157] S43, inputting the neighborhood network and the role network into a mutual learning module, performing mutual learning between the neighborhood network and the role network, and obtaining a common representation shared by the two networks.
[0158] Furthermore, step S4 specifically includes the following steps:
[0159] S41, inputting the neighborhood network and into an autonomous learning module to perform autonomous learning of the neighborhood network to obtain a representation of the neighborhood network;
[0160] Specifically, for the representation of the neighborhood network H n,k , the process of autonomous learning is as follows:
[0161]
[0162] where ε s (·) is the self-learning encoder, A is the neighborhood matrix, is the symmetric normalized Laplacian matrix of the neighborhood matrix, is the Laplace matrix The degree matrix, H n,k is the node representation of the neighborhood network after the kth layer encoding; when the number of layers is 0, H n,0 =(A, X), where X is the attribute information of the node, W n,k is the weight parameter of the kth layer of the encoder, σ is the nonlinear activation function; H n,k-1 It is the node representation of the neighborhood network after the k-1th layer encoding;
[0163] S42, inputting the role network and into an autonomous learning module to perform autonomous learning of the role network to obtain a representation of the role network;
[0164] For the representation of the role network Hr,k , the autonomous learning process is as follows: The learning process also uses the autonomous learning encoder ε s (·):
[0165]
[0166] Among them, ε s (·) is the self-learning encoder, A r is the role matrix, is the symmetric normalized Laplacian matrix of the role matrix, is the Laplace matrix The degree matrix, W r,k is the weight parameter of the kth layer of the encoder, σ is the nonlinear activation function, H r,0 =(A r , X), X is the attribute information of the node; H r,k-1 It is the node representation of the neighborhood network after the k-1th layer encoding;
[0167] S43, inputting the neighborhood network and the role network into a mutual learning module, performing mutual learning between the neighborhood network and the role network, and obtaining a common representation shared by the two networks;
[0168] For the common representation H of the two networks m,k , using the encoder ε with shared weights m (·) Learning the neighborhood-role complementary information H based on the neighborhood network n-rc,k And the role-neighborhood complementary information H based on the role network r-nc,k , the specific learning process is as follows:
[0169]
[0170] Where W m,k is the shared weight parameter of the GCN encoder; according to the neighborhood-role complementary information H n-rc,k and role-neighborhood complementary information H r-nc,k , use the attention mechanism to learn its corresponding importance:
[0171] (α n , α r )=att(H n-rc,k , H r-nc,k )
[0172] where α n and α r H n-m,k and H r-nc,k The attention coefficient for node v i Domain-role complementary information representation and node v i Role-neighborhood complementary information representation Need to first and Perform a nonlinear transformation and then use a shared attention vector q to obtain and The attention parameter and
[0173]
[0174] Where W att is the attention weight matrix, b is the bias vector; then the softmax function is used to normalize the attention score to obtain The attention weight and h r-nc,k The attention weight
[0175]
[0176]
[0177] Under mutual learning, the attention weight vectors of the complementary information of the nodes are and At this point, the common information representation of the two networks can be obtained:
[0178] H m,k =α n H n-rc,k +α r H r-nc,k
[0179] Based on the above learning process of message passing from layer 1 to layer k, until finally reaching layer k, the network learning is completed and the final common information H is obtained. m,k , and the neighborhood-role complementary information h n-rc,k and role-neighborhood complementary information h r -nc,k .
[0180] S5. By enhancing the difference between the representation of the neighborhood network and the representation of the role network and the consistency of the common representation, the vector representation is optimized to obtain the vector representation of the user.
[0181] Step S5 specifically includes:
[0182] S51. Enhance the representation of neighborhood networks through the Hilbert-Schmidt independence criterion HSIC n,k and the representation of the role network H r,k The differences between
[0183] S52, mutual information maximization enhances complementary information H n-rc,k and H r-nc,k consistency between
[0184] S53: Determine a vector representation of the user.
[0185] Furthermore, step S5 specifically includes:
[0186] S51. Enhance the representation of neighborhood networks through the Hilbert-Schmidt independence criterion HSIC n,k and the representation of the role network H r,k The differences between
[0187] H n,k and H r,k The difference is large, while H n,k and H n-rc,k The difference is small, so by increasing H n,k and H n-rc,k The difference between n,k and H r,k The difference between.
[0188] By increasing H n,k and H n-rc,k The difference between n,k and H r,k The differences between them are as follows:
[0189] HISC(H n,k , H n-rc,k )=(|V|-1) -2 tr(RK n R n-rc );
[0190] Where K n and K n-rc is the gram matrix, K n =f(H n,k , (H n,k ) T ), K n-rc =f(H n-rc,k , (H n-rc,k ) T ), f(·) is the inner product function, Where is the identity matrix, e is a single-column vector with all 1s, and tr(·) is the rank of the matrix;
[0191] For H r,k , also by increasing H r,k and H r-nc,k The difference betweenr,k and H n, The differences between k are as follows:
[0192] HISC(H r,k , H r-nc,k )=(|V|-1) -2 tr(RK r R r-nc );
[0193] Where K r and K r-nc is the gram matrix, K r =f(H r,k , (H r,k ) T ), K r-nc =f(H r-nc,k , (H r-nc,k ) T );
[0194] Based on the above differences, the difference training function of specific information is designed as follows:
[0195] L s =[HISC(H n,k , H n-rc,k )+HISC(H r,k , H r-nc,k )] / 2;
[0196] S52, mutual information maximization enhances complementary information H n-rc,k and H r-nc,k consistency between
[0197] In order to enhance H n-rc,k and H r-nc,k To achieve consistency, a binary cross entropy loss is adopted for the discriminator to maximize the mutual information of the two complementary information.
[0198] The binary cross entropy loss for the discriminator is used to maximize the mutual information of the two complementary information as follows:
[0199]
[0200]
[0201] Where |V| represents the number of nodes in the network, and The nodes v i The k-th layer of neighbor-role complementary information and role-neighbor complementary information obtained through mutual learning, s n-rc,k and r-nc,k Respectively and is the global representation of , σ is the nonlinear activation function, and the discriminator D(·) is the dot product between the two representation vectors. The consistency training function of complementary information is as follows:
[0202]
[0203] in and is the positive sample set, and is a negative sample set; negative samples are obtained by randomly perturbing the attribute information X of the network nodes, that is:
[0204]
[0205] According to the perturbed properties And build a neighborhood network G n Negative sample network and the role network G r Negative sample network Input it into the paired learning module to obtain a specific representation H n,k and H r,k Negative samples and Complementary expression H n-rc,k and H r-nc,k Negative samples and and together represent H m Negative samples The specific method is as follows:
[0206]
[0207] S53, determining a vector representation of the user;
[0208] The loss function of paired learning is the weighted sum of the autonomous learning objective function and the mutual learning objective function:
[0209] L=λL s +(1-λ)L m ;
[0210] The model is trained based on the above loss function. After the training is completed, the user's vector is represented as:
[0211] Z=H n,k ||H m,k ||H r,k .
[0212] This method first abstracts the interaction between users in the food recommendation problem into a network with nodes and edges, and constructs a neighborhood network and a role network based on user data. Among them, the neighborhood network represents the interaction between users, and the edges represent the interaction between users; the role network represents the role, and the edges represent the role similarity between users, such as users living in the same area. The basic steps are to first build a neighborhood network based on user data, and then analyze the role of the user node based on the edge situation between the network node and the neighbor node, as well as the structural subgraph contained in the network node, and build a role network. A paired learning method is designed to allow the neighborhood network and the role network to learn in pairs, so as to obtain the specific representation of each network and the common representation shared by the network, and aggregate to obtain the representation of the final user node.
[0213] S6. Calculate the similarity of the obtained user vectors, and generate a food recommendation list based on the similarity results, and recommend it to the user; specifically:
[0214] After obtaining the user's vector representation Z, the formula for calculating the similarity of the user's vector representation is as follows:
[0215]
[0216] Where Z i For user v i The vector representation in the network, Z j For user v j The vector representation in the network, · represents the dot product operation, |Z i | and |Z j |respectively represent vector Z i and Z j Sim i,j Represents user v i and user v j similarity;
[0217] Through this similarity calculation method, user v i Calculate the similarity with all user nodes in the network and get the final user v i Similarity vector Sim with other users i ; According to the similarity vector, select the first k users in descending order, read the historical food of these k users, and generate a recommendation list for user v i .
[0218] Specifically, users with similar neighborhood and role information will be represented as similar vectors, which means that the users are considered to have similar preferences and a food recommendation list with similar content is generated.
[0219] The present invention proposes a food recommendation method that pairs neighborhood networks and role networks, combines dimensions such as neighborhood information and role information, and applies them to food recommendation. Specifically, based on the original user data, a neighborhood network and a role network are constructed, wherein the neighborhood network focuses on capturing the interaction between users, that is, users with similar geographical locations and interactions will establish connections in the graph; while the role network focuses on the social role attributes of users, and constructs the relationship between nodes by analyzing information such as the user's occupation, hobbies, and interactions with other users; then the above-mentioned neighborhood network and role network are paired for learning, wherein the specific representation obtained by autonomous learning is used to capture the unique information of nodes in each network, such as the user's dietary preferences under ordinary social relationships; the common representation obtained by mutual learning emphasizes the consistency characteristics across networks, such as the common dietary tendencies that different social roles may show; finally, the similarity is calculated based on the generated user network representation, and similar food is recommended for similar users.
[0220] Figure 7 The present invention provides a food recommendation system based on the learning of paired representations of neighborhood networks and role networks. Figure 7 As shown, the food recommendation system based on neighborhood network and role network pair representation learning includes a user data acquisition module, a neighborhood network construction module, a role network construction module, a network representation acquisition module, a user vector representation determination module and a food recommendation module.
[0221] User data acquisition module, to acquire user data;
[0222] A neighborhood network construction module, which constructs a neighborhood network according to the user data;
[0223] A role network construction module, which constructs a role network according to the neighborhood network;
[0224] A network representation acquisition module inputs the neighborhood network and the role network into an autonomous learning module and a mutual learning module, respectively, to obtain a representation of the neighborhood network, a representation of the role network, and a common representation shared by the two networks;
[0225] The user vector representation determination module optimizes the vector representation by enhancing the difference between the representation of the neighborhood network and the representation of the role network and the consistency of the common representation to obtain the vector representation of the user;
[0226] The food recommendation module calculates the similarity of the obtained user vectors, generates a food recommendation list based on the similarity results, and recommends it to the user.
[0227] The above-mentioned food recommendation system based on neighborhood network and role network pair representation learning can be implemented in the form of a computer program, which can be run on a computer device.
[0228] The computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0229] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute a food recommendation method based on learning paired representations of a neighborhood network and a role network.
[0230] The processor is used to provide computing and control capabilities to support the operation of the entire computer equipment.
[0231] The internal memory provides an environment for the operation of a computer program in a non-volatile storage medium. When the computer program is executed by a processor, the processor can execute a food recommendation method based on learning paired representations of a neighborhood network and a role network.
[0232] The network interface is used to communicate with other devices over the network. Those skilled in the art will appreciate that the above-mentioned computer device structure is only a partial structure related to the present application solution, and does not constitute a limitation on the computer device to which the present application solution is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0233] The processor is used to run a computer program stored in the memory, which implements the food recommendation method based on neighborhood network and role network pair representation learning described in Example 1.
[0234] It should be understood that in the embodiments of the present application, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0235] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes 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 process steps of the embodiment of the above method.
[0236] The present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein when the computer program is executed by a processor, the processor executes a food recommendation method based on paired representation learning of a neighborhood network and a role network as described in Embodiment 1.
[0237] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, or any other computer-readable storage medium that can store program codes.
[0238] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0239] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0240] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.
[0241] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A food recommendation method based on paired representation learning of neighborhood network and role network, characterized in that: Includes steps: S1. Obtain user data; Specifically, user data includes user interactions (v i , v j ) and user attribute x i =(x i,1 , x i,2 , ..., x i,d ), where (v i , v j ) indicates that user i and user j are geographically close and have interactions, x i are the d basic attributes of user i, including the user's gender, age, occupation, hobbies, and birthplace; S2. Building a neighborhood network based on the user data; Specifically, the form of the neighborhood network is G n =(V, E, X), where V is the set of user nodes in the network and the number of users is |V|; E = {e u,v |u, v∈V} is the edge set of the network, e u,v Indicates that there is an interaction between user u and user v; X = {x1, x2, ..., x |V| } is the basic attribute set of all nodes; S3, constructing a role network based on the neighborhood network; Step S3 specifically includes: S31, calculating the role structure factor of the network according to the neighborhood network; S32, analyzing the role structure mode of the network according to the neighborhood network; S33, based on the role structure factors and the role structure model, construct a role network; the role network is in the form of G r =(V, E r , X), where V is the user node set and the number of users is |V|; E r ={e r u,v |u, v∈V} is the edge set of the role network, Indicates that there is a role similarity between user u and user v, X = {x1, x2, ..., x |V| } is the basic attribute set of the node; S4, inputting the neighborhood network and the role network into the autonomous learning module and the mutual learning module respectively, to obtain a representation of the neighborhood network, a representation of the role network and a common representation shared by the two networks; Step S4 specifically includes the following steps: S41, inputting the neighborhood network and into an autonomous learning module to perform autonomous learning of the neighborhood network to obtain a representation of the neighborhood network; S42, inputting the role network and into an autonomous learning module to perform autonomous learning of the role network to obtain a representation of the role network; S43, inputting the neighborhood network and the role network into a mutual learning module, performing mutual learning between the neighborhood network and the role network, and obtaining a common representation shared by the two networks; S5. By enhancing the difference between the representation of the neighborhood network and the representation of the role network and the consistency of the common representation, the vector representation is optimized to obtain the vector representation of the user; Step S5 specifically includes: S51. Enhance the representation of neighborhood networks through the Hilbert-Schmidt independence criterion HSIC n,k and the representation of the role network H r,k The differences between S52, mutual information maximization enhances complementary information H n-rc,k and H r-nc,k consistency between S53, determining a vector representation of the user; S6. Perform similarity calculation on the obtained user vectors, and generate a food recommendation list based on the similarity results, and recommend it to the user.
2. The method according to claim 1, characterized in that Step S3 specifically includes: S31, calculating the role structure factor of the network according to the neighborhood network; Specifically, calculate the role structure factor S of the entire network f , including the node degree, clustering coefficient and the edge relationship between its neighboring nodes; assuming that node v i represents user i, v i ∈V indicates that the node is in the neighborhood network G n In the node set V of i The neighbor node set of is defined as N(i) = {v j |e i,j ∈E}}, where E is the edge set of the graph; if v i The role structure factor is The calculation is as follows: where k i For node v i Degree, C i For node v i The clustering coefficient, For node v i The number of edges with all its neighbor nodes, For node v i The sum of the degrees of neighboring nodes, ed i =ec i / dc i For node v i The ratio of the number of edges and degrees of neighbors, od i =(dc i -ec i ) / dc i For node v i The ratio of the neighbors’ out-degree to their in-degree; Node v i of Updates are made by the aggregation itself and neighbor node v j ∈N(i) To achieve, that is: In this way, the role structure factor of the entire network is composed of the role structure factor of each node, that is, S32, analyzing the role structure mode of the network according to the neighborhood network; Calculate the role semantic information of nodes through the pattern subgraph; Pattern subgraph P s =(V m , E m ) is a subset of m nodes in the original network G And m nodes are in this subset V m and edge The pattern subgraph is composed of multiple connected subgraphs; and the pattern subgraph is composed of pattern units P u For a pattern subgraph P consisting of m nodes s =(V m , E m ), V m The nodes involved are divided into asymmetric pattern units P u , to describe the nodes in the pattern subgraph P s The modes available in According to the above definition, the role structure model of the network Indicates that node v i With mode unit P u ,otherwise S33, based on the role structure factors and the role structure model, construct a role network; the role network is in the form of G r =(V, E r , X), where V is the user node set, E r ={e r u,v |u, v∈V} is the edge set of the role network, Indicates that there is a similarity in roles between user u and user v; Specifically, get the node's S f and S p Finally, the role structure coefficients and role structure patterns of the nodes are concatenated, and PCA is used to process the acquired node features to obtain the role features R of all nodes: After obtaining the role feature R, the cosine similarity is used to calculate the role similarity of the node to construct the role matrix A r ; The calculation formula for role similarity is as follows: Among them, · represents the dot product operation, R and |R| represent the role features and the modulus of the role features constructed previously, Sim is the role similarity matrix between nodes, Sim i,j For node v i With node v j similarity of roles; After getting the role similarity Sim, select node v i The nodes corresponding to the first k Sim values are taken as nodes v i Similar role nodes, that is, for the role matrix like Description point i and node v j Is a similar role, otherwise Therefore, according to the role matrix A r , determine the edge relationship E of the nodes in the role network r ={e r u,v |u, v∈V}, thus obtaining the role network G r =(V, E r , X).
3. The method according to claim 1, characterized in that Step S4 specifically includes the following steps: S41, inputting the neighborhood network and into an autonomous learning module to perform autonomous learning of the neighborhood network to obtain a representation of the neighborhood network; Specifically, for the representation of the neighborhood network H n,k , the process of autonomous learning is as follows: where ε s (·) is the self-learning encoder, A is the neighborhood matrix, is the symmetric normalized Laplacian matrix of the neighborhood matrix, is the Laplace matrix The degree matrix, H n,k It is the node representation of the neighborhood network after the k-th layer encoding; When the number of layers is 0, H n,0 =(A, X), where X is the attribute information of the node, W n,k is the weight parameter of the kth layer of the encoder, σ is the nonlinear activation function; H n,k-1 It is the node representation of the neighborhood network after the k-1th layer encoding; S42, inputting the role network and into an autonomous learning module to perform autonomous learning of the role network to obtain a representation of the role network; For the representation of the role network H r,k , the autonomous learning process is as follows: The learning process also uses the autonomous learning encoder ε s (·): Among them, ε s (·) is the self-learning encoder, A r is the role matrix, is the symmetric normalized Laplacian matrix of the role matrix, is the Laplace matrix The degree matrix, W r,k is the weight parameter of the kth layer of the encoder, σ is the nonlinear activation function, H r,0 =(A r , X), X is the attribute information of the node; H r,k-1 It is the node representation of the neighborhood network after the k-1th layer encoding; S43, inputting the neighborhood network and the role network into a mutual learning module, performing mutual learning between the neighborhood network and the role network, and obtaining a common representation shared by the two networks; For the common representation H of the two networks m,k , using the encoder ε with shared weights m (·) Learning the neighborhood-role complementary information H based on the neighborhood network n-rc,k And the role-neighborhood complementary information H based on the role network r-nc,k , the specific learning process is as follows: Where W m,k is the shared weight parameter of the GCN encoder; according to the neighborhood-role complementary information H n-rc,k and role-neighborhood complementary information H r-nc,k , use the attention mechanism to learn its corresponding importance: (a n ,a r )=att(H n-rc,k ,H r-nc,k ) where α n and α r H n-rc,k and H r-nc,k The attention coefficient for node v i Domain-role complementary information representation and node v i Role-neighborhood complementary information representation Need to first and Perform a nonlinear transformation and then use a shared attention vector q to obtain and The attention parameter and Where W att is the attention weight matrix, b is the bias vector; then the softmax function is used to normalize the attention score to obtain The attention weight and h r-nc,k The attention weight Under mutual learning, the attention weight vectors of the complementary information of the nodes are and At this point, the common information representation of the two networks can be obtained: H m,k =a n H n-rc,k +a r H r-nc,k Based on the above learning process of message passing from layer 1 to layer k, until finally reaching layer k, the network learning is completed and the final common information H is obtained. m,k , and the neighborhood-role complementary information h n-rc,k and role-neighborhood complementary information h r-nc,k .
4. The method according to claim 1, characterized in that: Step S5 specifically includes: S51. Enhance the representation of neighborhood networks through the Hilbert-Schmidt independence criterion HSIC n,k and the representation of the role network H r,k The differences between By increasing H n,k and H n-rc,k The difference between n,k and H r,k The differences between them are as follows: HISC(H n,k ,H n-rc,k )(|V|-1) -2 tr(RK n RK n-rc )4 Where K n and K n-rc is the gram matrix, K n =f(H n,k , (H n,k ) T ), K n-rc =f(H n-rc,k , (H n-rc,k ) T ), f(·) is the inner product function, Where I is the identity matrix, e is a single-column vector with all 1s, and tr(·) is the rank of the matrix; For H r,k , also by increasing H r,k and H r-nc,k The difference between r,k and H n,k The differences between them are as follows: HISC(H r,k ,H r-nc,k )(|V|-1) -2 tr(RK r RK r-nc )4 Where K r and K r-nc is the gram matrix, K r =f(H r,k , (H r,k ) T ), K r-nc =f(H r-nc,k , (H r-nc,k ) T ); Based on the above differences, the difference training function of specific information is designed as follows: L s =[HISC(H n,k ,H n-rc,k )+HISC(H r,k ,H r-nc,k )] / 2; S52, mutual information maximization enhances complementary information H n-rc,k and H r-nc,k consistency between The binary cross entropy loss for the discriminator is used to maximize the mutual information of the two complementary information as follows: Where |V| represents the number of nodes in the network, and The nodes v i The k-th layer of neighbor-role complementary information and role-neighbor complementary information obtained through mutual learning, s n-rc,k and r-nc,k Respectively and The global representation of s n-rc,k =pooling(A,H n-rc,k ), s r-nc,k =pooling(A,H r-nc,k ), where pooling() is the pooling operation, σ is the nonlinear activation function, and the discriminator D(·) is the dot product between the two representation vectors. The consistency training function of complementary information is as follows: in and is the positive sample set, and is a negative sample set; negative samples are obtained by randomly perturbing the attribute information X of the network nodes, that is: According to the perturbed properties And build a neighborhood network G n Negative sample network and the role network G r Negative sample network Input it into the paired learning module to obtain a specific representation H n,k and H r,k Negative samples and Complementary expression H n-rc,k and H r-nc,k Negative samples and and together represent H m Negative samples The specific method is as follows: S53, determining a vector representation of the user; The loss function of paired learning is the weighted sum of the autonomous learning objective function and the mutual learning objective function: L=λL s +(1-λ)L m ; The model is trained based on the above loss function. After the training is completed, the user's vector is represented as: Z=H n,k ||H m,k| |H r,k 。 5. The method according to claim 1, characterized in that Step S6 is specifically as follows: After obtaining the user's vector representation Z, the formula for calculating the similarity of the user's vector representation is as follows: Where Z i For user v i The vector representation in the network, Z j For user v j The vector representation in the network, · represents the dot product operation, |Z i | and |Z j |respectively represent vector Z i and Z j Sim i,j Represents user v i and user v j similarity; Through this similarity calculation method, user v i Calculate the similarity with all user nodes in the network and get the final user v i Similarity vector Sim with other users i ; According to the similarity vector, select the first k users in descending order, read the historical food of these k users, and generate a recommendation list for user v i .
6. A food recommendation system based on paired representation learning of neighborhood network and role network, characterized in that: The food recommendation system implements the food recommendation method based on the neighborhood network and role network pair representation learning as claimed in claim 1, comprising: a user data acquisition module, a neighborhood network construction module, a role network construction module, a network representation acquisition module, a user vector representation determination module and a food recommendation module; User data acquisition module, to acquire user data; A neighborhood network construction module, which constructs a neighborhood network according to the user data; A role network construction module, which constructs a role network according to the neighborhood network; A network representation acquisition module inputs the neighborhood network and the role network into an autonomous learning module and a mutual learning module, respectively, to obtain a representation of the neighborhood network, a representation of the role network, and a common representation shared by the two networks; The user vector representation determination module optimizes the vector representation by enhancing the difference between the representation of the neighborhood network and the representation of the role network and the consistency of the common representation to obtain the vector representation of the user; The food recommendation module calculates the similarity of the obtained user vectors, generates a food recommendation list based on the similarity results, and recommends it to the user.
7. A computer device, characterized in that: The device comprises a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
News recommendation method based on multi-dimensional features
CN114357307A
Media content recommendation method, system and equipment based on dynamic network representation learning
CN117312651A
Personalized commodity recommendation method and system based on time sequence diagram convolutional network
CN117474637A
Social recommendation method based on collaborative heterogeneous information network
CN118410236A
Social recommendation method based on multi-feature heterogeneous graph neural networks
US20220414792A1