Gift recommendation method and system based on user portrait

By constructing gift knowledge graphs and user portraits, using multi-dimensional similarity calculation and graph search algorithms, the problems of insufficient personalization and insufficient dynamic preference capture in the existing technology are solved, and more accurate and diverse gift recommendations are achieved to adapt to users. Interests and social relationship changes.

CN118917929BActive Publication Date: 2024-12-06ZHONGXING BEIDOU (BEIJING) TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411413494.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2024-12-06
Estimated Expiration
2044-10-11

AI Technical Summary

Technical Problem

The existing gift recommendation system is insufficiently personalized, making it difficult to capture user dynamic preferences and social relationships, resulting in insufficiently accurate and diverse recommendation results.

Method used

By constructing gift knowledge graphs and user behavior data, generating user portraits, using graph embedding technology and multi-dimensional similarity calculation model, combining graph search algorithms and policy networks, searching for similar users and recommended gifts, considering user interests, consumption habits, and social relationships and context information to generate a personalized recommendation list.

Benefits of technology

It achieves more accurate and diverse gift recommendations, can dynamically adjust recommendation results, adapt to changes in user interests and social relationships, and improve the level of personalization of recommendations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118917929B_ABST
    Figure CN118917929B_ABST
Patent Text Reader

Abstract

The present invention provides a gift recommendation method and system based on user portraits, which relates to the technical field of information push, including constructing a gift knowledge graph including entities and relationships; generating a preliminary user portrait based on user behavior data; mapping the preliminary user portrait to the gift knowledge graph, and obtaining an enhanced user portrait by combining the preliminary user portrait and a user-item bipartite graph; in the gift knowledge graph, starting from the current user, searching for other user nodes with the highest similarity to the current user by using a multi-dimensional similarity calculation model and a graph search algorithm; collecting gift entities associated with other user nodes with the highest similarity to the current user to form a candidate gift set; screening and sorting the candidate gift set according to the contextual information of the current user's geographical location, time, and festival; generating a personalized gift recommendation list based on the screened and sorted candidate gift set and combining the enhanced user portrait of the current user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to information push technology, and in particular to a gift recommendation method and system based on user portraits. Background Art

[0002] With the development of e-commerce and social networks, personalized recommendation systems have become increasingly important in recent years. These systems can analyze users' historical behavior data, including purchase history, browsing history, and user interactions on social platforms, to predict users' interests and needs and recommend products or services that may be of interest to them. Among all types of recommendation systems, gift recommendation has received special attention due to its particularity. It not only needs to consider the preferences of the user receiving the gift, but also the purchase intention and emotional expression of the gift giver.

[0003] There are still some limitations in the specific applications of existing gift recommendations:

[0004] Insufficient personalization: Traditional recommendation systems often ignore the personalized element in gift selection, that is, the choice of gift not only reflects the preferences of the recipient, but also is part of the emotional expression of the giver.

[0005] Dynamic preference problem: Users’ interests and needs may change over time, on occasions, or on specific holidays. Existing systems often have difficulty capturing such dynamic changes, especially when predicting the preferences of gift recipients.

[0006] Insufficient consideration of social relationships: The closeness of the social relationship between the giver and the receiver is an important factor when choosing a gift, but existing recommendation systems often fail to fully consider this. Summary of the invention

[0007] The embodiments of the present invention provide a gift recommendation method and system based on user portraits, which can solve the problems in the prior art.

[0008] According to a first aspect of the embodiments of the present invention,

[0009] Provides gift recommendation methods based on user portraits, including:

[0010] Collect gift-related data, including gift name, category, price, applicable scenario, and information about the target audience, and construct the gift-related data into a gift knowledge graph containing entities and relationships; obtain user behavior data of historical purchase records, browsing records, collection records, and evaluation records of users; based on user behavior data, extract the characteristics of user interests, consumption habits, and price preferences, and generate a preliminary user portrait; map the preliminary user portrait to the gift knowledge graph, use graph embedding technology to calculate the association between the user and the gift entity, and determine the user-item rating matrix based on the preliminary user portrait, construct a user-item bipartite graph based on the filled user-item rating matrix, and combine the preliminary user portrait and the user-item bipartite graph to obtain an enhanced user portrait;

[0011] Based on enhanced user portraits, a similarity calculation model with multiple dimensions including user interest similarity, consumption habit similarity, and social relationship similarity is constructed; in the gift knowledge graph, starting from the current user, the multi-dimensional similarity calculation model and graph search algorithm are used to search for other user nodes with the highest similarity to the current user; the gift entities associated with other user nodes with the highest similarity to the current user are collected to form a candidate gift set;

[0012] The candidate gift set is filtered and sorted according to the contextual information of the current user's geographic location, time, and festival; based on the filtered and sorted candidate gift set and combined with the enhanced user portrait of the current user, a personalized gift recommendation list is generated.

[0013] In an optional embodiment,

[0014] Determining a user-item rating matrix based on the preliminary user profile, and constructing a user-item bipartite graph according to the filled user-item rating matrix includes:

[0015] Determine a user-item rating matrix based on the preliminary user profile, wherein each item in the user-item rating matrix represents a rating of a user to a certain item, and the rating is a standardized rating;

[0016] A user-item bipartite graph is constructed according to the filled user-item rating matrix, wherein the user-item bipartite graph includes a set of user nodes and a set of item nodes, and the weight of the edge between the user node and the item node is the corresponding rating value; and the transition probability from the user node to the item node and from the item node to the user node in the user-item bipartite graph is calculated, wherein the transition probability is determined by the rating value between the nodes and the degree of the nodes.

[0017] In an optional embodiment,

[0018] In the gift knowledge graph, starting from the current user, using the multi-dimensional similarity calculation model and graph search algorithm, search for other user nodes with the highest similarity to the current user, including:

[0019] Based on the access sequence obtained by random walk, the similarity between users is calculated. The calculation of the similarity comprehensively considers the position, frequency and attenuation factor of two user nodes in the access sequence, including: ;

