A recommendation method, system, device and medium based on a knowledge graph dataset

By training a recommendation model based on a knowledge graph dataset and combining user information with the degree of preference for historically purchased items, the problem of poor matching between items and user preferences in existing recommendation systems is solved, and more accurate recommendations are achieved.

CN115659001BActive Publication Date: 2026-03-20GUILIN UNIV OF ELECTRONIC TECH
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-23
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

Existing recommendation systems do not incorporate user preferences when pushing items, resulting in poor matching between items and user preferences.

Method used

We employ a recommendation method based on a knowledge graph dataset. By acquiring user information and historical purchase data, we train a recommendation model, consider the degree of preference between users and items, and use the knowledge graph dataset and embedded vectors to construct an auxiliary loss function to improve recommendation accuracy.

Benefits of technology

This improves the recommendation model by considering user preferences when recommending items, thus enhancing the matching degree between items and user preferences and improving the accuracy of recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115659001B_ABST
    Figure CN115659001B_ABST
Patent Text Reader

Abstract

The application relates to a recommendation method, system, device and medium based on a knowledge graph dataset, and comprises the following steps: obtaining first user information of a first user, wherein the first user information represents identity information of the first user; and determining a recommended item corresponding to the first user according to the first user information. The application solves the problem that the existing recommendation system does not push according to the preferences of users, and the matching degree of the pushed items and the preferences of the users is poor.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of big data, and particularly relates to a recommendation method and system based on a knowledge graph data set, a device and a medium. BACKGROUND

[0002] Information overload brought by data explosion has caused certain troubles to people's life. As an information filtering system, a recommendation system can not only effectively solve the problem of information overload, but also has certain practical significance for promoting production and improving life quality. The recommendation system learns from large-scale group data, realizes user group feature matching, and thus helps users effectively identify interesting content from massive data.

[0003] However, the existing recommendation system only pushes some items browsed by users in daily life, and does not push items in combination with user preferences, and the matching degree of the pushed items and user preferences is poor. SUMMARY

[0004] In order to overcome the problem that the existing recommendation system does not push items in combination with user preferences, and the matching degree of the pushed items and user preferences is poor, the present application provides a recommendation method and system based on a knowledge graph data set, a device and a medium.

[0005] In a first aspect, in order to solve the above technical problems, the present application provides a recommendation method based on a knowledge graph data set, comprising the following steps:

[0006] Obtaining first user information of a first user, the first user information representing identity information of the first user;

[0007] Determining a recommended item corresponding to the first user according to the first user information;

[0008] Determining a recommended item corresponding to the first user according to the first user information, comprising:

[0009] Inputting the first user information into a recommendation model, and outputting the recommended item corresponding to the first user through the recommendation model, wherein the recommendation model is obtained by training in the following manner:

[0010] S11, obtaining second user information of a plurality of second users and historical purchase items of each second user, for each second user information, the second user information representing identity information of the corresponding second user;

[0011] S12, determining a first preference degree between each second user and each historical purchase item according to each second user and each historical purchase item;

[0012] S13, determine a knowledge graph dataset according to the respective second user information, the respective historical purchase items and the respective first preference degrees, the knowledge graph dataset including the second user information of the respective second user, the respective historical purchase items and the first preference degrees between the respective second user and the respective historical purchase items, for each second user, the respective historical purchase items corresponding to the second user including the liked items of the second user;

[0013] S14, train the initial model according to the knowledge graph dataset to obtain the predicted recommendation items corresponding to each second user;

[0014] S15, determine the total loss value of the initial model according to the respective predicted recommendation items and the respective liked items;

[0015] S16, if the total loss value meets the preset ending condition, take the initial model when the preset ending condition is met as the recommendation model, if the total loss value does not meet the preset ending condition, adjust the network parameters of the initial network and retrain the initial model according to the adjusted network parameters until the total loss value of the initial model meets the preset ending condition.

[0016] The recommendation method based on the knowledge graph dataset has the beneficial effects that: during the training of the recommendation model, the knowledge graph dataset is added, the knowledge graph dataset includes not only the second user information of the respective second user and the respective historical purchase items, but also the first preference degrees between the respective second user and the respective historical purchase items, so that the recommendation model considers the preference degrees of the users to the items when recommending the items, and solves the problem that the existing recommendation system does not combine the preferences of the users for pushing and the matching degrees of the pushed items and the preferences of the users are poor.

[0017] On the basis of the above technical solution, the recommendation method based on the knowledge graph dataset can be further improved as follows.

[0018] Further, the method further includes:

[0019] determine an embedding vector according to the knowledge graph dataset, the embedding vector including a plurality of elements, the plurality of elements including the respective second user, the respective historical purchase items and the first preference degrees between the respective second user and the respective historical purchase items;

[0020] determine an auxiliary loss function of the initial model according to the embedding vector, the auxiliary loss function being used to determine the differences between the respective predicted recommendation items;

[0021] determine a total loss function of the initial model according to the auxiliary loss function and a main task loss function of the initial model, the main task loss function being used to determine the differences between the predicted recommendation items and the liked items;

[0022] The S15 specifically includes:

[0023] According to each predicted recommended item and each liked item, a total loss value of the initial model is determined through a total loss function.

