Food recommendation method based on neighborhood network and role network pairing representation learning

By constructing a neighborhood network and a role network, combining autonomous learning and mutual learning methods, and optimizing user vector representation, the problems of low recommendation accuracy and low user satisfaction in existing food recommendation methods are solved, and more accurate food recommendations are achieved.

CN119537695BActive Publication Date: 2025-10-17CHONGQING UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411597986.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-10-17
Estimated Expiration
2044-11-11

AI Technical Summary

Technical Problem

Existing food recommendation methods fail to fully consider the role attributes of user groups, resulting in recommendation results with geographical limitations, ignoring personalized needs, low accuracy and low user satisfaction.

Method used

A paired representation learning method based on neighborhood network and role network constructs neighborhood network and role network for autonomous learning and mutual learning respectively, enhances the diversity and consistency of network representation, optimizes user vector representation, and generates a food recommendation list based on similarity.

Benefits of technology

It improves the accuracy of food recommendations, enhances user experience, meets users' personalized needs, and enhances the personalization and accuracy of recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119537695B_ABST
    Figure CN119537695B_ABST
Patent Text Reader

Abstract

The application provides a food recommendation method based on neighborhood network and role network pair representation learning, and the method comprises the following steps: obtaining user data; constructing a neighborhood network according to the user data; constructing a role network according to the neighborhood network; inputting 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; optimizing 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 a vector representation of the user; performing similarity calculation on the obtained user vector, and generating a food recommendation list according to the similarity result and recommending the food recommendation list to the user. The food recommendation method based on neighborhood network and role network pair representation learning is adopted, so that the problem of low recommendation accuracy and low user satisfaction of the existing food recommendation method is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of personalized recommendation, and particularly relates to a food recommendation method based on neighborhood network and role network pairing representation learning. BACKGROUND

[0002] With the rapid development of Internet technology, various emerging technologies are profoundly changing the way of human life, such as online shopping, online socializing, online learning, etc. Precise recommendation 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 recommendation, the user experience will also be significantly improved, and the platform can also optimize the design according to the user's needs, thereby improving the competitiveness and market share of the platform.

[0003] However, most of the current food recommendation methods mainly focus on the analysis of interactive information based on location, evaluation, etc., i.e. neighborhood information, such as making recommendations according to the user's consumption preferences, etc. Such a recommendation method can meet the basic needs of users to a certain extent, but it fails to fully consider the role attributes (such as occupation, place of birth, etc.) of the user group itself, so the recommendation results often have strong regional limitations. If only the role attributes of the user are used for recommendation, the personalized needs of the user group, such as the influence factors of social new features such as consumption concepts and value concepts, will be easily ignored. In fact, if users have social relationships, they will also have an important influence on each other's food choices. That is, the existing food recommendation method has the problems of low recommendation accuracy and low user satisfaction.

[0004] Therefore, how to improve the accuracy of food recommendation and improve user satisfaction is a problem to be solved in the field. SUMMARY

[0005] The purpose of the present application is to provide a food recommendation method based on neighborhood network and role network pairing representation learning to solve the defects of the prior art. The food recommendation method based on neighborhood network and role network pairing representation learning of the present application acquires user data; constructs a neighborhood network according to the 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; thereby solving the problems of low recommendation accuracy and low user satisfaction of the existing food recommendation method.

[0006] To achieve the above object, the present application adopts the following technical solutions:

[0007] A food recommendation method based on neighborhood network and role network pairing representation learning, characterized in that it comprises the following steps:

[0008] S1, obtaining user data;

[0009] Specifically, the user data includes user interaction (v i , v j ) and user attributes x i =(x i,1 , x i,2 ,..., x i,d ), wherein (v i , v j ) indicates that user i and user j are close in geographical location and have interaction, x i is the d basic attributes of user i, including the user's gender, age, occupation, interest, birthplace;

[0010] S2, constructing a neighborhood network according to the user data;