[0020] in, sim(u,v) Indicates user u and users v Similarity, α represents the weight coefficient corresponding to the random walk sequence, T represents the total number of steps of random walk; γ Represents the attenuation factor, which is used to control the sensitivity of similarity calculation to distant nodes; β represents the weight coefficient corresponding to the user-item interaction, I Represents a collection of items. w i Indicates items i The importance weight of It means that when user u interacts with item i, the value is 1, otherwise it is 0. It means that when user v interacts with item i, the value is 1, otherwise it is 0. r ui , r vi They represent user u interacting with item i and user v interacting with item i, respectively. represents the similarity of item i in the interaction records of users u and v; t represents the step index of random walk, i u represents the rating behavior characteristics of user u on item i, i v represents the rating behavior characteristics of user v on item i, u t represents the behavior of user u in the random walk step index t, 1( u t =v): represents the indicator function, which is 1 when the behavior of users u and v at the random walk step index t is the same, and 0 otherwise.

[0021] In an optional embodiment,

[0022] Using the multi-dimensional similarity calculation model and graph search algorithm, other user nodes with the highest similarity to the current user are searched, including:

[0023] Construct a Markov decision process model: define the state space, including the currently visited user node, the set of neighbor nodes of the user node, the feature vector of the user node, and the current context information; define the action space as the next user node accessible from the current user node; design a reward function that comprehensively considers user similarity and diversity, including adjustable weight coefficients;

[0024] Design a policy network based on graph attention network: construct an input layer to encode the state into a vector representation; construct a graph attention layer to capture the importance relationship between nodes using a multi-head attention mechanism; construct an output layer to output the action probability distribution using a softmax function;

[0025] The policy network is trained using a proximal policy optimization algorithm: the objective function for clipping is defined, including the importance sampling ratio and the advantage function; the advantage function is calculated using generalized advantage estimation; a value function network is designed and learned to estimate the state value; an entropy regularization term is introduced to encourage policy exploration; an overall optimization objective is constructed, combining the clipping objective function, the value function loss, and the entropy regularization term;

[0026] Use the trained policy network to perform similar user discovery:

[0027] Input the target user node and its related information into the policy network; select the next access node according to the probability distribution output by the policy network; repeat the walking process until the predetermined number of walking steps is reached or the stopping condition is met; collect the user nodes visited during the walking process as a candidate set of similar users; sort the users in the candidate set to generate the final similar user list.

[0028] In an optional embodiment,

[0029] The method further comprises:

[0030] Execute the training process:

[0031] Use the current strategy to perform multiple rounds of walks in the user graph and collect state-action-reward-next-state samples; calculate the advantage of each time step based on the collected data and the current value function network; use the stochastic gradient ascent method to optimize the objective function and update the parameters of the policy network and the value function network;

[0032] Apply an early stopping strategy and stop training when the validation set performance does not improve for a predetermined number of training cycles;

[0033] Dynamically adjust the weight coefficient in the reward function according to user feedback and system goals; introduce a temperature parameter to control the degree of exploration of the strategy, and gradually reduce the parameter value as training progresses;

[0034] Implement cold start processing for newly added user nodes: extract features from the new user's registration information and initial behavior; calculate the content similarity between the new user and existing users; and generate the new user's initial embedding through weighted averaging based on the embeddings of a predetermined number of existing users with the highest similarity.

[0035] In an optional embodiment,

[0036] According to the current user's geographic location, time, and holiday context information, the candidate gift set is filtered and sorted; based on the filtered and sorted candidate gift set, combined with the enhanced user profile of the current user, a personalized gift recommendation list is generated, including:

[0037] According to the user-item rating matrix and the user similarity matrix, a collaborative filtering algorithm is used to calculate the target user's predicted rating for the unrated items. The collaborative filtering algorithm is based on the target user's neighboring user set, and obtains the predicted rating by weighted summation of the neighboring user's ratings on the items and the similarity between users. The items are sorted from high to low according to the predicted rating to generate an initial recommendation list.

[0038] Define relevance target, diversity target and novelty target. The relevance target uses the weighted sum of the predicted scores of the items in the recommendation list, and the weight is the discount coefficient of the position of the item in the recommendation list; the diversity target uses the normalized complementary value of the cosine similarity between the items in the recommendation list, and the item similarity is calculated based on the content characteristics of the items and the user behavior characteristics; the novelty target uses the sum of the logarithmic inverses of the popularity of the items in the recommendation list, and the popularity of the items is estimated based on the frequency of user interaction with the items;

[0039] Constructing a multi-objective ranking model, linearly combining the relevance objective, diversity objective and novelty objective into a single objective function by weighted summation, setting weight coefficients of relevance, diversity and novelty in the objective function, and optimizing the weight coefficient values ​​by grid search and cross-validation;

[0040] An improved non-dominated sorting genetic algorithm is used to solve the multi-objective sorting model, an elite retention strategy and crowding distance are introduced, the initial recommendation list is regarded as a chromosome, and the objective function is iteratively optimized through gene encoding, individual evaluation, selection, crossover, and mutation operations until the maximum number of iterations is reached or the convergence condition is met, and the optimal solution set is obtained;

[0041] The optimal solution is selected from the optimal solution set, the initial recommendation list is reordered, a final recommendation list is generated, and the final recommendation list is dynamically adjusted according to the real-time feedback of the user, and is returned to the user in real time as a result of personalized recommendation.

[0042] According to a second aspect of the embodiments of the present invention,

[0043] Provide a gift recommendation system based on user portraits, including:

[0044] The first unit is used to collect gift-related data, including gift name, category, price, applicable scenario, and information about the target audience, and construct the gift-related data into a gift knowledge graph containing entities and relationships; obtain user behavior data of historical purchase records, browsing records, collection records, and evaluation records of users; based on the user behavior data, extract the characteristics of the user's interests, consumption habits, and price preferences, and generate a preliminary user portrait; map the preliminary user portrait to the gift knowledge graph, use graph embedding technology to calculate the association between the user and the gift entity, and determine the user-item rating matrix based on the preliminary user portrait, construct a user-item bipartite graph based on the filled user-item rating matrix, and combine the preliminary user portrait and the user-item bipartite graph to obtain an enhanced user portrait;

[0045] The second unit is used to build a similarity calculation model including multiple dimensions of user interest similarity, consumption habit similarity, and social relationship similarity based on enhanced user portraits; in the gift knowledge graph, starting from the current user, using the multi-dimensional similarity calculation model and graph search algorithm, search for other user nodes with the highest similarity to the current user; collect gift entities associated with other user nodes with the highest similarity to the current user to form a candidate gift set;

[0046] The third unit is used to filter and sort the candidate gift set according to the context information of the current user's geographic location, time, and festival; based on the filtered and sorted candidate gift set, combined with the enhanced user portrait of the current user, a personalized gift recommendation list is generated.

[0047] According to a third aspect of the embodiments of the present invention,

[0048] An electronic device is provided, comprising:

[0049] processor;

[0050] a memory for storing processor-executable instructions;

[0051] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0052] According to a fourth aspect of the embodiments of the present invention,

[0053] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.

[0054] The user-item bipartite graph and its transition probability constructed in this way provide an important data structure and calculation basis for the subsequent personalized recommendation algorithm. It not only reflects the user's preferences, but also takes into account the popularity of items, and can support more accurate and diverse recommendation results. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 A flowchart of a gift recommendation method based on user portraits according to an embodiment of the present invention;

[0056] Figure 2 It is a structural diagram of a gift recommendation system based on user portrait according to an embodiment of the present invention. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0058] The technical solution of the present invention is described in detail with specific embodiments below. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0059] Figure 1 FIG. 1 is a flow chart of a method for recommending gifts based on user portraits according to an embodiment of the present invention. Figure 1 As shown, the method includes:

[0060] S101. Collect gift-related data, including gift name, category, price, applicable scenario, and information about the target audience, and construct the gift-related data into a gift knowledge graph containing entities and relationships; obtain user behavior data of historical purchase records, browsing records, collection records, and evaluation records of users; based on the user behavior data, extract the characteristics of the user's interests, consumption habits, and price preferences, and generate a preliminary user portrait; map the preliminary user portrait to the gift knowledge graph, calculate the association between the user and the gift entity using graph embedding technology, and determine the user-item rating matrix based on the preliminary user portrait, construct a user-item bipartite graph based on the filled user-item rating matrix, and combine the preliminary user portrait and the user-item bipartite graph to obtain an enhanced user portrait;

[0061] S102. Based on the enhanced user portrait, a similarity calculation model including user interest similarity, consumption habit similarity, and social relationship similarity is constructed; in the gift knowledge graph, starting from the current user, the multi-dimensional similarity calculation model and the graph search algorithm are used to search for other user nodes with the highest similarity to the current user; the gift entities associated with other user nodes with the highest similarity to the current user are collected to form a candidate gift set;

[0062] S103. Filter and sort the candidate gift set according to the contextual information of the current user's geographic location, time, and festival; based on the filtered and sorted candidate gift set, combined with the enhanced user portrait of the current user, generate a personalized gift recommendation list.

[0063] In an optional embodiment,

[0064] Determining a user-item rating matrix based on the preliminary user profile, and constructing a user-item bipartite graph according to the filled user-item rating matrix includes:

[0065] Determine a user-item rating matrix based on the preliminary user profile, wherein each item in the user-item rating matrix represents a rating of a user to a certain item, and the rating is a standardized rating;

[0066] A user-item bipartite graph is constructed according to the filled user-item rating matrix, wherein the user-item bipartite graph includes a set of user nodes and a set of item nodes, and the weight of the edge between the user node and the item node is the corresponding rating value; and the transition probability from the user node to the item node and from the item node to the user node in the user-item bipartite graph is calculated, wherein the transition probability is determined by the rating value between the nodes and the degree of the nodes.

[0067] Exemplarily, the detailed technical content of constructing a user-item bipartite graph based on user portraits is as follows:

[0068] Preliminary user portraits determine the user-item rating matrix, which is the basis for constructing the user-item bipartite graph. This process first requires collecting user behavior data, including browsing history, purchase history, evaluation content, etc. For e-commerce platforms, all user interactions in the past three months can be collected. For example, user A browsed 100 items, purchased 10 items, and evaluated 5 of them in the past three months.

[0069] After collecting user behavior data, it is necessary to preprocess and standardize the data. Preprocessing includes removing outliers and noise data, such as excluding robot behavior or obviously unreasonable ratings. Standardization is to convert ratings of different scales to the same range, usually between 0 and 1. Specifically, the minimum-maximum normalization method can be used to linearly map the original rating to the 0-1 range. Assuming the original rating range is 1-5 stars, a 2-star rating may become 0.25 after standardization.

[0070] After completing data preprocessing and standardization, you can construct a user-item rating matrix. The rows of this matrix represent users, the columns represent items, and the value of each cell represents the standardized rating of the user on the item. For items that the user has not interacted with, the corresponding cells are initially empty. For example, in a system with 10,000 users and 100,000 items, the size of the rating matrix is ​​10,000x100,000, but only 1% of the cells may have values, and the remaining 99% are empty.

[0071] In order to deal with the sparsity problem in the rating matrix, matrix filling is required. Common filling methods include collaborative filtering and matrix decomposition. Taking collaborative filtering as an example, the missing ratings can be predicted based on user similarity or item similarity. Specifically, for the missing ratings of user A and item X, the K users most similar to user A (such as K=10) can be found, and then the weighted average of the ratings of these K users on item X can be used to fill in the missing ratings. The weight can be set to user similarity.

