Product recommendation method, device, processor and electronic device
By introducing comparison loss terms into the clustering model, using the correlation relationship between customers, the problem of product recommendation mismatch in the existing technology is solved, and more accurate product recommendation results are achieved.
Patent Information
- Application Number
- CN202210918257.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-01
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2042-08-01
AI Technical Summary
When recommending products to customer groups, the prior art does not consider the relationship between customers, resulting in mismatch between the recommended products and customer groups.
By entering the target user's user data into the clustering model, the loss function of the clustering model, including clustering loss terms, sample reconstruction loss terms and comparison loss terms, is used to determine the category of the target user. The comparison loss item is determined by the correlation relationship between multiple sample user data, and the product to be recommended corresponding to the category of the target user is determined based on the preset relationship.
By considering the relationship between customers, accurately determine the category and recommended products of the target user, the matching degree of product recommendations is improved, and the problem of mismatch between recommended products and customer groups is solved.
Smart Images

Figure CN115099908B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence and other fields, and specifically, to a product recommendation method, device, processor and electronic device. Background Art
[0002] With the development of information technology, accurately recommending products to target customer groups through machine learning models has become a mainstream research direction. In related technologies, by analyzing customer characteristics and model results, we select key recommended product groups, strengthen product recommendations, provide targeted product recommendations, and increase the success rate of recommended products.
[0003] The machine learning technology in the related art is based on supervised learning. This technology requires that training samples be labeled to indicate whether a product should be recommended. However, labeling requires a lot of manpower and expertise, and there is no standard criterion for whether a product should be recommended. Customer characteristics and product characteristics are used when building machine learning models, such as basic characteristics such as the customer's age and gender, and behavioral preferences such as the customer's transaction category distribution and financial product configuration. However, the machine learning models in the related art are not very effective in accurately recommending products to target customer groups.
[0004] Currently, no effective solution has been proposed to the problem that related technologies do not consider the relationship between customers when recommending products to customer groups, resulting in a mismatch between the recommended products and customer groups. Summary of the invention
[0005] The main purpose of this application is to provide a product recommendation method, device, processor and electronic device to solve the problem that the related technology does not consider the relationship between customers when recommending products to customer groups, resulting in a mismatch between the recommended products and customer groups.
[0006] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a product recommendation method is provided. The method comprises: inputting the user data of the target user into the clustering model, processing to obtain the category to which the target user belongs, wherein the loss function of the clustering model is obtained by adding the clustering loss term, the sample reconstruction loss term and the contrast loss term, and the contrast loss term is determined by the association relationship between multiple sample user data; determining the product to be recommended corresponding to the category to which the target user belongs according to the preset relationship, wherein the preset relationship is used to characterize the relationship between the category to which the user belongs and the product to be recommended; and recommending the product to be recommended to the target user.
[0007] Optionally, the clustering model is generated in the following manner: determining a target coefficient matrix based on the correlation relationship between multiple sample user data, wherein the correlation relationship includes a direct correlation relationship and an indirect correlation relationship; determining a contrast loss term based on the target coefficient matrix, and determining a clustering loss term and a sample reconstruction loss term, adding the clustering loss term, the sample reconstruction loss term and the contrast loss term to obtain a loss function, wherein the contrast loss term is used to enhance the indirect correlation relationship; constructing an initial clustering model based on the loss function, and labeling multiple sample user data with their categories to obtain training set data, and training the initial clustering model based on the training set data to obtain a clustering model.
[0008] Optionally, determining a target coefficient matrix based on the correlation relationship between multiple sample user data includes: obtaining multiple sample user data, and obtaining user feature data and transaction feature data of each sample user data; determining each sample user data as a node to obtain multiple nodes, determining the location information of the node based on the user feature data of each sample user data, and determining the direct correlation relationship between nodes corresponding to different sample user data based on the transaction feature data; arranging multiple nodes based on the location information, and setting edges between two nodes with a direct correlation relationship to obtain a sample relationship graph; determining the target coefficient matrix through the correlation relationship in the sample relationship graph.
[0009] Optionally, determining the target coefficient matrix through the association relationship in the sample relationship graph includes: determining the association relationship of each pair of nodes in the sample relationship graph at different depths in turn, and obtaining an association relationship set of each pair of nodes, wherein the depth is used to characterize the number of edges between nodes, each depth is less than or equal to a preset depth, and the association relationship of each pair of nodes at a depth is connected or unconnected, and a pair of nodes is any two nodes in the sample relationship graph; calculating the ratio of the association relationship in the association relationship set of each pair of nodes to the preset depth, and obtaining multiple first ratios, determining the sum of the multiple first ratios as the target coefficient corresponding to a pair of nodes, and obtaining the target coefficient corresponding to each pair of nodes; and forming a target coefficient matrix from the target coefficients corresponding to each pair of nodes.
[0010] Optionally, determining the contrast loss term based on the target coefficient matrix includes: determining the distance between the node corresponding to each sample user and other nodes to obtain multiple distance sets, and determining an intermediate parameter from each distance set to obtain multiple intermediate parameters; calculating the mean of the intermediate parameters of all sample users to obtain the contrast loss term.
[0011] Optionally, determining the clustering loss term includes: obtaining multiple sample user data, determining each sample user data as a node, and obtaining multiple nodes; determining the clustering assignment probability of each node, and determining the current distribution of all sample user data based on the clustering assignment probability of each node; calculating the target distribution of all sample user data, and calculating the KL divergence loss between the current distribution and the target distribution; calculating the target clustering assignment probability of each sample user under the target distribution, calculating the ratio of the target clustering assignment probability to the clustering assignment probability of each sample user, obtaining multiple second ratios, and calculating the product of the logarithm of each second ratio and the corresponding target clustering assignment probability, obtaining multiple products; calculating the sum of all products, and calculating the difference between the KL divergence loss and all sums, to obtain the clustering loss term.
[0012] Optionally, calculating the target cluster assignment probability of each sample user under the target distribution includes: calculating the sum of the cluster assignment probabilities of all nodes to obtain a first probability, and calculating the sum of the probabilities of each node to any node to obtain a second probability; determining the square of the cluster assignment probability of all nodes to obtain a first square, calculating the ratio of the first square to the first probability to obtain multiple third ratios; determining the square of the cluster assignment probability of each node to any node to obtain a second square, calculating the ratio of the second square to the second probability to obtain multiple fourth ratios, and determining the sum of all fourth ratios; determining the ratio of each third ratio to the sum of the fourth ratios as the target cluster assignment probability of each node to the cluster center.
[0013] Optionally, determining the sample reconstruction loss term includes: determining an encoding function and a decoding function of an encoder; and calculating the sample reconstruction loss term according to the encoding function, the decoding function and the sample user data.
[0014] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a product recommendation device is provided. The device includes: an input unit, which is used to input the user data of the target user into the clustering model, and process to obtain the category to which the target user belongs, wherein the loss function of the clustering model is obtained by adding the clustering loss term, the sample reconstruction loss term and the contrast loss term, and the contrast loss term is determined by the association relationship between multiple sample user data; a determination unit, which is used to determine the product to be recommended corresponding to the category to which the target user belongs according to a preset relationship, wherein the preset relationship is used to characterize the relationship between the category to which the user belongs and the product to be recommended; and a recommendation unit, which is used to recommend the product to be recommended to the target user.
[0015] Through this application, the following steps are adopted: input the user data of the target user into the clustering model, and process to obtain the category to which the target user belongs, wherein the loss function of the clustering model is obtained by adding the clustering loss term, the sample reconstruction loss term and the contrast loss term, and the contrast loss term is determined by the association relationship between multiple sample user data; determine the recommended product corresponding to the category to which the target user belongs according to the preset relationship, wherein the preset relationship is used to characterize the relationship between the user's category and the product to be recommended; recommend the product to the target user, which solves the problem that the related technology does not consider the relationship between customers when recommending products to customer groups, resulting in a mismatch between the recommended products and the customer groups. The contrast loss term is determined based on the association relationship between customers, thereby determining the clustering model, thereby achieving the effect of accurately recommending products to the target group through the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0017] Figure 1 It is a flowchart of a method for recommending a product according to an embodiment of the present application;
[0018] Figure 2 It is a flowchart of a method for constructing a graph clustering model provided in an embodiment of the present application;
[0019] Figure 3 is a schematic diagram of a recommended device of a product provided according to an embodiment of the present application;
[0020] Figure 4 is a schematic diagram of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0021] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0025] The present invention is described below in conjunction with preferred implementation steps. Figure 1 is a flowchart of a method for recommending a product according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0026] Step S101, input the user data of the target user into the clustering model, and process it to obtain the category to which the target user belongs, wherein the loss function of the clustering model is obtained by adding the clustering loss term, the sample reconstruction loss term and the contrast loss term, and the contrast loss term is determined by the correlation relationship between multiple sample user data.
[0027] Specifically, the user data may be basic information of the user in the financial institution, such as age, gender, etc., and the user's transaction records, and the clustering model may be a graph clustering model. By inputting the user data into the clustering model, the clusters where the user data is located are obtained, and different clusters in the clustering results represent different user categories, thereby obtaining the category to which the target user belongs.
[0028] It should be noted that the loss function in the clustering model is obtained by adding the clustering loss term, the sample reconstruction loss term and the contrast loss term. The contrast loss term can characterize the correlation between user data, making the clustering results of the clustering model more accurate. After inputting user data into the clustering model, the expected clustering results can be obtained.
[0029] Step S102, determining the to-be-recommended product corresponding to the category to which the target user belongs according to a preset relationship, wherein the preset relationship is used to characterize the relationship between the category to which the user belongs and the to-be-recommended product.
[0030] Specifically, the preset relationship may be a corresponding relationship between the category to which the user belongs and the product to be recommended. For example, if the category to which the user belongs is a category that prefers high-return investments, the product to be recommended is a financial product with a short investment cycle and high investment risk. If the category to which the user belongs is a category that prefers stable investments, the product to be recommended is a financial product with a long investment cycle and low investment risk.
[0031] Step S103, recommending the product to be recommended to the target user.
[0032] Specifically, corresponding products are recommended to target users to achieve the effect of accurately pushing products.
[0033] The product recommendation method provided in the embodiment of the present application inputs the user data of the target user into the clustering model, and processes the target user's category, wherein the loss function of the clustering model is obtained by adding the clustering loss term, the sample reconstruction loss term and the contrast loss term, and the contrast loss term is determined by the association relationship between multiple sample user data; the to-be-recommended product corresponding to the target user's category is determined according to a preset relationship, wherein the preset relationship is used to characterize the relationship between the user's category and the to-be-recommended product; the to-be-recommended product is recommended to the target user, which solves the problem that the related technology does not consider the relationship between customers when recommending products to customer groups, resulting in a mismatch between the recommended products and the customer groups. The contrast loss term is determined based on the association relationship between customers, thereby determining the clustering model, thereby achieving the effect of accurately recommending products to the target group through the model.
[0034] Optionally, in the product recommendation method provided in the embodiment of the present application, the clustering model is generated in the following manner: determining a target coefficient matrix based on the correlation relationship between multiple sample user data, wherein the correlation relationship includes a direct correlation relationship and an indirect correlation relationship; determining a contrast loss term based on the target coefficient matrix, and determining a clustering loss term and a sample reconstruction loss term, adding the clustering loss term, the sample reconstruction loss term and the contrast loss term to obtain a loss function, wherein the contrast loss term is used to enhance the indirect correlation relationship; constructing an initial clustering model based on the loss function, and labeling multiple sample user data with their categories to obtain training set data, and training the initial clustering model based on the training set data to obtain a clustering model.
[0035] Specifically, the association relationship can be the connection between different users. For example, if there is a transaction record between user A and user B, then there is a direct association relationship between user A and user B. If there is a transaction record between user B and user C, then there is a direct association relationship between user C and user B, and there is an indirect association relationship between user A and user C. The target coefficient matrix can be a coefficient matrix determined according to the association relationships between all users. The loss function is calculated by the following formula:
[0036] Loss = loss recon +loss constrative +loss cluster ;
[0037] Among them, loss recon Reconstruct the loss term for the sample, loss constrative is the comparison loss term, loss cluster is the clustering loss term, and Loss is the loss function. Sample user data is also user data. The sample user data is grouped and statistically aggregated. For example, the data is grouped and statistically analyzed according to transaction category, transaction location, transaction method, etc. to obtain training set data. By generating a clustering model, user data can be clustered and analyzed to obtain clustering results, so that corresponding products can be recommended to users based on the clustering results.
[0038] The target coefficient matrix needs to be determined based on the association relationship. Optionally, in the product recommendation method provided in the embodiment of the present application, determining the target coefficient matrix based on the association relationship between multiple sample user data includes: obtaining multiple sample user data, and obtaining user feature data and transaction feature data for each sample user data; determining each sample user data as a node to obtain multiple nodes, determining the location information of the node based on the user feature data of each sample user data, and determining the direct association relationship between the nodes corresponding to different sample user data based on the transaction feature data; arranging multiple nodes based on the location information, and setting edges between two nodes with a direct association relationship to obtain a sample relationship graph; determining the target coefficient matrix through the association relationship in the sample relationship graph.
[0039] Specifically, transaction feature data is the transaction record of the user, and user feature data is basic information data, such as age, gender, etc. The user data of each user is used as a node in the graph cluster, and the position of the node in the graph cluster is determined according to the user feature data. According to the transaction parties in the transaction feature data, it is determined that there is a direct relationship between the two nodes, and the two nodes are connected by an edge in the graph cluster. After setting edges for all nodes with direct relationships, a sample relationship graph is obtained. The edges in the sample relationship graph represent direct relationships. The coefficients corresponding to the two nodes are determined according to the number of edges between any two nodes, and the target coefficient matrix is determined according to all coefficients. By determining the target coefficient matrix, the contrast loss term is determined, and the contrast loss term is applied to the clustering model to strengthen the relationship between users and obtain more accurate clustering results.
[0040] The target coefficient matrix is calculated through association relationships. Optionally, in the product recommendation method provided in the embodiment of the present application, determining the target coefficient matrix through the association relationships in the sample relationship graph includes: determining the association relationships of each pair of nodes in the sample relationship graph at different depths in turn, and obtaining an association relationship set of each pair of nodes, wherein the depth is used to characterize the number of edges between nodes, each depth is less than or equal to a preset depth, and the association relationship of each pair of nodes at a depth is connected or not connected, and a pair of nodes is any two nodes in the sample relationship graph; calculating the ratio of the association relationship in the association relationship set of each pair of nodes to the preset depth, obtaining multiple first ratios, determining the sum of the multiple first ratios as the target coefficient corresponding to a pair of nodes, and obtaining the target coefficient corresponding to each pair of nodes; and forming a target coefficient matrix by the target coefficients corresponding to each pair of nodes.
[0041] Specifically, the preset depth can be a manually set precision of the association relationship. For example, the preset depth is determined to be 5, which is to calculate the coefficient of the number of edges between all nodes within 5, that is, to determine the coefficient of the indirect association relationship between any two nodes within 5 edges. The target coefficient matrix is calculated by the following formula:
[0042]
[0043] Among them, γ ij is the target coefficient matrix, r represents the depth, R is the preset depth, relationship r (i, j) is the association relationship between node i and node j at the preset depth, and the association relationship is calculated by the following formula:
[0044]
[0045] Among them, a connection between node i and node j indicates that there is an edge between node i and node j, and no connection between node i and node j indicates that there is no edge between node i and node j.
[0046] It should be noted that in graph clustering, if there is an edge connection between two nodes, then there is a certain association between the two nodes, and they have some similarities compared to nodes without edge connections. In addition, benefiting from the unique structure of the graph, even if there is no direct connection between two nodes, they can influence each other through the graph structure. In the sample relationship graph, the graph structure between samples is usually very sparse, so most of the values in the adjacency matrix are zero. However, the absence of an edge between two nodes does not mean that there is no association, and there can still be a strong association, that is, the association is generated through other nodes. Therefore, it is possible to consider utilizing high-order relationships in the graph. For example, for a given preset depth, the total influence between samples is defined as the association relationship, and the following formula is used to determine whether there is an influence between two nodes.
[0047]
[0048] Among them, γ ij = 0 means that node i has no influence on node j in depth R, that is, node i has no connection with node j within R steps; ij =1 means that there is a connection between node i and node j in the transaction graph; 0<γ ij <1 means that there is no edge connection between node i and node j in the transaction graph, but there is a connection within R steps.
[0049] After determining the target coefficient matrix, the contrast loss term is calculated according to the target coefficient matrix. Optionally, in the recommendation method of the product provided in the embodiment of the present application, determining the contrast loss term according to the target coefficient matrix includes: determining the distance between the node corresponding to each sample user and other nodes to obtain multiple distance sets, and determining an intermediate parameter from each distance set to obtain multiple intermediate parameters; calculating the mean of the intermediate parameters of all sample users to obtain the contrast loss term.
[0050] Specifically, the contrast loss term is set to enhance the influence between two nodes. For each node, its R-level adjacency matrix is used to represent the association relationship with other samples. We compare the node with all nodes to make the influential nodes in the graph cluster closer to the node than the influent nodes. For example, for node i, the distance between two nodes can be Euclidean distance, cosine distance, etc. The contrast loss term is calculated by the following formula:
[0051]
[0052] Among them, loss contrastive is the contrast loss term, N is the number of sample user data, i represents the sequence number of the sample user data, l i is an intermediate variable, and the intermediate variable is calculated by the following formula:
[0053]
[0054] Among them, dis(z i ,z j ) is the distance between node i and node j, τ is the first hyperparameter, dis(z i ,z k ) is the distance between node i and node k, and exp(·) is an exponential function. By calculating the contrast loss term, the distance between two nodes with direct or indirect relationships in graph clustering is made closer.
[0055] Determining the loss function also includes determining a clustering loss term. Optionally, in the product recommendation method provided in the embodiment of the present application, determining the clustering loss term includes: obtaining multiple sample user data, determining each sample user data as a node, and obtaining multiple nodes; determining the clustering assignment probability of each node, and determining the current distribution of all sample user data based on the clustering assignment probability of each node; calculating the target distribution of all sample user data, and calculating the KL divergence loss between the current distribution and the target distribution; calculating the target clustering assignment probability of each sample user under the target distribution, calculating the ratio of the target clustering assignment probability to the clustering assignment probability of each sample user, obtaining multiple second ratios, and calculating the product of the logarithm of each second ratio and the corresponding target clustering assignment probability to obtain multiple products; calculating the sum of all products, and calculating the difference between the KL divergence loss and all sums to obtain a clustering loss term.
[0056] Specifically, graph clustering is essentially an unsupervised task with no available feedback to guide the optimization progress. Therefore, we use soft labels derived from probability distribution as a self-supervisory mechanism for clustering enhancement, effectively superimposing clusters on the embedding space. The embedding space is the medium where the sample user data is processed. First, we obtain the soft cluster assignment probability q iu , for z i and cluster center μ u , use radial basis functions to measure the similarity between nodes and centroids, for example, q iu The value is between (0,1). If z is embedded i and cluster center μ u Very similar, σ is a very small hyperparameter, for example, it can be 0.01, then the value of this item is 1. If the embedding z i and cluster center μ u If the difference is large, the value of this item is close to 0. In order to make the data representation closer to the cluster center and improve the cluster cohesion, the KL divergence loss between the Q and P distributions is minimized through the calculation formula of the cluster loss term, so that the current distribution Q is close to the target distribution P. The cluster assignment probability is calculated by the following formula:
[0057]
[0058] Among them, q iu Assign probabilities to clusters, z i is the location information of node i in the embedding space, μ u is the K-means cluster center in the embedding space, σ is the second hyperparameter; the current distribution of all sample user data is determined according to the cluster assignment probability, and the target cluster assignment probability of the target distribution of all sample user data is calculated; the clustering loss term is calculated by the following formula:
[0059]
[0060] Where Q is the current distribution, P is the target distribution, KL(P||Q) is the KL divergence loss between the current distribution and the target distribution, and p iu Assign probabilities to target clusters.
[0061] When calculating the clustering loss term, it is necessary to determine the target clustering assignment probability. Optionally, in the recommendation method of the product provided in the embodiment of the present application, calculating the target clustering assignment probability of the target distribution of all sample user data includes: calculating the sum of the clustering assignment probabilities of all nodes to obtain a first probability, and calculating the sum of the probabilities of each node to any node to obtain a second probability; determining the square of the clustering assignment probability of all nodes to obtain a first square, calculating the ratio of the first square to the first probability, and obtaining multiple third ratios; determining the square of the clustering assignment probability of each node to any node to obtain a second square, calculating the ratio of the second square to the second probability, and obtaining multiple fourth ratios, and determining the sum of all fourth ratios; determining the ratio of each third ratio to the sum of the fourth ratios as the target clustering assignment probability of each node to the cluster center.
[0062] Specifically, nodes closer to the cluster center have higher soft assignment probabilities in the current distribution. By raising the current distribution to a quadratic power and normalizing it, a target distribution that emphasizes confidence assignment is defined, and the target cluster assignment probability is calculated by the following formula:
[0063]
[0064] in, is the sum of the clustering assignment probabilities of all nodes, is the sum of the assignment probabilities for each pair of nodes.
[0065] Determining the loss function also includes determining the sample reconstruction loss term. Optionally, in the recommended method of the product provided in the embodiment of the present application, determining the sample reconstruction loss term includes: determining the encoding function and decoding function of the encoder; calculating the sample reconstruction loss term based on the encoding function, decoding function and sample user data.
[0066] Specifically, since some of the user's data is missing, the sample reconstruction loss term is added to the loss function. If there is missing data in the user's data, it is filled according to the category of the missing data. For example, the missing data of numerical features is filled with the column '0' value, and the missing data of non-numerical features is filled with "unknown". The sample reconstruction loss term is calculated by the following formula:
[0067] loss recon =||XD AE (E AE (X))|| 2 ;
[0068] Among them, loss recon is the sample reconstruction loss term, X is the sample user data, D AE is the decoding function of the encoder, E AE is the encoding function of the encoder. It should be noted that when performing graph clustering, in order to prevent the dimensionality curse problem and remove the influence of noise, it is necessary to map the sample user data to a low-dimensional embedding space. The user sample data is mapped to the embedding space through the pre-trained autoencoder to obtain the initial embedding of the sample. The encoder-decoder using the autoencoder minimizes the original data X∈R n×d and reconstructing data The reconstruction loss between is used to extract the latent embedding. After pre-training the sample user data, the latent embedding, that is, the embedding space, is obtained, and the cluster center is obtained using K-means clustering.
[0069] According to another embodiment of the present application, a method for constructing a graph clustering model is provided. Figure 2 is a flow chart of a method for constructing a graph clustering model according to an embodiment of the present application. Figure 2 As shown, the method includes:
[0070] First, obtain the customer's basic characteristics and customer transaction details.
[0071] Then, the basic features of the customer are encoded through an automatic encoder to obtain samples, and the samples are embedded in a low-dimensional space. At the same time, a transaction graph is constructed according to the customer's transaction details, and the sample impact coefficient is calculated based on the transaction graph.
[0072] Next, the clustering loss is calculated based on the samples embedded in the low-dimensional space, and the influence enhancement contrast loss is calculated based on the samples embedded in the low-dimensional space and the sample influence coefficients.
[0073] Finally, the graph clustering model is determined by clustering loss and influence enhanced contrast loss.
[0074] By using the graph clustering model construction method provided in the embodiment of the present application, the closeness of the relationship between customers is increased, and the recommended group of products can be determined more accurately.
[0075] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0076] The present application also provides a product recommendation device. It should be noted that the product recommendation device of the present application can be used to execute the product recommendation method provided by the present application. The product recommendation device provided by the present application is introduced below.
[0077] Figure 3 Schematic diagram of a recommended device for a product provided according to an embodiment of the present application. Figure 3 As shown, the device comprises:
[0078] An input unit 10 is used to input the user data of the target user into the clustering model, and process it to obtain the category to which the target user belongs, wherein the loss function of the clustering model is obtained by adding a clustering loss term, a sample reconstruction loss term, and a contrast loss term, and the contrast loss term is determined by the correlation relationship between multiple sample user data;
[0079] A determination unit 20, configured to determine the to-be-recommended product corresponding to the category to which the target user belongs according to a preset relationship, wherein the preset relationship is used to characterize the relationship between the category to which the user belongs and the to-be-recommended product;
[0080] The recommendation unit 30 is used to recommend the product to be recommended to the target user.
[0081] The product recommendation device provided in the embodiment of the present application inputs the user data of the target user into the clustering model through the input unit 10, and processes to obtain the category to which the target user belongs, wherein the loss function of the clustering model is obtained by adding the clustering loss term, the sample reconstruction loss term and the contrast loss term, and the contrast loss term is determined by the correlation relationship between multiple sample user data; the determination unit 20 determines the to-be-recommended product corresponding to the category to which the target user belongs according to a preset relationship, wherein the preset relationship is used to characterize the relationship between the user's category and the to-be-recommended product; the recommendation unit 30 recommends the to-be-recommended product to the target user, which solves the problem that the related technology does not consider the relationship between customers when recommending products to customer groups, resulting in a mismatch between the recommended products and the customer groups, and determines the contrast loss term based on the correlation relationship between customers, thereby determining the clustering model, thereby achieving the effect of accurately recommending products to the target group through the model.
[0082] Optionally, in the product recommendation device provided in the embodiment of the present application, the device also includes: a first determination module, used to determine the target coefficient matrix based on the correlation relationship between multiple sample user data, wherein the correlation relationship includes a direct correlation relationship and an indirect correlation relationship; a second determination module, used to determine the contrast loss term based on the target coefficient matrix, and determine the clustering loss term and the sample reconstruction loss term, add the clustering loss term, the sample reconstruction loss term and the contrast loss term to obtain a loss function, wherein the contrast loss term is used to enhance the indirect correlation relationship; a construction module, used to construct an initial clustering model based on the loss function, and label the categories of multiple sample user data to obtain training set data, train the initial clustering model based on the training set data, and obtain a clustering model.
[0083] Optionally, in the product recommendation device provided in the embodiment of the present application, the first determination module includes: an acquisition submodule, used to acquire multiple sample user data, and acquire user feature data and transaction feature data of each sample user data; a first determination submodule, used to determine each sample user data as a node, obtain multiple nodes, determine the location information of the node according to the user feature data of each sample user data, and determine the direct association relationship between the nodes corresponding to different sample user data according to the transaction feature data; an arrangement submodule, used to arrange multiple nodes according to the location information, and set edges between two nodes with a direct association relationship, to obtain a sample relationship graph; a second determination submodule, used to determine the target coefficient matrix through the association relationship in the sample relationship graph.
[0084] Optionally, in the product recommendation device provided by the embodiment of the present application, the second determination submodule includes: a depth determination module, used to sequentially determine the association relationship of each pair of nodes in the sample relationship graph at different depths, and obtain the association relationship set of each pair of nodes, wherein the depth is used to characterize the number of edges between the nodes, each depth is less than or equal to a preset depth, the association relationship of each pair of nodes in a depth is connected or unconnected, and a pair of nodes is any two nodes in the sample relationship graph; a ratio calculation module, used to calculate the ratio of the association relationship in the association relationship set of each pair of nodes to the preset depth, obtain multiple first ratios, determine the sum of the multiple first ratios as the target coefficient corresponding to a pair of nodes, and obtain the target coefficient corresponding to each pair of nodes; a matrix construction module, used to construct a target coefficient matrix from the target coefficients corresponding to each pair of nodes. ;
[0085] Optionally, in the recommendation device of the product provided in the embodiment of the present application, the second determination module includes: a distance determination submodule, used to determine the distance between the node corresponding to each sample user and other nodes, to obtain multiple distance sets, and to determine an intermediate parameter from each distance set, to obtain multiple intermediate parameters; a first calculation submodule, used to calculate the mean of the intermediate parameters of all sample users, to obtain a contrast loss term.
[0086] Optionally, in the product recommendation device provided in the embodiment of the present application, the second determination module also includes: a node determination submodule, which is used to obtain multiple sample user data, determine each sample user data as a node, and obtain multiple nodes; a probability determination submodule, which is used to determine the cluster assignment probability of each node; a current distribution determination submodule, which is used to determine the current distribution of all sample user data based on the cluster assignment probability of each node, and calculate the target distribution of all sample user data, and the target cluster assignment probability of each sample user under the target distribution; a divergence loss calculation submodule, which is used to calculate the KL divergence loss between the current distribution and the target distribution; a third calculation submodule, which is used to calculate the ratio of the target cluster assignment probability to the cluster assignment probability of each sample user, obtain multiple second ratios, and calculate the product of the logarithm of each second ratio and the corresponding target cluster assignment probability, and obtain multiple products; a fourth calculation submodule, which is used to calculate the sum of all products, calculate the difference between the KL divergence loss and the sum of all products, and obtain a cluster loss term.
[0087] Optionally, in the recommendation device of the product provided in the embodiment of the present application, the third calculation submodule includes: a first probability calculation module, used to calculate the sum of the cluster assignment probabilities of all nodes to obtain a first probability, and calculate the sum of the probabilities of each node to any node to obtain a second probability; a second ratio calculation module, used to determine the square of the cluster assignment probability of all nodes to obtain a first square, calculate the ratio of the first square to the first probability, and obtain multiple third ratios; a third ratio calculation module, used to determine the square of the cluster assignment probability of each node to any node to obtain a second square, calculate the ratio of the second square to the second probability, obtain multiple fourth ratios, and determine the sum of all fourth ratios; a second probability determination module, used to determine the ratio of each third ratio to the sum of the fourth ratios as the target cluster assignment probability of each node to the cluster center.
[0088] Optionally, in the product recommendation device provided in the embodiment of the present application, the second determination module also includes: a function determination submodule, used to determine the encoding function and decoding function of the encoder; and a fifth calculation submodule, used to calculate the sample reconstruction loss term based on the encoding function, decoding function and sample user data.
[0089] The product recommendation device includes a processor and a memory. The input unit 10, the determination unit 20 and the recommendation unit 30 are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
[0090] The processor contains a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and products can be accurately recommended to the target group by adjusting the kernel parameters.
[0091] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0092] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, a product recommendation method is implemented.
[0093] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program executes a product recommendation method when running.
[0094] like Figure 4 As shown, an embodiment of the present invention provides an electronic device, wherein the device 401 includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the following steps when executing the program: a product recommendation method. The device in this article may be a server, a PC, a PAD, a mobile phone, etc.
[0095] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing the following method steps: a product recommendation method.
[0096] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0097] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0098] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0099] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0100] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0101] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0102] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0103] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0104] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0105] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A product recommendation method, characterized in that: include: Inputting the user data of the target user into the clustering model, and processing to obtain the category to which the target user belongs, wherein the loss function of the clustering model is obtained by adding a clustering loss term, a sample reconstruction loss term, and a contrast loss term, and the contrast loss term is determined by a target coefficient matrix, and the target coefficient matrix is determined according to the correlation relationship between multiple sample user data; Determine the to-be-recommended product corresponding to the category to which the target user belongs according to a preset relationship, wherein the preset relationship is used to characterize the relationship between the category to which the user belongs and the to-be-recommended product; Recommending the product to be recommended to the target user; Wherein, determining the target coefficient matrix according to the association relationship between the plurality of sample user data comprises: obtaining the plurality of sample user data, and obtaining the user feature data and transaction feature data of each sample user data; determining each sample user data as a node to obtain a plurality of nodes, determining the position information of the node according to the user feature data of each sample user data, and determining the direct association relationship between the nodes corresponding to different sample user data according to the transaction feature data; arranging the plurality of nodes according to the position information, and setting edges between two nodes having the direct association relationship to obtain a sample relationship graph; determining the target coefficient matrix according to the association relationship in the sample relationship graph; Determining the target coefficient matrix through the association relationship in the sample relationship graph includes: determining the association relationship of each pair of nodes in the sample relationship graph at different depths in turn, and obtaining an association relationship set of each pair of nodes, wherein the depth is used to characterize the number of edges between nodes, each depth is less than or equal to a preset depth, and the association relationship of each pair of nodes at a depth is connected or not connected, and a pair of nodes is any two nodes in the sample relationship graph; calculating the ratio of the association relationship in the association relationship set of each pair of nodes to the preset depth, and obtaining multiple first ratios, and determining the sum of the multiple first ratios as the target coefficient corresponding to a pair of nodes, and obtaining the target coefficient corresponding to each pair of nodes; and forming the target coefficient matrix by the target coefficients corresponding to each pair of nodes.
2. The method according to claim 1, characterized in that: The clustering model is generated in the following way: Determining a target coefficient matrix according to association relationships among a plurality of the sample user data, wherein the association relationships include direct association relationships and indirect association relationships; Determining a contrast loss term according to the target coefficient matrix, and determining a clustering loss term and a sample reconstruction loss term, adding the clustering loss term, the sample reconstruction loss term and the contrast loss term to obtain a loss function, wherein the contrast loss term is used to enhance the indirect association relationship; An initial clustering model is constructed according to the loss function, and the categories to which the multiple sample user data belong are labeled to obtain training set data. The initial clustering model is trained according to the training set data to obtain the clustering model.
3. The method according to claim 1, characterized in that Determining the contrast loss term according to the target coefficient matrix includes: Determine the distance between the node corresponding to each sample user and other nodes to obtain multiple distance sets, and determine an intermediate parameter from each distance set to obtain multiple intermediate parameters; The mean of the intermediate parameters of all sample users is calculated to obtain the contrast loss term.
4. The method according to claim 2, characterized in that: Determine the clustering loss terms include: Acquire a plurality of the sample user data, and determine each of the sample user data as a node, thereby obtaining a plurality of nodes; Determine a clustering allocation probability of each node, and determine the current distribution of all the sample user data according to the clustering allocation probability of each node; Calculating the target distribution of all the sample user data, and calculating the KL divergence loss between the current distribution and the target distribution; Calculating the target cluster allocation probability of each of the sample users under the target distribution, calculating the ratio of the target cluster allocation probability to the cluster allocation probability of each of the sample users to obtain a plurality of second ratios, and calculating the product of the logarithm of each of the second ratios and the corresponding target cluster allocation probability to obtain a plurality of products; The sum of all the products is calculated, and the difference between the KL divergence loss and all the sums is calculated to obtain the clustering loss term.
5. The method according to claim 4, characterized in that Calculating the target clustering assignment probability of each of the sample users under the target distribution includes: Calculate the sum of the clustering assignment probabilities of all nodes to obtain a first probability, and calculate the sum of the probabilities of each node to any node to obtain a second probability; Determine the square of the cluster assignment probability of all nodes to obtain a first square, and calculate the ratio of the first square to the first probability to obtain a plurality of third ratios; Determine the square of the cluster assignment probability of each of the nodes to any of the nodes to obtain a second square, calculate the ratio of the second square to the second probability to obtain multiple fourth ratios, and determine the sum of all the fourth ratios; The ratio of each of the third ratios to the sum of the fourth ratios is determined as the target cluster assignment probability of each of the nodes to the cluster center.
6. The method according to claim 2, characterized in that Determining the sample reconstruction loss term includes: Determine the encoding function and decoding function of the encoder; The sample reconstruction loss term is calculated according to the encoding function, the decoding function and the sample user data.
7. A product recommendation device, characterized in that: include: An input unit, used to input user data of a target user into a clustering model, and process the data to obtain a category to which the target user belongs, wherein a loss function of the clustering model is obtained by adding a clustering loss term, a sample reconstruction loss term, and a contrast loss term, and the contrast loss term is determined by a target coefficient matrix, and the target coefficient matrix is determined according to a correlation relationship between a plurality of sample user data; A determination unit, configured to determine the to-be-recommended product corresponding to the category to which the target user belongs according to a preset relationship, wherein the preset relationship is used to characterize the relationship between the category to which the user belongs and the to-be-recommended product; A recommendation unit, used for recommending the product to be recommended to the target user; A first determination module is used to determine the target coefficient matrix according to the association relationship between multiple sample user data, and the first determination module includes: an acquisition submodule, used to acquire multiple sample user data, and acquire user feature data and transaction feature data of each sample user data; a first determination submodule is used to determine each sample user data as a node, obtain multiple nodes, determine the location information of the node according to the user feature data of each sample user data, and determine the direct association relationship between nodes corresponding to different sample user data according to the transaction feature data; an arrangement submodule is used to arrange the multiple nodes according to the location information, and respectively set edges between two nodes with the direct association relationship to obtain a sample relationship graph; a second determination submodule is used to determine the target coefficient matrix according to the association relationship in the sample relationship graph; The second determination submodule includes: a depth determination module, which is used to determine the association relationship of each pair of nodes in the sample relationship graph at different depths in turn, and obtain an association relationship set of each pair of nodes, wherein the depth is used to characterize the number of edges between nodes, each depth is less than or equal to a preset depth, and the association relationship of each pair of nodes at a depth is connected or not connected, and a pair of nodes is any two nodes in the sample relationship graph; a ratio calculation module, which is used to calculate the ratio of the association relationship in the association relationship set of each pair of nodes to the preset depth, and obtain multiple first ratios, and determine the sum of the multiple first ratios as the target coefficient corresponding to a pair of nodes, and obtain the target coefficient corresponding to each pair of nodes; a matrix construction module, which is used to construct the target coefficient matrix from the target coefficients corresponding to each pair of nodes.
8. A processor, characterized in that: The processor is used to run a program, wherein the program executes the product recommendation method according to any one of claims 1 to 6 when running.
9. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the product recommendation method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for processing interaction sequence data
CN110598847A
Audio recommendation method and device, equipment and storage medium
CN113343021A
Deep semi-supervised text clustering method based on pairwise constraint and cluster guidance
CN114238638A