[0011] Specifically, the neighborhood network is in the form of G n =(V, E, X), wherein V is the user node set of 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 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 according to 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, constructing a role network based on the role structure factor and the role structure mode; the role network is in the form of G r =(V, E r , X), wherein 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, to express the similarity between users u and v in roles, X = {x1, x2,..., x |V|} is a basic attribute set of nodes;

[0017] S4, input 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;

[0018] Step S4 specifically comprises the following steps:

[0019] S41, input the neighborhood network into the autonomous learning module to perform autonomous learning of the neighborhood network, to obtain the representation of the neighborhood network;

[0020] S42, input the role network into the autonomous learning module to perform autonomous learning of the role network, to obtain the representation of the role network;

[0021] S43, input the neighborhood network and the role network into the mutual learning module to perform mutual learning of the neighborhood network and the role network, to obtain the common representation shared by the two networks;

[0022] S5, optimize 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;

[0023] Step S5 specifically comprises:

[0024] S51, enhance the difference between the representation H n,k of the neighborhood network and the representation H r,k of the role network by Hilbert-Schmidt independence criterion HSIC;

[0025] S52, mutual information maximization enhances the consistency between the complementary information H n-rc,k and H r-nc,k ;

[0026] S53, determine the vector representation of the user;

[0027] S6, perform similarity calculation on the obtained user vector, and generate a food recommendation list according to the similarity result and recommend it to the user.

[0028] Further, step S3 specifically comprises:

[0029] S31, calculate the role structure factor of the network according to the neighborhood network;

[0030] Specifically, the role structure factor S f, including the degree of node, clustering coefficient and the edge relationship between its neighbor nodes; assuming node v i represents user i, v i ∈V indicates that the node is in the neighborhood network G n 's node set V; the neighbor node set of node v i is defined as N(i) = {v j |e i,j ∈E}}, wherein E is the edge set of the graph; if the role structure factor of v i is , it is calculated as follows:

[0031]

[0032] wherein k i is the degree of node v i , C i is the clustering coefficient of node v i , ec i is the number of edges between node v i and all its neighbor nodes, dc i is the sum of degrees of node v i 's neighbor nodes, ed i = ec i / dc i is the ratio of edge number and degree of node v i 's neighbor, od i = (dc i - ec i ) / dc i is the ratio of out-degree and degree of node v j 's neighbor;

[0033] The s of node v m is updated by aggregating its own m and the m of neighbor nodes v u ∈N(i), that is:

[0034]

[0035]

[0036] In this way, the role structure factor of the entire network is composed of the role structure factors of each node, that is

[0037] S32, according to the neighborhood network, analyzing the role structure pattern of the network;

[0038] calculating the role semantic information of the node through the pattern subgraph;

[0039] the pattern subgraph Ps = (V m , E m ) is a subset of m nodes in the original network G and m nodes are in the subset V m and edges composed of multiple connected subgraphs; and the pattern subgraph is composed of pattern units P u For the pattern subgraph P s = (V m , E m ), the nodes contained in V m are divided into asymmetric pattern units P u to describe the patterns possessed by the nodes in the pattern subgraph P s ;

[0040] According to the above definition, the role structure pattern of the network indicates that the node v i has the pattern unit P u , otherwise

[0041] S33, based on the role structure factor and the role structure pattern, a role network is constructed; the form of the role network is G r = (V, E r , X), wherein V is a set of user nodes, E r = {e r u,v |u, v∈V} is a set of edges of the role network, indicating that there is a role similarity between user u and user v;

[0042] Specifically, after obtaining S f and S p , the role structure coefficient and the role structure pattern of the node are spliced, and the obtained node features are processed using PCA to obtain the role features R of all nodes:

[0043]

[0044] After obtaining the role features R, the role similarity of the nodes is calculated using the cosine similarity to construct the role matrix A r ; the calculation formula of the role similarity is as follows:

[0045]

[0046] Where · represents the dot product operation, R and |R| represent the role features constructed in the front and the modulus of the role features, Sim is the role similarity matrix between nodes, and 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 v 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 , and its autonomous learning process 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 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,kThe autonomous learning process thereof is as follows: the learning process thereof also uses an autonomous learning encoder ε s (·):