[0072] The filled user-item rating matrix provides the basis for constructing a bipartite graph. In this bipartite graph, one type of node represents the user and the other type of node represents the item. If a user has rated an item, an edge is connected between the corresponding user node and the item node, and the weight of the edge is the rating value. For example, if user A's standardized rating for item X is 0.8, there will be an edge with a weight of 0.8 between user node A and item node X.

[0073] After constructing the bipartite graph, it is necessary to calculate the transition probability between nodes, which is crucial for the subsequent random walk or recommendation algorithm. The calculation of the transition probability takes into account the rating value and the degree of the node. The degree of a node indicates the number of edges connected to the node, reflecting the user's activity or the popularity of an item.

[0074] The transition probability from a user node to an item node can be calculated by first summing up the user's ratings for all items, and then dividing the user's rating for a specific item by this sum. For example, if user A has rated a total of 5 items, with a standardized rating of 0.8 for item X, and ratings of 0.6, 0.7, 0.5, and 0.4 for the other 4 items, then the transition probability from user A to item X is 0.8 divided by (0.8+0.6+0.7+0.5+0.4), which is approximately 0.27.

[0075] The calculation method for the transition probability from the item node to the user node is similar, but the popularity of the item needs to be taken into account. You can first calculate the sum of the ratings of the item by all users, and then divide the rating of the item by the specific user. Suppose item X is rated by 20 users in total, the sum of these ratings is 15, and user A's rating of item X is 0.8, then the transition probability from item X to user A is 0.8 divided by 15, which is approximately equal to 0.053.

[0076] The user-item bipartite graph and its transition probability constructed in this way provide an important data structure and calculation basis for the subsequent personalized recommendation algorithm. It not only reflects the user's preferences, but also takes into account the popularity of items, and can support more accurate and diverse recommendation results.

[0077] In an optional embodiment,

[0078] In the gift knowledge graph, starting from the current user, using the multi-dimensional similarity calculation model and graph search algorithm, search for other user nodes with the highest similarity to the current user, including:

[0079] Based on the access sequence obtained by random walk, the similarity between users is calculated. The calculation of the similarity comprehensively considers the position, frequency and attenuation factor of two user nodes in the access sequence, including: ;

[0080] in, sim(u,v) Indicates user u and users v Similarity, α represents the weight coefficient corresponding to the random walk sequence, T represents the total number of steps of random walk; γ Represents the attenuation factor, which is used to control the sensitivity of similarity calculation to distant nodes; β represents the weight coefficient corresponding to the user-item interaction, I Represents a collection of items. w i Indicates items i The importance weight of It means that when user u interacts with item i, the value is 1, otherwise it is 0. It means that when user v interacts with item i, the value is 1, otherwise it is 0. r ui , r vi They represent user u interacting with item i and user v interacting with item i, respectively. represents the similarity of item i in the interaction records of users u and v; t represents the step index of random walk, i u represents the rating behavior characteristics of user u on item i, i v represents the rating behavior characteristics of user v on item i, u t represents the behavior of user u in the random walk step index t, 1( u t =v): represents the indicator function, which is 1 when the behavior of users u and v at the random walk step index t is the same, and 0 otherwise.

[0081] In an optional embodiment,

[0082] Using the multi-dimensional similarity calculation model and graph search algorithm, other user nodes with the highest similarity to the current user are searched, including:

[0083] Construct a Markov decision process model: define the state space, including the currently visited user node, the set of neighbor nodes of the user node, the feature vector of the user node, and the current context information; define the action space as the next user node accessible from the current user node; design a reward function that comprehensively considers user similarity and diversity, including adjustable weight coefficients;

[0084] Design a policy network based on graph attention network: construct an input layer to encode the state into a vector representation; construct a graph attention layer to capture the importance relationship between nodes using a multi-head attention mechanism; construct an output layer to output the action probability distribution using a softmax function;

[0085] The policy network is trained using a proximal policy optimization algorithm: the objective function for clipping is defined, including the importance sampling ratio and the advantage function; the advantage function is calculated using generalized advantage estimation; a value function network is designed and learned to estimate the state value; an entropy regularization term is introduced to encourage policy exploration; an overall optimization objective is constructed, combining the clipping objective function, the value function loss, and the entropy regularization term;

[0086] Use the trained policy network to perform similar user discovery:

[0087] Input the target user node and its related information into the policy network; select the next access node according to the probability distribution output by the policy network; repeat the walking process until the predetermined number of walking steps is reached or the stopping condition is met; collect the user nodes visited during the walking process as a candidate set of similar users; sort the users in the candidate set to generate the final similar user list.

[0088] In an optional embodiment,

[0089] The method further comprises:

[0090] Execute the training process:

[0091] Use the current strategy to perform multiple rounds of walks in the user graph and collect state-action-reward-next-state samples; calculate the advantage of each time step based on the collected data and the current value function network; use the stochastic gradient ascent method to optimize the objective function and update the parameters of the policy network and the value function network;

[0092] Apply an early stopping strategy and stop training when the validation set performance does not improve for a predetermined number of training cycles;

[0093] Dynamically adjust the weight coefficient in the reward function according to user feedback and system goals; introduce a temperature parameter to control the degree of exploration of the strategy, and gradually reduce the parameter value as training progresses;

[0094] Implement cold start processing for newly added user nodes: extract features from the new user's registration information and initial behavior; calculate the content similarity between the new user and existing users; and generate the new user's initial embedding through weighted averaging based on the embeddings of a predetermined number of existing users with the highest similarity.

[0095] For example, using a multi-dimensional similarity calculation model and a graph search algorithm to search for other user nodes with the highest similarity to the current user is a complex and sophisticated process. The process involves multiple key steps, including building a Markov decision process model, designing a policy network based on a graph attention network, using a proximal policy optimization algorithm for training, and finally performing similar user discovery.