[0024] The beneficial effect of the further scheme is that by adding the auxiliary loss function to the main task loss function, the differences between the predicted recommended items are added to the total loss value, so that the final prediction result of the recommendation model is more accurate.

[0025] Further, the method further includes:

[0026] Each element in the embedded vector is taken as a target element, mutual information between the target element and each element in the embedded vector except the target element is determined, and for each mutual information, the mutual information represents the correlation between the corresponding two elements;

[0027] For each mutual information corresponding to each target element, the mutual information is sorted from large to small, and the first K mutual information is obtained, the elements corresponding to the first K mutual information and the target element are feature fused to obtain a first fused element, the mutual information other than the first K mutual information is sorted from large to small, and the elements corresponding to the mutual information and the target element are feature fused to obtain a second fused element, a first fused vector is determined according to each first fused element, and a second fused vector is determined according to each second fused element;

[0028] According to the first fused vector, a first feature of each first fused element in the first fused vector is extracted through a first encoder to determine a first feature vector, and a second feature of each first fused element in the first fused vector is extracted through a second encoder to determine a second feature vector, according to the second fused vector, a third feature of each second fused element in the second fused vector is extracted through the second encoder to determine a third feature vector, and a fourth feature of each second fused element in the second fused vector is extracted through the second encoder to determine a fourth feature vector;

[0029] According to the embedded vector, an auxiliary loss function of the initial model is determined, including:

[0030] According to the first feature vector, the second feature vector, the third feature vector and the fourth feature vector, the auxiliary loss function of the initial model is determined.

[0031] The beneficial effect of adopting the above-mentioned further scheme is that the first fusion element and the second fusion element are determined by the mutual information between the target element and each element in the embedded vector other than the target element. The first fusion element and the second fusion element both incorporate the feature information of each element in the embedded vector, thus enhancing the feature representation of the embedded vector. Finally, the features of the fusion vector (first fusion vector and second fusion vector) are extracted by the encoder (first encoder and second encoder) to obtain the first feature vector, the second feature vector, the third feature vector and the fourth feature vector. An auxiliary loss function is constructed by the first feature vector, the second feature vector, the third feature vector and the fourth feature vector, so that the initial model can extract richer feature information.

[0032] Furthermore, the above method determines the knowledge graph dataset based on each second user's information, each historically purchased item, and each first preference level, including:

[0033] Based on the information of each second user, each historical purchased item, and each first preference level, the knowledge graph dataset is determined using the first formula, which is:

[0034] O + ={(h, r, t)|(h, t)∈(U, I)};

[0035] U = {u1, u2, u3…u} n};

[0036] I = {i1, i2, i3, ..., i} m};

[0037] Among them, O + Let represent a knowledge graph dataset, where h represents the head nodes in the dataset, each head node representing a second user, t represents the tail nodes in the dataset, each tail node representing a historically purchased item, r represents the first preference degree between the head nodes and the tail nodes, and (h, t) represents the first preference degree between the target second user and the target historically purchased item, where the target second user is any second user and the target historically purchased item is any historically purchased item, and U represents the set of second user information, u1, u2, u3…u n Let i represent a total of n pieces of second user information, and let I represent the set of historically purchased items, i1, i2, i3…i m This represents a total of m historical purchased items.

[0038] The beneficial effect of the further scheme is that the first formula can convert each second user information, each historical purchase item and each first preference degree into knowledge knowledge graph dataset, so as to add the first preference degree in the second user information and the historical purchase item.

[0039] Further, in the method, each element in the embedded vector is taken as a target element, and mutual information between the target element and each element in the embedded vector except the target element is determined, including:

[0040] Each element in the embedded vector is taken as a target element, and mutual information between the target element and each element in the embedded vector except the target element is determined by a second formula, wherein the second formula is:

[0041]

[0042] wherein MI(V I , V J ) represents mutual information between the target element V i and each element v j in the embedded vector except the target element, v j represents the jth element in the embedded vector except the target element, p(v i , v j ) represents a joint probability distribution function of V i and v j , p(v i ) represents an edge probability distribution function of V i , and p(v j ) represents an edge probability distribution function of v j .

[0043] The beneficial effect of the further scheme is that the second formula is used to determine mutual information between the target element and each element in the embedded vector except the target element, so as to enhance the correlation between the corresponding two elements in the embedded vector.

[0044] Further, in the method, the auxiliary loss function of the initial model is determined according to the first feature vector, the second feature vector, the third feature vector and the fourth feature vector, including:

[0045] The auxiliary loss function of the initial model is determined according to the first feature vector, the second feature vector, the third feature vector and the fourth feature vector by a third formula, wherein the third formula is:

[0046]

[0047] wherein z i represents the first feature vector, z′i denotes a second feature vector, z j denotes a third feature vector, z' j denotes a fourth feature vector, N denotes the number of samples in a single batch during the initial model training process, τ denotes a temperature coefficient, H denotes a first encoder, and G denotes a second encoder, denotes an auxiliary loss function;

[0048] According to the auxiliary loss function and the main task loss function of the initial model, a total loss function of the initial model is determined, including:

[0049] According to the auxiliary loss function and the main task loss function, the total loss function is determined through a fourth formula, wherein the fourth formula is:

[0050]

[0051] wherein L main denotes a main task loss function, and α denotes a loss weight, denotes an auxiliary loss function, denotes a total loss function.

[0052] The beneficial effects of the above further scheme are: through the third formula, the auxiliary loss function is constructed, so that the initial model can extract more rich feature information, and then through the fourth formula, the auxiliary loss function is added to the main task function to obtain the total loss function.

[0053] In a second aspect, the present application provides a recommendation system based on a knowledge graph dataset, comprising:

[0054] An acquisition module is configured to acquire first user information of a first user, the first user information representing identity information of the first user.

[0055] A prediction module is configured to determine a recommended item corresponding to the first user according to the first user information.

[0056] The prediction module determines the recommended item corresponding to the first user through a recommendation model, wherein the recommendation model is obtained by training a first unit, and the first unit is specifically as follows:

[0057] S11, acquiring second user information of a plurality of second users and historical purchase items of each second user, for each second user information, the second user information representing identity information of the corresponding second user.

[0058] S12, determining a first preference degree between each second user and each historical purchase item according to each second user and each historical purchase item.

[0059] S13, determine a knowledge graph dataset according to the respective second user information, the respective historical purchase items and the respective first preference degrees, the knowledge graph dataset including the second user information of the respective second user, the respective historical purchase items and the first preference degrees between the respective second user and the respective historical purchase items, for each second user, the respective historical purchase items corresponding to the second user including the favorite items of the second user;

[0060] S14, train the initial model according to the knowledge graph dataset to obtain the predicted recommendation items corresponding to each second user;

[0061] S15, determine the total loss value of the initial model according to the respective predicted recommendation items and the respective favorite items;

[0062] S16, if the total loss value meets the preset ending condition, take the initial model when the preset ending condition is met as the recommendation model, if the total loss value does not meet the preset ending condition, adjust the network parameters of the initial network and retrain the initial model according to the adjusted network parameters until the total loss value of the initial model meets the preset ending condition.

[0063] The beneficial effects of the recommendation based on the knowledge graph dataset provided by the application are that: during the training of the recommendation model, the knowledge graph dataset is added, the knowledge graph dataset includes not only the second user information of the respective second user and the respective historical purchase items, but also the first preference degrees between the respective second user and the respective historical purchase items, so that the user's preference is also considered when the recommendation model recommends the items, and the problem that the existing recommendation system does not combine the user's preference for pushing and the matching degree of the pushed items and the user's preference is poor is solved.

[0064] In a third aspect, the application further provides an electronic device, including a memory, a processor and a program stored in the memory and running on the processor, and the processor implements the steps of the recommendation method based on the knowledge graph dataset when executing the program.

[0065] In a fourth aspect, the application further provides a computer readable storage medium, and the computer readable storage medium stores instructions, and when the instructions run on the terminal device, the terminal device executes the steps of the recommendation method based on the knowledge graph dataset. BRIEF DESCRIPTION OF DRAWINGS

[0066] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the application will be further described below with reference to the drawings and embodiments.

[0067] Figure 1 FIG. 1 is a flowchart of a recommendation method based on a knowledge graph dataset according to an embodiment of the application.

[0068] Figure 2 This is a schematic diagram of the TransR model;

[0069] Figure 3 A flowchart for obtaining the auxiliary loss function;

[0070] Figure 4 This is a schematic diagram of the structure of a recommendation system based on a knowledge graph dataset according to an embodiment of the present invention. Detailed Implementation

[0071] The following embodiments are further explanations and supplements to the present invention and do not constitute any limitation on the present invention.

[0072] The following describes a recommendation method based on a knowledge graph dataset according to an embodiment of the present invention, with reference to the accompanying drawings.

[0073] like Figure 1 As shown in the figure, a recommendation method based on a knowledge graph dataset according to an embodiment of the present invention includes the following steps:

[0074] Obtain the first user's first user information, which represents the first user's identity information;

[0075] Based on the first user's information, determine the recommended items corresponding to the first user.

[0076] The first user information can be the first user's identity information, such as name, username in the shopping app, etc.

[0077] Optionally, based on the first user information, determine the recommended items corresponding to the first user, including:

[0078] The first user's information is input into the recommendation model, which then outputs recommended items for that user. The recommendation model is trained in the following way:

[0079] S11, obtain the second user information of multiple second users and the historical purchase items of each second user. For each second user information, the second user information represents the identity information of the corresponding second user.

[0080] The second user information is the identity information of the second user, such as name, username in the shopping app, etc.

[0081] In addition, the second user's historical purchases are the second user's past shopping records, and it is possible to obtain all of the second user's shopping records within the past year.

[0082] S12, based on each second user and each historically purchased item, determine the degree of first preference between each second user and each historically purchased item.

[0083] The degree of first preference can be determined based on the number of times the second user has repeatedly purchased the same type of product in the past year. For example, if the number of times the second user has purchased the same type of product in the past year is greater than a threshold, then the degree of first preference of the second user for that type of product is determined to be high.

[0084] S13. Based on the information of each second user, each historical purchase item, and each first preference level, determine the knowledge graph dataset. The knowledge graph dataset includes the second user information of each second user, each historical purchase item, and the first preference level between each second user and each historical purchase item. For each second user, the historical purchase items corresponding to the second user include the items liked by the second user.

