Training of an object recommendation model, object recommendation method, apparatus and device
By combining matrix factorization and social relationship networks to train an object recommendation model, the problems of new user recommendation and niche interest identification are solved, achieving accurate recommendations even without data for new users, and improving the stability and accuracy of the recommendation model.
Patent Information
- Application Number
- CN202311459564.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-03
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2043-11-03
AI Technical Summary
In existing technologies, collaborative filtering recommendation methods cannot recommend items to new users, and social relationship-based recommendation methods cannot collaboratively process social relationships and user-item relationship tables, resulting in insufficient recommendation accuracy.
By acquiring user and object interaction information, latent vectors of users and objects are obtained using matrix factorization. Combined with social relationship networks, an object recommendation model is constructed, including a social latent effect layer, a social behavior attention mechanism layer, and a social latent vector extraction layer. The objective optimization function is calculated for model training.
It can still make accurate recommendations even when there is no data for new users, which improves the training effect and stability of the object recommendation model and enhances the accuracy of recommendations, especially the ability to identify niche and unique preferences.
Smart Images

Figure CN118822634B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of Internet application, and in particular to a training method of an object recommendation model, an object recommendation method, device and equipment. BACKGROUND
[0002] The advertisement recommendation system is one of typical application results of the recommendation system at present, and is also an important form of the Internet advertisement at present. The large e-commerce websites begin to promote their products by means of the advertisement recommendation system, and the companies compare the historical data of the users and the consumption preferences of the users by means of reasonable application of data mining and related program algorithms, and truly predict the goods which the users may be interested in and trigger the purchase behavior.
[0003] The recommendation algorithm is the most core part in the advertisement recommendation system, and directly determines the effect of the advertisement recommendation. In recent years, the recommendation algorithms emerge in an endless stream, including the collaborative filtering recommendation and the recommendation based on social relationship, etc. The collaborative filtering recommendation is to recommend the goods similar to the goods which the user likes before or the goods which other users with similar interests like. The recommendation based on social relationship is to recommend the goods according to the preference influence of the users with social relationship to the current user.
[0004] However, the inventor finds that the prior art at least has the following problems: when there is no data of the new user, the method of the collaborative filtering recommendation cannot recommend the goods to the new user well, and cannot obtain some unique preferences of the small groups. The recommendation based on social relationship cannot simultaneously process the two types of data of the social relationship and the user-goods relationship table, and influences the accuracy of the goods recommendation. SUMMARY
[0005] The object recommendation model training method, the object recommendation method, the device and the equipment provided by the embodiments of the present application can realize the training of the object recommendation model based on the social relationship network of the users and the relationship data between the users and the objects, so as to accurately recommend the objects to the users by means of the object recommendation model.
[0006] To achieve the above object, the embodiments of the present application provide a training method of an object recommendation model, comprising:
[0007] Obtaining the interaction information between the users and the objects to obtain a user-object relationship matrix; wherein the users include a first user and at least one second user with social relationship to the first user;
[0008] According to the user-object relationship matrix, a matrix decomposition method is adopted to obtain the hidden vector of the first user, the hidden vector of the second user and the hidden vector of the object related to the first user;
[0009] inputting the latent vector of the first user and the latent vector of the second user into a preset object recommendation model, and calculating a social latent vector of the first user; wherein the social latent vector is used to represent the preference of the first user and the influence of the second user on the preference of the first user;
[0010] determining a target optimization function of the object recommendation model according to the latent vector of the object and the social latent vector of the first user;
[0011] updating parameters of the object recommendation model to minimize the target optimization function, and obtaining a trained object recommendation model.
[0012] As an improvement of the above scheme, the object recommendation model comprises a first sub-model, a second sub-model and a third sub-model.
[0013] The method further comprises:
[0014] inputting the latent vector of the first user and the latent vector of each second user into the first sub-model, analyzing the social potential influence of each second user on the preference of the first user, and obtaining an influence latent vector of each second user on the preference of the first user;
[0015] inputting the latent vector of the first user and the corresponding influence latent vector of the second user into the second sub-model, analyzing the attention weight of each second user on the preference of the first user, and weighting the corresponding influence latent vector of each second user according to the attention weight, and calculating a preference potential vector of the first user;
[0016] inputting the latent vector of the first user and the preference potential vector of the first user into the third sub-model, and determining the social latent vector of the first user based on the output of the third sub-model.
[0017] As an improvement of the above scheme, the first sub-model comprises a first shared embedding layer and a first multi-layer perceptron network module, and the first multi-layer perceptron network module is composed of a plurality of hidden layers.
[0018] The method further comprises:
[0019] inputting the latent vector of the first user and the latent vector of each second user into the first shared embedding layer for calculation; a calculation formula of the first shared embedding layer is:
[0020]
[0021] inputting an output result of the first shared embedding layer into a first hidden layer of the first multi-layer perception network module, and sequentially inputting an output result of a current hidden layer into a next hidden layer for calculation; a calculation formula of each hidden layer is:
[0022]
[0023] according to an output result of a last hidden layer, calculating an influence latent vector of a preference influence of each second user on the first user:
[0024]
[0025] wherein, u u is the latent vector of the first user, u ufp is the latent vector of the pth second user, and respectively represent a weight matrix of the latent vector of the first user and the pth second user, is a weight matrix of the q-1th layer, is a weight matrix of the last hidden layer; and respectively are preset bias vectors, g is a relu activation function, p = 1, 2, …, k; q = 1, 2, …, h; k is the number of the second users, and h is the number of the hidden layers.
[0026] As an improvement of the above scheme, the second sub-model comprises a behavior attention mechanism module formed by a single layer perception;
[0027] The inputting the latent vector of the first user and the corresponding influence latent vector of the second user into the second sub-model, analyzing an attention weight of a preference influence of each second user on the first user, and performing weighted processing on the corresponding influence latent vector of each second user according to the attention weight to calculate a preference latent vector of the first user, comprises:
[0028] inputting the latent vector of the first user and the corresponding influence latent vector of the second user into the behavior attention mechanism module to calculate an attention coefficient of a preference influence of each second user on the first user:
[0029]
[0030] The attention coefficient corresponding to each second user is normalized by a softmax function to obtain an attention weight corresponding to each second user:
[0031]
[0032] According to the influence hidden vector corresponding to each second user and the attention weight corresponding to each second user, a preference latent vector of the first user is calculated by using the following weighted function:
[0033]
[0034] wherein, u u is the hidden vector of the first user, f up is the influence hidden vector corresponding to the pth second user, and is a preset weight matrix, b ψ is a preset bias vector, the superscript ψ is a behavior attention mechanism module, p = 1, 2, …, k; k is the number of second users.
[0035] As an improvement of the above scheme, the third sub-model comprises a second shared embedding layer and a second multi-layer perceptron network module, and the second multi-layer perceptron network module is composed of a plurality of hidden layers;
[0036] The method further comprises:
[0037] The hidden vector of the first user and the preference latent vector of the first user are input into the second shared embedding layer for calculation;
[0038] The output result of the second shared embedding layer is input into a first hidden layer of the second multi-layer perceptron network module, and the output result of the current hidden layer is sequentially input into a next hidden layer for calculation;
[0039] The social hidden vector of the first user is obtained according to the output result of the last hidden layer.
[0040] As an improvement of the above scheme, the hidden vector of the object related to the first user comprises a hidden vector of an object that has interacted with the first user and a hidden vector of an object that has not interacted with the first user;
[0041] The method further comprises:
[0042] According to the latent vector of the object interacted by the first user, the latent vector of the object not interacted by the first user and the social latent vector of the first user, a target optimization function of the object recommendation model is calculated as:
[0043]
[0044] wherein, sigma is a logistic sigmoid function; z u is the social latent vector of the first user, is the latent vector of the object interacted by the first user; is the latent vector of the object not interacted by the first user.
[0045] The embodiment of the application further provides an object recommendation method, which adopts the object recommendation model trained by the training method of any one of the above object recommendation models to perform object recommendation, and the object recommendation method comprises the following steps:
[0046] obtaining the latent vector of a target user, the latent vector of at least one user having a social relationship with the target user and the latent vector of an object to be recommended;
[0047] inputting the latent vector of the target user and the latent vector of the at least one user having a social relationship with the target user into the object recommendation model to calculate the social latent vector of the target user;
[0048] matching the latent vector of the object to be recommended and the social latent vector of the target user to obtain the recommendation priority of each object to be recommended;
[0049] performing object recommendation on the target user according to the recommendation priority of each object to be recommended.
[0050] The embodiment of the application further provides a training device of an object recommendation model, which comprises:
[0051] a relationship matrix obtaining module, which is used for obtaining the interaction information of a user and an object to obtain a user-object relationship matrix; wherein the user comprises a first user and at least one second user having a social relationship with the first user;
[0052] a matrix decomposition module, which is used for obtaining the latent vector of the first user, the latent vector of the second user and the latent vector of the object related to the first user according to the user-object relationship matrix by using a matrix decomposition method;
[0053] The first hidden vector calculation module is configured to input the hidden vector of the first user and the hidden vector of the second user into a preset object recommendation model, and calculate a social hidden vector of the first user, wherein the social hidden vector is used to represent the preference of the first user and the influence of the second user on the preference of the first user.
[0054] The target optimization function calculation module is configured to determine a target optimization function of the object recommendation model according to the hidden vector of the object and the social hidden vector of the first user.
[0055] The object recommendation model training module is configured to update parameters of the object recommendation model with the target optimization function minimization as a target, and obtain a trained object recommendation model.
[0056] The embodiment of the present application further provides an object recommendation device, which adopts the trained object recommendation model by the training method of the object recommendation model according to any one of the above, and performs object recommendation, and the object recommendation device comprises:
[0057] The data acquisition module is configured to acquire a hidden vector of a target user, hidden vectors of at least one user having a social relationship with the target user, and a hidden vector of a to-be-recommended object.
[0058] The second hidden vector calculation module is configured to input the hidden vector of the target user and the hidden vectors of the at least one user having a social relationship with the target user into the object recommendation model, and calculate a social hidden vector of the target user.
[0059] The recommendation priority calculation module is configured to match the hidden vector of the to-be-recommended object and the social hidden vector of the target user, and obtain a recommendation priority of each to-be-recommended object.
[0060] The object recommendation module is configured to perform object recommendation on the target user according to the recommendation priority of each to-be-recommended object.
[0061] The embodiment of the present application further provides a terminal device, which comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and the processor implements the training method of the object recommendation model according to any one of the above or the object recommendation method according to any one of the above when executing the computer program.
[0062] The embodiment of the present application further provides a computer readable storage medium, which comprises a stored computer program, wherein the computer readable storage medium controls a device where the computer readable storage medium is located to execute the training method of the object recommendation model according to any one of the above or the object recommendation method according to any one of the above when the computer program runs.
[0063] Compared with the prior art, the object recommendation model training, object recommendation method, device, equipment and medium disclosed by the application solve the problem that the user-object relationship matrix and the user social relationship network cannot be cooperatively processed by receiving the interaction information of the user and the object, using a matrix decomposition method to obtain the implicit vector of the user and the implicit vector of the object. The social implicit vector of the user is calculated by analyzing the influence of the preferences of friends in the social relationship network of the user and the influence size, so as to calculate a target optimization function to realize the training of the object recommendation model. The application can also perform object recommendation when a new user has no any data, effectively avoids the shortcomings of respective models by integrating collaborative filtering and social recommendation algorithms and fusing the matrix decomposition in the collaborative filtering algorithm and the social relationship influence layer of the social recommendation algorithm in the model, greatly improves the training effect and stability of the object recommendation model, and improves the accuracy of object recommendation. BRIEF DESCRIPTION OF DRAWINGS
[0064] Figure 1 is a flowchart of an object recommendation model training method provided by an embodiment of the application;
[0065] Figure 2 is a structural diagram of an object recommendation model in an embodiment of the application;
[0066] Figure 3 is a flowchart of an object recommendation method provided by an embodiment of the application;
[0067] Figure 4 is a structural diagram of an object recommendation model training device provided by an embodiment of the application;
[0068] Figure 5 is a structural diagram of an object recommendation device provided by an embodiment of the application;
[0069] Figure 6 is a structural diagram of a terminal device provided by an embodiment of the application. DETAILED DESCRIPTION
[0070] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the application.
[0071] In the description and claims, it should be understood that the terms "first," "second," etc., used in the description and claims are only for the purpose of distinguishing the description of the same technical features, and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated, nor necessarily the order of description or chronological order. The terms are interchangeable where appropriate. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature.
[0072] See Figure 1 This is a flowchart illustrating a training method for an object recommendation model provided in an embodiment of the present invention. The embodiment of the present invention provides a training method for an object recommendation model, including steps S11 to S15:
[0073] S11. Obtain user-object interaction information to obtain a user-object relationship matrix; wherein, the user includes a first user and at least one second user who has a social relationship with the first user;
[0074] S12. Based on the user-object relationship matrix, a matrix decomposition method is used to obtain the latent vector of the first user, the latent vector of the second user, and the latent vector of the object related to the first user;
[0075] S13. Input the latent vector of the first user and the latent vector of the second user into a preset object recommendation model to calculate the social latent vector of the first user; wherein, the social latent vector is used to represent the preferences of the first user and the influence of the second user's preferences on the first user;
[0076] S14. Determine the objective optimization function of the object recommendation model based on the object's latent vector and the first user's social latent vector;
[0077] S15. With the goal of minimizing the objective optimization function, update the parameters of the object recommendation model to obtain the trained object recommendation model.
[0078] It should be noted that the objects mentioned include concrete items, such as commodities, as well as abstract objects, such as short videos, news, music, and e-books.
[0079] In the embodiment of the present application, firstly, sample data of an object recommendation model is acquired, mainly including two parts, one is a social relationship network of a user, which includes a first user and a second user having a social relationship with the first user. The other is a user-object relationship matrix constructed according to interaction information between the user and the object, such as data of the user clicking and purchasing a financial product in a financial product marketing scenario. According to the sample data, a training set and a test set are divided, the training set is used to realize parameter training of the object recommendation model, and the test set is used to realize effect evaluation of the object recommendation model.
[0080] The training set is used to realize training of the object recommendation model. Specifically, the user-object relationship matrix includes a user-object relationship matrix corresponding to the first user and a user-object relationship matrix corresponding to the second user. The user-object relationship matrix corresponding to the first user is decomposed by using a matrix decomposition method, so that the hidden vector of the first user and the hidden vector of the object related to the first user are obtained. Similarly, the user-object relationship matrix corresponding to the second user is decomposed, so that the hidden vector of the second user and the hidden vector of the object related to the second user are obtained.
[0081] Taking the first user as an example, the user-object relationship matrix R ui is decomposed by minimizing the following objective function:
[0082]
[0083] The hidden vector of the first user u and the hidden vector of the object v are calculated, where u = 1, 2, …, n; i = 1, 2, …, m; n is the number of users, m is the number of objects, and d is the dimension of the hidden vector.
[0084] By using the technical means of the embodiment of the present application, the user-object relationship matrix is decomposed by matrix decomposition to obtain the hidden vector, which is used for subsequent input of the object recommendation model, and the problem that the user-object relationship matrix and the user social relationship network cannot be cooperatively processed is well solved.
[0085] Further, an initial object recommendation model is constructed, and the hidden vector u u of the first user and the hidden vector u ufp of each second user related to the first user are input into a preset object recommendation model, the nonlinear correlation between the social potential effect of each second user on the behavior of the first user and the potential influence is considered, and the social hidden vector of the first user is calculated Then, according to the hidden vector v iand a social latent vector z of the first user u The target optimization function L of the object recommendation model is determined. By judging whether the target optimization function reaches a preset convergence condition, when the target optimization function does not reach the preset convergence condition, the network parameters in the object recommendation model are updated, the updated object recommendation model is used to calculate the training data again, and the target optimization function is calculated again to continuously adjust the network parameter settings of the object recommendation model to continuously reduce the target optimization function, until the value of the target optimization function tends to be minimized, that is, the preset convergence condition is reached, and the trained object recommendation model is obtained. Optionally, the network parameter updating method is that the loss function gradient is calculated, and the gradient descent method is used to update each network parameter in the object recommendation model.
[0086] By using the technical means of the embodiment of the application, the interaction information of the user and the object is received, the matrix decomposition method is used to obtain the latent vector of the user and the latent vector of the object, and the problem that the user-object relationship matrix and the user social relationship network cannot be cooperatively processed is solved. The social latent vector of the user is calculated by analyzing the preference influence and the influence size of the friends in the social relationship network of the user on the user, and the target optimization function is calculated to realize the training of the object recommendation model. The object recommendation can be performed when there is no data of the new user, the matrix decomposition in the collaborative filtering algorithm and the social relationship influence layer in the social recommendation algorithm are integrated in the model, the shortcomings of the respective models are effectively avoided, the training effect and stability of the object recommendation model are greatly improved, and the accuracy of the object recommendation is improved.
[0087] As a preferred embodiment, the embodiment of the application is further implemented on the basis of the above-mentioned embodiment, referring to Figure 2 is a structural schematic diagram of the object recommendation model in the embodiment of the application, and the object recommendation model comprises a first sub-model, a second sub-model and a third sub-model.
[0088] Then, step S13, that is, the input of the latent vector of the first user and the latent vector of the second user into the preset object recommendation model to calculate the social latent vector of the first user comprises steps S131 to S133:
[0089] S131, the latent vector of the first user and the latent vector of each second user are input into the first sub-model to analyze the social potential influence of each second user on the preference of the first user, and the influence latent vector of the influence of each second user on the preference of the first user is obtained.
[0090] S132, input the latent vector of the first user and the influence latent vector corresponding to the second user into the second sub-model, analyze the attention weight of the preference influence of each second user on the first user, and weight the influence latent vector corresponding to each second user according to the attention weight, to obtain the preference latent vector of the first user;
[0091] S133, input the latent vector of the first user and the preference latent vector of the first user into the third sub-model, and determine the social latent vector of the first user based on the output of the third sub-model.
[0092] The object recommendation model based on the neural attention mechanism for social collaborative filtering (NAS) is constructed, and the object recommendation model is mainly divided into three parts: a social latent effect layer (i.e., a first sub-model), a social behavior attention mechanism layer (i.e., a second sub-model), and a social latent vector extraction layer (i.e., a third sub-model). Figure 2 As shown in the figure, taking three second users as an example, a first user u and his three friends (i.e., second users) {f1, f2, f3} are considered. By decomposing the user-object relationship matrix R, the latent vector u of the first user and the latent vectors {u u , uf1 , uf2 , uf3 of the friends are calculated. In the social latent effect layer, the social latent influence of the three friends on the preference of the first user u is calculated. In the social behavior attention mechanism, the attention weight of the latent effect, i.e., γ1, γ2 and γ3, is calculated, and the weight corresponds to the matching degree of the preference of the first user and the preference of the three friends. In the social latent vector extraction layer, the nonlinear relationship between the aggregated social latent effects is deeply mined, and the social latent vector z u of the first user u is output. The target function L is calculated by the social latent vector and the latent vector v i of the commodity i.
[0093] According to the embodiment of the application, a neural architecture is designed, the social latent influence of friends on user behavior is considered, and the nonlinear relationship in the preference of friends is deeply mined. In addition, a social behavior attention mechanism is introduced to adaptively weigh the influence of friends on user preference, and social relationship is used to overcome the data sparsity of user preference, so as to generate accurate object recommendation.
[0094] The calculation processes of the three network layers are explained and described below.
[0095] Preferably, the first sub-model comprises a first shared embedding layer and a first multi-layer perceptron network module, and the first multi-layer perceptron network module is composed of several hidden layers.
[0096] In the embodiment of the present application, the purpose of the social potential effect layer is to calculate the latent vector of the user u affected by the pth second user Therefore, a multi-layer perceptron (MLP) network is designed to simulate the social potential influence of the k friends of the first user on the preference of the first user u.
[0097] Then, step S131 is specifically:
[0098] The latent vector of the first user and the latent vector of each second user are input into the first shared embedding layer for calculation, and the calculation formula of the first shared embedding layer is:
[0099]
[0100] The output result of the first shared embedding layer is input into the first hidden layer of the first multi-layer perceptron network module, and the output result of the current hidden layer is sequentially input into the next hidden layer for calculation, and the calculation formula of each hidden layer is:
[0101]
[0102] According to the output result of the last hidden layer, the influence latent vector of the preference influence of each second user on the first user is calculated:
[0103]
[0104] wherein, u u is the latent vector of the first user, u ufp is the latent vector of the pth second user, and respectively represent the weight matrix of the latent vector of the first user and the pth second user, is the weight matrix of the q-1 layer, is the weight matrix of the last hidden layer; and are respectively preset bias vectors, g is a relu activation function, and p=1, 2, …, k; q=1, 2, …, h; k is the number of second users, and h is the number of hidden layers.
[0105] Preferably, the second sub-model comprises a behavior attention mechanism module formed by a single-layer perceptron.
[0106] In the embodiment of the present application, in order to accurately measure the influence size of the first user u by the k different friends, the embodiment of the present application proposes a behavior attention mechanism, which can learn an adaptive weighting function to measure the influence size of different friends.
[0107] Then, step S132 is specifically:
[0108] The hidden vector of the first user and the corresponding influence hidden vector of the second user are input into the behavior attention mechanism module, and the attention coefficient of each second user to the preference influence of the first user is calculated:
[0109]
[0110] The attention coefficient corresponding to each second user is normalized by a softmax function to obtain the attention weight corresponding to each second user:
[0111]
[0112] According to the influence hidden vector corresponding to each second user and the attention weight corresponding to each second user, the following weighting function is used to calculate the preference latent vector of the first user:
[0113]
[0114] Where, u u is the hidden vector of the first user, f up is the influence hidden vector corresponding to the pth second user, and is a preset weight matrix, b ψ is a preset bias vector, the superscript ψ is a behavior attention mechanism module, p = 1, 2, …, k; k is the number of second users.
[0115] By using the embodiment of the present application, based on the newly proposed behavior attention mechanism, an adaptive weighting function is learned, and the influence size of different friends on user preferences is fully considered, solving the problem of low accuracy in conventional friend recommendation methods, improving the model effect, and thus accurate object recommendation can be generated.
[0116] Preferably, the third sub-model includes a second shared embedding layer and a second multi-layer perception network module, and the second multi-layer perception network module is composed of a plurality of hidden layers. The target of this layer is to predict the social hidden vector of the first user u influenced by different social behaviors of the k friends of the first user.
[0117] Then, step S133 is specifically:
[0118] inputting the latent vector of the first user and the preference latent vector of the first user into the second shared embedding layer for calculation;
[0119] inputting an output result of the second shared embedding layer into a first hidden layer of the second multi-layer perception network module, and sequentially inputting an output result of a current hidden layer into a next hidden layer for calculation;
[0120] obtaining the social latent vector of the first user according to an output result of a last hidden layer.
[0121] Specifically, the structure of the social latent vector extraction layer is similar to that of the social latent effect layer. First, the latent vector of k friends influencing the user u and the latent vector of the user u u are mapped to the shared embedding layer, so as to construct a hidden layer Then, is input into the MLP network containing h layers of hidden layers, so as to mine the influence of complex social relationships on the preference of the user u. The output of the MLP network is the social latent vector that is, the last layer of hidden layers of the MLP network.
[0122] By combining the influence of friends of the user, the technical means of the embodiment of the present application solves the problem that a new user cannot be recommended due to data missing when entering the network. In addition, since some small hobbies often have strong small community characteristics, the unique preferences of some small groups can be recommended. In addition, the embodiment of the present application does not need to calculate the entire matrix, is suitable for sparse data, improves the effect and stability of the object recommendation model, and thus improves the recommendation accuracy.
[0123] As a preferred embodiment, the embodiment of the present application further implements on the basis of the above embodiment, and limits the target optimization function. The user-object relationship matrix corresponding to the first user includes a first relationship matrix constructed by the first user and the objects that have interacted, and a second relationship matrix constructed by the first user and the objects that have not interacted. Therefore, after decomposition of the relationship matrix, the latent vector of the object related to the first user includes the latent vector of the object that has interacted with the first user and the latent vector of the object that has not interacted with the first user
[0124] Therefore, step S14, that is, determining the target optimization function of the object recommendation model according to the latent vector of the object and the social latent vector of the first user, includes:
[0125] According to the latent vector of the object interacted with the first user, the latent vector of the object not interacted with the first user and the social latent vector of the first user, a target optimization function of the object recommendation model is calculated as follows:
[0126]
[0127] wherein, σ(x) = 1 / (1+exp(-x)) is a logistic sigmoid function; is an inner product of the social latent vector z of the first user and the latent vector of the object interacted with the first user, u is an inner product of the social latent vector z of the first user and the latent vector of the object not interacted with the first user. u
[0128] In the embodiment of the present application, two disjoint sets are defined, one is the set of items interacted with the first user u and the other is the set of items not interacted with the user For each item interacted with the user u a non-interacted item is randomly extracted to participate in the training. According to Bayesian Personalised Ranking (BPR), it is tried to rank the interacted items higher than the non-interacted items, i.e. the target optimization function L is obtained, and then the parameter updating and training of the object recommendation model are realized according to the target optimization function L.
[0129] Preferably, after step S15, the training method of the object recommendation model further comprises: using cross-validation method to evaluate the effect of the object recommendation model.
[0130] In the embodiment of the present application, after training with the training set, an object recommendation model is obtained, then the object recommendation model is predicted by using the test set, N recommended items output by the object recommendation model are obtained, and the Normalized Discounted Cumulative Gain (NDCG) index is used to evaluate the model effect, which is defined as follows:
[0131]
[0132] wherein, rel l represents the relevance score of the item l.
[0133] The index considers the ranking of the first N recommended items, and the higher the index score, the better the object recommendation model effect, and the best object recommendation model is used as the final model for object recommendation of the target user in the application process.
[0134] Referring to Figure 3 is a flowchart of an object recommendation method provided by an embodiment of the present application. The object recommendation method provided by the embodiment of the present application uses the object recommendation model trained by the training method of any one of the above embodiments to perform object recommendation, and the object recommendation method comprises steps S21 to S24:
[0135] S21, obtaining a hidden vector of a target user, a hidden vector of at least one user having a social relationship with the target user, and a hidden vector of an object to be recommended;
[0136] S22, inputting the hidden vector of the target user and the hidden vector of the at least one user having a social relationship with the target user into the object recommendation model to calculate a social hidden vector of the target user;
[0137] S23, matching the hidden vector of the object to be recommended and the social hidden vector of the target user to obtain a recommendation priority of each of the objects to be recommended;
[0138] S24, performing object recommendation on the target user according to the recommendation priority of each of the objects to be recommended.
[0139] In the embodiment of the present application, the target user and its social relationship network are first determined, so that the target user and at least one user having a social relationship with the target user are determined. When a user browses or clicks a certain page, user information and scene context information are collected in real time, and a candidate object library is determined, and then the hidden vector of the target user and the hidden vector of the user having a social relationship with the target user are calculated, as well as the hidden vector of the object to be recommended in the candidate object library.
[0140] It should be noted that the calculation method of the hidden vector of the user can be the method of segmenting the user-object relationship matrix as described in the above embodiments, which will not be described here.
[0141] Further, the latent vector of the target user and the latent vector of the at least one user in social relationship with the target user are input into the trained object recommendation model, and the social latent vector of the target user is obtained through analysis and calculation of a social potential effect layer, a social behavior attention mechanism layer and a social latent vector extraction layer in sequence. Further, the latent vector of the to-be-recommended object and the social latent vector of the target user are matched to obtain a recommendation priority of each to-be-recommended object, and the first N to-be-recommended objects in the candidate object library are obtained to form a recommended object list, which is displayed to the target user.
[0142] By using the technical means of the embodiment of the present application, the latent vector of the user and the latent vector of the object are obtained, the pre-trained object recommendation model is used to analyze the preference influence and influence size of the user by friends in the social relationship network, the social latent vector of the user is calculated, and then the social latent vector is matched with the to-be-recommended object, so as to realize the object recommendation for the target user. The object recommendation can be performed for the new user without any data, and by integrating the collaborative filtering and the social recommendation algorithm, the matrix decomposition in the collaborative filtering algorithm and the social relationship influence layer in the social recommendation algorithm are fused in the model, the shortcomings of the respective models are effectively avoided, and the accuracy of the object recommendation is greatly improved.
[0143] Referring to Figure 4 is a structural schematic diagram of a training device of an object recommendation model provided by the embodiment of the present application. The embodiment of the present application provides a training device 30 of an object recommendation model, which comprises:
[0144] A relationship matrix acquisition module 31 is configured to acquire the interaction information of the user and the object, and obtain a user-object relationship matrix. The user comprises a first user and at least one second user in social relationship with the first user.
[0145] A matrix decomposition module 32 is configured to obtain the latent vector of the first user, the latent vector of the second user and the latent vector of the object related to the first user according to the user-object relationship matrix by using a matrix decomposition method.
[0146] A first latent vector calculation module 33 is configured to input the latent vector of the first user and the latent vector of the second user into a preset object recommendation model, and calculate the social latent vector of the first user. The social latent vector is used to represent the preference of the first user and the preference influence of the second user on the first user.
[0147] A target optimization function calculation module 34 is configured to determine the target optimization function of the object recommendation model according to the latent vector of the object and the social latent vector of the first user.
[0148] The object recommendation model training module 35 is configured to update parameters of the object recommendation model to obtain a trained object recommendation model, with the objective of minimizing the target optimization function.
[0149] It should be noted that the object recommendation model training device provided in the embodiments of the present application is used to perform all process steps of the object recommendation model training method provided in the above embodiments, and the working principles and advantages of the two are one-to-one correspondence, thus no longer being described herein.
[0150] By using the technical means of the embodiments of the present application, the user's implicit vector and the object's implicit vector are obtained by receiving the interaction information between the user and the object using the matrix decomposition method, and the problem that the user-object relationship matrix and the user social relationship network cannot be cooperatively processed is solved. By analyzing the influence of the preferences of the friends in the social relationship network of the user and the influence size, the social implicit vector of the user is calculated, and the target optimization function is calculated to train the object recommendation model. The present application can also perform object recommendation when there is no data for the new user, and by integrating the collaborative filtering and social recommendation algorithm, the matrix decomposition in the collaborative filtering algorithm and the social relationship influence layer in the social recommendation algorithm are fused in the model, the shortcomings of the respective models are effectively avoided, the training effect and stability of the object recommendation model are greatly improved, and the accuracy of the object recommendation is improved.
[0151] Referring to Figure 5 is a structural schematic diagram of an object recommendation device provided in the embodiments of the present application, and the embodiments of the present application also provide an object recommendation device 40, which uses the object recommendation model trained by the object recommendation model training method provided in any one of the above embodiments to perform object recommendation. The object recommendation device 40 comprises:
[0152] The data acquisition module 41 is configured to acquire the implicit vector of a target user, the implicit vectors of at least one user having a social relationship with the target user, and the implicit vectors of to-be-recommended objects.
[0153] The second implicit vector calculation module 42 is configured to input the implicit vector of the target user and the implicit vectors of the at least one user having a social relationship with the target user into the object recommendation model, and calculate a social implicit vector of the target user.
[0154] The recommendation priority calculation module 43 is configured to match the implicit vectors of the to-be-recommended objects with the social implicit vector of the target user, to obtain a recommendation priority of each to-be-recommended object.
[0155] The object recommendation module 44 is configured to perform object recommendation for the target user according to the recommendation priority of each to-be-recommended object.
[0156] It should be noted that the object recommendation device provided by the embodiment of the present application is used to execute all process steps of the object recommendation method of the above-mentioned embodiment, and the working principles and beneficial effects of the two are one-to-one correspondence, thus not being described again.
[0157] By using the technical means of the embodiment of the present application, the social latent vector of the user is calculated by acquiring the latent vector of the user and the latent vector of the object, analyzing the influence of the preference of the friends in the social relationship network of the user and the influence size by using the pre-trained object recommendation model, and matching the object recommendation model with the to-be-recommended object, so as to realize the object recommendation of the target user. The object recommendation can be performed when the new user has no any data, and the matrix decomposition in the collaborative filtering algorithm and the social relationship influence layer of the social recommendation algorithm are fused in the model by integrating the collaborative filtering and the social recommendation algorithm, the defects of the respective models are effectively avoided, and the accuracy of the object recommendation is greatly improved.
[0158] Reference Figure 6 The present embodiment also provides a terminal device 50, which comprises a processor 51, a memory 52, and a computer program stored in the memory and configured to be executed by the processor, such as a computer program 1, a computer program 2, and the like. When the processor executes the computer program, the training method of the object recommendation model according to any one of the above-mentioned embodiments or the object recommendation method according to any one of the above-mentioned embodiments is implemented.
[0159] The present embodiment also provides a computer readable storage medium, which comprises a stored computer program. When the computer program is executed, the device where the computer readable storage medium is located performs the training method of the object recommendation model according to any one of the above-mentioned embodiments or the object recommendation method according to any one of the above-mentioned embodiments.
[0160] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware. The program can be stored in a computer readable storage medium, and when the program is executed, the processes of the above-mentioned embodiments can be included. The storage medium can be a magnetic disc, an optical disc, a read-only memory (ROM), a random access memory (RAM), or the like.
[0161] The above-mentioned is the preferred embodiment of the present application. It should be noted that those skilled in the art can make several improvements and refinements without departing from the principles of the present application, and these improvements and refinements are also regarded as the protection scope of the present application.
Claims
1. A training method for an object recommendation model, characterized in that, include: The interaction information between users and objects is obtained to obtain a user-object relationship matrix; wherein, the users include a first user and at least one second user who has a social relationship with the first user; Based on the user-object relationship matrix, matrix decomposition is used to obtain the latent vectors of the first user, the second user, and the objects related to the first user. The latent vectors of the first user and the second user are input into a preset object recommendation model to calculate the social latent vector of the first user; wherein, the social latent vector is used to characterize the preferences of the first user and the influence of the second user's preferences on the first user; Based on the latent vector of the object and the social latent vector of the first user, the objective optimization function of the object recommendation model is determined; The parameters of the object recommendation model are updated with the objective of minimizing the objective optimization function to obtain the trained object recommendation model.
2. The training method for the object recommendation model as described in claim 1, characterized in that, The object recommendation model includes a first sub-model, a second sub-model, and a third sub-model; The step of inputting the latent vectors of the first user and the second user into a preset object recommendation model to calculate the social latent vector of the first user includes: The latent vectors of the first user and each of the second users are input into the first sub-model to analyze the potential social impact of each of the second users' preferences on the first user, and the impact latent vector of each of the second users' preferences on the first user is obtained. The latent vector of the first user and the influence latent vector of the second user are input into the second sub-model. The attention weight of each second user's influence on the first user's preference is analyzed. The influence latent vector of each second user is weighted according to the attention weight to calculate the latent vector of the first user's preference. The latent vector of the first user and the latent preference vector of the first user are input into the third sub-model, and the social latent vector of the first user is determined based on the output of the third sub-model.
3. The training method for the object recommendation model as described in claim 2, characterized in that, The first sub-model includes a first shared embedding layer and a first multilayer perceptron network module, wherein the first multilayer perceptron network module is composed of several hidden layers; The step of inputting the latent vector of the first user and the latent vector of each second user into the first sub-model, analyzing the potential social impact of each second user's preference on the first user, and obtaining the latent vector of the impact of each second user's preference on the first user includes: The latent vectors of the first user and each of the second users are input into the first shared embedding layer for calculation. The output of the first shared embedding layer is input to the first hidden layer of the first multilayer perceptron network module, and the output of the current hidden layer is input to the next hidden layer for calculation. Based on the output of the last hidden layer, the influence vector of each second user's preference on the first user is calculated.
4. The training method for the object recommendation model as described in claim 2, characterized in that, The second sub-model includes a behavioral attention mechanism module formed by a single-layer perceptron; The process of inputting the latent vector of the first user and the influence latent vector corresponding to the second user into the second sub-model, analyzing the attention weight of each second user's influence on the first user's preference, and weighting the influence latent vector corresponding to each second user according to the attention weight to calculate the first user's preference latent vector includes: The latent vector of the first user and the influence latent vector of the second user are input into the behavior attention mechanism module to calculate the attention coefficient of the influence of the second user's preference on the first user. The attention coefficients of each second user are normalized using the softmax function to obtain the attention weights of each second user. Based on the influence latent vector corresponding to each second user and the attention weight corresponding to each second user, the preference latent vector of the first user is calculated using a weighted function.
5. The training method for the object recommendation model as described in claim 2, characterized in that, The third sub-model includes a second shared embedding layer and a second multilayer perceptron network module, wherein the second multilayer perceptron network module consists of several hidden layers; The step of inputting the latent vector of the first user and the latent preference vector of the first user into the third sub-model, and determining the social latent vector of the first user based on the output of the third sub-model, includes: The latent vector of the first user and the latent preference vector of the first user are input into the second shared embedding layer for calculation; The output of the second shared embedding layer is input into the first hidden layer of the second multilayer perceptron network module, and the output of the current hidden layer is input into the next hidden layer for calculation. Based on the output of the last hidden layer, the social latent vector of the first user is obtained.
6. The training method for the object recommendation model as described in claim 1, characterized in that, The latent vectors of the objects related to the first user include the latent vectors of objects that have interacted with the first user and the latent vectors of objects that have not interacted with the first user. The step of determining the objective optimization function of the object recommendation model based on the object's latent vector and the first user's social latent vector includes: The objective optimization function of the object recommendation model is calculated based on the latent vectors of objects that have interacted with the first user, the latent vectors of objects that have not interacted with the first user, and the social latent vector of the first user.
7. An object recommendation method, characterized in that, Object recommendation is performed using an object recommendation model trained by the training method of any one of claims 1 to 6, wherein the object recommendation method includes: Obtain the latent vector of the target user, the latent vector of at least one user who has a social relationship with the target user, and the latent vector of the object to be recommended; The latent vector of the target user and the latent vector of at least one user who has a social relationship with the target user are input into the object recommendation model to calculate the social latent vector of the target user. The latent vectors of the objects to be recommended are matched with the social latent vectors of the target users to obtain the recommendation priority of each object to be recommended. Based on the recommendation priority of each of the objects to be recommended, object recommendations are made to the target user.
8. A training device for an object recommendation model, characterized in that, include: The relationship matrix acquisition module is used to acquire user-object interaction information to obtain a user-object relationship matrix; wherein, the user includes a first user and at least one second user who has a social relationship with the first user; The matrix decomposition module is used to obtain the latent vectors of the first user, the second user, and the objects related to the first user by using a matrix decomposition method based on the user-object relationship matrix. The first latent vector calculation module is used to input the latent vectors of the first user and the second user into a preset object recommendation model to calculate the social latent vector of the first user; wherein, the social latent vector is used to represent the preferences of the first user and the influence of the second user's preferences on the first user; The objective optimization function calculation module is used to determine the objective optimization function of the object recommendation model based on the object's latent vector and the first user's social latent vector. The object recommendation model training module is used to update the parameters of the object recommendation model with the goal of minimizing the objective optimization function, so as to obtain the trained object recommendation model.
9. An object recommendation device, characterized in that, The object recommendation model trained using the training method described in any one of claims 1 to 6 is used for object recommendation, and the object recommendation device includes: The data acquisition module is used to acquire the latent vector of the target user, the latent vector of at least one user who has a social relationship with the target user, and the latent vector of the object to be recommended; The second latent vector calculation module is used to input the latent vector of the target user and the latent vector of at least one user who has a social relationship with the target user into the object recommendation model to calculate the social latent vector of the target user. The recommendation priority calculation module is used to match the latent vector of the object to be recommended with the social latent vector of the target user to obtain the recommendation priority of each object to be recommended. The object recommendation module is used to recommend objects to the target user based on the recommendation priority of each of the objects to be recommended.
10. A terminal device, characterized in that, It 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 training method for an object recommendation model as described in any one of claims 1 to 6, or an object recommendation method as described in claim 7.
Citation Information
Patent Citations
Business recommendation method, device and equipment
CN111931035A
Recommendation method and device, electronic equipment, and storage medium
CN113761388A