Article recommendation model training method and device, terminal equipment, storage medium and article recommendation method
By generating a historical bipartite graph and filtering a set of difficult negative samples, and by adjusting the training parameters using a backbone encoder and discriminator network, the problem of simple negative sample settings in item recommendation models is solved, thus improving the accuracy of item recommendation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-03
AI Technical Summary
In existing technologies, the negative sample settings used in the training process of item recommendation models are simple, which makes it impossible for the models to learn fine-grained features that accurately distinguish users' true preferences, resulting in low item recommendation accuracy.
By acquiring historical user and item interaction relationships to generate a historical bipartite graph, the initial embedding representation of nodes is generated using a backbone encoder, feature fusion network, and edge importance learning network. A set of difficult negative samples is selected, and a candidate node set is generated through a discriminator network. The training parameters are adjusted until the total loss function converges, thereby improving the model's fine-grained feature learning ability.
This improves the item recommendation model's ability to learn fine-grained features of user preferences, thereby enhancing the accuracy of item recommendations.
Smart Images

Figure CN121786618A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of item recommendation technology, and in particular to an item recommendation model training method, apparatus, terminal device, storage medium, and item recommendation method. Background Technology
[0002] Recommendation systems analyze user behavior data and item characteristics to provide personalized content or product recommendations, playing a vital role in e-commerce, social media, and content platforms. Existing technologies employ graph neural networks to model the complex interactions between users and items. By propagating and aggregating information on a user-item bipartite graph, they learn richer representations of users and items, thereby enabling item recommendations to be made to users.
[0003] However, during the initial training phase, the contrastive loss function of this type of model typically treats all other samples within a batch as negative samples. This strategy leads to the training process being dominated by a large number of simple negative samples. For example, forcing the model to distinguish between the representations of "basketball" and "lipstick" is too simplistic and contributes little to improving the model's fine-grained discrimination ability. The model cannot learn fine-grained features that accurately distinguish users' true preferences, resulting in low accuracy in recommending items to users. Summary of the Invention
[0004] This invention provides a method, apparatus, terminal device, storage medium, and item recommendation method for training an item recommendation model. It solves the problem that the negative sample settings used in the training of existing models are simple, which makes the model unable to learn fine-grained features that accurately distinguish users' true preferences, thus resulting in low accuracy in item recommendations for users.
[0005] An embodiment of the present invention provides a method for training an item recommendation model, comprising: Obtain several historical bipartite graphs generated from historical users, historical items, and the interaction relationships between historical users and the aforementioned historical items; Based on the above bipartite historical graph, the item recommendation model to be trained is iteratively trained until the total loss function converges, thus obtaining the trained item recommendation model and the final embedding representation of each node. In each iteration, the initial embedding representation of each node is generated based on the current historical bipartite graph, the backbone encoder built into the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network. For each node, based on the initial embedding representation of the current node, the initial basic embedding representation of the remaining nodes, and the discriminator network built into the item recommendation model to be trained, a set of candidate nodes with high similarity to the current node and the discrimination score corresponding to each candidate node are generated. An activation operation is performed on the above discrimination scores to obtain the probability of each candidate node as a positive sample, and a set of difficult negative samples is generated based on the candidate nodes whose probabilities are not greater than a preset probability threshold. Based on the initial embedding representations and the set of difficult negative samples corresponding to all nodes, the value of the current total loss function is calculated. If the current total loss function converges, the item recommendation model training is complete; otherwise, the training parameters of the current item recommendation model are adjusted and training continues.
[0006] Furthermore, based on the current historical bipartite graph, the backbone encoder built into the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network, the initial embedding representation of each node is generated, including: Generate an initial adjacency matrix, an angle matrix, an initial user embedding matrix, and an initial item embedding matrix based on the current historical bipartite graph; By concatenating the initial user embedding matrix and the initial item embedding matrix, the initial node feature matrix of the current historical bipartite graph is obtained. Based on the initial adjacency matrix and the angle matrix mentioned above, the normalized adjacency matrix of the current historical bipartite graph is calculated. The normalized adjacency matrix and the initial node feature matrix are input into the backbone encoder to perform feature embedding fusion, thereby obtaining the initial basic embedding representation of each node. Based on the initial basic embedding representation, edge importance learning network, initial adjacency matrix, initial node feature matrix and backbone encoder mentioned above, a refined node embedding representation for each node is generated. Based on the initial adjacency matrix, initial node feature matrix, current historical bipartite graph, initial basic embedding representation, and feature fusion network, a comprehensive node embedding representation for each node is generated. The above-mentioned initial basic embedding representation, refined node embedding representation, and comprehensive node embedding representation are used as the initial embedding representation of the corresponding node.
[0007] Furthermore, based on the initial basic embedding representation, the edge importance learning network, the initial adjacency matrix, the initial node feature matrix, and the backbone encoder, the refined node embedding representation of each node is generated, including: Based on all the above initial basic embedding representations, obtain the edge node vector corresponding to each edge in the current historical bipartite graph; For each edge in the current historical bipartite graph, the edge node vectors of the above edges are combined and then input into the above edge importance learning network to generate importance scores for each edge; Based on the importance scores and random perturbation noise, calculate the mask value of each edge, and construct an edge mask matrix based on the mask values of all edges. Based on the edge mask matrix and the initial adjacency matrix mentioned above, the refined adjacency matrix is calculated. The refined adjacency matrix and the initial node feature matrix are input into the backbone encoder to perform feature embedding fusion, generating a refined node embedding representation for each node.
[0008] Furthermore, based on the aforementioned initial adjacency matrix, initial node feature matrix, current historical bipartite graph, initial basic embedding representation, and feature fusion network, a comprehensive node embedding representation for each node is generated, including: Perform graph convolution on the initial adjacency matrix and the initial node feature matrix to obtain the local feature node representation of each node; Perform a K-step random walk on the current bipartite historical graph to generate a higher-order neighborhood relation matrix; where K is a positive integer; Using the aforementioned high-order neighborhood relation matrix as a graph structure, graph convolution is performed on the initial basic embedding representation of each node to generate high-order feature node representations. For each node, the local feature node representation and the higher-order feature node representation are concatenated and then input into the feature fusion network to generate the fusion score for each node. Differentiable the above fusion scores yield the fusion weights for each node; Based on the aforementioned fusion weights, the local feature node representations and higher-order feature node representations are weighted and summed to obtain the comprehensive node embedding representation of each node.
[0009] Furthermore, based on the initial embedding representation of the current node, the initial basic embedding representations of the remaining nodes, and the discriminator network built into the item recommendation model to be trained, a set of candidate nodes with high similarity to the current node and a discrimination score corresponding to each candidate node are generated, including: For each node, the cosine similarity between the current node and all other nodes is calculated based on the initial basic embedding representation of the current node and the initial basic embedding representation of the other nodes. The remaining nodes corresponding to the first M largest cosine similarities are used as candidate nodes to generate a candidate node set; where each node corresponds to a candidate node set; M is a positive integer; The initial basic embedding representation of the current node is concatenated with the initial basic embedding representations of each candidate node in the corresponding candidate node set, and then input into the discriminator network to generate the discrimination score for each candidate node.
[0010] Furthermore, based on the initial embedding representations corresponding to all nodes and the hard negative sample set, the current total loss function value is calculated, including: Get the total number of nodes in the current historical bipartite graph; The first contrastive loss of each node is calculated based on the initial basic embedding representation, the refined node embedding representation, and the refined node embedding representation of each candidate node in the corresponding hard negative sample set. The second contrastive loss of each node is calculated based on the initial basic embedding representation of all nodes, the comprehensive node embedding representation, and the comprehensive node embedding representation of each candidate node in the corresponding hard negative sample set. The contrast loss of each node is calculated based on the sum of the first contrast loss and the second contrast loss. Based on the total number of nodes and the comparison loss of each node, the total comparison loss of the current historical bipartite graph is calculated. The current global regularization loss is calculated based on the current training parameters; The current principal loss is calculated based on the initial basic embedding representation described above; The current sparsity loss is calculated based on the sum of the above mask values; The value of the current total loss function is calculated based on the current total contrastive loss, the current global regularization loss, the current principal loss, and the current sparsity loss of the current historical bipartite graph.
[0011] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments; This invention provides a training device for an item recommendation model, comprising: Historical data acquisition module and model training module; The aforementioned historical data acquisition module is used to acquire several historical bipartite graphs generated from historical users, historical items, and the interaction relationships between historical users and the aforementioned historical items. The above model training module is used to iteratively train the item recommendation model to be trained based on the above historical bipartite graph until the total loss function converges, so as to obtain the trained item recommendation model and the final embedding representation of each node. In each iteration, the initial embedding representation of each node is generated based on the current historical bipartite graph, the backbone encoder built into the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network. For each node, based on the initial embedding representation of the current node, the initial basic embedding representation of the remaining nodes, and the discriminator network built into the item recommendation model to be trained, a set of candidate nodes with high similarity to the current node and the discrimination score corresponding to each candidate node are generated. An activation operation is performed on the above discrimination scores to obtain the probability of each candidate node as a positive sample, and a set of difficult negative samples is generated based on the candidate nodes whose probabilities are not greater than a preset probability threshold. Based on the initial embedding representations and the set of difficult negative samples corresponding to all nodes, the value of the current total loss function is calculated. If the current total loss function converges, the item recommendation model training is complete; otherwise, the training parameters of the current item recommendation model are adjusted and training continues.
[0012] Based on the above method embodiments, the present invention provides a corresponding terminal device embodiment; The present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the item recommendation model training method described in any embodiment of the present invention.
[0013] Based on the above method embodiments, the present invention provides a corresponding storage medium embodiment; The present invention provides a storage medium including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the item recommendation model training method described in any embodiment of the present invention.
[0014] Another embodiment of the present invention provides a method for recommending items, including: Obtain the final embedded representations of the user to be recommended and each node corresponding to the preset item recommendation model; wherein, the preset item recommendation model is obtained by training according to the item recommendation model training method described above in any of the above embodiments; Based on the aforementioned final embedding representation, obtain the first final basic embedding representation corresponding to the user to be recommended, and all second final basic embedding representations used to represent item nodes; Calculate the inner product of the first final basic node embedding representation and each of the second final basic node embedding representations to obtain the preference score of the user to be recommended for each item. The items corresponding to the top N largest preference scores are selected as target recommended items for the aforementioned users, and then recommended to them.
[0015] The embodiments of the present invention have the following beneficial effects: This invention provides a method, apparatus, terminal device, storage medium, and item recommendation model training method. The item recommendation model training method includes: acquiring several historical bipartite graphs generated from historical users, historical items, and the interaction relationships between historical users and the historical items; then iteratively training the item recommendation model to be trained based on the historical bipartite graphs until the total loss function converges, obtaining the trained item recommendation model and the final embedding representation of each node; wherein, in each iteration, an initial embedding representation of each node is generated based on the current historical bipartite graph, the built-in backbone encoder of the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network; subsequently, for... For each node, based on the initial embedding representation of the current node, the initial basic embedding representations of the remaining nodes, and the discriminator network built into the item recommendation model to be trained, a set of candidate nodes with high similarity to the current node and a discrimination score corresponding to each candidate node are generated. Then, an activation operation is performed on the above discrimination scores to obtain the probability of each candidate node as a positive sample, and a set of difficult negative samples is generated based on the candidate nodes whose probabilities are not greater than a preset probability threshold. Finally, based on the initial embedding representations of all nodes and the set of difficult negative samples, the value of the current total loss function is calculated. If the current total loss function converges, the item recommendation model training is complete; otherwise, the training parameters of the current item recommendation model are adjusted and training continues. Therefore, in this invention, by setting a preset probability threshold, a set of difficult negative samples that are dissimilar to the corresponding nodes is further filtered from the candidate nodes. Since this set of difficult negative samples is obtained by further filtering from the set of candidate nodes with high similarity, each candidate node in the set of difficult negative samples is similar to the corresponding node, but there are subtle semantic differences. After the model is trained based on these difficult samples, it can improve its learning and extraction of fine-grained features, thus ultimately improving the accuracy of item recommendations for users. Attached Figure Description
[0016] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating a method for training an item recommendation model according to an embodiment of the present invention.
[0018] Figure 2 This is a schematic diagram of the structure of an item recommendation model training device provided in an embodiment of the present invention.
[0019] Figure 3This is a flowchart illustrating an item recommendation method provided in an embodiment of the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0022] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0023] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0024] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0025] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).
[0026] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.
[0027] See Figure 1 To address the problem that existing technologies often use simple negative sample settings for model training, leading to a failure to learn fine-grained features that accurately distinguish users' true preferences and resulting in low accuracy in item recommendations, this invention provides an item recommendation model training method, comprising: Step S101: Obtain several historical bipartite graphs generated from historical users, historical items, and the interaction relationships between historical users and the aforementioned historical items; Specifically, the set of historical users is set to U, with a size of M', and the set of historical items is set to I, with a size of N'. Based on the interaction records between these historical users and historical items, a bipartite historical graph is constructed. In this graph, V represents a node in the bipartite history graph, which includes historical users and historical items, and E represents an edge in the bipartite history graph, used to represent the interaction between historical users and historical items.
[0028] Preferably, before constructing the historical bipartite graph, a K-core strategy can be used to iteratively remove historical users and items whose interaction counts are less than a preset threshold until all remaining nodes meet the minimum interaction count requirement, and then the historical bipartite graph can be constructed to achieve data cleaning.
[0029] Step S102: Iteratively train the item recommendation model to be trained based on the above historical bipartite graph until the total loss function converges, and obtain the trained item recommendation model and the final embedding representation of each node; In each iteration, the initial embedding representation of each node is generated based on the current historical bipartite graph, the backbone encoder built into the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network. For each node, based on the initial embedding representation of the current node, the initial basic embedding representation of the remaining nodes, and the discriminator network built into the item recommendation model to be trained, a set of candidate nodes with high similarity to the current node and the discrimination score corresponding to each candidate node are generated. An activation operation is performed on the above discrimination scores to obtain the probability of each candidate node as a positive sample, and a set of difficult negative samples is generated based on the candidate nodes whose probabilities are not greater than a preset probability threshold. Specifically, the selected "node" is used as the anchor node. To obtain a smoother and more easily optimized probability value, the discrimination score is transformed into a probability representing the possible positive sample of the candidate node being the corresponding anchor node through a sigmoid function with a temperature parameter. In the formula, This represents the probability that anchor node a corresponds to candidate node c. This represents the Sigmoid function. This represents the discrimination score corresponding to anchor node a and candidate node c. The temperature parameter used to calculate the probability can be set to 0.2.
[0030] Specifically, based on this probability, all candidate nodes in the candidate node set are divided into two mutually exclusive sets: the inferred positive sample set, which contains all candidate nodes considered highly likely to be positive samples (e.g., whose probability is higher than a certain preset threshold, set to 0.7 in this application), and the hard negative sample set, which contains all candidate nodes considered to be negative samples (i.e., whose probability is lower than 0.7). Since the latter are highly similar to the anchor nodes in the original feature space, but should be semantically dissimilar, they constitute high-quality hard negative samples.
[0031] Based on the initial embedding representations and the set of difficult negative samples corresponding to all nodes, the value of the current total loss function is calculated. If the current total loss function converges, the item recommendation model training is complete; otherwise, the training parameters of the current item recommendation model are adjusted and training continues.
[0032] Specifically, the item recommendation model incorporates a backbone encoder, a feature fusion network, an edge importance learning network, and a discriminator network. The backbone encoder uses a lightweight graph convolutional network (LightGCN) as its foundation, while the feature fusion network, edge importance learning network, and discriminator network are all built upon multilayer perceptrons. The edge importance learning network evaluates the relative importance of each edge in the historical bipartite graph; it contains several fully connected layers with a hidden dimension of [missing information]. The activation function is ReLU.
[0033] Specifically, the training parameters mentioned above include the network parameters corresponding to the backbone encoder, feature fusion network, edge importance learning network, and discriminator network, as well as the initial basic embedding representation in the initial embedding representation. During training, gradient descent optimization algorithms such as AdamW are used to update all training parameters of the model end-to-end by minimizing the total loss function. The initial embedding representation includes: the initial basic embedding representation, the refined node embedding representation, and the comprehensive node embedding representation.
[0034] Preferably, the above-mentioned process of constructing difficult negative samples replaces the traditional global negative sampling, and can accurately locate the most valuable difficult samples for learning.
[0035] In a preferred embodiment, the above-mentioned generation of initial embedding representations for each node based on the current historical bipartite graph, the backbone encoder built into the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network includes: Generate an initial adjacency matrix, an angle matrix, an initial user embedding matrix, and an initial item embedding matrix based on the current historical bipartite graph; Specifically, the current topology of the bipartite historical graph can be represented by an initial adjacency matrix with dimensions (M+N)x(M+N). If there is interaction between historical users and historical items in the current bipartite historical graph, the corresponding elements in the initial adjacency matrix... and All are set to 1, otherwise 0. Simultaneously, for subsequent graph convolution operations, the diagonal matrix is calculated, where the diagonal elements are defined as the degree of the nodes. The diagonal matrix is represented by the following formula: In the formula, This represents the degree corresponding to node i in the angle matrix. This represents the elements corresponding to node i and node j in the initial adjacency matrix.
[0036] Specifically, trainable low-dimensional vector representations are assigned to the nodes corresponding to all historical users and historical items in the model. Therefore, two independent embedding matrices are created: a user embedding matrix and a user embedding matrix. , dimension and item embedding matrix The two matrices have dimensions N'×d, where d is the preset embedding dimension, which can be set to 64. Xavier normal initialization is used to randomly initialize these two matrices, resulting in the initial item embedding matrix and the initial user embedding matrix.
[0037] By concatenating the initial user embedding matrix and the initial item embedding matrix, the initial node feature matrix of the current historical bipartite graph is obtained. Specifically, the initial item embedding matrix and the initial user embedding matrix are concatenated along the rows to form the initial node feature matrix.
[0038] Based on the initial adjacency matrix and the angle matrix mentioned above, the normalized adjacency matrix of the current historical bipartite graph is calculated. Specifically, the normalized adjacency matrix is calculated using the following formula: In the formula, Let represent the normalized adjacency matrix, D represent the angle matrix, and A represent the initial adjacency matrix.
[0039] The normalized adjacency matrix and the initial node feature matrix are input into the backbone encoder to perform feature embedding fusion, thereby obtaining the initial basic embedding representation of each node. Specifically, the above normalized adjacency matrix is compared with the above initial node feature matrix (denoted as...). As the input to the backbone encoder, neighborhood information is aggregated through L layers of linear information propagation within the backbone encoder. The embedding matrix of the k'-th layer is obtained by multiplying the embedding matrix of the previous layer by the normalized adjacency matrix, and its update rule is: In the formula, Let k' be the embedding matrix of the k'th layer. Let represent the embedding matrix of the (k'-1)th layer.
[0040] Specifically, to comprehensively utilize neighborhood information of different orders, all embedding representations from layer 0 to layer L are fused. Mean pooling is used to sum the embedding matrices of all layers element-wise and then average them to obtain the initial basic embedding representation under the original graph structure. The calculation formula is as follows: In the formula, This represents the initial basic embedding representation, and L represents the number of graph convolutional layers, which can be set to 3.
[0041] Based on the initial basic embedding representation, edge importance learning network, initial adjacency matrix, initial node feature matrix and backbone encoder mentioned above, a refined node embedding representation for each node is generated. Based on the initial adjacency matrix, initial node feature matrix, current historical bipartite graph, initial basic embedding representation, and feature fusion network, a comprehensive node embedding representation for each node is generated. The above-mentioned initial basic embedding representation, refined node embedding representation, and comprehensive node embedding representation are used as the initial embedding representation of the corresponding node.
[0042] In this preferred embodiment, based on the current historical bipartite graph, the backbone encoder built into the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network, the initial basic embedding representation, refined node embedding representation, and comprehensive node embedding representation of each node are generated, thereby obtaining the initial embedding representation of the node.
[0043] In another preferred embodiment, the process of generating refined node embedding representations for each node based on the initial basic embedding representation, the edge importance learning network, the initial adjacency matrix, the initial node feature matrix, and the backbone encoder includes: Based on all the above initial basic embedding representations, obtain the edge node vector corresponding to each edge in the current historical bipartite graph; Schematic: For any existing edge e = (u,v) in a bipartite historical graph, its edge node vector is the vector... and , representing the embedding feature of the corresponding edge.
[0044] For each edge in the current historical bipartite graph, the edge node vectors of the above edges are combined and then input into the above edge importance learning network to generate importance scores for each edge; Specifically, a pre-defined combination operation is used to combine the edge node vectors of the aforementioned edges. The combined feature vector is then input into the edge importance learning network, which outputs a scalar value, namely the importance score of the edge. The generation process of the importance score is represented by the following formula: In the formula, The importance score represents the edge between node u and node v. It is a scalar, and a higher value indicates that the edge is likely to be more important in the current task. The edge importance learning network is represented by a multilayer perceptron, which maps the edge features of the input to a scalar importance score. This indicates a vector concatenation operation.
[0045] Based on the importance scores and random perturbation noise, calculate the mask value of each edge, and construct an edge mask matrix based on the mask values of all edges. Specifically, to achieve discrete edge selection (i.e., retain or discard) within a gradient-based optimization framework, this invention employs the Gumbel-Softmax reparameterization technique. This technique provides a continuous and differentiable approximation of the discrete sampling process, allowing gradients to propagate smoothly backward. Specifically, the importance score of an edge is considered as the logarithmic probability of the decision. Gumbel noise is introduced to randomly perturb the decisions to "retain" or "discard" the edge, and then normalized using a Softmax function with a temperature parameter, ultimately yielding an approximately binary mask value. This mask value represents the "soft" probability of retaining the corresponding edge; a value close to 1 indicates retention, and a value close to 0 indicates discarding. Its calculation formula is as follows: In the formula, The mask value representing the edge between node u and node v is a continuous value between 0 and 1. and This represents two independent random noise samples sampled from the standard Gumbel distribution (i.e., Gumbel(0,1)), injecting randomness into the sampling process. The temperature parameter represents the temperature when calculating the mask value. It can be set to 0.1. It is a positive scalar that controls the smoothness of the output distribution. When it approaches 0, the output is closer to discrete 0 or 1.
[0046] Specifically, after obtaining the mask values, an edge mask matrix with the same dimensions as the initial adjacency matrix of the historical bipartite graph is constructed based on the mask values generated for each edge.
[0047] Based on the edge mask matrix and the initial adjacency matrix mentioned above, the refined adjacency matrix is calculated. Specifically, by performing element-wise multiplication on the initial adjacency matrix and the constructed edge mask matrix, a refined adjacency matrix with a refined structure is obtained, thereby dynamically adjusting the topology of the original historical bipartite graph. The generation formula is as follows: In the formula, This represents the refined adjacency matrix, which indicates the optimized graph structure. Represents the edge mask matrix. This represents the Hadamard product operator.
[0048] The refined adjacency matrix and the initial node feature matrix are input into the backbone encoder to perform feature embedding fusion, generating a refined node embedding representation for each node.
[0049] Specifically, the refined adjacency matrix and the initial node feature matrix of the generated "refined structural view" are used as inputs and passed through the backbone encoder again to obtain the refined node embedding representation under this view.
[0050] In this preferred embodiment, refined node embedding representations for each node are generated based on the initial basic embedding representation, the edge importance learning network, the initial adjacency matrix, the initial node feature matrix, and the backbone encoder.
[0051] In another preferred embodiment, the above-mentioned generation of a comprehensive node embedding representation for each node based on the initial adjacency matrix, the initial node feature matrix, the current historical bipartite graph, the initial basic embedding representation, and the feature fusion network includes: Perform graph convolution on the initial adjacency matrix and the initial node feature matrix to obtain the local feature node representation of each node; Specifically, to capture the close relationships between a node and its direct neighbors, a local feature node representation is first generated. Specifically, a specific graph convolution operation (e.g., aggregating only even-numbered layers or only odd-numbered layers) is performed on the initial adjacency matrix and the initial node feature matrix. Through this operation, each node aggregates information from its similar or dissimilar neighborhoods, thereby generating a node representation focused on a "local structural view" of the local graph topology, i.e., the aforementioned local feature node representation. This representation encodes the node's direct connections and neighboring features.
[0052] Perform a K-step random walk on the current bipartite historical graph to generate a higher-order neighborhood relation matrix; where K is a positive integer; Specifically, to overcome the limitations of local connectivity, capture higher-order relationships between nodes, and alleviate the oversmoothing problem, global structural information is aggregated, and a K-step random walk is performed on the original graph. This generates a new relation matrix (i.e., the aforementioned higher-order neighborhood relation matrix), whose... Each element represents a node. Starting from the point, after a K-step random walk, the node is reached. The probability. Unlike the initial adjacency matrix, Non-zero values in the matrix indicate that there is a K-step reachable path between nodes, and the magnitude of the value reflects the strength of this higher-order proximity. Therefore, the higher-order neighborhood relation matrix defines a new graph structure under a "higher-order semantic view".
[0053] Using the aforementioned high-order neighborhood relation matrix as a graph structure, graph convolution is performed on the initial basic embedding representation of each node to generate high-order feature node representations. Specifically, using a high-order neighborhood relation matrix as the graph structure, graph convolution is performed on the matrix constructed from the initial basic embedding representation. Through this operation, each node aggregates its semantically related node information, thereby generating a node representation under a "high-order semantic view," i.e., a high-order feature node representation.
[0054] For each node, the local feature node representation and the higher-order feature node representation are concatenated and then input into the feature fusion network to generate the fusion score for each node. Specifically, in order to adaptively and personally fuse two types of information (local structure and higher-order semantics) from different perspectives, this invention designs a feature fusion network. For each node, its local feature node representation is concatenated with its higher-order feature node representation to form a combined feature vector, which is then used as... Given the input, the network will learn and output a scalar fusion decision score (i.e., the fusion score mentioned above). Its calculation formula is as follows: In the formula, The fusion score of node v represents the model's fusion score for node v, reflecting the fusion score of node v. The preference for balancing local structural information with higher-order semantic information. Indicating feature fusion networks, This indicates a feature concatenation operation. This represents the local feature node representation of node v. This represents the higher-order feature node representation of node v.
[0055] Differentiable the above fusion scores yield the fusion weights for each node; Specifically, to achieve end-to-end model training, discrete fusion scores are transformed into continuously differentiable fusion weights. For each node's fusion score, a fusion weight between 0 and 1 is obtained through the Gumbel-Softmax transformation.
[0056] Based on the aforementioned fusion weights, the local feature node representations and higher-order feature node representations are weighted and summed to obtain the comprehensive node embedding representation of each node.
[0057] Specifically, the two view representations are adaptively weighted and summed using fusion weights to generate a final semantically rich node representation, i.e., a comprehensive node embedding representation: In the formula, The comprehensive node embedding representation of node v. This represents the fusion weight of node v.
[0058] Specifically, the integrated node embedding representation is a dynamic convex combination of its local structural features and higher-order semantic features. The closer the fusion weight is to 1, the more the model tends to adopt the local structural information of the node; conversely, the closer it is to 1, the more it tends to incorporate higher-order semantic information.
[0059] Preferably, a Gumbel-Softmax-driven differentiable graph enhancement mechanism is introduced to replace the fixed random perturbation, intelligently denoising and optimizing the graph structure.
[0060] In this preferred embodiment, a comprehensive node embedding representation for each node is generated based on the initial adjacency matrix, the initial node feature matrix, the current historical bipartite graph, the initial basic embedding representation, and the feature fusion network.
[0061] In another preferred embodiment, the above-mentioned generation of a set of candidate nodes with high similarity to the current node and a discrimination score corresponding to each candidate node, based on the initial embedding representation of the current node, the initial basic embedding representations of the remaining nodes, and the discriminator network built into the item recommendation model to be trained, includes: For each node, based on the initial basic embedding representation of the current node and the initial basic embedding representations of the other nodes, the cosine similarity between the current node and each of the other nodes is calculated. Specifically, in each calculation of cosine similarity, the selected "current node" serves as the anchor node. To efficiently filter out the most deceptive sample set that is close to the anchor node in the feature space, serving as the basis for subsequent refined discrimination, within a training batch, for any selected anchor node, its initial basic embedding representation is used to calculate its cosine similarity with all other nodes in that batch (i.e., the remaining nodes mentioned above). The similarity calculation formula is as follows: In the formula, This represents the cosine similarity between anchor node a and the other nodes j. Let be the transpose of the initial basic embedding representation of anchor node a. This represents the initial basic embedding representation of the remaining node j. This represents the initial basic embedding representation of anchor node a. This represents the L2 norm of a vector.
[0062] The remaining nodes corresponding to the first M largest cosine similarities are used as candidate nodes to generate a candidate node set; where each node corresponds to a candidate node set; M is a positive integer; Specifically, after calculating the cosine similarity of each of the remaining nodes, the nodes are sorted from high to low according to their similarity values, and the top M nodes are selected as candidate nodes for anchor nodes to generate a candidate node set.
[0063] Preferably, M can be set to 10.
[0064] The initial basic embedding representation of the current node is concatenated with the initial basic embedding representations of each candidate node in the corresponding candidate node set, and then input into the discriminator network to generate the discrimination score for each candidate node.
[0065] Specifically, to achieve intelligent identification of candidate nodes within the candidate node set, this invention designs a learnable discriminator network, which is an independent neural network with a typical structure of a multilayer perceptron. Its core function is to learn a discriminant function that receives a pair of node representations and determines whether they belong to a semantically "positive sample pair." This discriminator will be trained end-to-end with the main model, thereby dynamically adapting to constantly changing node embeddings.
[0066] Specifically, for each candidate node in the candidate node set, the initial basic embedding representation of the corresponding anchor node is first concatenated with the initial basic embedding representation of the candidate node to form a combined representation vector. This vector is then input into the discriminator network to obtain a discrimination score, the calculation process of which is as follows: In the formula, This represents the discriminator network. This indicates a splicing operation. This represents the initial basic embedding representation of anchor node a. This represents the initial basic embedding representation of candidate node c.
[0067] In this preferred embodiment, a set of candidate nodes with high similarity to the anchor node and a discrimination score corresponding to each candidate node are generated based on the initial basic embedding representation of the anchor node, the initial basic embedding representation of the remaining nodes, and the discriminator network.
[0068] In another preferred embodiment, the calculation of the current total loss function based on the initial embedding representations and the hard negative sample set corresponding to all nodes includes: Get the total number of nodes in the current historical bipartite graph; The first contrastive loss of each node is calculated based on the initial basic embedding representation, the refined node embedding representation, and the refined node embedding representation of each candidate node in the corresponding hard negative sample set. Specifically, to construct the dual-view contrastive loss function, the original historical bipartite graph is compared with two enhanced views (i.e., the structurally refined view and the node-enhanced view generated based on the comprehensive node embedding representation). For any anchor node 'a', its initial basic embedding representation is first paired with the corresponding refined node embedding representation in the structurally refined view to form a positive sample pair, and the first contrastive loss is calculated: In the formula, This represents the first contrast loss of anchor node a. Let represent the cosine similarity between the initial basic embedding representation and the refined node embedding representation of anchor node a. This represents the initial basic embedding representation of anchor node a. This represents the refined node embedding representation of anchor node a. This represents the set of difficult negative samples of the same type as anchor node a (if the anchor node is a user node, then the negative sample is also a user node; if it is an item node, then the negative sample is also an item node). Let represent the cosine similarity between the initial basic embedding representation of anchor node a and the refined node embedding representation of candidate node n. Let n be the refined node embedding representation of candidate node n. This represents the temperature parameter used to calculate the contrast loss, and can be set to 0.2.
[0069] The second contrastive loss of each node is calculated based on the initial basic embedding representation of all nodes, the comprehensive node embedding representation, and the comprehensive node embedding representation of each candidate node in the corresponding hard negative sample set. Specifically, for any anchor node a, its initial basic embedding representation is then combined with the comprehensive node embedding representation to form a positive sample pair, and the second contrastive loss is calculated: In the formula, This represents the second contrast loss of anchor node a. Let cosine similarity represent the initial basic embedding representation and the synthesized node embedding representation of anchor node a. This represents the composite node embedding representation of anchor node a. The cosine similarity is represented between the initial basic embedding representation of anchor node a and the comprehensive node embedding representation of candidate node n.
[0070] The contrast loss of each node is calculated based on the sum of the first contrast loss and the second contrast loss. Specifically, the two contrast losses are combined to obtain the total contrast loss for the anchor node: In the formula, This represents the total contrast loss of anchor node a.
[0071] Based on the total number of nodes and the comparison loss of each node, the total comparison loss of the current historical bipartite graph is calculated. Specifically, the formula for calculating the total comparative loss of the current historical bipartite graph is as follows: In the formula, This indicates the total comparative loss in the current bipartite historical graph. This represents the set of nodes representing historical users. This represents the contrastive loss corresponding to historical user u. The set of nodes representing historical items, This represents the comparative loss corresponding to historical item i.
[0072] The current global regularization loss is calculated based on the current training parameters; Specifically, the global regularization loss is added to the total loss function to penalize excessively large parameter values during training, thereby preventing overfitting and enhancing the model's generalization ability. The global regularization loss is calculated using the following formula: In the formula, This represents the global regularization loss. This represents all the training parameters in the model.
[0073] The current principal loss is calculated based on the initial basic embedding representation described above; Specifically, the Bayesian personalized ranking loss is used as the main loss mentioned above, and its formula is as follows: In the formula, Indicates the main loss. Let represent the transpose of the initial basic embedding representation of node u. Let i represent the initial basic embedding representation of node i. Let represent the initial basic embedding representation of node j, and D represent the set of all nodes in the entire history bipartite graph.
[0074] It should be noted that in the formula for calculating the main loss above, node u represents a user node in set D, i represents an item node in set D that user u has interacted with, and j represents an item node in set D that user u has not interacted with.
[0075] The current sparsity loss is calculated based on the sum of the above mask values; Specifically, to guide the model to learn a sparser and simpler graph structure and encourage it to trade performance improvements for minimal structural changes, a sparsity regularization term is introduced. This regularization term is specifically the edge mask matrix. The norm, achieved by summing the mask values of all existing edges in the graph, effectively penalizes the number of edges that are retained. This sparsity loss is defined as follows: In the formula, Let E represent the sparsity loss, and let E represent the set of existing edges.
[0076] The value of the current total loss function is calculated based on the current total contrastive loss, the current global regularization loss, the current principal loss, and the current sparsity loss of the current historical bipartite graph.
[0077] Specifically, the total loss function is calculated using the following formula: In the formula, Represents the total loss function. This represents the weight used to balance the total contrast loss, and can be set to 1. This represents the weight used to balance the sparsity loss, and can be set to 0.2. This represents the temperature parameter used to balance the global regularization loss, and its value is... .
[0078] The preferred method, through end-to-end joint optimization, effectively improves the learning efficiency and representation quality of the model. Compared with existing methods, it achieves significant improvements in key metrics such as recall and normalized depreciation cumulative gain on multiple public datasets, realizing more accurate and efficient personalized recommendations.
[0079] In this preferred embodiment, the current value of the total loss function is calculated based on the initial basic embedding representation, refined node embedding representation, comprehensive node embedding representation, and difficult negative sample set corresponding to the node.
[0080] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments.
[0081] like Figure 2 As shown, an embodiment of the present invention provides an item recommendation model training device, comprising: Historical data acquisition module and model training module; The aforementioned historical data acquisition module is used to acquire several historical bipartite graphs generated from historical users, historical items, and the interaction relationships between historical users and the aforementioned historical items. The above model training module is used to iteratively train the item recommendation model to be trained based on the above historical bipartite graph until the total loss function converges, so as to obtain the trained item recommendation model and the final embedding representation of each node. In each iteration, the initial embedding representation of each node is generated based on the current historical bipartite graph, the backbone encoder built into the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network. For each node, based on the initial embedding representation of the current node, the initial basic embedding representation of the remaining nodes, and the discriminator network built into the item recommendation model to be trained, a set of candidate nodes with high similarity to the current node and the discrimination score corresponding to each candidate node are generated. An activation operation is performed on the above discrimination scores to obtain the probability of each candidate node as a positive sample, and a set of difficult negative samples is generated based on the candidate nodes whose probabilities are not greater than a preset probability threshold. Based on the initial embedding representations and the set of difficult negative samples corresponding to all nodes, the value of the current total loss function is calculated. If the current total loss function converges, the item recommendation model training is complete; otherwise, the training parameters of the current item recommendation model are adjusted and training continues.
[0082] It should be noted that the device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without creative effort. The above schematic diagrams are merely examples of an item recommendation model training device and do not constitute a limitation on an item recommendation model training device. It may include more or fewer components than illustrated, or combine certain components, or use different components.
[0083] Based on the above method embodiments, the present invention provides corresponding terminal device embodiments.
[0084] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the item recommendation model training method described in any embodiment of the present invention.
[0085] For example, in this embodiment, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the device. The aforementioned terminal devices may be computing devices such as desktop computers, laptops, handheld computers, and cloud servers. These devices may include, but are not limited to, processors and memory. The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. This processor is the control center of the device, connecting various parts of the device via various interfaces and lines. The aforementioned memory can be used to store the aforementioned computer programs and / or modules. The aforementioned processor implements various functions of the aforementioned device by running or executing the computer programs and / or modules stored in the aforementioned memory, and by calling data stored in the memory. The aforementioned memory may mainly include a program storage area and a data storage area, wherein the program storage area may store the operating system, at least one application program required for a function, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0086] Based on the above method embodiments, the present invention provides corresponding storage medium embodiments.
[0087] Another embodiment of the present invention provides a storage medium including a stored computer program, wherein, when the computer program is running, it controls the device where the storage medium is located to execute the item recommendation model training method described in any embodiment of the present invention.
[0088] In this embodiment, the storage medium is a computer-readable storage medium, and the computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0089] like Figure 3 As shown, based on the item recommendation model training method, this invention provides an item recommendation method accordingly; An embodiment of the present invention provides a method for recommending items, including: Step S201: Obtain the final embedding representation of each node corresponding to the user to be recommended and the preset item recommendation model; wherein, the preset item recommendation model is obtained by training according to any of the above-described item recommendation model training methods in any embodiment; Specifically, the model is trained on a global graph that includes all users and items. By propagating and aggregating information on this global graph, the training parameters, which contain the basic embedding representations in the embedding representations, are continuously adjusted during training, and finally a final basic embedding representation is learned for each user and item in the graph.
[0090] Step S202: Based on the above final embedding representation, obtain the first final basic embedding representation corresponding to the user to be recommended, and all second final basic embedding representations used to represent item nodes; Specifically, when there is a user to be recommended, the first final basic embedding representation corresponding to the user is found directly from the trained matrix containing the final basic embedding representations of all nodes. Similarly, the second final basic embedding representations of all items are found.
[0091] Step S203: Calculate the inner product of the first final basic node embedding representation and each of the second final basic node embedding representations to obtain the preference score of the user to be recommended for each item. Specifically, the preference score is calculated using the following formula: In the formula, This represents the preference score between the user u to be recommended and the item i. Let be the transpose of the first final base node embedding representation of the user u to be recommended. The second final base node embedding representation of item i.
[0092] Step S204: Select the items corresponding to the top N largest preference scores as target recommended items to recommend to the aforementioned users, and recommend them to the aforementioned users.
[0093] Specifically, a sorting table is generated by ranking all items in descending order according to their preference scores. Then, the top N items are selected from the top of the sorting table as target recommended items and recommended to the user.
[0094] Preferably, N can be set to 20.
[0095] The above are preferred embodiments of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for training an item recommendation model, characterized in that, include: Obtain several historical bipartite graphs generated from historical users, historical items, and the interaction relationships between historical users and historical items; The item recommendation model to be trained is iteratively trained according to the historical bipartite graph until the total loss function converges, so as to obtain the trained item recommendation model and the final embedding representation of each node. In each iteration, the initial embedding representation of each node is generated based on the current historical bipartite graph, the backbone encoder built into the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network. For each node, based on the initial embedding representation of the current node, the initial basic embedding representation of the remaining nodes, and the discriminator network built into the item recommendation model to be trained, a set of candidate nodes with high similarity to the current node and the discrimination score corresponding to each candidate node are generated. An activation operation is performed on the discrimination score to obtain the probability of each candidate node as a positive sample, and a set of difficult negative samples is generated based on the candidate nodes whose probabilities are not greater than a preset probability threshold. Based on the initial embedding representations and the set of difficult negative samples corresponding to all nodes, the value of the current total loss function is calculated. If the current total loss function converges, the item recommendation model training is complete; otherwise, the training parameters of the current item recommendation model are adjusted and training continues.
2. The item recommendation model training method according to claim 1, characterized in that, The process of generating initial embedding representations for each node based on the current historical bipartite graph, the backbone encoder built into the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network includes: Generate an initial adjacency matrix, an angle matrix, an initial user embedding matrix, and an initial item embedding matrix based on the current historical bipartite graph; The initial user embedding matrix and the initial item embedding matrix are concatenated to obtain the initial node feature matrix of the current historical bipartite graph; Based on the initial adjacency matrix and the angle matrix, the normalized adjacency matrix of the current historical bipartite graph is calculated. The normalized adjacency matrix and the initial node feature matrix are input into the backbone encoder for feature embedding fusion to obtain the initial basic embedding representation of each node. Based on the initial basic embedding representation, edge importance learning network, initial adjacency matrix, initial node feature matrix, and backbone encoder, a refined node embedding representation for each node is generated. Based on the initial adjacency matrix, initial node feature matrix, current historical bipartite graph, initial basic embedding representation, and feature fusion network, a comprehensive node embedding representation for each node is generated. The initial basic embedding representation, the refined node embedding representation, and the comprehensive node embedding representation are used as the initial embedding representation of the corresponding node.
3. The item recommendation model training method according to claim 2, characterized in that, The step of generating refined node embedding representations for each node based on the initial basic embedding representation, edge importance learning network, initial adjacency matrix, initial node feature matrix, and backbone encoder includes: Based on all the initial basic embedding representations, obtain the edge node vector corresponding to each edge in the current historical bipartite graph; For each edge in the current historical bipartite graph, the edge node vectors of the edge are combined and then input into the edge importance learning network to generate importance scores for each edge. Based on the importance scores and random perturbation noise, calculate the mask value of each edge, and construct an edge mask matrix based on the mask values of all edges. The refined adjacency matrix is calculated based on the edge mask matrix and the initial adjacency matrix. The refined adjacency matrix and the initial node feature matrix are input into the backbone encoder for feature embedding fusion to generate a refined node embedding representation for each node.
4. The item recommendation model training method according to claim 3, characterized in that, The step of generating a comprehensive node embedding representation for each node based on the initial adjacency matrix, initial node feature matrix, current historical bipartite graph, initial basic embedding representation, and feature fusion network includes: Perform graph convolution operation on the initial adjacency matrix and the initial node feature matrix to obtain the local feature node representation of each node; Perform a K-step random walk on the current bipartite historical graph to generate a higher-order neighborhood relation matrix; where K is a positive integer; Using the higher-order neighborhood relation matrix as a graph structure, graph convolution is performed on the initial basic embedding representation of each node to generate higher-order feature node representations; For each node, the local feature node representation and the higher-order feature node representation are concatenated and then input into the feature fusion network to generate the fusion score for each node. The fusion score is made differentiable to obtain the fusion weight of each node; The local feature node representation and the higher-order feature node representation are weighted and summed according to the fusion weights to calculate the comprehensive node embedding representation of each node.
5. The item recommendation model training method according to claim 4, characterized in that, The step of generating a set of candidate nodes with high similarity to the current node and a discrimination score for each candidate node based on the initial embedding representation of the current node, the initial basic embedding representations of the remaining nodes, and the discriminator network built into the item recommendation model to be trained includes: For each node, the cosine similarity between the current node and all other nodes is calculated based on the initial basic embedding representation of the current node and the initial basic embedding representation of the other nodes. The remaining nodes corresponding to the first M largest cosine similarities are used as candidate nodes to generate a candidate node set; where each node corresponds to a candidate node set; M is a positive integer; The initial basic embedding representation of the current node is concatenated with the initial basic embedding representations of each candidate node in the corresponding candidate node set, and then input into the discriminator network to generate the discrimination score corresponding to each candidate node.
6. The item recommendation model training method according to claim 5, characterized in that, The step of calculating the current total loss function value based on the initial embedding representations corresponding to all nodes and the hard negative sample set includes: Get the total number of nodes in the current historical bipartite graph; The first contrastive loss of each node is calculated based on the initial basic embedding representation, the refined node embedding representation, and the refined node embedding representation of each candidate node in the corresponding hard negative sample set. The second contrastive loss of each node is calculated based on the initial basic embedding representation of all nodes, the comprehensive node embedding representation, and the comprehensive node embedding representation of each candidate node in the corresponding hard negative sample set. The contrast loss of each node is calculated based on the sum of the first contrast loss and the second contrast loss. Based on the total number of nodes and the comparison loss of each node, the total comparison loss of the current historical bipartite graph is calculated. The current global regularization loss is calculated based on the current training parameters; The current principal loss is calculated based on the initial basic embedding representation; The current sparsity loss is calculated based on the sum of the mask values; The value of the current total loss function is calculated based on the current total contrastive loss, the current global regularization loss, the current principal loss, and the current sparsity loss of the current historical bipartite graph.
7. A training device for an item recommendation model, characterized in that, include: Historical data acquisition module and model training module; The historical data acquisition module is used to acquire several historical bipartite graphs generated by historical users, historical items, and the interaction relationships between historical users and historical items. The model training module is used to iteratively train the item recommendation model to be trained based on the historical bipartite graph until the total loss function converges, thereby obtaining the trained item recommendation model and the final embedding representation of each node. In each iteration, the initial embedding representation of each node is generated based on the current historical bipartite graph, the backbone encoder built into the item recommendation model to be trained, the built-in feature fusion network, and the built-in edge importance learning network. For each node, based on the initial embedding representation of the current node, the initial basic embedding representation of the remaining nodes, and the discriminator network built into the item recommendation model to be trained, a set of candidate nodes with high similarity to the current node and the discrimination score corresponding to each candidate node are generated. An activation operation is performed on the discrimination score to obtain the probability of each candidate node as a positive sample, and a set of difficult negative samples is generated based on the candidate nodes whose probabilities are not greater than a preset probability threshold. Based on the initial embedding representations and the set of difficult negative samples corresponding to all nodes, the value of the current total loss function is calculated. If the current total loss function converges, the item recommendation model training is complete; otherwise, the training parameters of the current item recommendation model are adjusted and training continues.
8. A terminal device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement a method for training an item recommendation model as described in any one of claims 1 to 6.
9. A storage medium, characterized in that, The storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to perform an item recommendation model training method as described in any one of claims 1 to 6.
10. A method for recommending items, characterized in that, include: Obtain the final embedded representations of the user to be recommended and each node corresponding to the preset item recommendation model; wherein, the preset item recommendation model is obtained by training an item recommendation model training method according to any one of claims 1-6; Based on the final embedding representation, obtain the first final basic embedding representation corresponding to the user to be recommended, and all second final basic embedding representations used to represent item nodes; Calculate the inner product of the first final basic node embedding representation and each of the second final basic node embedding representations to obtain the preference score of the user to be recommended for each item. The items corresponding to the top N largest preference scores are selected as target recommended items for the user to be recommended, and then recommended to the user.