[0055]

[0056] wherein ε s (·) is an autonomous learning encoder, A r is a role matrix, is a symmetric normalized Laplacian matrix of the role matrix, is a degree matrix of the Laplacian matrix W r,k is a weight parameter of the kth layer of the encoder, and σ is a nonlinear activation function, H r,0 = (A r , X), and X is attribute information of the nodes; H r,k-1 is a node representation of the neighborhood network after the k-1th layer of encoding;

[0057] S43, input the neighborhood network and the role network to a mutual learning module, and perform mutual learning of the neighborhood network and the role network to obtain a common representation shared by the two networks;

[0058] For the common representation H m,k of the two networks, a shared weight encoder ε m (·) is used to learn neighborhood-role complementary information H n-rc,k based on the neighborhood network and role-neighborhood complementary information H r-nc,k based on the role network, and the specific learning process is as follows:

[0059]

[0060]

[0061] wherein W m,k is a shared weight parameter of the GCN encoder; according to the neighborhood-role complementary information H n-rc,k and the role-neighborhood complementary information H r-nc,k , an attention mechanism is used to learn the importance thereof:

[0062] (α n ,α r )=att(H n-rc,k , H r-nc,k )

[0063] wherein α n and α r are attention coefficients of H n-rc,k and H r-bc,k , respectively, for a 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 Attention parameters 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, 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 them is used to enhance H n,k and Hr,k The difference between H and H is specifically as follows:

[0073] HISC(H n,k , H n-rc,k ) = (|V| - 1) -2 tr(RK n RK n-rc );

[0074] where K n and K n-rc are gram matrices, 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 an inner product function, where I is an identity matrix, e is a vector with all elements being 1, and tr(·) is the rank of a matrix;

[0075] For H r,k , the difference between H r,k and H r-nc,k is also enhanced by increasing the difference between H r,k and H n,k , specifically as follows:

[0076] HISC(H r,k , H r-nc,k ) = (|V| - 1) -2 tr(RK r RK r-nc );

[0077] where K r and K r-nc are gram matrices, 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 difference, 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 between them;

[0081] The mutual information of the two complementary information is maximized by using the binary cross-entropy loss for the discriminator, as follows:

[0082]

[0083]

[0084] where |V| represents the number of nodes in the network, and are the global representations of s i The k-th layer neighborhood-role complementary information and role-neighborhood complementary information obtained by mutual learning, s n-rc,k and s r-nc,k are the global representations of s and , respectively, s n-rc,k = pooling(A, H n-rc,k) , s r-nc,k = pooling(A, H r-nc,k ), where pooling() is a pooling operation, σ is a nonlinear activation function, and discriminator D(·) is the dot product between the two representation vectors, The consistency training function of the complementary information is as follows:

[0085]

[0086] where and 1 are the positive sample set, and are the negative sample set; the negative sample is obtained by randomly perturbing the attribute information X of the network nodes, i.e.,

[0087]

[0088] According to the perturbed attribute , the neighborhood network G n , the negative sample network G , and the role network G r are constructed Input them into the paired learning module to obtain the negative samples of specific representations H n,k and H r,k and the negative samples of complementary representations H n-rc,k and H r-nc,k and​​ and H collectively represent H m negative samples The specific manner is as follows:

[0089]

[0090] S53, determining the vector representation of the user;

[0091] The loss function of the pairing learning is a weighted sum of the autonomous learning objective function and the mutual learning objective function:

[0092] L = λL s + (1-λ)L m ;

[0093] Based on the above loss function, the model is trained, and after the training is completed, the vector representation of the user is:

[0094] Z = H n,k ||H n,k| |H r,k .

[0095] Further, step S6 is specifically:

[0096] After obtaining the vector representation Z of the user, the formula for calculating the similarity of the vector representation of the user is as follows:

[0097]