[0085] Optionally, based on each second user's information, each historically purchased item, and each first preference level, the knowledge graph dataset is determined using a first formula, where the first formula is:

[0086] O + ={(h, r, t)|(h, t)∈(U, I)};

[0087] U = {u1, u2, u3…u} n};

[0088] I = {i1, i2, i3, ..., i} m};

[0089] Among them, O + Let represent a knowledge graph dataset, where h represents the head nodes in the dataset, each head node representing a second user, t represents the tail nodes in the dataset, each tail node representing a historically purchased item, r represents the first preference degree between the head nodes and the tail nodes, and (h, t) represents the first preference degree between the target second user and the target historically purchased item, where the target second user is any second user and the target historically purchased item is any historically purchased item, and U represents the set of second user information, u1, u2, u3…u n This represents a total of n pieces of second user information, where I represents the set of historically purchased items, i1, i2, i3, ..., i m This represents a total of m historical purchased items.

[0090] In addition, the second user's historical purchase items include items the second user likes. These "liked items" are items the second user subjectively marks as having a high degree of preference, or they can be determined based on the degree of preference between the second user and each historical purchase item. This degree of preference can be a score; a higher score indicates that the second user prefers the item corresponding to that degree of preference.

[0091] S14, training the initial model according to the knowledge graph dataset to obtain a predicted recommended item corresponding to each second user.

[0092] Optionally, the method further comprises:

[0093] According to the knowledge graph dataset, an embedding vector is determined, the embedding vector including a plurality of elements, the plurality of elements including each second user, each historical purchase item, and a first preference degree between each second user and each historical purchase item;

[0094] According to the embedding vector, a auxiliary loss function of the initial model is determined, the auxiliary loss function being used to determine the difference between each predicted recommended item;

[0095] According to the auxiliary loss function and a main task loss function of the initial model, a total loss function of the initial model is determined, the main task loss function being used to determine the difference between the predicted recommended item and the liked item.

[0096] Wherein, when the knowledge graph dataset is converted into the embedding vector, it is realized by a TransR model, the TransR model performing an Embedding process on h, t and r in the knowledge graph set, thereby outputting the embedding vector.

[0097] In addition, in order to evaluate the representation effect of the embedding vector on (h, t) and (r), a scoring function is introduced, as shown in Figure 2 The principle is that the TransR model considers that the entities (h, t) and the relations (r) in the knowledge graph dataset have different attributes, so an entity space and a relation space are constructed, mainly projecting the entity space (Entity Space) to the relation space (Relation Space of r) through a projection matrix Mr, so as to evaluate the representation effect of the embedding vector on (h, t) and (r), the specific process being as follows:

[0098] According to the knowledge graph dataset, the representation effect of the embedding vector on (h, t) and (r) is scored by a fifth formula, wherein the fifth formula is:

[0099]

[0100] h ⊥ = hM r ;

[0101] t ⊥ = tM r ;

[0102] Wherein, M r represents a projection matrix, h⊥ = hM r denotes the head node is projected into the relation space, t ⊥ = tM r denotes the tail node is projected into the relation space, f r (h, t) denotes the score of the representation effect of the embedded vector on (h, t) and (r).

[0103] Optionally, the method further comprises:

[0104] As each element in the embedded vector is a target element, the mutual information amount between the target element and each element in the embedded vector except the target element is determined, and for each mutual information amount, the mutual information amount represents the correlation between the corresponding two elements.

[0105] Optionally, as each element in the embedded vector is a target element, the mutual information amount between the target element and each element in the embedded vector except the target element is determined, and the determination comprises:

[0106] As each element in the embedded vector is a target element, the mutual information amount between the target element and each element in the embedded vector except the target element is determined by a second formula, wherein the second formula is:

[0107]

[0108] wherein MI(V I , V J ) represents the mutual information amount between the target element V i and each element v j in the embedded vector except the target element, v j represents the jth element in the embedded vector except the target element, p(v i , v j ) represents the joint probability distribution function of V i and v j , p(v i ) represents the marginal probability distribution function of V i , and p(v j ) represents the marginal probability distribution function of v j .

[0109] In addition, in the second formula, whether there is mutual information amount between the target element and each element in the embedded vector except the target element is determined by the result of ; if , it indicates that the mutual information amount between the target element and one element in the embedded vector except the target element is 0, that is, there is no common information and no mutual information amount; if , it indicates that there is mutual information amount between the target element and one element in the embedded vector except the target element.The mutual information between the target element and one element in the embedded vector other than the target element is not 0.

[0110] Optionally, as shown in Figure 3 , for each mutual information corresponding to the target element, the mutual information is sorted from large to small, and the first K mutual information is obtained, the elements corresponding to the first K mutual information are fused with the target element to obtain the first fusion element, the mutual information other than the first K mutual information is sorted from large to small, and the elements corresponding to the mutual information are fused with the target element to obtain the second fusion element, the first fusion vector (x i ) is determined according to each first fusion element, and the second fusion vector (x j ) is determined according to each second fusion element.