[0096] First, building a Markov decision process model is the basis of the entire system. In this model, the state space is defined as a multidimensional vector, which includes the currently visited user node, the user's neighbor node set, the user feature vector, and the current context information. For example, for an e-commerce platform, the user node may be the user ID, the neighbor node set may include other users who have recently interacted, the user feature vector may include information such as age, gender, purchase history, etc., and the context information may be the current time, festival, etc. Specifically, a state may be represented as: user ID is 10086, neighbor node set is [10087, 10088, 10089], user feature vector is [28 years old, male, prefer electronic products], and context is [weekend, non-holiday].

[0097] The action space is defined as the next user node that can be accessed from the current user node. In practical applications, this may be a set of users that are directly connected to the current user or have some common characteristics. For example, for user 10086, its possible action space (i.e., the next accessible users) may be [10087, 10088, 10089, 10090, 10091].

[0098] The design of the reward function is key, as it takes into account both user similarity and diversity. User similarity can be calculated based on multiple dimensions, such as demographic characteristics, behavior patterns, interests, and hobbies. Diversity ensures that the recommendation results are not too simplistic. For example, the reward function can be set to weight user similarity at 0.7 and diversity at 0.3. For a jump between two users, if their similarity is 0.8, and the diversity gain brought by this jump to the recommendation list is 0.5, then the total reward value is 0.7 x 0.8 + 0.3 x 0.5 = 0.71.

[0099] Next, design a policy network based on the graph attention network. The input layer encodes the state into a vector representation, which may contain the one-hot encoding of the user ID, the average embedding of the neighbor nodes, the user feature vector, and the encoding of the context information. For example, for the state mentioned above, it may be encoded into a 300-dimensional vector, where the first 100 dimensions represent the user ID, the next 100 dimensions represent the neighbor node information, the next 50 dimensions represent the user features, and the last 50 dimensions represent the context information.

[0100] The graph attention layer uses a multi-head attention mechanism to capture the importance relationship between nodes. For example, 8 attention heads can be used, each focusing on a different combination of features. In this way, the model is able to consider node relationships from multiple angles at the same time. Finally, the output layer uses a softmax function to generate an action probability distribution, that is, the probability of selecting the next user node.

[0101] The proximal policy optimization algorithm is used to train the policy network to improve the stability and efficiency of training. The clipped objective function contains the importance sampling ratio and the advantage function, which helps control the magnitude of the policy update and prevents excessive updates from causing training instability. The generalized advantage estimate is used to calculate the advantage of each action, that is, how good it is relative to the average level. The value function network is used to estimate the value of each state, which helps reduce the variance of the advantage estimate.

[0102] The introduction of entropy regularization is to encourage policy exploration and prevent premature convergence to suboptimal solutions. For example, an initial entropy weight can be set to 0.1 and gradually reduced to 0.01 during training. This can maintain a high level of exploration in the early stages of training, while focusing more on utilizing the learned knowledge in the later stages.

[0103] Finally, similar user discovery is performed using the trained policy network. First, the target user's information is input, and then the next node to be visited is selected based on the probability distribution output by the policy network. This process is repeated many times until a predetermined number of steps (such as 100 steps) is reached or certain stopping conditions are met (such as the similarity reaches a threshold). The user nodes visited during the walk are collected to form a candidate set of similar users. Finally, the users in this candidate set are sorted, and factors such as access frequency and similarity may be considered to generate the final list of similar users.

[0104] During the training process, the current strategy is used to perform multiple rounds of walks in the user graph, each round may contain 1,000 steps. At each step, the current state, the action taken, the reward obtained, and the next state are recorded, forming a large amount of sample data. This data is used to calculate the advantage function and update the strategy. For example, if in a certain step, the strategy selects a user with a high similarity as the next visit node, then this action may get a higher advantage value, and thus be strengthened in subsequent updates.

[0105] The early stopping strategy is applied to prevent overfitting. You can set a window and stop training if the performance (such as average reward) on the validation set does not improve within 10 consecutive training cycles. This allows you to stop the training in time when the model performance reaches the best, avoiding performance degradation caused by continued training.

[0106] Dynamically adjusting the weight coefficients in the reward function is to adapt to different scenarios and needs. For example, if it is found that user feedback indicates that the current recommendation results lack diversity, the weight of diversity in the reward function can be increased, such as from 0.3 to 0.4. The introduction and adjustment of the temperature parameter is to control the degree of exploration of the strategy. In the early stage of training, a higher temperature (such as 1.0) can be set to encourage more random exploration; as training progresses, the temperature can be gradually lowered (such as to 0.1) to make the strategy more deterministic.

[0107] For newly added user nodes, special cold start processing is required. First, extract features from the new user's registration information (such as age, gender, occupation) and initial behavior (such as the first browsed product category). Then calculate the content similarity between this new user and existing users, and methods such as cosine similarity may be used. Finally, select some users with the highest similarity (such as top10), take a weighted average of their embedding vectors, and generate the initial embedding of the new user. The weight can be set based on the similarity. For example, if the most similar user has a similarity of 0.8 and the second most similar is 0.7, then their weight ratio in the weighted average may be 8:7.

[0108] Through this method, the system can effectively find similar users in a large-scale user graph, while taking into account the accuracy and diversity of recommendations, and can dynamically adapt to different scenario requirements.

[0109] In an optional embodiment,

[0110] According to the current user's geographic location, time, and holiday context information, the candidate gift set is filtered and sorted; based on the filtered and sorted candidate gift set, combined with the enhanced user profile of the current user, a personalized gift recommendation list is generated, including:

[0111] According to the user-item rating matrix and the user similarity matrix, a collaborative filtering algorithm is used to calculate the target user's predicted rating for the unrated items. The collaborative filtering algorithm is based on the target user's neighboring user set, and obtains the predicted rating by weighted summation of the neighboring user's ratings on the items and the similarity between users. The items are sorted from high to low according to the predicted rating to generate an initial recommendation list.