[0098] wherein Z i is the vector representation of the user v i in the network, Z j is the vector representation of the user v j in the network, · represents the dot product operation, |Z i | and |Z j | are the modules of the vector representations Z i and Z j respectively; Sim i,j represents the similarity of the user v i and the user v j ;

[0099] Through the similarity calculation method, the similarity of the user v i and all user nodes in the network is calculated, and the similarity vector Sim i of the final user v i and other users is obtained; according to the similarity vector, the top k users are selected in descending order, and the history gourmet of the k users is read to generate a recommendation list for the user v i .

[0100] The application further provides a food recommendation system based on neighborhood network and role network pair representation learning, which executes the food recommendation method based on neighborhood network and role network pair representation learning, and comprises 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] The user data acquisition module acquires user data.

[0102] The neighborhood network construction module constructs a neighborhood network according to the user data.

[0103] The role network construction module constructs a role network according to the neighborhood network.

[0104] The 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 neighborhood network representation, role network representation and common representation shared by the two networks.

[0105] The user vector representation determination module optimizes vector representation by enhancing the difference between neighborhood network representation and role network representation and the consistency of common representation, and obtains user vector representation.

[0106] The food recommendation module performs similarity calculation on the obtained user vector, generates a food recommendation list according to the similarity result, and recommends the food recommendation list to the user.

[0107] The application further provides a computer device, which comprises a memory and a processor, the memory stores a computer program, and the processor executes the computer program to realize the method.

[0108] Compared with the prior art, the application has the following beneficial effects:

[0109] The food recommendation method based on neighborhood network and role network pair representation learning 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 neighborhood network representation, role network representation and common representation shared by the two networks, optimizes vector representation by enhancing the difference between neighborhood network representation and role network representation and the consistency of common representation, obtains user vector representation, performs similarity calculation on the obtained user vector, generates a food recommendation list according to the similarity result, and recommends the food recommendation list to the user. The neighborhood network focuses on capturing the interaction between users, and the role network focuses on the social role attribute of the user. By analyzing the occupation and interest of the user, the application improves the accuracy of food recommendation through neighborhood network and role network pair learning, and further improves the user experience. BRIEF DESCRIPTION OF DRAWINGS

[0110] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0111] Figure 1 A food recommendation method based on neighborhood network and role network pairing representation learning provided by the embodiments of the present application is shown in the schematic diagram.

[0112] Figure 2 A model framework diagram based on neighborhood network and role network pairing representation learning provided by the embodiments of the present application is shown in the schematic diagram.

[0113] Figure 3 A food recommendation method framework diagram based on neighborhood network and role network pairing representation learning provided by the embodiments of the present application is shown in the schematic diagram.

[0114] Figure 4 A model unit and mode sub-diagram provided by the embodiments of the present application is shown in the schematic diagram.

[0115] Figure 5 An autonomous learning process diagram provided by the embodiments of the present application is shown in the schematic diagram.

[0116] Figure 6 A mutual learning process diagram provided by the embodiments of the present application is shown in the schematic diagram.

[0117] Figure 7 A food recommendation system based on neighborhood network and role network pairing representation learning provided by the embodiments of the present application is shown in the schematic diagram. DETAILED DESCRIPTION

[0118] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without any creative effort belong to the protection scope of the present application.

[0119] It should be understood that when used in the specification and the appended claims, the terms "comprise" and "include" indicate the presence of described features, integers, steps, operations, elements, and / or components, but do not exclude one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0120] The present application will be further described below with reference to the drawings and specific embodiments, but not as a limitation of the present application.

[0121] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the present invention. As used in the specification and appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms unless the context clearly indicates otherwise.

[0122] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0123] This paper proposes a food recommendation method based on paired representation learning of neighborhood network and role network. Figure 1 As shown in FIG, 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 of the food recommendation method based on the paired representation learning of the neighborhood network and the role network is shown in the figure 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 The user i has d basic attributes, including gender, age, occupation, hobbies, and birthplace. Furthermore, the user attributes also include education level, university major, and marital status.

