Model training method, project recommendation method, device, equipment, medium and product
By combining the information of binary graph samples and knowledge graph samples in project recommendation model training for comparative learning, the problem of insufficient comprehensive features in the existing technology is solved, the accuracy of project recommendation is improved, and user needs are met.
Patent Information
- Application Number
- CN202411178149.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-17
AI Technical Summary
The existing project recommendation model learns the characteristics of the training process, which leads to the inaccurate enough recommendation projects and cannot meet user needs.
During the training process of project recommendation model, the information of binary graph samples and knowledge graph samples is combined for comparison and learning. By obtaining multiple training samples, including binary graph samples and knowledge graph samples, feature extraction and comparison learning are performed, and model parameters are adjusted. Until the training stop condition is met.
By taking into account the information of bipartite graph samples and knowledge graph samples, the characteristics of the project recommendation model are more comprehensive, the accuracy of the recommended project is improved, and user needs can be better met.
Smart Images

Figure CN119150022A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of artificial intelligence technology, and in particular relates to a model training method, a project recommendation method, a device, equipment, a medium and a product. Background Art
[0002] In order to recommend items that better meet user needs, an item recommendation model is usually used to predict the items recommended to users.
[0003] However, the features learned by the item recommendation model used in the related art during the training process are not comprehensive enough, resulting in the recommended items being inaccurate and unable to meet user needs. Summary of the invention
[0004] The embodiments of the present application provide a model training method, a project recommendation method, an apparatus, a device, a medium and a product, which can take into account the information of two views, namely, bipartite graph samples and knowledge graph samples, during the process of training the project recommendation model, so that the features learned by the project recommendation model during the training process are more comprehensive, thereby making the trained project recommendation model more accurate and the predicted recommended projects better able to meet user needs.
[0005] In a first aspect, an embodiment of the present application provides a model training method, the method comprising:
[0006] Acquire multiple training samples, the training samples include bipartite graph samples and knowledge graph samples, the first node in the bipartite graph sample is user information, the second node in the bipartite graph sample is project information, the first edge in the bipartite graph sample represents the relationship between the two nodes connected by the first edge, the third node in the knowledge graph sample is user information, the fourth node in the knowledge graph sample is project information, and the second edge in the knowledge graph sample represents the relationship between the two nodes connected by the second edge;
[0007] For each of the multiple training samples, perform the following steps respectively:
[0008] Input the training sample into a preset project recommendation model, extract features from the bipartite graph sample through the project recommendation model to obtain a first feature vector, and extract features from the knowledge graph sample through the project recommendation model to obtain a second feature vector;
[0009] By using the item recommendation model, the first eigenvector and the second eigenvector are compared and learned to obtain a first loss function value;
[0010] When the training stop condition is not met, the model parameters of the item recommendation model are adjusted based on the first loss function value, and the item recommendation model with adjusted parameters is trained using multiple training samples until the training stop condition is met to obtain a trained item recommendation model.
[0011] Therefore, by taking bipartite graph samples and knowledge graph samples as training samples and performing comparative learning on the first eigenvector of the bipartite graph samples and the second eigenvector of the knowledge graph samples, it is possible to take into account the information of both the bipartite graph samples and the knowledge graph samples during the training of the project recommendation model, so that the features learned by the project recommendation model during the training process are more comprehensive, thereby making the trained project recommendation model more accurate and the predicted recommended projects more able to meet user needs.
[0012] In a second aspect, an embodiment of the present application provides a project recommendation method, the method comprising:
[0013] Acquire first user information of a first user and first project information of a first project;
[0014] The project recommendation model predicts the relationship between the first user and the first project based on the first user information and the first project information, and determines the target project recommended for the first user from the first project based on the relationship between the first user and the first project. The project recommendation model is trained by the model training method of any one of claims 1-6.
[0015] Therefore, since the information of both the bipartite graph samples and the knowledge graph samples is taken into account during the training of the project recommendation model, the features learned by the project recommendation model during the training process are more comprehensive, and the trained project recommendation model is more accurate. Therefore, the target project recommended for the first user predicted by the project recommendation model is more accurate and can better meet user needs.
[0016] In a third aspect, an embodiment of the present application provides a model training device, the device comprising:
[0017] A first acquisition module is used to acquire multiple training samples, the training samples include bipartite graph samples and knowledge graph samples, the first node in the bipartite graph sample is user information, the second node in the bipartite graph sample is project information, the first edge in the bipartite graph sample represents the relationship between the two nodes connected by the first edge, the third node in the knowledge graph sample is user information, the fourth node in the knowledge graph sample is project information, and the second edge in the knowledge graph sample represents the relationship between the two nodes connected by the second edge;
[0018] The model training module is used to perform the following steps for each training sample in the multiple training samples:
[0019] Input the training sample into a preset project recommendation model, extract features from the bipartite graph sample through the project recommendation model to obtain a first feature vector, and extract features from the knowledge graph sample through the project recommendation model to obtain a second feature vector;
[0020] By using the item recommendation model, the first eigenvector and the second eigenvector are compared and learned to obtain a first loss function value;
[0021] When the training stop condition is not met, the model parameters of the item recommendation model are adjusted based on the first loss function value, and the item recommendation model with adjusted parameters is trained using multiple training samples until the training stop condition is met to obtain a trained item recommendation model.
[0022] In a fourth aspect, an embodiment of the present application provides a project recommendation device, the device comprising:
[0023] A second acquisition module, used to acquire first user information of a first user and first project information of a first project;
[0024] A recommended project determination module is used to predict the relationship between the first user and the first project based on the first user information and the first project information through a project recommendation model, and determine a target project recommended for the first user from the first project based on the relationship between the first user and the first project. The project recommendation model is trained by the model training method of any one of claims 1-6.
[0025] In a fifth aspect, an embodiment of the present application provides an electronic device, the device comprising: a processor and a memory storing computer program instructions;
[0026] When the processor executes the computer program instructions, it implements the model training method as shown in any one of the embodiments of the first aspect and / or the item recommendation method as shown in any one of the embodiments of the second aspect.
[0027] In a sixth aspect, an embodiment of the present application provides a computer storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the model training method shown in any one of the embodiments of the first aspect and / or the project recommendation method shown in any one of the embodiments of the second aspect.
[0028] In the seventh aspect, an embodiment of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the model training method shown in any one of the embodiments of the first aspect and / or the item recommendation method shown in any one of the embodiments of the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0030] Figure 1 is a flow chart of a model training method provided by an embodiment of the present application;
[0031] Figure 2 is a schematic diagram of a vector generator provided by an embodiment of the present application;
[0032] Figure 3 is a schematic diagram of a subgraph generator provided by an embodiment of the present application;
[0033] Figure 4 It is a structural diagram of a project recommendation model provided by an embodiment of the present application;
[0034] Figure 5 is a flow chart of a project recommendation method provided by an embodiment of the present application;
[0035] Figure 6 It is a structural schematic diagram of a model training device provided by an embodiment of the present application;
[0036] Figure 7 It is a structural schematic diagram of a project recommendation device provided by an embodiment of the present application;
[0037] Figure 8 It is a structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0038] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0039] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0040] The following is an introduction to the model training method, project recommendation method, device, equipment, medium and product provided in the embodiments of the present application.
[0041] Figure 1 A flow chart of a model training method provided by an embodiment of the present application is shown. It should be noted that the execution subject of the model training method may be a model training device, such as Figure 1 As shown, the model training method may include the following steps:
[0042] S110, obtaining multiple training samples;
[0043] S120: for each training sample in the plurality of training samples, perform the following steps respectively:
[0044] Input the training sample into a preset project recommendation model, extract features from the bipartite graph sample through the project recommendation model to obtain a first feature vector, and extract features from the knowledge graph sample through the project recommendation model to obtain a second feature vector;
[0045] By using the item recommendation model, the first eigenvector and the second eigenvector are compared and learned to obtain a first loss function value;
[0046] When the training stop condition is not met, the model parameters of the item recommendation model are adjusted based on the first loss function value, and the item recommendation model with adjusted parameters is trained using multiple training samples until the training stop condition is met to obtain a trained item recommendation model.
[0047] Therefore, by taking bipartite graph samples and knowledge graph samples as training samples and performing comparative learning on the first eigenvector of the bipartite graph samples and the second eigenvector of the knowledge graph samples, it is possible to take into account the information of both the bipartite graph samples and the knowledge graph samples during the training of the project recommendation model, so that the features learned by the project recommendation model during the training process are more comprehensive, thereby making the trained project recommendation model more accurate and the predicted recommended projects more able to meet user needs.
[0048] In relation to S110, the training samples may include bipartite graph samples and knowledge graph samples.
[0049] The first node in the bipartite graph sample may be user information, the second node in the bipartite graph sample may be project information, the first edge in the bipartite graph sample may represent the relationship between two nodes connected by the first edge, and the first edge may be any edge in the bipartite graph sample.
[0050] The third node in the knowledge graph sample may be user information, the fourth node in the knowledge graph sample may be project information, and the second edge in the knowledge graph sample may represent the relationship between two nodes connected by the second edge. The second edge may be any edge in the knowledge graph sample.
[0051] For example, a bipartite graph sample G can be constructed based on historical user information, project information, and the relationship between users and projects. b ={(u,y uv ,v)}, where u∈U, v∈V represent users and projects respectively, U and V are user sets and project sets respectively, where users can carry user information, projects can carry project information, and y uv is a binary value that can be used to record the relationship between users and items. This relationship can represent whether there is interaction between users and items. If there is interaction between user u and item v, then y uv =1, otherwise y uv = 0. For example, the interaction may include consumption, ordering, etc.
[0052] You can also build a knowledge graph sample G based on historical user information, project information, and the relationship between users and projects. k ={(h,r,t)}, where each triple (h,r,t) can describe the existence of a relationship r∈R from the head entity h∈I to the tail entity t∈I, where I and R represent the entity set and relationship set in the knowledge graph, respectively. Entities can include users and items, and relationships can represent whether there is interaction between users and items.
[0053] A knowledge graph is a graph structure that represents entities and relationships between them. It can be used to represent knowledge and semantic information in a domain. Knowledge graphs can be combined with graph neural networks to enhance the performance of recommendation systems. Knowledge graph embedding can be combined with user behavior data to better understand the relationship between user interests and recommended items.
[0054] In S120, the training stop condition may be that the loss function value is less than a first threshold value, or the number of training times reaches a second threshold value. The loss function value may be a first loss function value, or may be a total loss function value described below.
[0055] Contrastive learning is an unsupervised or self-supervised machine learning method that aims to learn data representation. The basic principle of contrastive learning is to learn meaningful feature representations by maximizing the similarity between positive samples while minimizing the similarity between negative samples. This can help the model capture key features in the data, making similar samples closer in the representation space and dissimilar samples farther away.
[0056] In the related art, when training a model, the information of the bipartite graph will dominate the training of the model, so the information of the knowledge graph will hardly be encoded in the feature representation of the item to be learned; while in the embodiment of the present application, based on the joint modeling of the bipartite graph samples and the knowledge graph samples and the use of a comparative learning method, while utilizing the information of the bipartite graph samples, it also makes full use of the valuable information in the knowledge graph samples to obtain optimized node embeddings of users and items, which can achieve more accurate recommendations.
[0057] Bipartite graph samples usually contain a lot of information that is irrelevant to recommendation, and such noise will be amplified in the message aggregation process of the graph neural network. Therefore, in some embodiments, in order to remove the noise in the bipartite graph samples, the project recommendation model may include a first subgraph generator and a first vector generator. The above-mentioned feature extraction of the bipartite graph samples by the project recommendation model to obtain the first feature vector may include:
[0058] Splitting the bipartite graph sample by a first subgraph generator to obtain a plurality of bipartite graph subgraphs, and determining a target bipartite graph subgraph from the plurality of bipartite graph subgraphs based on a first preset rule;
[0059] The first vector generator is used to extract features from the target bipartite graph subgraph to obtain a first feature vector.
[0060] Here, the target bipartite graph subgraph may be an optimal subgraph among multiple bipartite graph subgraphs.
[0061] The first subgraph generator may include a graph corruption mechanism and an optimal subgraph selection mechanism.
[0062] Specifically, graph corruption can randomly remove a portion of edges from the bipartite graph sample at a certain ratio during each iteration to obtain a series of bipartite graph subgraphs. Then, the optimal subgraph selection mechanism can select a bipartite graph subgraph that performs best on a specific evaluation indicator as the target bipartite graph subgraph based on the performance of the bipartite graph subgraph during the training process.
[0063] The specific evaluation index may be accuracy Accuray, and the calculation formula may be:
[0064]
[0065] Among them, TP is the true example that there is a relationship between the predicted nodes, TN is the true negative example, and Total is the number of all sample pairs.
[0066] The first preset rule may be to determine the subgraph with the highest accuracy from among multiple bipartite graph subgraphs as the target bipartite graph subgraph.
[0067] like Figure 2 As shown, the first vector generator may include multiple network layers 210 , each of which may include a GAT network 211 and a GraphSAGE layer 212 .
[0068] The GAT network can be a graph neural network that can be used to process graph data, especially node classification and graph classification tasks. The principle of GAT is based on the idea of self-attention mechanism and convolutional neural network, which can effectively capture the relationship and characteristics between nodes in graph data. The core of GAT is the self-attention mechanism. For each node, GAT can calculate the correlation score with other nodes to determine which nodes are more important to the current node. This correlation score can be calculated by learnable weight parameters. The calculated correlation score is used to weight the feature vectors of other nodes, and then these weighted feature vectors are added to generate a new feature representation of the current node. Finally, the new feature representations of all nodes are input into an output layer for performing specific tasks.
[0069] Specifically, the first vector generator can use the graph attention mechanism of the GAT network to update the node features, and use the GraphSAGE layer to update the node features, and finally complete the output of the node feature vector (that is, the first feature vector) by superimposing multiple layers of this structure.
[0070] For example, for one of the network layers, the linear combination of node neighbor features can be calculated by the GAT network, and the calculation formula can be as follows:
[0071]
[0072] in, is the linear combination of the neighbor features of node i, N i is the set of neighbor nodes of node i, h j is the feature of node j, α ij represents the attention score between node i and node j.
[0073] α ij The calculation formula can be as follows:
[0074]
[0075] Among them, W b is the weight parameter matrix, || represents the link operation, LeakyReLU is the activation function, h i is the feature of node i, h k is the feature of node k, is the corresponding attention score.
[0076] Then, the features of the nodes can be updated through the GraphSAGE layer, using concat to represent the concatenation process of the parameters. The specific update process is as follows:
[0077]
[0078] in, is the feature of node i in the l+1 layer, W is the weight parameter matrix, is the feature of node i in layer l, It is the feature after all neighbors of node i in the l+1th node are aggregated.
[0079] In this way, the noise in the bipartite graph samples can be removed through the above process, thereby improving the recommendation efficiency and accuracy of the item recommendation model.
[0080] Knowledge graph samples usually also contain a lot of information that is irrelevant to recommendation, and this noise will be amplified during the message aggregation process of the graph neural network. Therefore, in some embodiments, in order to remove the noise in the knowledge graph samples, the project recommendation model may include a second subgraph generator and a second vector generator. The above-mentioned feature extraction of the knowledge graph samples by the project recommendation model to obtain the second feature vector may include:
[0081] Splitting the knowledge graph sample by a second subgraph generator to obtain a plurality of knowledge graph subgraphs, and determining a target knowledge graph subgraph from the plurality of knowledge graph subgraphs based on a second preset rule;
[0082] The second vector generator is used to extract features from the target knowledge graph subgraph to obtain a second feature vector.
[0083] Here, the target knowledge graph subgraph may be the optimal subgraph among multiple knowledge graph subgraphs.
[0084] The second subgraph generator may include graph corruption and optimal subgraph selection mechanisms.
[0085] Specifically, graph corruption can randomly remove a portion of edges from the knowledge graph sample at a certain ratio during each iteration to obtain a series of knowledge graph subgraphs. Then, the optimal subgraph selection mechanism can select a knowledge graph subgraph that performs best on a specific evaluation indicator as the target knowledge graph subgraph based on the performance of the knowledge graph subgraph during the training process.
[0086] The specific evaluation index may be accuracy, and the calculation formula may refer to the above embodiment, which will not be described in detail here.
[0087] The second preset rule may be to determine the knowledge graph subgraph with the highest accuracy from multiple knowledge graph subgraphs as the target knowledge graph subgraph.
[0088] The structure and function of the second vector generator may be the same as those of the first vector generator, and will not be described in detail herein.
[0089] In this way, the above process can remove the noise in the knowledge graph samples and improve the recommendation efficiency and accuracy of the project recommendation model.
[0090] In some implementations, the first feature vector and the second feature vector are compared and learned by the item recommendation model to obtain a first loss function value. The specific process may be:
[0091] Input the first eigenvector and the second eigenvector into the corresponding multilayer perceptron (MLP), and map the first eigenvector and the second eigenvector to the same feature space to obtain In the contrastive learning module, the same entity is used as a positive sample pair Take the real random example v and the random instance j as negative sample pairs The contrastive learning module can calculate the first loss function value l1 by the following formula:
[0092]
[0093] Where N is the negative sample set, which can include multiple negative sample pairs, s(.) represents the cosine similarity measure, and exp(x) is an exponential function that returns e to the power of x, i.e., e x , log(x) is a logarithmic function, which represents the natural logarithm with base e.
[0094] In some implementations, in order to improve the accuracy of the item recommendation model, the item recommendation model may further include a third vector generator, a connection layer, and a fourth vector generator. Before adjusting the model parameters of the item recommendation model based on the first loss function value, the method may further include:
[0095] Perform feature extraction on the bipartite graph sample by using a third vector generator to obtain a third feature vector;
[0096] The first eigenvector, the second eigenvector and the third eigenvector are connected through a connection layer to obtain a comprehensive eigenvector;
[0097] Extracting features from the comprehensive feature vector by a fourth vector generator to obtain a target feature vector;
[0098] Determining a second loss function value based on the target feature vector;
[0099] Determining a total loss function value based on the first loss function value and the second loss function value;
[0100] Based on this, the above-mentioned adjustment of the model parameters of the item recommendation model based on the first loss function value may include:
[0101] The model parameters of the item recommendation model are adjusted based on the total loss function value.
[0102] Here, the structure and function of the third vector generator may be the same as those of the first vector generator, and will not be described in detail herein.
[0103] Then, the first eigenvector h of the target bipartite graph subgraph can be b , the second eigenvector h of the target knowledge graph subgraph s and the third eigenvector h of the bipartite graph sample k The connections are made to obtain a comprehensive feature vector, and then the final target feature vector is obtained by passing it through a fourth vector generator composed of a multi-layer graph neural network (GNN).
[0104] Exemplarily, the comprehensive feature vector h can be expressed as:
[0105] h=h b ||h s ||h k
[0106] For example, the feature representation of node i by the l-th layer GNN is The calculation can be as follows:
[0107]
[0108] Among them, σ is the Sigmoid activation function, is the feature of node i at layer l-1, w (l) is the weight parameter of the lth layer.
[0109] After obtaining the final target feature vector, it can be used for recommendation. For user u and item v, the inner product of the vector To evaluate user u’s preference for item v.
[0110] The second loss function value may be the value of the BPR loss function, and the second loss function value may be determined based on the target feature vector and the random negative sample. The calculation formula of the second loss function value l2 may be:
[0111] l2=-logσ(y(u,v + )-y(u,v - ))
[0112] Among them, (u,v + ) is a positive sample, that is, the target feature vector, (u,v - ) is a random negative sample, and σ is the Sigmoid activation function.
[0113] The calculation formula of the total loss function value can be:
[0114] l=λl1+l2
[0115] Among them, λ is a balancing hyperparameter.
[0116] In this way, by adding the third eigenvector of the bipartite graph sample in the training process of the item recommendation model, the accuracy of the model training can be improved, thereby improving the accuracy of the trained item recommendation model.
[0117] In some implementations, in order to more accurately remove noise from a bipartite graph sample, splitting the bipartite graph sample to obtain a plurality of bipartite graph subgraphs may include:
[0118] For each first edge in the bipartite graph sample, determining a first parameter of the first edge based on feature vectors of two nodes connected by the first edge;
[0119] The edges whose first parameters are less than a first preset threshold value among the plurality of first edges included in the bipartite graph sample are removed to obtain a plurality of bipartite graph subgraphs.
[0120] Here, the first parameter may be positively correlated with the importance of the first edge.
[0121] The first preset threshold can be set according to actual needs.
[0122] If the first parameter of an edge in the bipartite graph sample is less than the first preset threshold, it can be indicated that the importance of the edge is low and can be removed. If the first parameter of an edge in the bipartite graph sample is greater than or equal to the first preset threshold, it can be indicated that the importance of the edge is high and should be retained.
[0123] For example, the first parameter The calculation formula can be:
[0124]
[0125] in, is the feature vector of the node corresponding to the user, is the feature vector of the node corresponding to the project, || is the connection symbol, indicating that the two feature vectors are connected first, MLP b It is a shallow perceptron.
[0126] For example, Figure 3 As shown, the first subgraph generator may include a splicing layer 310 and a multi-layer perceptron 320. The splicing layer 310 may be used to splice the feature vectors of two nodes connected by the first edge to obtain a first spliced feature vector. The multi-layer perceptron 320 may be used to calculate the first parameter based on the first spliced feature vector, and the edges whose first parameters are less than a first preset threshold are removed, while the edges whose first parameters are greater than or equal to the first preset threshold are retained.
[0127] In this way, the edges with lower importance in the bipartite graph samples can be removed through the above process, thereby accurately removing the noise in the bipartite graph samples.
[0128] In some implementations, in order to more accurately remove noise from a knowledge graph sample, the above splitting of the knowledge graph sample to obtain multiple knowledge graph subgraphs may include:
[0129] For each second edge in the knowledge graph sample, determine a second parameter of the second edge based on feature vectors of two nodes connected by the second edge;
[0130] Remove the edges whose second parameters are less than the second preset threshold from the multiple second edges included in the knowledge graph sample to obtain multiple knowledge graph subgraphs.
[0131] Here, the second parameter may be positively correlated with the importance of the second edge.
[0132] The second preset threshold can be set according to actual needs.
[0133] If the second parameter of an edge in the knowledge graph sample is less than the second preset threshold, it can be indicated that the importance of the edge is low and can be removed. If the second parameter of an edge in the knowledge graph sample is greater than or equal to the second preset threshold, it can be indicated that the importance of the edge is high and should be retained.
[0134] For example, the second parameter The calculation formula can be:
[0135]
[0136] in, Represents the feature vector of the node corresponding to the user, The feature vector representing the node corresponding to the item, is the transformation matrix of the relationship between users and items.
[0137] Exemplarily, the structure and function of the second sub-image generator may be the same as those of the first sub-image generator, and will not be described in detail here.
[0138] In this way, the above process can remove the edges with lower importance in the knowledge graph samples, thereby accurately removing the noise in the knowledge graph samples.
[0139] In some embodiments, Figure 4 As shown, the item recommendation model may include a first subgraph generator 401 , a second subgraph generator 402 , a first vector generator 403 , a second vector generator 404 , a third vector generator 405 and a fourth vector generator 406 .
[0140] The specific functions of each part can be found in the above embodiments and will not be described again here.
[0141] In the embodiment of the present application, comparative learning can be performed based on the two views of the bipartite graph sample and the knowledge graph sample, so as to optimize the node representation by taking into account the information of the two views; in addition, in the embodiment of the present application, the MLP is used to calculate the parameters representing the importance of the edge to decide whether to remove the edge, thereby reducing randomness. Moreover, in the embodiment of the present application, the graph attention network is used not only on the knowledge graph sample, but also on the bipartite graph sample, which effectively integrates multi-source information, provides a more comprehensive representation learning, effectively captures the complex relationship between users and projects, and provides personalized recommendation results; in addition, the embodiment of the present application does not use a multi-layer attention network, does not need to consider additional hierarchical results and calculations, and has higher computational efficiency.
[0142] In the embodiments of the present application, a graph attention mechanism is introduced and combined with GraphSAGE. The graph attention mechanism allows the model to simultaneously focus on the local neighbors and global structure of a node. By combining the local sampling and aggregation strategies of GraphSAGE with the graph attention mechanism, the model can effectively capture the local and global context information of the node, so that the representation of the node can more accurately capture its context information in the entire graph, continuously optimize the node representation, help improve the quality of the node representation, and improve the accuracy of the recommendation.
[0143] In addition, in an embodiment of the present application, an adaptive subgraph generator based on a multi-layer MLP generates a target knowledge graph subgraph and a target bipartite graph subgraph. In the subgraph generator, the conventional random removal of edges is not used to generate subgraphs. Instead, a shallow MLP is used to calculate the parameters that characterize the importance of the edges, and the parameters are used to determine whether the edges should be removed. In this way, it can help remove edges that are not related to recommendations in data enhancement, reduce the impact of noise aggregation in the GNN network, effectively remove noise, and improve the accuracy and efficiency of recommendations.
[0144] In an embodiment of the present application, a multi-task learning framework is adopted, which can supplement the classic recommendation loss through additional comparative learning between the bipartite graph view and the knowledge graph view, so as to fully explore the information of the bipartite graph and the knowledge graph, and better balance the global information in the knowledge graph and the personalized information in the user behavior data, thereby improving the quality and diversity of the recommendations and making the recommendations more accurate.
[0145] Figure 5 A schematic diagram of a project recommendation method provided by an embodiment of the present application is shown. It should be noted that the execution subject of the project recommendation method may be a project recommendation device, such as Figure 5 As shown, the project recommendation method may include the following steps:
[0146] S510, obtaining first user information of a first user and first project information of a first project;
[0147] S520, predicting the relationship between the first user and the first project based on the first user information and the first project information through the project recommendation model, and determining a target project recommended to the first user from the first project based on the relationship between the first user and the first project.
[0148] The project recommendation model can be obtained by training the model training method shown in the above embodiment. The structure and processing process of the project recommendation model can refer to the above embodiment.
[0149] Therefore, since the information of both the bipartite graph samples and the knowledge graph samples is taken into account during the training of the project recommendation model, the features learned by the project recommendation model during the training process are more comprehensive, and the trained project recommendation model is more accurate. Therefore, the target project recommended for the first user predicted by the project recommendation model is more accurate and can better meet user needs.
[0150] The embodiment of the present application can create a more accurate personalized recommendation system by combining the information in the knowledge graph with user behavior data. Through GNN, users, items and entities in the knowledge graph can be effectively connected to provide more attractive recommendation results. This helps to improve user experience and increase user engagement and conversion rate.
[0151] The rich information in the knowledge graph can help solve the cold start problem, that is, for new users or new items, traditional collaborative filtering methods may not be able to provide accurate recommendations. By combining knowledge graphs and GNNs, the system can use existing knowledge to better recommend new entities, thereby reducing the impact of the cold start problem.
[0152] Recommendation systems combined with knowledge graphs are generally more likely to provide explanatory recommendations based on entities and relationships in the knowledge graph, so users can see why an item is recommended, which helps build user trust, especially for high-value or complex items and services.
[0153] The embodiments of the present application mainly relate to project recommendation, and recommendation refers to recommending specific projects (such as products, services, content or information) to users based on their interests, needs or behaviors. These recommendations are usually based on data analysis and algorithms, aiming to provide personalized suggestions to help users better meet their needs, discover new things or improve their experience. The recommendation system plays an important role in the digital age, not only improving the user experience, but also helping to improve business benefits and data-driven decision-making, so the research on project recommendation algorithms is of great significance. In recent years, with the rise of deep learning technology, technical methods such as neural networks, convolutional neural networks and recurrent neural networks have been applied to recommendations, which have improved the accuracy and personalization of recommendations, but there are also data sparsity and cold start problems. The model training method and project recommendation method proposed in the embodiments of the present application can solve the above problems.
[0154] Based on the same inventive concept, the present application embodiment also provides a model training device. Figure 6 The model training device provided in the embodiment of the present application is described in detail.
[0155] Figure 6 A schematic structural diagram of a model training device provided in one embodiment of the present application is shown.
[0156] like Figure 6 As shown, the model training device may include:
[0157] The first acquisition module 601 is used to acquire multiple training samples, where the training samples include bipartite graph samples and knowledge graph samples, where the first node in the bipartite graph sample is user information, the second node in the bipartite graph sample is project information, the first edge in the bipartite graph sample represents the relationship between the two nodes connected by the first edge, the third node in the knowledge graph sample is user information, the fourth node in the knowledge graph sample is project information, and the second edge in the knowledge graph sample represents the relationship between the two nodes connected by the second edge;
[0158] The model training module 602 is used to perform the following steps for each training sample in the plurality of training samples:
[0159] Input the training sample into a preset project recommendation model, extract features from the bipartite graph sample through the project recommendation model to obtain a first feature vector, and extract features from the knowledge graph sample through the project recommendation model to obtain a second feature vector;
[0160] By using the item recommendation model, the first eigenvector and the second eigenvector are compared and learned to obtain a first loss function value;
[0161] When the training stop condition is not met, the model parameters of the item recommendation model are adjusted based on the first loss function value, and the item recommendation model with adjusted parameters is trained using multiple training samples until the training stop condition is met to obtain a trained item recommendation model.
[0162] Therefore, by taking bipartite graph samples and knowledge graph samples as training samples and performing comparative learning on the first eigenvector of the bipartite graph samples and the second eigenvector of the knowledge graph samples, it is possible to take into account the information of both the bipartite graph samples and the knowledge graph samples during the training of the project recommendation model, so that the features learned by the project recommendation model during the training process are more comprehensive, thereby making the trained project recommendation model more accurate and the predicted recommended projects more able to meet user needs.
[0163] In some implementations, in order to remove noise in a bipartite graph sample, the item recommendation model includes a first subgraph generator and a first vector generator, and the model training module 602 may include:
[0164] A first subgraph generation submodule, configured to split the bipartite graph sample by a first subgraph generator to obtain a plurality of bipartite graph subgraphs, and determine a target bipartite graph subgraph from the plurality of bipartite graph subgraphs based on a first preset rule;
[0165] The first vector generation submodule is used to extract features from a target bipartite graph subgraph through a first vector generator to obtain a first feature vector.
[0166] In some implementations, in order to remove noise in the knowledge graph sample, the item recommendation model includes a second subgraph generator and a second vector generator, and the model training module 602 may include:
[0167] A second subgraph generation submodule, used to split the knowledge graph sample through a second subgraph generator to obtain multiple knowledge graph subgraphs, and determine a target knowledge graph subgraph from the multiple knowledge graph subgraphs based on a second preset rule;
[0168] The second vector generation submodule is used to extract features of the target knowledge graph subgraph through a second vector generator to obtain a second feature vector.
[0169] In some implementations, in order to improve the accuracy of the item recommendation model, the item recommendation model further includes a third vector generator, a connection layer, and a fourth vector generator, and the apparatus may further include:
[0170] A vector generator module, used for extracting features from the bipartite graph sample by a third vector generator to obtain a third feature vector before adjusting the model parameters of the item recommendation model based on the first loss function value;
[0171] A connection module, used for connecting the first feature vector, the second feature vector and the third feature vector through a connection layer to obtain a comprehensive feature vector;
[0172] A feature extraction module, used for extracting features from the comprehensive feature vector through a fourth vector generator to obtain a target feature vector;
[0173] A first determination module, used to determine a second loss function value based on a target feature vector;
[0174] A second determination module, configured to determine a total loss function value based on the first loss function value and the second loss function value;
[0175] Based on this, the model training module 602 may include:
[0176] The adjustment submodule is used to adjust the model parameters of the item recommendation model based on the total loss function value.
[0177] In some implementations, in order to more accurately remove noise from the bipartite graph sample, the first sub-graph generation sub-module may include:
[0178] A first determining unit is used to determine, for each first edge in the bipartite graph sample, a first parameter of the first edge based on feature vectors of two nodes connected by the first edge, wherein the first parameter is positively correlated with the importance of the first edge;
[0179] The first removing unit is used to remove the edges whose first parameters are less than a first preset threshold from the multiple first edges included in the bipartite graph sample to obtain multiple bipartite graph subgraphs.
[0180] In some implementations, in order to more accurately remove noise from the knowledge graph sample, the second subgraph generation submodule may include:
[0181] A second determination unit is used to determine, for each second edge in the knowledge graph sample, a second parameter of the second edge based on feature vectors of two nodes connected by the second edge, where the second parameter is positively correlated with the importance of the second edge;
[0182] The second removal unit is used to remove the edges whose second parameters are less than the second preset threshold among the multiple second edges included in the knowledge graph sample, so as to obtain multiple knowledge graph subgraphs.
[0183] Based on the same inventive concept, the present application embodiment also provides a project recommendation device. Figure 7 The project recommendation device provided in the embodiment of the present application is described in detail.
[0184] Figure 7 A schematic diagram of the structure of a project recommendation device provided by an embodiment of the present application is shown.
[0185] like Figure 7 As shown, the recommended devices for this project may include:
[0186] The second acquisition module 701 is used to acquire first user information of a first user and first project information of a first project;
[0187] The recommended project determination module 702 is used to predict the relationship between the first user and the first project based on the first user information and the first project information through the project recommendation model, and determine the target project recommended for the first user from the first project based on the relationship between the first user and the first project. The project recommendation model is trained by the model training method shown in the above embodiment.
[0188] Therefore, since the information of both the bipartite graph samples and the knowledge graph samples is taken into account during the training of the project recommendation model, the features learned by the project recommendation model during the training process are more comprehensive, and the trained project recommendation model is more accurate. Therefore, the target project recommended for the first user predicted by the project recommendation model is more accurate and can better meet user needs.
[0189] Figure 8 A schematic structural diagram of an electronic device provided by an embodiment of the present application is shown.
[0190] like Figure 8As shown, the electronic device 8 is a structural diagram of an exemplary hardware architecture of an electronic device that can implement the model training method, item recommendation method, model training device, and item recommendation device in the embodiments of the present application. The electronic device may refer to the electronic device in the embodiments of the present application.
[0191] The electronic device 8 may include a processor 801 and a memory 802 storing computer program instructions.
[0192] Specifically, the processor 801 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0193] The memory 802 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 802 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 802 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 802 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 802 is a non-volatile solid-state memory. In a specific embodiment, the memory 802 may include a read-only memory (ROM), a random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical, or other physical / tangible memory storage device. Therefore, typically, the memory 802 includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present application.
[0194] The processor 801 implements any one of the model training methods and / or item recommendation methods in the above embodiments by reading and executing computer program instructions stored in the memory 802.
[0195] In one example, the electronic device may further include a communication interface 803 and a bus 804. Figure 8 As shown, the processor 801, the memory 802, and the communication interface 803 are connected via a bus 804 and communicate with each other.
[0196] The communication interface 803 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0197] Bus 804 includes hardware, software or both, and the parts of electronic equipment are coupled to each other.For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 804 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0198] The electronic device can execute the model training method and project recommendation method in the embodiment of the present application, thereby realizing the combination of Figures 1 to 7 Described model training method, item recommendation method, model training device and item recommendation device.
[0199] In addition, in combination with the model training method and project recommendation method in the above embodiments, the present application embodiment may provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the model training methods and / or project recommendation methods in the above embodiments is implemented.
[0200] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0201] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0202] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0203] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0204] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A model training method, characterized in that: include: Acquire multiple training samples, the training samples include bipartite graph samples and knowledge graph samples, the first node in the bipartite graph sample is user information, the second node in the bipartite graph sample is project information, the first edge in the bipartite graph sample represents the relationship between the two nodes connected by the first edge, the third node in the knowledge graph sample is user information, the fourth node in the knowledge graph sample is project information, and the second edge in the knowledge graph sample represents the relationship between the two nodes connected by the second edge; For each training sample in the multiple training samples, the following steps are performed respectively: Inputting the training sample into a preset item recommendation model, extracting features from the bipartite graph sample through the item recommendation model to obtain a first feature vector, and extracting features from the knowledge graph sample through the item recommendation model to obtain a second feature vector; Performing comparative learning on the first feature vector and the second feature vector through the item recommendation model to obtain a first loss function value; When the training stop condition is not met, the model parameters of the item recommendation model are adjusted based on the first loss function value, and the item recommendation model with adjusted parameters is trained using the multiple training samples until the training stop condition is met, thereby obtaining a trained item recommendation model.
2. The method according to claim 1, characterized in that: The item recommendation model includes a first subgraph generator and a first vector generator, and the step of extracting features from the bipartite graph sample by the item recommendation model to obtain a first feature vector includes: Splitting the bipartite graph sample by the first subgraph generator to obtain a plurality of bipartite graph subgraphs, and determining a target bipartite graph subgraph from the plurality of bipartite graph subgraphs based on a first preset rule; The first feature vector is obtained by performing feature extraction on the target bipartite graph subgraph through the first vector generator.
3. The method according to claim 1, characterized in that The item recommendation model includes a second subgraph generator and a second vector generator, and extracting features from the knowledge graph sample by the item recommendation model to obtain a second feature vector includes: Splitting the knowledge graph sample by the second subgraph generator to obtain a plurality of knowledge graph subgraphs, and determining a target knowledge graph subgraph from the plurality of knowledge graph subgraphs based on a second preset rule; The second feature vector is obtained by performing feature extraction on the target knowledge graph subgraph through the second vector generator.
4. The method according to claim 2, characterized in that: The item recommendation model further includes a third vector generator, a connection layer, and a fourth vector generator. Before adjusting the model parameters of the item recommendation model based on the first loss function value, the method further includes: Performing feature extraction on the bipartite graph sample by the third vector generator to obtain a third feature vector; Connecting the first feature vector, the second feature vector and the third feature vector through the connection layer to obtain a comprehensive feature vector; Performing feature extraction on the comprehensive feature vector by the fourth vector generator to obtain a target feature vector; Determine a second loss function value based on the target feature vector; Determine a total loss function value based on the first loss function value and the second loss function value; The adjusting the model parameters of the item recommendation model based on the first loss function value includes: Model parameters of the item recommendation model are adjusted based on the total loss function value.
5. The method according to claim 2, characterized in that: The bipartite graph sample is split to obtain a plurality of bipartite graph subgraphs, including: For each first edge in the bipartite graph sample, determining a first parameter of the first edge based on feature vectors of two nodes connected by the first edge, where the first parameter is positively correlated with the importance of the first edge; The edges whose first parameters are less than a first preset threshold value among the multiple first edges included in the bipartite graph sample are removed to obtain multiple bipartite graph subgraphs.
6. The method according to claim 3, characterized in that: The knowledge graph sample is split to obtain multiple knowledge graph subgraphs, including: For each second edge in the knowledge graph sample, based on feature vectors of two nodes connected by the second edge, determine a second parameter of the second edge, where the second parameter is positively correlated with the importance of the second edge; The edges whose second parameters are less than a second preset threshold among the multiple second edges included in the knowledge graph sample are removed to obtain multiple knowledge graph subgraphs.
7. A project recommendation method, characterized in that: include: Acquire first user information of a first user and first project information of a first project; Based on the first user information and the first project information, the project recommendation model predicts the relationship between the first user and the first project, and based on the relationship between the first user and the first project, determines the target project recommended for the first user from the first projects, wherein the project recommendation model is trained by the model training method described in any one of claims 1-6.
8. A model training device, characterized in that: include: A first acquisition module is used to acquire multiple training samples, wherein the training samples include bipartite graph samples and knowledge graph samples, wherein the first node in the bipartite graph sample is user information, the second node in the bipartite graph sample is project information, the first edge in the bipartite graph sample represents the relationship between the two nodes connected by the first edge, the third node in the knowledge graph sample is user information, the fourth node in the knowledge graph sample is project information, and the second edge in the knowledge graph sample represents the relationship between the two nodes connected by the second edge; The model training module is used to perform the following steps for each training sample in the multiple training samples: Inputting the training sample into a preset item recommendation model, extracting features from the bipartite graph sample through the item recommendation model to obtain a first feature vector, and extracting features from the knowledge graph sample through the item recommendation model to obtain a second feature vector; Performing comparative learning on the first feature vector and the second feature vector through the item recommendation model to obtain a first loss function value; When the training stop condition is not met, the model parameters of the item recommendation model are adjusted based on the first loss function value, and the item recommendation model with adjusted parameters is trained using the multiple training samples until the training stop condition is met, thereby obtaining a trained item recommendation model.
9. A project recommendation device, characterized in that: include: A second acquisition module, used to acquire first user information of a first user and first project information of a first project; A recommended project determination module is used to predict the relationship between the first user and the first project based on the first user information and the first project information through a project recommendation model, and determine a target project recommended for the first user from the first projects based on the relationship between the first user and the first project. The project recommendation model is trained by the model training method described in any one of claims 1 to 6.
10. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the model training method according to any one of claims 1 to 6 and / or the project recommendation method according to claim 7.
11. A computer storage medium, characterized in that: The computer storage medium stores computer program instructions, which, when executed by a processor, implement the model training method according to any one of claims 1 to 6 and / or the project recommendation method according to claim 7.
12. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the model training method as described in any one of claims 1 to 6 and / or the item recommendation method as described in claim 7.