[0112] Define relevance target, diversity target and novelty target. The relevance target uses the weighted sum of the predicted scores of the items in the recommendation list, and the weight is the discount coefficient of the position of the item in the recommendation list; the diversity target uses the normalized complementary value of the cosine similarity between the items in the recommendation list, and the item similarity is calculated based on the content characteristics of the items and the user behavior characteristics; the novelty target uses the sum of the logarithmic inverses of the popularity of the items in the recommendation list, and the popularity of the items is estimated based on the frequency of user interaction with the items;

[0113] Constructing a multi-objective ranking model, linearly combining the relevance objective, diversity objective and novelty objective into a single objective function by weighted summation, setting weight coefficients of relevance, diversity and novelty in the objective function, and optimizing the weight coefficient values ​​by grid search and cross-validation;

[0114] An improved non-dominated sorting genetic algorithm is used to solve the multi-objective sorting model, an elite retention strategy and crowding distance are introduced, the initial recommendation list is regarded as a chromosome, and the objective function is iteratively optimized through gene encoding, individual evaluation, selection, crossover, and mutation operations until the maximum number of iterations is reached or the convergence condition is met, and the optimal solution set is obtained;

[0115] The optimal solution is selected from the optimal solution set, the initial recommendation list is reordered, a final recommendation list is generated, and the final recommendation list is dynamically adjusted according to the real-time feedback of the user, and is returned to the user in real time as a result of personalized recommendation.

[0116] For example, it is a complex and sophisticated process to filter and sort the candidate gift set according to the current user's geographic location, time, festival and other contextual information, and generate a personalized gift recommendation list in combination with the user's enhanced portrait. This process involves multiple key steps, including the application of collaborative filtering algorithm, multi-objective definition, construction of multi-objective sorting model and optimization solution based on genetic algorithm.

[0117] First, based on the user-item rating matrix and the user similarity matrix, a collaborative filtering algorithm is used to calculate the target user's predicted rating for the unrated items. This process first requires determining the target user's neighboring user set. For example, for user A, the top 20 users with the highest similarity may be selected as the neighboring user set. Then, for each item that user A has not rated, the possible rating of A will be predicted based on the ratings of these 20 neighboring users.

[0118] Specifically, assume that user B is a neighbor of A, B's rating for item X is 4.5 (out of 5), and the user similarity between A and B is 0.8. Then B's contribution to predicting A's rating for X is 4.5 x 0.8 = 3.6. Sum this contribution of all neighboring users and divide it by the sum of similarities to get A's predicted rating for X. Repeat this process for all unrated items, and then sort them from high to low according to the predicted rating to generate the initial recommendation list.

[0119] Next, define the three objectives of relevance, diversity, and novelty. The relevance objective reflects the degree of match between the recommended items and the user's interests. It uses the weighted sum of the predicted scores of the items in the recommendation list, with the weight being the discount factor for the position of the item in the recommendation list. For example, if the predicted score of the first item in the recommendation list is 4.8 and the second is 4.6, then the first item may be given a weight of 1, the second item a weight of 0.9, and so on. In this way, the relevance objective will favor items with high predicted scores and that are ranked at the top.

[0120] The diversity goal aims to ensure that the items in the recommendation list are not too similar. It uses the normalized complementary value of the cosine similarity between the items in the recommendation list. Item similarity is calculated based on the content characteristics of the items (such as category, brand, etc.) and user behavior characteristics (such as items that are often purchased together). For example, if the cosine similarity of two items is 0.8, then their contribution to the diversity goal is 1 - 0.8 = 0.2. The diversity goal tends to select combinations of items that are not too similar to each other.

[0121] The novelty goal is to recommend items that users may not be familiar with but may be interested in. It uses the sum of the logarithmic inverses of the popularity of items in the recommendation list. Item popularity is estimated based on the frequency of user interaction. For example, if one item has been interacted with by 10,000 users and another has only been interacted with by 100 users, the novelty contribution of the latter will be much greater than that of the former. In this way, the novelty goal tends to recommend relatively unpopular but potentially promising items.

[0122] When constructing a multi-objective ranking model, the three objectives of relevance, diversity, and novelty are linearly combined into a single objective function by weighted summation. For example, the relevance weight can be initially set to 0.6, the diversity weight to 0.3, and the novelty weight to 0.1. These weight coefficients are then optimized through grid search and cross-validation. Specifically, the relevance weight may be tried from 0.5 to 0.7, the diversity weight from 0.2 to 0.4, and the novelty weight from 0.05 to 0.15, with a step size of 0.05. The effect of each weight combination is evaluated through 5-fold cross-validation, and the best performing weight combination is finally selected.

[0123] In order to solve this multi-objective sorting model, an improved non-dominated sorting genetic algorithm is used. This algorithm regards the initial recommendation list as a chromosome, and each recommended item is a gene. For example, if the initial recommendation list is [A, B, C, D, E], then this is a chromosome. The algorithm generates new recommendation list combinations through crossover and mutation operations. The crossover operation may swap the first half of the two recommendation lists, and the mutation operation may randomly swap the positions of two items in the list.

[0124] In each iteration, the algorithm evaluates the performance of all the recommendation lists (chromosomes) on the three objectives and sorts them according to the non-domination relationship. A non-domination relationship means that if a solution is better than another solution in at least one objective and is not inferior to it in other objectives, then this solution dominates another solution. The algorithm will prioritize those solutions that are not dominated by any other solution.

[0125] The introduced elite retention strategy ensures that the best solutions in each generation will be directly retained to the next generation. The introduction of crowding distance is to further distinguish among solutions with the same non-dominated level to ensure the diversity of solutions. For example, if there are two solutions with the same non-dominated relationship, the algorithm will choose the solution that is more isolated in the target space to maintain the diversity of the population.

[0126] The algorithm will continue to iterate until it reaches the preset maximum number of iterations (such as 100 generations) or meets the convergence condition (such as no significant improvement in the optimal solution for 10 consecutive generations). In the final set of optimal solutions, each solution represents a recommendation list that achieves different trade-offs on the three objectives.