[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 according to the neighborhood network;

[0129] Step S3 specifically comprises:

[0130] S31, calculating a role structure factor of the network according to the neighborhood network;

[0131] S32, analyzing a role structure pattern of the network according to the neighborhood network;

[0132] S33, constructing a role network based on the role structure factor and the role structure pattern; the form of the role network is G r =(V, E r , x), wherein V is a user node set, the number of users is |V|; E r ={e r u,v |u, v∈V} is an edge set of the role network, indicating that there is a similarity in roles between user u and user v, X={x1, x2,..., x |V| is a basic attribute set of the node.

[0133] Further, step S3 specifically comprises:

[0134] S31, calculating a role structure factor of the network according to the neighborhood network;

[0135] Specifically, the role structure factor S f of the entire network is calculated, including the degree of the node, the clustering coefficient, and the edge relationship with the neighbor nodes; it is assumed that node v i represents user i, v i ∈V indicates that the node is in the node set V of the neighborhood network G n ; the neighbor node set of node v i is defined as N(i)={v j |e i,j ∈E}}, wherein E is an edge set of the graph; if the role structure factor of v i is S , then it is calculated as shown below:

[0136]

[0137] wherein k i is the degree of node v i , C i is the clustering coefficient of node v i , is the number of edges of node v i and all neighbor nodes, is the sum of the degrees of the neighbor nodes of node v i , and 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 neighbor's out-degree to its in-degree;

[0138] Node v i of Updates are made by the aggregate itself and neighbor node v j ∈N(i) Implementation, 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 pattern 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 the edge The pattern subgraph consists of multiple connected subgraphs; and the pattern subgraph consists of pattern units P u Composition, such as Figure 4 As shown, for the 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 patterns in

[0145] According to the above definition, the role structure model of the network Indicates that node v i With pattern unit P u ,otherwise

[0146] S33, constructing a role network based on the role structure factors and the role structure model; the role network is in the form of G r =(V, E r , X), where V is the set of user nodes, 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;

[0147] Specifically, get the node's S f and S p Finally, the role structure coefficients and role structure patterns of the nodes are spliced ​​together, and PCA is used to process the obtained 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 nodes v i Similar role nodes, that is, for the role matrix like Description point v 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, input 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; wherein the autonomous learning process is as shown in Figure 5 , and the mutual learning process is as shown in Figure 6 .

[0154] Step S4 specifically includes the following steps:

[0155] S41, input the neighborhood network into the autonomous learning module to perform autonomous learning of the neighborhood network, and obtain a representation of the neighborhood network;

[0156] S42, input the role network into the autonomous learning module to perform autonomous learning of the role network, and obtain a representation of the role network;

[0157] S43, input the neighborhood network and the role network into the mutual learning module to perform mutual learning of the neighborhood network and the role network, and obtain a common representation shared by the two networks.

[0158] Further, step S4 specifically includes the following steps:

[0159] S41, input the neighborhood network into the autonomous learning module to perform autonomous learning of the neighborhood network, and obtain a representation of the neighborhood network;

[0160] Specifically, for the representation H n,k of the neighborhood network, the autonomous learning process is as follows:

[0161]

[0162] wherein ε s (·) is an autonomous learning encoder, A is a neighborhood matrix, is a symmetric normalized Laplacian matrix of the neighborhood matrix, is a degree matrix of the Laplacian matrix , H n,k is a node representation of the neighborhood network after k-layer encoding; when the number of layers is 0, H n,0 = (A, X), wherein X is attribute information of the node, W n,k is a weight parameter of the k-th layer of the encoder, and σ is a nonlinear activation function; H n,k-1 is a node representation of the neighborhood network after k-1-layer encoding;

[0163] S42, input the role network into the autonomous learning module to perform autonomous learning of the role network, and obtain a representation of the role network;

[0164] For the representation Hr,k The autonomous learning process thereof is as follows: the learning process thereof also uses an autonomous learning encoder ε s (·) :

[0165]

[0166] wherein ε s (·) is an autonomous learning encoder, A r is a role matrix, is a symmetric normalized Laplacian matrix of the role matrix, is a degree matrix of the Laplacian matrix , W r,k is a weight parameter of the kth layer of the encoder, and σ is a nonlinear activation function, H r,0 = (A r , X), and X is attribute information of the node; H r,k-1 is a node representation of the neighborhood network after the k-1th layer of encoding;

[0167] S43, inputting the neighborhood network and the role network to a mutual learning module to perform mutual learning of the neighborhood network and the role network, and obtaining a common representation shared by the two networks;

[0168] For the common representation H m,k of the two networks, a shared weight encoder ε m (·) learns neighborhood-role complementary information H n-rc,k based on the neighborhood network and role-neighborhood complementary information H r-nc,k based on the role network, and the specific learning process is as shown below:

[0169]

[0170] wherein W m,k is a shared weight parameter of the GCN encoder; according to the neighborhood-role complementary information H n-rc,k and the role-neighborhood complementary information H r-nc,k , an attention mechanism is used to learn the importance thereof:

[0171] (α n , α r ) = att (H n-rc,k , H r-nc,k )

[0172] wherein α n and α r are attention coefficients of H n-m,k and H r-nc,k , respectively, and the neighborhood-role complementary information representation of the node v i is and node v i Role-neighbor complementary information representation Need to first make nonlinear transformation to and Then use a shared attention vector q to obtain the attention parameters of and and

[0173]

[0174] Where W att is the weight matrix of attention, and b is the bias vector; then use the softmax function to normalize the attention score to obtain the attention weight of and the attention weight of r-nc,k h

[0175]

[0176]

[0177] Under mutual learning, the attention weight vectors of the complementary information of the nodes are respectively and At this time, 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 the first layer to the kth layer, until the final kth layer network learning is completed, the final common information H m,k , neighborhood-role complementary information h n-rc,k and role-neighbor complementary information h r -nc,k are obtained.

[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, by Hilbert-Schmidt independence criterion HSIC, the difference between the representation H n,k of the neighborhood network and the representation H r,k of the role network is enhanced;​​

[0183] S52, mutual information maximization enhances the complementarity H n-rc,k and H r-nc,k between them;

[0184] S53, determine the vector representation of the user.

[0185] Further, step S5 specifically includes:

[0186] S51, enhance the representation H of the neighborhood network by Hilbert-Schmidt independence criterion HSIC n,k and the representation H of the role network r,k between them;

[0187] The difference between H n,k and H r,k is large, while the difference between H n,k and H n-rc,k is small, so by increasing the difference between H n,k and H n-rc,k , the difference between H n,k and H r,k is enhanced.

[0188] By increasing the difference between H n,k and H n-rc,k , the difference between H n,k and H r,k is enhanced, specifically as follows:

[0189] HISC(H n,k , H n-rc,k ) = (|V| - 1) -2 tr(RK n RK n-rc );

[0190] where K n and K n-rc are gram matrices, 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 an inner product function, where I is the identity matrix, e is a vector with all 1s, and tr(·) is the rank of the matrix;

[0191] For H r,k , the difference between H r,k and H r-nc,k is also enhanced by increasing the difference between Hr,k and H n, The difference between k and H

[0192] HISC(H r,k , H r-nc,k ) = (|V| - 1) -2 tr(RK r RK r-nc );

[0193] where K r and K r-nc are gram matrices, 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 difference, the difference 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 the consistency of complementary information H n-rc,k and H r-nc,k ;

[0197] In order to enhance the consistency of H n-rc,k and H r-nc,k , the binary cross entropy loss for the discriminator is used 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, which is as follows:

[0199]

[0200]

[0201] where |V| represents the number of nodes in the network, and are the kth layer neighborhood-role complementary information and role-neighborhood complementary information obtained by mutual learning, respectively, s i and s n-rc,k are the kth layer neighborhood-role complementary information and role-neighborhood complementary information obtained by mutual learning, respectively, s r-nc,k and s are the kth layer neighborhood-role complementary information and role-neighborhood complementary information obtained by mutual learning, respectively, s The global representation of , σ is a 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, namely:

[0204]

[0205] According to the perturbed properties And build a neighborhood network G n Negative sample network and character 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 jointly 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 training, the user's vector is represented as:

[0211] Z=H n,k ||H m,k ||H r,k .

[0212] The method first abstracts the user and 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 edge represents the interaction between users; the role network represents the role, and the edge represents the role similarity between users, such as users living in the same area. The basic steps are, first, according to the user data, construct a neighborhood network, then according to the edge condition of the network node and the neighbor node, and the structure subgraph contained in the network node, analyze the role of the user node, construct the role network, and design the pairing learning method, let the neighborhood network and the role network pair learning, get the specific representation of the network and the common representation shared by the network, and aggregate to get the final user node representation.

[0213] S6, similarity calculation is performed on the obtained user vector, and a food recommendation list is generated according to the similarity result and recommended to the user; specifically:

[0214] After obtaining the vector representation Z of the user, the formula for calculating the similarity of the user vector representation is as follows:

[0215]

[0216] Where Z i is the vector representation of user v i in the network, Z j is the vector representation of user v j in the network, · represents the dot product operation, |Z i | and |Z j | are the modules of vector representations Z i and Z j respectively; Sim i,j represents the similarity between user v i and user v j ;

[0217] Through the similarity calculation method, the similarity between user v i and all user nodes in the network is calculated, and the final similarity vector Sim i between user v i and other users is obtained; according to the similarity vector, the top k users are selected in descending order, and the historical food of the k users is read to generate a recommendation list for user v i .

[0218] Specifically, users with similar neighborhood and role information will be represented as similar vectors, that is, users with similar preferences can be considered to generate a food recommendation list with similar content.

[0219] The application provides a food recommendation method based on neighborhood network and role network pairing, which combines neighborhood information and role information dimensions and applies them to food recommendation. Specifically, according to original user data, a neighborhood network and a role network are constructed. The neighborhood network focuses on capturing the interaction between users, that is, users with close geographical positions and interactions will establish connections in the graph. The role network focuses on the social role attributes of users, and the relationship between nodes is constructed by analyzing the user's occupation, interest, interaction with other users and the like. Then, the neighborhood network and the role network are paired learning. The specific representation learned autonomously is used to capture the unique information of the nodes in each network, such as the user's food preference in ordinary social relationship. The common representation learned by mutual learning emphasizes the consistency features across networks, such as the common food tendency that different social roles may show. Finally, the similarity is calculated according to the generated user network representation, and similar food is recommended for similar users.

[0220] Figure 7 A food recommendation system based on neighborhood network and role network pairing representation learning is provided by the embodiment of the application. As shown in the figure, Figure 7 The food recommendation system based on neighborhood network and role network pairing 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] The user data acquisition module acquires user data.

[0222] The neighborhood network construction module constructs a neighborhood network according to the user data.

[0223] The role network construction module constructs a role network according to the neighborhood network.

[0224] The network representation acquisition module 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.

[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, and obtains the vector representation of the user.

[0226] The food recommendation module performs similarity calculation on the obtained user vector, generates a food recommendation list according to the similarity result, and recommends it to the user.

[0227] The food recommendation system based on neighborhood network and role network pairing representation learning can be realized in the form of a computer program, which can run on a computer device.

[0228] The computer device comprises a processor, a memory and a network interface connected through a system bus, wherein the memory can comprise 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 comprises program instructions which, when executed, can cause the processor to perform a food recommendation method based on neighborhood network and role network pair representation learning.

[0230] The processor is configured to provide computing and control capabilities to support the operation of the entire computer device.

[0231] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium, which, when executed by the processor, can cause the processor to perform a food recommendation method based on neighborhood network and role network pair representation learning.

[0232] The network interface is configured to perform network communication with other devices. Those skilled in the art can understand that the above computer device structure is only part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can comprise more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.

[0233] The processor is configured to run a computer program stored in the memory, which program implements the food recommendation method based on neighborhood network and role network pair representation learning of the first embodiment.

[0234] It should be understood that, in the embodiments of the present application, the processor can be a central processing unit (CPU), and the processor can 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. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0235] Those skilled in the art can understand that all or part of the processes in the method of the above-mentioned embodiments can be completed by instructing the relevant hardware by 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 realize the process steps of the above-mentioned embodiment of the method.

[0236] The application further provides a storage medium. The storage medium can be a computer readable storage medium. The storage medium stores a computer program, wherein the computer program is executed by a processor to make the processor execute the method for food recommendation based on neighborhood network and role network pair representation learning according to the first embodiment.

[0237] The storage medium can be a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk, and various computer readable storage media that can store program codes.

[0238] Those skilled in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been described in general in the above description. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the application.

[0239] The steps in the method of the embodiments of the application can be adjusted, combined and deleted in sequence according to actual needs. The units in the device of the embodiments of the application can be combined, divided and deleted according to actual needs. In addition, each functional unit in each embodiment of the application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0240] The integrated unit, if realized in the form of a software functional unit and sold or used as an independent product, can be stored in a storage medium. Based on such understanding, the technical solutions of the application essentially or the parts that make contributions to the prior art, or all or part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a terminal or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the application.

