A Graph Convolutional Recommendation Method and System for Aggregating Multiple Types of Neighbors
Through the graph convolution recommendation method of multiple types of neighbor aggregation, the samples are divided into positive samples, intermediate samples and negative samples, and different weights are assigned to the graph convolution network, which solves the problem of poor recommendation effect of the existing recommendation system and achieves higher recommendation accuracy and accuracy.
Patent Information
- Application Number
- CN202111116056.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-23
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2041-09-23
AI Technical Summary
The recommendation effect of the existing recommendation system is poor and cannot effectively utilize users' information needs and interests to accurately recommend.
A graph convolution recommendation method with multiple types of neighbor aggregation is adopted. By setting thresholds, the samples are divided into positive samples, intermediate samples and negative samples, a graph convolution network model is constructed, and different weights are assigned to the loss calculation, and parameters are iteratively optimized to improve the recommendation accuracy.
It significantly improves the accuracy of the recommendation system, can better reflect users' preferences for projects, and provide more accurate recommendation results.
Smart Images

Figure CN113850317B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information recommendation, and in particular relates to a graph convolution recommendation method and system for multi-category neighbor aggregation. Background Art
[0002] Currently, Internet technology is developing rapidly, but the amount of information is also increasing significantly. This makes it difficult for users to obtain the information that is truly useful to them when faced with a large amount of information, which in turn reduces people's utilization of information. With the emergence of recommendation systems, this problem has been effectively solved. Recommendation systems can recommend information and products that users are interested in to users based on their needs and interests, thereby saving users time. Summary of the invention
[0003] The purpose of the present invention is to provide a graph convolution recommendation method and system for multi-category neighbor aggregation, which solves the defect of poor recommendation effect existing in the recommendation system in the prior art.
[0004] In order to achieve the above object, the technical solution adopted by the present invention is:
[0005] The graph convolution recommendation method based on multi-category neighbor aggregation provided by the present invention comprises the following steps:
[0006] Step 1, setting the threshold;
[0007] Step 2: Divide the data samples in the training set and the test set according to the threshold set in step 1 to obtain a training set and a test set. Both sample sets consist of positive samples, intermediate samples, and negative samples.
[0008] Step 3: construct a graph convolutional network model based on the positive samples and intermediate samples obtained in step 2;
[0009] Step 4: Update the graph convolutional network model constructed in step 3 through loss calculation to obtain an updated graph convolutional network model;
[0010] Step 5: Recommend items based on the updated graph convolutional network model to obtain recommendation indicators;
[0011] Step 6, iteratively execute steps 4 and 5 until the output recommendation index tends to be stable;
[0012] Step 7: Optimize the threshold set in step 1, the parameters in the graph convolutional network model obtained in step 3, and the parameters of the loss calculation in step 4 according to the final recommendation index obtained in step 6 to obtain the optimized threshold and parameters;
[0013] Step 8: Iteratively execute Steps 2 to 7 until the threshold and each parameter in Step 7 reach the optimum; thus, an optimal graph convolutional network model is obtained, and project recommendations are made through the optimal graph convolutional network model.
[0014] Preferably, in Step 1, the specific method for setting the threshold is as follows:
[0015] An initial threshold is set based on the number of interactions between users and projects.
[0016] Preferably, in Step 2, the data samples are divided according to the set threshold, and the specific method is as follows:
[0017] Both the training set and the test set are classified according to the set threshold. Among them, the data with the number of interactions greater than the set threshold is used as the positive sample of the user, the data with the number of interactions between 0 and the set threshold is used as the intermediate sample, and the rest is used as the negative sample; the number of positive samples in the training set and the test set accounts for 85%-95% of the total number of positive samples and intermediate samples.
[0018] Preferably, in Step 3, a graph convolutional network model is constructed based on the positive samples and intermediate samples obtained in Step 1, and the specific method is as follows:
[0019] S21: Combine the data in the positive samples and intermediate samples in the training set obtained in Step 1 respectively to obtain the adjacency matrix A1 of the positive samples and the adjacency matrix A2 of the intermediate samples;
[0020] S22: Obtain the transfer function of the convolutional layer in the graph convolutional network model according to the adjacency matrix A1 of the positive samples and the adjacency matrix A2 of the intermediate samples obtained in S21;
[0021] S23: Randomly generate an initial embedding matrix, and combine it with the transfer function obtained in S22 to obtain the embedding matrix of each convolutional layer;
[0022] S24: Obtain the final embedding matrix of the graph convolutional network model according to the multiple embedding matrices obtained in S23; finally, the graph convolutional network model is obtained.
[0023] Preferably, in Step 4, the graph convolutional network model constructed in Step 3 is updated through loss calculation to obtain an updated graph convolutional network model, and the specific method is as follows:
[0024] Use the following formula to calculate the loss value of all users in the training set:
[0025] Loss = Loss1 + Loss2 + λ||E (0) || 2
[0026] Among them, Loss is the loss value of all users in the training set; Loss1 is the loss value of all users with intermediate samples during training; Loss2 is the loss value of all users without intermediate samples in the training set; λ is a coefficient; E (0) is a randomly generated initial embedding matrix; ||E (0) || 2 is the second norm of the initial embedding matrix E (0) and serves as a regularization term in the function expression to prevent overfitting.
[0027] According to the loss values of all users in the obtained training set, combined with the backpropagation method and the gradient descent method, update the obtained final embedding matrix; and use the updated final embedding matrix as the randomly generated initial embedding matrix for the next epoch;
[0028] Obtain the final embedding matrix of the graph convolutional network model according to the randomly generated initial embedding matrix; finally obtain the updated graph convolutional network model.
[0029] Preferably, in step 5, perform item recommendation according to the updated graph convolutional network model to obtain recommendation metrics. The specific method is:
[0030] Calculate the rating value between each user and each corresponding item; obtain the rating table for each user's corresponding items;
[0031] In descending order, obtain the top 20 items corresponding to the rating values from the rating table, and use these 20 items as the recommended item set for the user;
[0032] Use the positive sample set in the test set as the TestTrue set;
[0033] Calculate the recall recommendation metric, precision recommendation metric, and ndcg recommendation metric respectively according to the user's recommended item set and the TestTrue set.
[0034] Preferably, calculate the rating value between each user and each corresponding item through the following formula:
[0035]
[0036] where y ui represents the preference degree of user u for item i; e u is the embedding vector of user u after passing through multiple convolutional layers; is the transpose of the embedding vector of item i after passing through multiple convolutional layers.
[0037] A graph convolutional recommendation system based on multi-type neighbor aggregation, which can run the method, includes:
[0038] A threshold setting unit for setting a threshold;
[0039] A sample partitioning unit for partitioning data samples in a training set and a test set according to the set threshold to obtain a training set and a test set, both of which are composed of positive samples, intermediate samples, and negative samples;
[0040] A model construction unit for constructing a graph convolutional network model according to the obtained positive samples and intermediate samples;
[0041] A model updating unit for updating the constructed graph convolutional network model through loss calculation to obtain an updated graph convolutional network model;
[0042] A project recommendation unit for making project recommendations according to the updated graph convolutional network model to obtain recommendation metrics;
[0043] An iteration unit for iteratively executing until the output recommendation metrics tend to be stable;
[0044] A parameter optimization unit for optimizing the set threshold, the parameters in the obtained graph convolutional network model, and the parameters of loss calculation according to the obtained final recommendation metrics to obtain an optimized threshold and each parameter;
[0045] A model optimization unit for iteratively executing until the threshold and each parameter reach the optimum; thereby obtaining an optimal graph convolutional network model and making project recommendations through the optimal graph convolutional network model.
[0046] Compared with the prior art, the beneficial effects of the present invention are:
[0047] A graph convolutional recommendation method based on multi-type neighbor aggregation provided by the present invention divides samples into positive samples, intermediate samples, and negative samples by setting conditions. Dividing these three types of samples is an indispensable step for subsequent loss calculation; in the neighbor aggregation part, the neighbor information aggregated by many recommendation system models comes from the connection information contained in positive samples, but this method makes some adjustments to the aggregation of neighbor information; among the three types of samples, since the connection information contained in positive samples and intermediate samples has a positive effect on neighbor aggregation, but their influences are different, therefore, when aggregating neighbor information, this method assigns different weights to the connection information contained in positive samples and intermediate samples, and then continuously passes the aggregated neighbor information downward through the convolutional layer; when calculating the loss, corresponding to the above network structure, the loss is calculated according to the three types of samples divided. Compared with the recommendation method based on positive and negative samples, the recommendation accuracy of this method has been significantly improved, and it can better recommend for users. Therefore, this method has certain reference significance for other recommendation models. Description of the Drawings
[0048] Figure 1 is the overall flowchart of this method;
[0049] Figure 2 is the schematic diagram of neighbor aggregation and transmission in Embodiment 1. Specific embodiments
[0050] The present invention will be further described in detail below with reference to the accompanying drawings.
[0051] As Figure 1 、 Figure 2 shown, a graph convolutional recommendation method based on multi-type neighbor aggregation provided by the present invention includes the following steps:
[0052] Step 1, divide the data set into a training set and a test set, set a threshold based on the number of interactions, and classify both the training set and the test set according to this threshold to obtain positive samples, intermediate samples, and negative samples; wherein, the proportion of positive samples and intermediate samples in the training set and the test set is between 85% and 95%.
[0053] The data set includes multiple pieces of data, and each piece of data includes a user ID, an item ID, and the number of interactions.
[0054] Many data sets contain multiple types of data. For example, there are data sets containing users, items, and the number of interactions, and there are also data sets containing users, items, and ratings, etc. However, in the neighbor aggregation part of many models, data such as the number of interactions and ratings are not considered. As long as there is an interaction record between a user and an item, this part of the interaction information will be aggregated and these interacting items will be used as positive samples, and other items will be used as negative samples of the user. However, the number of interactions varies, and some interactions with fewer times cannot reflect the user's preference for the item. When using such data sets, dividing the samples into positive and negative two types of samples for subsequent calculations cannot achieve the optimal recommendation effect. Therefore, we try to set a threshold on the number of interactions and classify the original data set by setting the threshold. Through classification, on the basis of the original positive and negative samples, the samples are divided into three categories: positive samples, intermediate samples, and negative samples. The sample division process is as follows:
[0055] S11, set an initial threshold ε based on the number of interactions between the user and the item, and classify both the training set and the test set according to this initial threshold ε to obtain positive samples, intermediate samples, and negative samples; wherein, the number of positive samples in the training set and the test set accounts for 85% - 95% of the total number of positive samples and intermediate samples;
[0056] The data with the number of interactions greater than the initial threshold ε is used as the positive sample of the user, the data with the number of interactions between 0 and the initial threshold ε is used as the intermediate sample, and the rest is used as the negative sample;
[0057] S12. Set the threshold range. The value of the threshold ε needs to be continuously adjusted according to the recommended metrics obtained subsequently. Set the upper and lower limits in advance, and then continuously adjust the value of the threshold ε within the upper and lower limits according to the set amplitude. When adjusting, it is also necessary to ensure that the ratio of positive samples and intermediate samples in the training set and the test set is between 85% and 95%.
[0058] Step 2. Construct a graph convolutional network model
[0059] S21. Combine the data in the positive samples and intermediate samples in the training set in Step 1 respectively to obtain the adjacency matrix A1 of the positive samples and the adjacency matrix A2 of the intermediate samples;
[0060] S22. Obtain the transfer function of the convolutional layer in the graph convolutional network model according to the adjacency matrix A1 of the positive samples and the adjacency matrix A2 of the intermediate samples obtained in S21;
[0061] S23. Obtain the embedding matrix of each convolutional layer according to the transfer function obtained in S22;
[0062] S24. Obtain the final embedding matrix of the graph convolutional network model according to the multiple embedding matrices obtained in S23; Finally, obtain the graph convolutional network model.
[0063] Specifically, in S22: Since the positive samples and intermediate samples play different roles in neighbor aggregation, different weights, α and β respectively, are assigned to the aggregated positive sample information and intermediate sample information. The transfer function is:
[0064]
[0065] Among them, A1 is the adjacency matrix of the positive samples, indicating that the aggregated neighbor information comes from the positive samples; D1 is the degree matrix of A1; A2 is the adjacency matrix of the intermediate samples, indicating that the aggregated neighbor information comes from the intermediate samples; D2 is the degree matrix of A2; E k represents the embedding matrix of the k-th layer; E k+1 represents the embedding matrix of the (k + 1)-th layer; α and β are normalized. Similarly, initial values are assigned first, and then adjusted continuously according to the amplitude until the parameters corresponding to the optimal recommendation result are found.
[0066] In S23, the number of rows of the embedding matrix is the sum of the number of users and items, and the number of columns is the embedding dimension; randomly generate the initial embedding matrix E (0) ; Through the transfer rule of the convolutional layer, the embedding matrix of the next layer can be obtained from the embedding matrix of the previous layer.
[0067] In S24, after obtaining the embedding matrix of each layer through the propagation rule, it is necessary to perform weighted summation on the embedding matrix of each layer to obtain the final embedding matrix. Its expression is:
[0068] E = α0E (0) + α1E (1) + α2E (2) +... + α k E (k) (8)
[0069] where α k represents the weight corresponding to each layer of the embedding matrix. Since the value of α0 + α1 +... + α k must be 1, and the importance of each embedding matrix between E (0) and E k is the same, so each parameter of α0 to α k needs to be equal, and the value is 1 / (K + 1).
[0070] Step 3: Calculate three recommendation metrics according to the constructed graph convolutional network model. Among them, the three recommendation metrics are recall, precision, and ndcg respectively. The specific method is as follows:
[0071] First, between the user and the target, it is defined that for a user and an item, the dot product of the vectors after passing through all convolutional layers will obtain a rating value, which can be regarded as the preference degree of the user for the item. The calculation formula of the rating value is abbreviated as y, and the specific formula is as follows. Then, calculate the preference degrees of m users for n items:
[0072]
[0073] where y ui represents the preference degree of user u for item i; e u is the embedding vector of user u after passing through multiple convolutional layers; is the transpose of the embedding vector of item i after passing through multiple convolutional layers.
[0074] According to the above formula, the preference degrees of m users for n items can be obtained, that is, the rating table is obtained, and the size of the rating table is m * n.
[0075] Next, select the top 20 items corresponding to the rating values for each user from this rating table to obtain the top 20 items corresponding to each user as the recommended item subset for this user. It should be noted that if a recommended item of a user already exists in the training set, then this item needs to be removed from the user's recommended list and new recommended items need to be added;
[0076] Next, combine the recommended item subsets corresponding to m users to obtain the user recommended item set, denoted as the rating set;
[0077] Next, denote the positive sample set of users in the test set as the TestTrue set. Based on the rating set and the TestTrue set, three recommendation metrics, recall, precision, and ndcg, can be calculated.
[0078] Step 4: Calculate the loss value in the training set
[0079] According to Step 1, the samples in the training set are divided into three categories: positive samples, intermediate samples, and negative samples. Therefore, when calculating the loss, it is necessary to consider how to calculate the loss based on the differences between the three types of samples.
[0080] Since the difference between positive samples and intermediate samples is relatively small compared to negative samples, the differences between positive samples and negative samples and between intermediate samples and negative samples are mainly considered in the loss calculation process. Here, the difference can be measured by the difference in rating values. At the same time, when calculating, it is necessary to judge whether the user has intermediate samples. For the same user, since the intermediate samples are relatively special, the user may not have intermediate samples. Therefore, the calculation of the loss function needs to be carried out in segments. Specifically:
[0081] 1) For users with intermediate samples, denote their user set as U1, N u1 as the positive sample set of these users, M u1 as the intermediate sample set of these users, and L u1 as the negative sample set of the users. Then the loss calculation method for this part of users is as follows:
[0082]
[0083] where σ is the activation function; ω and γ are weights, and ω + γ = 1; is the loss calculated through the positive and negative samples of the user. The goal of loss calculation is to expand the differences between positive samples and negative samples and between intermediate samples and negative samples. Since it was proposed above that y ui represents the preference degree of user u for item i, therefore, when y ui - y uj has a larger value, the difference between item i and item j is more obvious, and the loss value calculated for this part is smaller. And this part is the same in principle, but this part is the loss calculated through the intermediate samples and negative samples of the user. The proportions of these two parts of loss calculation (i.e., ω and γ) cannot be directly judged and need to be found through continuous experiments to find the optimal values.
[0084] 2) For users without intermediate samples, denote their user set as U2, and the positive sample set of these users is N u2 , and the negative sample set is denoted as Lu2 , the loss calculation method for this part of users is as follows:
[0085]
[0086] Among them, σ is the activation function. Since there are no intermediate samples for the users in U2, there is no need to consider the difference between intermediate samples and negative samples. Therefore, in , it is mainly considered how to set the loss function through the difference between positive samples and negative samples. The principle is the same as the part of calculating the loss through positive and negative samples of users in formula (10).
[0087] In addition, we should also add the second norm to the overall loss to prevent overfitting. Its coefficient is λ. Therefore, the final loss is:
[0088] Loss = Loss1 + Loss2 + λ||E (0) || 2 (12)
[0089] Among them, Loss is the loss value of all users in the training set; Loss1 is the loss value of all users with intermediate samples in the training; Loss2 is the loss value of all users without intermediate samples in the training set; λ is the coefficient; E (0) is the randomly generated initial embedding matrix; ||E (0) || 2 is the second norm of the initial embedding matrix E (0) , which is used as a regularization term in the function expression (12) to prevent overfitting.
[0090] Step 5: According to the final loss value, combined with the backpropagation method and the gradient descent method, update the final embedding matrix in Step 2 to obtain the updated embedding matrix; and use this updated embedding matrix as the initial embedding matrix E for the next epoch 0 , and iteratively execute Steps 2 to 4 until the three recommended metrics output in Step 3 tend to be stable;
[0091] The number of epochs is set according to the change curve of the loss value. The value of epoch should be selected in the stable region of the loss change curve. If the set number of epochs is M, then for each update of the parameters, M epochs are required.
[0092] Step 6: Use the final three recommended metrics in Step 5 as the basic recommended metrics, and update the threshold ε, weights α, β, ω, γ respectively within the set threshold ε range, weight α range, weight β range, weight ω range, weight γ range; iteratively execute Steps 1 to 5 to find the optimal parameters through the recommended metrics.
[0093] In step 5, the final three recommended metrics refer to selecting the maximum values from all the recommended metrics that tend to be stable as the final three recommended metrics, and using them to measure the recommendation effect of the current model.
[0094] The threshold ε for dividing positive samples, intermediate samples, and negative samples in step (1) of the present invention is continuously adjusted through experiments.
[0095] In step (2) of the present invention, the aggregated neighbor information comes from the connection information included in positive samples and intermediate samples, and the proportions of the two are different.
[0096] In step (3) of the present invention, the calculation of the loss function of the model corresponds to the network structure, which can significantly improve the recommendation effect.
[0097] Since the present invention is based on using a convolutional network and divides samples into positive samples, intermediate samples, and negative samples through the set conditions, compared with the traditional method of dividing positive and negative samples, this method can better reflect the differences between samples and more deeply reflect the user's preference for items. In addition, during the aggregation and transmission process, this method assigns different weights to the connection information included in positive samples and intermediate samples, making the network structure of the entire method clearer and more reasonable. When calculating the loss subsequently, the loss is calculated corresponding to the network structure, making the overall structure more perfect. Through these three steps, the recommendation effect of this method has been significantly improved compared with the traditional method, and it has certain reference significance for other recommendation algorithms.
[0098] Example 1
[0099] Use the lastfm dataset, which contains 1,892 users and 4,489 items. There are a total of 42,135 interaction data in the training set and 10,533 interaction data in the test set. Both the training set and the test set contain three types of data. The first column of data represents the user, the second column represents the item, and the third column represents the number of interactions. The convolutional layer network in the entire method has 3 layers, and the embedding dimension of the vector is 64 dimensions.
[0100] (1) Data sample division
[0101] Set an initial threshold of 35, and the setting basis is the number of interactions in the training set. According to the number of interactions, the ratio of positive samples and intermediate samples in the training set and the test set after division is both around 9:1. The set initial threshold is 35. When classifying samples, the items with the number of interactions greater than 35 in the training set and the test set are used as positive samples of the user, the items with the number of interactions between 0 and 35 are used as intermediate samples of the user, and the samples obtained by subtracting positive samples and intermediate samples from all items are used as negative samples.
[0102] (2) Subsequently, the size of the threshold ε needs to be continuously adjusted according to the recommended metrics. During the adjustment, it is necessary to ensure that the ratio of positive samples and intermediate samples in both the training set and the test set is around 9:1. The downward adjustment range is 25 - 35, the upward adjustment range is 35 - 50, and the adjustment amplitude is 5. The optimal threshold is found through continuous adjustment.
[0103] (2) Multi - neighbor aggregation and transmission
[0104] According to (1), the current ε is 35, and this method divides the samples into three categories: positive samples, intermediate samples, and negative samples. At this time, there are 38358 positive sample data and 9555 intermediate sample data in the training set. During the neighbor aggregation process, through experimental comparison, it is found that aggregating the neighbor information of negative samples has a negative impact on the experimental results. Therefore, during the neighbor aggregation process, we mainly focus on aggregating the neighbor information of positive samples and intermediate samples. Considering the different roles of positive samples and intermediate samples in neighbor aggregation, we assign different weights to the aggregated positive sample information and intermediate sample information, which are α and β respectively. The aggregated information is transmitted between convolutional layers, and the transmission rules are as follows:
[0105]
[0106] Among them, both A1 and A2 are matrices of 1892 * 4489, and the sizes of D1 and D2 are both 1892 * 1. A1 is the connection matrix of positive samples, indicating that the aggregated neighbor information comes from positive samples, and D1 is the degree matrix of A1; A2 is the connection matrix of intermediate samples, indicating that the aggregated neighbor information comes from intermediate samples, and D2 is the degree matrix of A2. E k represents the embedding matrix of the k - th layer, and E k+1 represents the embedding matrix of the (k + 1) - th layer. In the embedding matrices of users and items, the rows are the sum of behavioral users and items, and the columns are the embedding dimensions. The initial embedding matrix E 0 is randomly generated and is a matrix of 6381 * 64. According to the transmission rules of the convolutional layer, the embedding matrix of the next layer can be obtained from the embedding matrix of the previous layer. The parameters α and β are normalized. α takes values from 0 to 1, and is adjusted by 0.1 each time, and β changes accordingly. The current values of α and β are α = 0.9 and β = 0.1.
[0107] After obtaining the embedding matrix of each layer through the propagation rules, it is necessary to perform weighted summation on the embedding matrix of each layer to obtain the final embedding matrix, and its expression is:
[0108] E = α0E (0) +α1E (1) +α2E (2) +...+α k E (k) (14)
[0109] Among them, α0...α k represents the weights corresponding to the embedding matrix of each layer. In this example, the number of network layers is 3. Therefore, the values of each parameter from α0 to α k are 1 / 4.
[0110] (3) Make recommendations
[0111] Between the user and the target, we define that for a user and an item, their dot product of vectors will obtain a rating value, abbreviated as y. The formula is as follows:
[0112]
[0113] Among them, e u and e i represent the embedding vectors of user u and item i after passing through multiple convolutional network layers. A rating table for each user regarding each item can be obtained, and the size of the table is 1892 * 4489. Take the top 20 items with the highest rating values for each user in this rating table, denoted as the rating set, and this set is the recommended set. At the same time, find the set of positive samples of the user in the test set, denoted as the TestTrue set, and calculate three recommendation metrics, recall, precision, and ndcg, based on these two sets.
[0114] (4) Calculation of loss
[0115] E 0 As the initial embedding matrix is not fixed, the E 0 in each training and testing cycle is constantly changing. Calculating the loss is to continuously optimize and train the initial embedding matrix E 0 , thereby improving our recommendation effect. According to the formula:
[0116]
[0117] Perform subsequent loss calculations.
[0118] According to (1) and (2), since the samples in the training set are divided into three categories: positive samples, intermediate samples, and negative samples, when calculating the loss, we need to consider how to calculate the loss through these three types of samples. Since the difference between positive samples and intermediate samples is relatively small compared to negative samples, the main factors considered in the loss calculation process are the rating differences between positive samples and negative samples, and between intermediate samples and negative samples. At the same time, it is necessary to judge whether the user has intermediate samples. For the same user, because intermediate samples are relatively special, this user may not have intermediate samples. Therefore, we need to calculate the loss function in segments according to this situation. The calculation formula is as follows:
[0119] 1) For users with intermediate samples, the set of these users is denoted as U1, N u1 is the set of positive samples of these users, M u1 is the set of intermediate samples of these users, L u1 is the set of negative samples of the user. Then the loss calculation method for this part of users is as follows:
[0120]
[0121] 2) For users without intermediate samples, the set of these users is denoted as U2, and the set of positive samples of these users is N u2 , and the set of negative samples is denoted as L u2 . The loss calculation method for this part of users is as follows:
[0122]
[0123] In addition to calculating the loss according to the above, we should also add the second norm to the overall loss to prevent overfitting. Its coefficient is λ. Therefore, the final loss function is:
[0124] Loss = Loss1 + Loss2 + λ||E (0) || 2 (18)
[0125] where the value of λ is 6 * 10 -4 . According to the set loss function, continuously update and optimize the initial embedding matrix E for each test and training cycle 0 . Take one test and training as an epoch. The whole method needs to be carried out for 1000 epochs, and the best result is taken among the 1000 epochs. Among the 1000 epochs, the recall of the recommended metrics is 0.2836, the ndcg is 0.2183, and the precision is 0.0756
[0126] In the above, the selection of the threshold, the parameters in the aggregation transfer process, and the parameters in the loss calculation process all need to be continuously adjusted to find the optimal values. Each time a value is adjusted, 1000 epochs are required. By calculating the three optimal parameter indicators among the 1000 times, it is observed whether the adjusted value is the optimal value. Through multiple experiments, the optimal value of the threshold selection is 45, the optimal values of α and β in the aggregation transfer are 1 and 0 respectively, and the optimal values of α and β in the loss calculation process are 0.9 and 0.1 respectively. At this time, the recommendation indicators are calculated, and the recall is 0.2932, the ndcg is 0.2226, and the precision is 0.0759.
Claims
1. A graph convolution recommendation method based on multi - type neighbor aggregation, characterized in that, It includes the following steps: Step 1, set a threshold value; Step 2, divide the data samples in the training set and the test set according to the threshold value set in Step 1 to obtain a training set and a test set. Both sample sets include positive samples, intermediate samples, and negative samples; Step 3, construct a graph convolutional network model based on the positive samples and intermediate samples obtained from the training set in Step 2; Step 4, update the graph convolutional network model constructed in Step 3 through loss calculation to obtain an updated graph convolutional network model; Step 5, perform project recommendation according to the updated graph convolutional network model and obtain a recommendation metric in combination with the test set; Step 6, iteratively execute Step 4 and Step 5 until the output recommendation metric tends to be stable; Step 7, optimize the threshold value set in Step 1, the parameters in the graph convolutional network model obtained in Step 3, and the parameters of the loss calculation in Step 4 according to the final recommendation metric obtained in Step 6 to obtain an optimized threshold value and each parameter; Step 8, iteratively execute Step 2 to Step 7 until the threshold value and each parameter in Step 7 reach the optimum; thereby obtaining an optimum graph convolutional network model and performing project recommendation through the optimum graph convolutional network model. In Step 1, the specific method for setting the threshold value is: Set an initial threshold value based on the number of interactions between users and projects; Divide the data samples according to the set threshold value. The specific method is: Classify both the training set and the test set according to the set threshold value. Among them, the data with the number of interactions greater than the set threshold value is used as the positive sample of the user, the data with the number of interactions between 0 and the set threshold value is used as the intermediate sample, and the rest is used as the negative sample.
2. The graph convolution recommendation method based on multi-type neighbor aggregation according to claim 1, wherein In Step 2, The number of positive samples in the training set and the test set accounts for 85%-95% of the total number of positive samples and intermediate samples.
3. A graph convolutional recommendation method based on multi - type neighbor aggregation according to claim 1, characterized in that, In Step 3, construct a graph convolutional network model according to the positive samples and intermediate samples obtained in Step 1. The specific method is: S21, combine the data in the positive samples and intermediate samples in the training set in step 1 respectively to obtain the adjacency matrix of the positive samples and the adjacency matrix of the intermediate samples ; S22. The adjacency matrix of the positive samples obtained according to S21 and the adjacency matrix of the intermediate samples are used to obtain the transfer function of the convolutional layer in the graph convolutional network model; S23, randomly generate an initial embedding matrix, and combine it with the transfer function obtained in S22 to obtain the embedding matrix of each convolutional layer; S24, obtain the final embedding matrix of the graph convolutional network model according to the multiple embedding matrices obtained in S23; finally obtain the graph convolutional network model.
4. A graph convolutional recommendation method based on multi-type neighbor aggregation according to claim 3, characterized in that In Step 4, update the graph convolutional network model constructed in Step 3 through loss calculation to obtain an updated graph convolutional network model. The specific method is: Use the following formula to calculate the loss values of all users in the training set: Among them, is the loss value of all users in the training set; is the loss value of all users with intermediate samples during training; is the loss value of all users without intermediate samples in the training set; is the coefficient; is the randomly generated initial embedding matrix; is the initial embedding matrix of the second norm, which is used as a regularization term in the function expression to prevent overfitting; According to the obtained loss values of all users in the training set, combine the backpropagation method and the gradient descent method to update the obtained final embedding matrix; and use the updated final embedding matrix as the randomly generated initial embedding matrix for the next epoch; Obtain the final embedding matrix of the graph convolutional network model according to the randomly generated initial embedding matrix; finally obtain the updated graph convolutional network model.
5. The graph convolutional recommendation method based on multi-type neighbor aggregation according to claim 1, characterized in that In Step 5, perform project recommendation according to the updated graph convolutional network model and obtain a recommendation metric in combination with the test set. The specific method is: Calculate the rating value between each user and each corresponding project; obtain the rating table of each user corresponding to the project; Retrieve the items corresponding to the top 20 rating values from the rating table in descending order, and use these 20 items as the set of recommended items for the user; Use the set of positive samples in the test set as the TestTrue set; Calculate the recall recommendation metric, precision recommendation metric, and ndcg recommendation metric respectively based on the user's set of recommended items and the TestTrue set.
6. The graph convolutional recommendation method based on multi - type neighbor aggregation according to claim 5, wherein, Calculate the rating value between each user and each corresponding item through the following formula: Among them, represents the preference degree of the user for the project ; is the embedding vector of user u after passing through multiple convolutional layers; is the transpose of the embedding vector of project i after passing through multiple convolutional layers.
7. A graph convolutional recommendation system based on the aggregation of multiple types of neighbors, characterized in that, The system can run the method described in any one of claims 1-6, including: A threshold setting unit for setting a threshold; A sample partitioning unit for partitioning the data samples in the training set and the test set according to the set threshold to obtain a training set and a test set, and both sample sets include positive samples, intermediate samples, and negative samples; A model construction unit for constructing a graph convolutional network model based on the obtained positive samples and intermediate samples; A model update unit for updating the constructed graph convolutional network model through loss calculation to obtain an updated graph convolutional network model; An item recommendation unit for making item recommendations based on the updated graph convolutional network model and obtaining recommendation metrics in combination with the test set; An iteration unit for iteratively executing until the output recommendation metrics tend to be stable; A parameter optimization unit for optimizing the set threshold, the parameters in the obtained graph convolutional network model, and the parameters of the loss calculation according to the obtained final recommendation metrics to obtain an optimized threshold and each parameter; A model optimization unit for iteratively executing until the threshold and each parameter reach the optimum; and then obtaining an optimal graph convolutional network model, and making item recommendations through the optimal graph convolutional network model.
Citation Information
Patent Citations
Method for improving diversity of recommendation system
CN108268900A
Knowledge graph driven personalized accurate recommendation method
CN110955834A