[0127] When selecting the optimal solution from the optimal solution set, you can define the selection criteria based on the specific application scenario requirements. For example, you can select the solution with the highest weighted sum of the three objectives, or select the solution with the highest diversity among the solutions whose correlation is not less than a certain threshold. After selecting the optimal solution, you can reorder the initial recommendation list based on it to generate the final recommendation list.

[0128] Finally, the system dynamically adjusts the final recommendation list based on real-time user feedback. For example, if a user clicks on a recommended item, the system may increase the weight of similar items; if a user skips multiple consecutive recommendations, the system may increase the weight of novelty. This dynamic adjustment ensures that the recommendation results can respond to changes in user interests in a timely manner and provide a more personalized experience.

[0129] Through this approach, the system is able to generate high-quality personalized gift recommendation lists while considering multiple objectives such as relevance, diversity, and novelty, and can dynamically adjust based on real-time user feedback to provide a better user experience.

[0130] Figure 2 FIG. 1 is a schematic diagram of the structure of a gift recommendation system based on user portraits according to an embodiment of the present invention. Figure 2 As shown, the system comprises:

[0131] The first unit is used to collect gift-related data, including gift name, category, price, applicable scenario, and information about the target audience, and construct the gift-related data into a gift knowledge graph containing entities and relationships; obtain user behavior data of historical purchase records, browsing records, collection records, and evaluation records of users; based on the user behavior data, extract the characteristics of the user's interests, consumption habits, and price preferences, and generate a preliminary user portrait; map the preliminary user portrait to the gift knowledge graph, use graph embedding technology to calculate the association between the user and the gift entity, and determine the user-item rating matrix based on the preliminary user portrait, construct a user-item bipartite graph based on the filled user-item rating matrix, and combine the preliminary user portrait and the user-item bipartite graph to obtain an enhanced user portrait;

[0132] The second unit is used to build a similarity calculation model including multiple dimensions of user interest similarity, consumption habit similarity, and social relationship similarity based on enhanced user portraits; in the gift knowledge graph, starting from the current user, using the multi-dimensional similarity calculation model and graph search algorithm, search for other user nodes with the highest similarity to the current user; collect gift entities associated with other user nodes with the highest similarity to the current user to form a candidate gift set;

[0133] The third unit is used to filter and sort the candidate gift set according to the context information of the current user's geographic location, time, and festival; based on the filtered and sorted candidate gift set, combined with the enhanced user portrait of the current user, a personalized gift recommendation list is generated.

[0134] According to a third aspect of the embodiments of the present invention,

[0135] An electronic device is provided, comprising:

[0136] processor;

[0137] a memory for storing processor-executable instructions;

[0138] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0139] According to a fourth aspect of the embodiments of the present invention,

[0140] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the aforementioned method is implemented.

[0141] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.