[0111] Optionally, according to the first fusion vector (x i ), the first feature (y i ) of each first fusion element in the first fusion vector is extracted through the first encoder to determine the first feature vector (z i ), and the second feature (y i ) of each first fusion element in the first fusion vector is extracted through the second encoder to determine the second feature vector (z i` ), according to the second fusion vector (x j ), the third feature (y j ) of each second fusion element in the second fusion vector is extracted through the second encoder to determine the third feature vector (z j ), and the fourth feature (y j` ) of each second fusion element in the second fusion vector is extracted through the second encoder to determine the fourth feature vector (z j` ).

[0112] Optionally, as shown in Figure 3 , H represents the first encoder, G represents the second encoder, and maximize represents the type of the encoder.

[0113] According to the first feature vector, the second feature vector, the third feature vector and the fourth feature vector, the auxiliary loss function of the initial model is determined.

[0114] Optionally, according to the first feature vector, the second feature vector, the third feature vector and the fourth feature vector, the auxiliary loss function of the initial model is determined through a third formula, wherein the third formula is:

[0115]

[0116] wherein z i represents the first feature vector, and z'i denotes the second feature vector, z j denotes the third feature vector, z' j denotes the fourth feature vector, N denotes the number of samples in a single batch during the initial model training process, τ denotes a temperature coefficient, H denotes the first encoder, and G denotes the second encoder, denotes the auxiliary loss function.

[0117] Optionally, according to the auxiliary loss function and the main task loss function of the initial model, a total loss function of the initial model is determined, including:

[0118] According to the auxiliary loss function and the main task loss function, the total loss function is determined by a fourth formula, wherein the fourth formula is:

[0119]

[0120] wherein L main denotes the main task loss function, and α denotes a loss weight, denotes the auxiliary loss function, denotes the total loss function.

[0121] S15, according to each predicted recommended item and each liked item, a total loss value of the initial model is determined.

[0122] Optionally, the main task loss function is used to determine the difference between the predicted recommended item and the liked item. In the embodiment, the auxiliary loss function is added to the main task loss function. Therefore, through the total loss value of the total loss function, not only the difference between the predicted recommended item and the liked item can be obtained, but also the difference between each predicted recommended item can be determined, further improving the accuracy of the recommendation model.

[0123] S16, if the total loss value meets a preset ending condition, an initial model at the time when the preset ending condition is met is taken as a recommendation model, if the total loss value does not meet the preset ending condition, network parameters of the initial network are adjusted, and the initial model is retrained according to the adjusted network parameters until the total loss value of the initial model meets the preset ending condition.

[0124] Optionally, the preset ending condition is that the total loss value obtained in a new round of training is greater than or equal to the total loss value obtained in a previous round of training, for example: after the Nth round of training, if the total loss value corresponding to the Nth round of training is less than the total loss value corresponding to the (N-1)th round of training, the network parameters of the initial network are updated and adjusted, and a new round of training is performed, if the total loss value corresponding to the Nth round of training is greater than or equal to the total loss value corresponding to the (N-1)th round of training, the initial network training is completed, and the initial model completed in the Nth round of training is taken as the recommendation model.

[0125] Optionally, the network parameters of the initial network are updated and adjusted, and a new round of training is performed, including:

[0126] The network parameters of the initial network are updated by a back propagation algorithm, such as a gradient descent algorithm, and the next round of training is performed.

[0127] As shown in Figure 4 The recommendation system based on the knowledge graph dataset according to the embodiment of the present application comprises:

[0128] The acquisition module 202 is configured to acquire first user information of a first user, the first user information representing identity information of the first user.

[0129] The prediction module 203 is configured to determine a recommended item corresponding to the first user according to the first user information.

[0130] The prediction module 203 determines the recommended item corresponding to the first user through a recommendation model, wherein the recommendation model is obtained by training a first unit, and the first unit is specifically as follows:

[0131] S11, acquiring second user information of a plurality of second users and historical purchase items of each second user, for each second user information, the second user information representing identity information of the corresponding second user;

[0132] S12, determining a first preference degree between each second user and each historical purchase item according to each second user and each historical purchase item;

[0133] S13, determining a knowledge graph dataset according to each second user information, each historical purchase item and each first preference degree, the knowledge graph dataset comprising the second user information of each second user, each historical purchase item and the first preference degree between each second user and each historical purchase item, for each second user, the historical purchase items corresponding to the second user including favorite items of the second user;

[0134] S14, training an initial model according to the knowledge graph dataset to obtain a predicted recommended item corresponding to each second user;

[0135] S15, determining a total loss value of the initial model according to each predicted recommended item and each favorite item;

[0136] S16, if the total loss value meets a preset ending condition, taking the initial model when the preset ending condition is met as the recommendation model, if the total loss value does not meet the preset ending condition, adjusting network parameters of an initial network, and retraining the initial model according to the adjusted network parameters until the total loss value of the initial model meets the preset ending condition.

[0137] Optionally, the prediction module 203 further comprises:

[0138] an embedded vector module configured to determine, according to the knowledge graph dataset, an embedded vector, the embedded vector comprising a plurality of elements, the plurality of elements comprising each second user, each historical purchase item, and a first preference degree between each second user and each historical purchase item;

[0139] an auxiliary loss function module configured to determine, according to the embedded vector, an auxiliary loss function of the initial model, the auxiliary loss function being used to determine a difference between each predicted recommendation item;

[0140] a total loss function module configured to determine, according to the auxiliary loss function and a main task loss function of the initial model, a total loss function of the initial model, the main task loss function being used to determine a difference between the predicted recommendation item and the liked item, and the prediction module 203 is specifically configured to:

[0141] determine, according to each predicted recommendation item and each liked item, a total loss value of the initial model by the total loss function.

[0142] Optionally, the prediction module 203 further comprises:

[0143] a mutual information quantity module configured to determine, for each element in the embedded vector as a target element, a mutual information quantity between the target element and each element in the embedded vector except the target element, and for each mutual information quantity, the mutual information quantity represents a correlation between the corresponding two elements;

[0144] a fusion vector module configured to, for each target element corresponding to each mutual information quantity, sort the mutual information quantities from large to small, obtain a first K mutual information quantities, perform feature fusion on elements corresponding to the first K mutual information quantities and the target element to obtain a first fusion element, sort the mutual information quantities from large to small, perform feature fusion on elements corresponding to mutual information quantities other than the first K mutual information quantities and the target element to obtain a second fusion element, determine a first fusion vector according to each first fusion element, and determine a second fusion vector according to each second fusion element;

[0145] The feature vector module is configured to: extract first features of each first fusion element in the first fusion vector by a first encoder according to the first fusion vector to determine a first feature vector, and extract second features of each first fusion element in the first fusion vector by a second encoder to determine a second feature vector; extract third features of each second fusion element in the second fusion vector by the second encoder according to the second fusion vector to determine a third feature vector, and extract fourth features of each second fusion element in the second fusion vector by the second encoder to determine a fourth feature vector.

[0146] The prediction module is configured to:

[0147] determine the auxiliary loss function of the initial model according to the first feature vector, the second feature vector, the third feature vector and the fourth feature vector.

[0148] Optionally, the prediction module 203 is further configured to determine the knowledge graph dataset according to the respective second user information, the respective historical purchase item and the respective first preference degree, and the prediction module 203 comprises:

[0149] a first calculation module configured to determine the knowledge graph dataset according to the respective second user information, the respective historical purchase item and the respective first preference degree by a first formula, wherein the first formula is:

[0150] O + = {(h, r, t) | (h, t) ∈ (U, I)};

[0151] U = {u1, u2, u3…un}; n};

[0152] I = {i1, i2, i3…im}; m};

[0153] wherein O + represents the knowledge graph dataset, h represents a head node in the knowledge graph dataset, each head node represents a second user, t represents a tail node in the knowledge graph dataset, each tail node represents a historical purchase item, r represents a first preference degree between the head node and the tail node, (h, t) represents a first preference degree between a target second user and a target historical purchase item, wherein the target second user is any one of the second users and the target historical purchase item is any one of the historical purchase items, U represents a set of second user information, u1, u2, u3…un n represent n second user information, and I represents a set of historical purchase items, i1, i2, i3…im m represent m historical purchase items.

[0154] Optionally, the mutual information module comprises:

[0155] The second calculation module is configured to determine, by a second formula, mutual information between each element in the embedded vector and each element in the embedded vector except the target element, taking each element in the embedded vector as a target element, wherein the second formula is:

[0156]

[0157] wherein MI(V I , V J ) represents mutual information between the target element V i and the element v j in the embedded vector except the target element, v j represents the jth element in the embedded vector except the target element, p(v i , v j ) represents a joint probability distribution function of V i and v j , p(v i ) represents an edge probability distribution function of V i , and p(v j ) represents an edge probability distribution function of v j .

[0158] Optionally, the auxiliary loss function module comprises:

[0159] The third calculation module is configured to determine, by a third formula, an auxiliary loss function of the initial model according to the first feature vector, the second feature vector, the third feature vector and the fourth feature vector, wherein the third formula is:

[0160]

[0161] wherein z i represents the first feature vector, z′ i represents the second feature vector, z j represents the third feature vector, z′ j represents the fourth feature vector, N represents the number of samples in a single batch in the initial model training process, τ represents a temperature coefficient, H represents the first encoder, G represents the second encoder, and L represents the auxiliary loss function.

[0162] Optionally, the total loss module comprises:

[0163] The fourth calculation module is configured to determine, by a fourth formula, a total loss function according to the auxiliary loss function and the main task loss function, wherein the fourth formula is:

[0164]

[0165] wherein L main represents a main task loss function, and a represents a loss weight, represents an auxiliary loss function, represents a total loss function.

[0166] An electronic device according to an embodiment of the disclosure includes a memory, a processor, and a program stored in the memory and running on the processor, and the processor implements part or all of the steps of the above-mentioned recommendation method based on a knowledge graph dataset when running the program.

[0167] Correspondingly, the program is computer software, and the parameters and steps described above in the electronic device can refer to the parameters and steps in the embodiments of the recommendation method based on a knowledge graph dataset, which will not be described here.

[0168] Those skilled in the art know that the present disclosure can be implemented as a system, a method, or a computer program product. Therefore, the present disclosure can be specifically implemented as follows: it can be complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" in this paper. In addition, in some embodiments, the present disclosure can also be implemented as a computer program product in one or more computer readable media, which contains computer readable program code. The computer readable storage medium may, for example, be but not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above.

[0169] In the description of the present disclosure, the description of the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present disclosure. In the present disclosure, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any suitable manner in any one or more embodiments or examples. In addition, the skilled in the art can combine and combine the different embodiments or examples described in the present disclosure and the features of different embodiments or examples without contradiction.

[0170] Although the embodiments of the present disclosure have been shown and described above, it should be understood that the above embodiments are exemplary and cannot be understood as limiting the present disclosure, and those skilled in the art can make changes, modifications, replacements and variations to the above embodiments within the scope of the present disclosure.

Claims

1. A recommendation method based on a knowledge graph dataset, characterized in that, Includes the following steps: Obtain the first user information of the first user, which represents the identity information of the first user; Based on the first user information, determine the recommended items corresponding to the first user; The step of determining the recommended items corresponding to the first user based on the first user information includes: The first user's information is input into the recommendation model, and the recommendation model outputs recommended items corresponding to the first user. The recommendation model is trained in the following way: S11, obtain the second user information of multiple second users and the historical purchase items of each second user. For each second user information, the second user information represents the identity information of the corresponding second user. S12, based on each second user and each historically purchased item, determine the first degree of preference between each second user and each historically purchased item; S13, determine a knowledge graph dataset based on each second user information, each historical purchase item and each first preference degree. The knowledge graph dataset includes the second user information of each second user, each historical purchase item and the first preference degree between each second user and each historical purchase item. For each second user, the historical purchase items corresponding to the second user include the second user's favorite items. S14, Train the initial model based on the knowledge graph dataset to obtain the predicted recommended items for each second user; S15, determine the total loss value of the initial model based on each of the predicted recommended items and each of the liked items; S16. If the total loss value meets the preset termination condition, the initial model that meets the preset termination condition is used as the recommended model. If the total loss value does not meet the preset termination condition, the network parameters of the initial network are adjusted, and the initial model is retrained according to the adjusted network parameters until the total loss value of the initial model meets the preset termination condition. The method further includes: Based on the knowledge graph dataset, an embedded vector is determined. The embedded vector includes multiple elements, including each second user, each historically purchased item, and a first preference degree between each second user and each historically purchased item. Based on the embedded vector, an auxiliary loss function is determined for the initial model, which is used to determine the differences between the predicted recommended items. Based on the auxiliary loss function and the main task loss function of the initial model, the total loss function of the initial model is determined, wherein the main task loss function is used to determine the difference between the predicted recommended items and the liked items; S15 specifically includes: Based on each of the predicted recommended items and each of the preferred items, the total loss value of the initial model is determined by the total loss function. The method further includes: Each element in the embedded vector is taken as the target element, and the mutual information between the target element and each element in the embedded vector other than the target element is determined. For each mutual information, the mutual information represents the correlation between the corresponding two elements. For each mutual information quantity corresponding to each target element, sort the mutual information quantities from largest to smallest and obtain the top K mutual information quantities. Perform feature fusion between the elements corresponding to the top K mutual information quantities and the target element to obtain a first fusion element. Sort the mutual information quantities from largest to smallest and perform feature fusion between the elements corresponding to the mutual information quantities other than the top K mutual information quantities and the target element to obtain a second fusion element. Determine a first fusion vector based on each of the first fusion elements and a second fusion vector based on each of the second fusion elements. Based on the first fusion vector, the first feature of each first fusion element in the first fusion vector is extracted by the first encoder to determine the first feature vector, and the second feature of each first fusion element in the first fusion vector is extracted by the second encoder to determine the second feature vector. Based on the second fusion vector, the third feature of each second fusion element in the second fusion vector is extracted by the second encoder to determine the third feature vector, and the fourth feature of each second fusion element in the second fusion vector is extracted by the second encoder to determine the fourth feature vector. The step of determining the auxiliary loss function of the initial model based on the embedded vector includes: The auxiliary loss function of the initial model is determined based on the first feature vector, the second feature vector, the third feature vector, and the fourth feature vector.

2. The method according to claim 1, characterized in that, The step of determining the knowledge graph dataset based on each of the second user information, each of the historical purchased items, and each of the first preference levels includes: Based on each of the second user information, each of the historical purchased items, and each of the first preference levels, a knowledge graph dataset is determined using a first formula, wherein the first formula is: ; ; ; in, Represents a knowledge graph dataset. Let represent the head nodes in the knowledge graph dataset, where each head node represents a second user; let t represent the tail nodes in the knowledge graph dataset, where each tail node represents a historically purchased item; and let r represent the degree of preference between the head nodes and the tail nodes. This represents the degree of preference between the target second user and the target historically purchased items, where the target second user is any second user, the target historically purchased items are any historically purchased items, and U represents the set of second user information. Let I represent a total of n pieces of information about the second user, and let I represent the set of historically purchased items. This represents a total of m historical purchased items.

3. The method according to claim 2, characterized in that, The step of taking each element in the embedded vector as a target element and determining the mutual information between the target element and each element in the embedded vector other than the target element includes: Taking each element in the embedded vector as the target element, the mutual information between the target element and each element in the embedded vector other than the target element is determined by a second formula, wherein the second formula is: ; in, Represents the target element Elements in the embedded vector other than the target element Mutual information between them This represents the j-th element in the embedded vector, excluding the target element. express and The joint probability distribution function, express The marginal probability distribution function, express The marginal probability distribution function.

4. The method according to claim 3, characterized in that, The step of determining the auxiliary loss function of the initial model based on the first feature vector, the second feature vector, the third feature vector, and the fourth feature vector includes: Based on the first feature vector, the second feature vector, the third feature vector, and the fourth feature vector, the auxiliary loss function of the initial model is determined using a third formula, wherein the third formula is: ; in, Represents the first eigenvector. Represents the second eigenvector. Represents the third eigenvector. Represents the fourth eigenvector. This indicates the number of samples in a single batch during the initial model training process. Indicates the temperature coefficient. G represents the first encoder, and G represents the second encoder. Represents the auxiliary loss function; The step of determining the total loss function of the initial model based on the auxiliary loss function and the main task loss function of the initial model includes: Based on the auxiliary loss function and the main task loss function, the total loss function is determined using the fourth formula, wherein the fourth formula is: ; in, This represents the loss function of the main task. Indicates the loss weight. Denotes the auxiliary loss function. This represents the total loss function.

5. A recommendation system based on a knowledge graph dataset, characterized in that, include: The acquisition module is used to acquire the first user information of the first user, which represents the identity information of the first user. The prediction module is used to determine the recommended items corresponding to the first user based on the first user information; The prediction module determines the recommended items for the first user through a recommendation model, wherein the recommendation model is trained using a first unit, which is specifically as follows: S11, obtain the second user information of multiple second users and the historical purchase items of each second user. For each second user information, the second user information represents the identity information of the corresponding second user. S12, based on each second user and each historically purchased item, determine the first degree of preference between each second user and each historically purchased item; S13, determine a knowledge graph dataset based on each second user information, each historical purchase item and each first preference degree. The knowledge graph dataset includes the second user information of each second user, each historical purchase item and the first preference degree between each second user and each historical purchase item. For each second user, the historical purchase items corresponding to the second user include the second user's favorite items. S14, Train the initial model based on the knowledge graph dataset to obtain the predicted recommended items for each second user; S15, determine the total loss value of the initial model based on each of the predicted recommended items and each of the liked items; S16. If the total loss value meets the preset termination condition, the initial model that meets the preset termination condition is used as the recommended model. If the total loss value does not meet the preset termination condition, the network parameters of the initial network are adjusted, and the initial model is retrained according to the adjusted network parameters until the total loss value of the initial model meets the preset termination condition. Optionally, the prediction module 203 also includes: The embedded vector module is used to determine embedded vectors based on the knowledge graph dataset. The embedded vectors include multiple elements, including each second user, each historical purchased item, and the degree of first preference between each second user and each historical purchased item. The auxiliary loss function module is used to determine the auxiliary loss function of the initial model based on the embedded vectors. The auxiliary loss function is used to determine the differences between the predicted recommended items. The total loss function module is used to determine the total loss function of the initial model based on the auxiliary loss function and the main task loss function of the initial model. The main task loss function is used to determine the difference between predicted recommended items and liked items. Therefore, when determining the total loss value of the initial model based on each predicted recommended item and each liked item, the prediction module 203 is specifically used for: Based on each predicted recommended item and each liked item, the total loss value of the initial model is determined by the total loss function. Optionally, the prediction module 203 also includes: The mutual information module is used to take each element in the embedded vector as the target element and determine the mutual information between the target element and each element in the embedded vector other than the target element. For each mutual information, the mutual information represents the correlation between the corresponding two elements. The fusion vector module is used to sort the mutual information values ​​corresponding to each target element from largest to smallest, obtain the top K mutual information values, fuse the elements corresponding to the top K mutual information values ​​with the target element to obtain the first fusion element, sort the mutual information values ​​from largest to smallest, and fuse the elements corresponding to the mutual information values ​​other than the top K mutual information values ​​with the target element to obtain the second fusion element, determine the first fusion vector based on each first fusion element, and determine the second fusion vector based on each second fusion element. The feature vector module is used to extract the first feature of each first fusion element in the first fusion vector by the first encoder and determine the first feature vector, and to extract the second feature of each first fusion element in the first fusion vector by the second encoder and determine the second feature vector, and to extract the third feature of each second fusion element in the second fusion vector by the second encoder and determine the third feature vector, and to extract the fourth feature of each second fusion element in the second fusion vector and determine the fourth feature vector. The prediction module described above, when determining the auxiliary loss function of the initial model based on the embedded vectors, is specifically used for: The auxiliary loss function of the initial model is determined based on the first feature vector, the second feature vector, the third feature vector, and the fourth feature vector.

6. An electronic device comprising a memory, a processor, and a program stored in the memory and running on the processor, characterized in that, When the processor executes the program, it implements the steps of a recommendation method based on a knowledge graph dataset as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a terminal device, cause the terminal device to perform the steps of a recommendation method based on a knowledge graph dataset as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Graph recommendation method and device and electronic equipment

    CN113742531A