[0241] Note that the above merely describes preferred embodiments of the present application and the principles of the technology applied. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, modifications and substitutions can be made to the present application without departing from the scope of the present application. Therefore, although the present application has been described in detail through the above embodiments, the present application is not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.

Claims

1. A food recommendation method based on paired representation learning of neighborhood network and role network, characterized in that: Including 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 a role structure factor of the network based on the neighborhood network; S32. Analyzing the role structure pattern of the network according to the neighborhood network; S33, constructing a role network based on the role structure factors and the role structure model; the role network is in the form of G r =(V, E r , X), where V is the set of user nodes 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 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; 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 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 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. Calculate the similarity of the obtained user vectors, 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 a role structure factor of the network based on 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 the 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 neighboring 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 neighbor's out-degree to its in-degree; Node v i of Updates are made by the aggregate itself and neighbor node v j ∈N(i) Implementation, 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 pattern 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 the edge The pattern subgraph consists of multiple connected subgraphs; and the pattern subgraph consists 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 patterns in According to the above definition, the role structure model of the network Indicates that node v i With pattern unit P u ,otherwise S33, constructing a role network based on the role structure factors and the role structure model; the role network is in the form of G r =(V, E r , X), where V is the set of user nodes, 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; Specifically, get the node's S f and S p Finally, the role structure coefficients and role structure patterns of the nodes are spliced ​​together, and PCA is used to process the obtained 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 v 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 , and its autonomous learning process 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 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 , its autonomous learning process is as follows: Its 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 neighborhood-role complementary information H based on 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 Attention parameters 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, 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, wherein 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 differences between By increasing H n,k and H n-rc,k The difference between them is used to enhance H 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 A binary cross entropy loss is used for the discriminator to maximize the mutual information of the two complementary information as follows: Where |V| represents the number of nodes in the network, and Node 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 s 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, namely: According to the perturbed properties And build a neighborhood network G n Negative sample network and character 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 jointly 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 training, the user's vector is represented as: Z=H n,k ||H m,k| |H r,k 。 5. The method according to claim 1, wherein Step S6 is specifically as follows: After obtaining the user's vector representation Z, the formula for calculating the user's vector representation similarity 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 Indicates 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 networks and role networks, characterized by: The food recommendation system implements the food recommendation method based on paired representation learning of neighborhood networks and role networks 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, acquires user data; A neighborhood network construction module, which constructs a neighborhood network based on the user data; A role network construction module, which constructs a role network based on the neighborhood network; A network representation acquisition module inputs 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; 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 includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the method according to any one of claims 1 to 5 when executing the computer program.

Citation Information

Patent Citations

  • Media content recommendation method, system and equipment based on dynamic network representation learning

    CN117312651A

  • Social recommendation method based on collaborative heterogeneous information network

    CN118410236A