[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A gift recommendation method based on user portrait, characterized in that: include: Collect gift-related data, including gift name, category, price, applicable scenario, and audience information, and construct the gift-related data into a gift knowledge graph containing entities and relationships; obtain user behavior data such as user historical purchase records, browsing records, collection records, and evaluation records; Based on user behavior data, extract the characteristics of users' interests, hobbies, consumption habits, and price preferences to generate preliminary user portraits; Mapping the preliminary user portrait to the gift knowledge graph, calculating the association between the user and the gift entity using graph embedding technology, and determining the user-item rating matrix based on the preliminary user portrait, constructing a user-item bipartite graph according to the filled user-item rating matrix, and combining the preliminary user portrait and the user-item bipartite graph to obtain an enhanced user portrait; Based on enhanced user portraits, a similarity calculation model with multiple dimensions including user interest similarity, consumption habit similarity, and social relationship similarity is constructed; in the gift knowledge graph, starting from the current user, the multi-dimensional similarity calculation model and graph search algorithm are used to search for other user nodes with the highest similarity to the current user; Collect the gift entities associated with other user nodes that have the highest similarity to the current user to form a candidate gift set; Filter and sort the candidate gift set based on the current user's geographic location, time, and holiday context information; Generate a personalized gift recommendation list based on the filtered and sorted candidate gift set and the enhanced user profile of the current user; Using the multi-dimensional similarity calculation model and graph search algorithm, other user nodes with the highest similarity to the current user are searched, including: Construct a Markov decision process model: define the state space, including the currently visited user node, the set of neighbor nodes of the user node, the feature vector of the user node, and the current context information; define the action space as the next user node accessible from the current user node; design a reward function that comprehensively considers user similarity and diversity, including adjustable weight coefficients; Design a policy network based on graph attention network: construct an input layer to encode the state into a vector representation; construct a graph attention layer to capture the importance relationship between nodes using a multi-head attention mechanism; construct an output layer to output the action probability distribution using a softmax function; The policy network is trained using a proximal policy optimization algorithm: the objective function for clipping is defined, including the importance sampling ratio and the advantage function; the advantage function is calculated using generalized advantage estimation; a value function network is designed and learned to estimate the state value; an entropy regularization term is introduced to encourage policy exploration; an overall optimization objective is constructed, combining the clipping objective function, the value function loss, and the entropy regularization term; Use the trained policy network to perform similar user discovery: Input the target user node and its related information into the policy network; select the next access node according to the probability distribution output by the policy network; repeat the walking process until the predetermined number of walking steps is reached or the stopping condition is met; collect the user nodes visited during the walking process as the candidate set of similar users; sort the users in the candidate set to generate the final similar user list; According to the current user's geographic location, time, and holiday context information, the candidate gift set is filtered and sorted; based on the filtered and sorted candidate gift set, combined with the enhanced user profile of the current user, a personalized gift recommendation list is generated, including: According to the user-item rating matrix and the user similarity matrix, a collaborative filtering algorithm is used to calculate the target user's predicted rating for the unrated items. The collaborative filtering algorithm is based on the target user's neighboring user set, and obtains the predicted rating by weighted summation of the neighboring user's ratings on the items and the similarity between users. The items are sorted from high to low according to the predicted rating to generate an initial recommendation list. Define relevance target, diversity target and novelty target. The relevance target uses the weighted sum of the predicted scores of the items in the recommendation list, and the weight is the discount coefficient of the position of the item in the recommendation list; the diversity target uses the normalized complementary value of the cosine similarity between the items in the recommendation list, and the item similarity is calculated based on the content characteristics of the items and the user behavior characteristics; the novelty target uses the sum of the logarithmic inverses of the popularity of the items in the recommendation list, and the popularity of the items is estimated based on the frequency of user interaction with the items; Constructing a multi-objective ranking model, linearly combining the relevance objective, diversity objective and novelty objective into a single objective function by weighted summation, setting weight coefficients of relevance, diversity and novelty in the objective function, and optimizing the weight coefficient values ​​by grid search and cross-validation; An improved non-dominated sorting genetic algorithm is used to solve the multi-objective sorting model, an elite retention strategy and crowding distance are introduced, the initial recommendation list is regarded as a chromosome, and the objective function is iteratively optimized through gene encoding, individual evaluation, selection, crossover, and mutation operations until the maximum number of iterations is reached or the convergence condition is met, and the optimal solution set is obtained; The optimal solution is selected from the optimal solution set, the initial recommendation list is reordered to generate a final recommendation list, and the final recommendation list is dynamically adjusted according to the real-time feedback of the user, and is returned to the user in real time as a result of personalized recommendation.

2. The method according to claim 1, characterized in that Determining a user-item rating matrix based on the preliminary user profile, and constructing a user-item bipartite graph according to the filled user-item rating matrix includes: Determine a user-item rating matrix based on the preliminary user profile, wherein each item in the user-item rating matrix represents a rating of a user to a certain item, and the rating is a standardized rating; A user-item bipartite graph is constructed according to the filled user-item rating matrix, wherein the user-item bipartite graph includes a set of user nodes and a set of item nodes, and the weight of the edge between the user node and the item node is the corresponding rating value; and the transition probability from the user node to the item node and from the item node to the user node in the user-item bipartite graph is calculated, wherein the transition probability is determined by the rating value between the nodes and the degree of the nodes.

3. The method according to claim 1, characterized in that In the gift knowledge graph, starting from the current user, using the multi-dimensional similarity calculation model and graph search algorithm, search for other user nodes with the highest similarity to the current user, including: Based on the access sequence obtained by random walk, the similarity between users is calculated. The calculation of the similarity comprehensively considers the position, frequency and attenuation factor of two user nodes in the access sequence, including: ; ; in, sim(u,v) Indicates user u and users v Similarity, α represents the weight coefficient corresponding to the random walk sequence, T represents the total number of steps of random walk; γ Represents the attenuation factor, which is used to control the sensitivity of similarity calculation to distant nodes; β represents the weight coefficient corresponding to the user-item interaction, I Represents a collection of items. w i Indicates items i The importance weight of It means that when user u interacts with item i, the value is 1, otherwise it is 0. It means that when user v interacts with item i, the value is 1, otherwise it is 0. r ui , r vi They represent user u interacting with item i and user v interacting with item i, respectively. Represents the similarity of item i in the interaction records of users u and v; t represents the step index of the random walk, i u represents the rating behavior characteristics of user u on item i, i v represents the rating behavior characteristics of user v on item i, u t represents the behavior of user u at the step index t of random walk, 1( u t =v): represents the indicator function, which is 1 when the behavior of users u and v at the random walk step index t is the same, and 0 otherwise.

4. The method according to claim 1, characterized in that: The method further comprises: Execute the training process: Use the current strategy to perform multiple rounds of walks in the user graph and collect state-action-reward-next-state samples; calculate the advantage of each time step based on the collected data and the current value function network; use the stochastic gradient ascent method to optimize the objective function and update the parameters of the policy network and the value function network; Apply an early stopping strategy and stop training when the validation set performance does not improve for a predetermined number of training cycles; Dynamically adjust the weight coefficient in the reward function according to user feedback and system goals; introduce a temperature parameter to control the degree of exploration of the strategy, and gradually reduce the parameter value as training progresses; Implement cold start processing for newly added user nodes: extract features from the new user's registration information and initial behavior; calculate the content similarity between the new user and existing users; and generate the new user's initial embedding through weighted averaging based on the embeddings of a predetermined number of existing users with the highest similarity.

5. A gift recommendation system based on user portraits, used to implement the method described in any one of claims 1 to 4, characterized in that: include: The first unit is used to collect gift-related data, including gift name, category, price, applicable scenario, and audience information, and construct the gift-related data into a gift knowledge graph containing entities and relationships; obtain user behavior data such as user historical purchase records, browsing records, collection records, and evaluation records; Based on user behavior data, extract the characteristics of users' interests, hobbies, consumption habits, and price preferences to generate preliminary user portraits; Mapping the preliminary user portrait to the gift knowledge graph, calculating the association between the user and the gift entity using graph embedding technology, and determining the user-item rating matrix based on the preliminary user portrait, constructing a user-item bipartite graph according to the filled user-item rating matrix, and combining the preliminary user portrait and the user-item bipartite graph to obtain an enhanced user portrait; The second unit is used to build a similarity calculation model with multiple dimensions including user interest similarity, consumption habit similarity, and social relationship similarity based on enhanced user portraits; in the gift knowledge graph, starting from the current user, the multi-dimensional similarity calculation model and graph search algorithm are used to search for other user nodes with the highest similarity to the current user; Collect the gift entities associated with other user nodes that have the highest similarity to the current user to form a candidate gift set; The third unit is used to filter and sort the candidate gift set according to the context information of the current user's geographical location, time, and festival; Based on the filtered and sorted candidate gift set and combined with the enhanced user profile of the current user, a personalized gift recommendation list is generated.

6. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the method described in any one of claims 1 to 4.

7. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 4 is implemented.