Recommendation models, object recommendation methods and devices, training methods and devices
By introducing an attribute query layer into the recommendation model, object identifiers are converted into object attribute information, which solves the problem of low prediction accuracy in existing technologies and achieves more efficient object recommendation results and conversion rates.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-30
- Publication Date
- 2026-04-03
AI Technical Summary
Existing click-through rate prediction models ignore detailed attribute information of objects, resulting in poor prediction accuracy and reduced object recommendation effectiveness and conversion rate.
An attribute query layer is introduced into the recommendation model. Through the attribute information table and the attribute encoding table, the object identifier is converted into object attribute information and concatenated into an object feature vector. Combined with the target user feature vector, the recommendation value is determined.
This improved the accuracy and efficiency of the recommendation model in predicting various objects, thereby enhancing the object recommendation effect and conversion rate.
Smart Images

Figure CN115858928B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an object recommendation method. This application also relates to a recommendation model, a method for training the recommendation model, an object recommendation apparatus, a training apparatus for the recommendation model, a computing device, and a computer-readable storage medium. Background Technology
[0002] With the rapid development of computer technology, internet technology, and artificial intelligence technology, users can browse and select objects of interest online. In e-commerce or information flow recommendation systems, click-through rate (CTR) or conversion rate (CTR) estimation methods are often used to recommend objects based on the estimated CTR or CTR of each object.
[0003] In existing technologies, commonly used click-through rate (CTR) prediction models include traditional machine learning algorithms and deep neural networks. These methods take user information and object identifiers of each object to be recommended as input, and through training, they predict the user's value for each object to be recommended, thereby making object recommendations.
[0004] However, the methods described above only use object identifiers for click-through rate (CTR) prediction, ignoring detailed attribute information of different objects. This results in poor prediction accuracy, reduces the effectiveness of object recommendations, and impacts conversion rates. Therefore, more accurate and efficient methods are needed for object recommendation operations or processing. Summary of the Invention
[0005] In view of this, embodiments of this application provide an object recommendation method. This application also relates to a recommendation model, a training method for the recommendation model, an object recommendation apparatus, a training apparatus for the recommendation model, a computing device, and a computer-readable storage medium, to solve the technical problem of poor prediction accuracy in the prior art.
[0006] According to a first aspect of the embodiments of this application, a recommendation model is provided, the recommendation model including a first feature extraction layer, an attribute query layer and a feature analysis layer, wherein the attribute query layer is provided with an attribute information table and an attribute encoding table;
[0007] The first feature extraction layer is used to receive target user information and output the target user feature vector corresponding to the target user information.
[0008] The attribute query layer is used to receive at least one object identifier, and for the first object identifier, query the target object attribute information corresponding to the first object identifier from the attribute information table, and query the encoded feature representation corresponding to each object attribute in the target object attribute information from the attribute encoding table, and concatenate the encoded feature representations corresponding to each object attribute to obtain the object feature vector corresponding to the first object identifier; wherein, the first object identifier is any one of at least one object identifier;
[0009] The feature analysis layer is used to analyze the target user feature vector and the object feature vector corresponding to at least one object identifier to determine the recommended value of at least one object identifier.
[0010] According to a second aspect of the embodiments of this application, an object recommendation method is provided, including:
[0011] Obtain the target user information of the target user, and the recommendation object identifier of at least one object to be recommended;
[0012] Input the target user information into the first feature extraction layer of the recommendation model to obtain the target user feature vector;
[0013] The recommendation object identifier of at least one object to be recommended is input into the attribute query layer of the recommendation model. The attribute information table in the attribute query layer is used to query the first object attribute information corresponding to the first recommendation object identifier. The attribute encoding table in the attribute query layer is used to determine the encoded feature representation corresponding to each first attribute in the first object attribute information. The encoded feature representations corresponding to each first attribute are concatenated to obtain the object feature vector corresponding to the first recommendation object identifier. The first recommendation object identifier is any one of the recommendation object identifiers of at least one object to be recommended.
[0014] Based on the target user's feature vector and the object feature vector of at least one object to be recommended, a recommendation value for at least one object to be recommended is determined, and the target object is recommended to the target user based on the recommendation value.
[0015] According to a third aspect of the embodiments of this application, a method for training a recommendation model is provided, comprising:
[0016] Obtain the sample user information of the sample user, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample user. The positive sample object identifier is the identifier of the object selected by the sample user, and the negative sample object identifier is the identifier of other objects besides the object selected by the sample user.
[0017] Input the sample user information into the first feature extraction layer of the initial recommendation model to obtain the sample user feature vector;
[0018] The positive sample object identifier and negative sample object identifier are input into the attribute query layer of the initial recommendation model. The positive sample attribute information corresponding to the positive sample object identifier is queried through the attribute information table in the attribute query layer. The encoded feature representation corresponding to each positive sample attribute in the positive sample attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each positive sample attribute are concatenated to obtain the positive sample feature vector corresponding to the positive sample object identifier.
[0019] The negative sample attribute information corresponding to the negative sample object identifier is queried from the attribute information table in the attribute query layer, and the encoded feature representation corresponding to each negative sample attribute in the negative sample attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each negative sample attribute are concatenated to obtain the negative sample feature vector corresponding to the negative sample object identifier.
[0020] Based on the sample user feature vector and the positive sample feature vector, the positive sample prediction value is determined, and based on the sample user feature vector and the negative sample feature vector, the negative sample prediction value is determined. Based on the positive sample prediction value and the negative sample prediction value, the initial recommendation model is trained to obtain the trained recommendation model.
[0021] According to a fourth aspect of the embodiments of this application, an object recommendation apparatus is provided, comprising:
[0022] The first acquisition module is configured to acquire the target user information of the target user, and the recommendation object identifier of at least one object to be recommended;
[0023] The first acquisition module is configured to input the target user information into the first feature extraction layer of the recommendation model to obtain the target user feature vector of the target user.
[0024] The first concatenation module is configured to input the recommendation object identifier of at least one object to be recommended into the attribute query layer of the recommendation model, query the first object attribute information corresponding to the first recommendation object identifier through the attribute information table in the attribute query layer, determine the encoded feature representation corresponding to each first attribute in the first object attribute information through the attribute encoding table in the attribute query layer, and concatenate the encoded feature representations corresponding to each first attribute to obtain the object feature vector corresponding to the first recommendation object identifier; wherein, the first recommendation object identifier is any one of the recommendation object identifiers of at least one object to be recommended;
[0025] The recommendation module is configured to determine the recommendation value of at least one object to be recommended based on the feature vector of the target user and the object feature vector of at least one object to be recommended, and recommend the target object to the target user based on the recommendation value.
[0026] According to a fifth aspect of the embodiments of this application, a training apparatus for a recommendation model is provided, comprising:
[0027] The second acquisition module is configured to acquire sample user information of the sample user, as well as positive sample object identifier and negative sample object identifier corresponding to the sample user, wherein the positive sample object identifier is the identifier of the object selected by the sample user, and the negative sample object identifier is the identifier of other objects besides the object selected by the sample user.
[0028] The second acquisition module is configured to input sample user information into the first feature extraction layer of the initial recommendation model to obtain the sample user feature vector of the sample user.
[0029] The second concatenation module is configured to input the positive sample object identifier and the negative sample object identifier into the attribute query layer of the initial recommendation model, query the positive sample attribute information corresponding to the positive sample object identifier through the attribute information table in the attribute query layer, and determine the encoded feature representation corresponding to each positive sample attribute in the positive sample attribute information through the attribute encoding table in the attribute query layer, and concatenate the encoded feature representations corresponding to each positive sample attribute to obtain the positive sample feature vector corresponding to the positive sample object identifier.
[0030] The third splicing module is configured to query the negative sample attribute information corresponding to the negative sample object identifier through the attribute information table in the attribute query layer, and determine the encoded feature representation corresponding to each negative sample attribute in the negative sample attribute information through the attribute encoding table in the attribute query layer, and splice the encoded feature representation corresponding to each negative sample attribute to obtain the negative sample feature vector corresponding to the negative sample object identifier.
[0031] The first training module is configured to determine the positive sample prediction value based on the sample user feature vector and the positive sample feature vector, and to determine the negative sample prediction value based on the sample user feature vector and the negative sample feature vector; and to train the initial recommendation model based on the positive sample prediction value and the negative sample prediction value to obtain the trained recommendation model.
[0032] According to a sixth aspect of the embodiments of this application, a computing device is provided, comprising:
[0033] Memory and processor;
[0034] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of any of the above-described object recommendation methods, or the steps of the above-described recommendation model training methods.
[0035] According to a seventh aspect of the present application, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of any of the above-described object recommendation methods or the steps of the above-described recommendation model training methods.
[0036] The recommendation model provided in this application includes a first feature extraction layer, an attribute query layer, and a feature analysis layer. The attribute query layer includes an attribute information table and an attribute encoding table. The first feature extraction layer receives target user information and outputs a target user feature vector corresponding to the target user information. The attribute query layer receives at least one object identifier, queries the attribute information table for the target object identifier corresponding to the first object identifier, and queries the attribute encoding table for the encoded feature representations corresponding to each object attribute in the target object attribute information. The encoded feature representations corresponding to each object attribute are concatenated to obtain the object feature vector corresponding to the first object identifier. The first object identifier is any one of at least one object identifier. The feature analysis layer analyzes the target user feature vector and the object feature vectors corresponding to at least one object identifier to determine the recommendation value of at least one object identifier.
[0037] In this scenario, an attribute query layer is added to the recommendation model. This layer contains an attribute information table and an attribute encoding table. It converts the input object identifier into corresponding object attribute information, then looks up the encoded feature representations of each object attribute in the attribute information, and concatenates them to obtain the object feature vector. Thus, by adding the attribute query layer, the recommendation model can convert the input object identifier into the indicated object attribute information and determine the corresponding object feature vector. The introduction of object attribute information into the recommendation model improves the accuracy of predicting the recommendation value for each object, thereby improving the object recommendation effect and ensuring the object conversion rate.
[0038] The object recommendation method provided in this application embodiment obtains target user information of a target user and recommendation object identifiers of at least one object to be recommended; inputs the target user information into the first feature extraction layer of the recommendation model to obtain the target user feature vector; inputs the recommendation object identifiers of at least one object to be recommended into the attribute query layer of the recommendation model, queries the attribute information table in the attribute query layer to find the first object attribute information corresponding to the first recommendation object identifier, and determines the encoded feature representation corresponding to each first attribute in the first object attribute information through the attribute encoding table in the attribute query layer, and concatenates the encoded feature representations corresponding to each first attribute to obtain the object feature vector corresponding to the first recommendation object identifier; wherein, the first recommendation object identifier is any one of the recommendation object identifiers of at least one object to be recommended; based on the target user feature vector and the object feature vectors of at least one object to be recommended, determines the recommendation value of at least one object to be recommended, and recommends the target object to the target user based on the recommendation value.
[0039] In this scenario, the recommendation model can analyze at least one object to be recommended simultaneously. A single calculation is needed for one user and multiple objects to be recommended, significantly reducing computational load and improving the efficiency of predicting recommendation values, thereby enhancing object recommendation efficiency. Furthermore, the target user information and the identifier of the object to be recommended can be input into the recommendation model. The attribute query layer within the model converts the input object identifier into corresponding object attribute information. Then, the coded feature representations corresponding to each object attribute are found and concatenated to obtain the object feature vector. In other words, the object identifier can be converted into the indicated object attribute information, thus determining the object feature vector corresponding to the object attribute information. Combining the target user information and this object feature vector, the recommendation value of the object to be recommended is analyzed, and the object is recommended to the user. Thus, the recommendation model incorporates an attribute query layer, which includes an attribute information table and an attribute coding table. This allows the introduction of object attribute information corresponding to the object identifier, and since a single calculation is needed for one user and multiple object attribute information, the model's accuracy and efficiency in predicting the recommendation value of each object to be recommended are improved, thereby enhancing the object recommendation effect and ensuring the object conversion rate. Attached Figure Description
[0040] Figure 1a This is a schematic diagram illustrating the training process of a recommendation model provided in one embodiment of this application;
[0041] Figure 1b This is a schematic diagram illustrating the training process of another recommendation model provided in one embodiment of this application;
[0042] Figure 1c This is a schematic diagram of an object recommendation process provided in an embodiment of this application;
[0043] Figure 2 This is a flowchart of an object recommendation method provided in an embodiment of this application;
[0044] Figure 3a This is a schematic diagram of the structure of an attribute query layer provided in an embodiment of this application;
[0045] Figure 3b This is a schematic diagram illustrating the training process of another recommendation model provided in an embodiment of this application;
[0046] Figure 4 This is a schematic diagram of the structure of a recommendation model provided in an embodiment of this application;
[0047] Figure 5 This is a flowchart of a training method for a recommendation model provided in one embodiment of this application;
[0048] Figure 6a This is a schematic diagram of another object recommendation process provided in an embodiment of this application;
[0049] Figure 6b This is a flowchart illustrating an object recommendation method applied to an e-commerce scenario, provided by an embodiment of this application.
[0050] Figure 7 This is a schematic diagram of the structure of an object recommendation device provided in an embodiment of this application;
[0051] Figure 8 This is a schematic diagram of the structure of a training device for a recommendation model provided in one embodiment of this application;
[0052] Figure 9 This is a structural block diagram of a computing device provided in one embodiment of this application. Detailed Implementation
[0053] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0054] The terminology used in one or more embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this application. The singular forms “a” and “the” as used in one or more embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this application refers to and includes any or all possible combinations of one or more associated listed items.
[0055] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this application, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0056] First, the terms and concepts involved in one or more embodiments of this application will be explained.
[0057] Exposure: refers to the objects displayed to users in the fields of recommendation or search.
[0058] Positive samples: These are samples that receive positive feedback from users after being exposed to the product.
[0059] Negative samples: These are samples that, after being exposed, do not elicit positive feedback from users.
[0060] It should be noted that click-through rate (CTR) or conversion rate (CTR) estimation methods are commonly used in e-commerce or information flow recommendation systems. By estimating the CTR or CTR of users for each object, object recommendations are made to achieve the maximum overall benefit.
[0061] Commonly used recommendation models include traditional machine learning algorithms and deep neural networks. By inputting user information, object information, and user behavior tags for the object, the parameters of the recommendation model are optimized, ultimately obtaining a recommendation model that can predict the click-through rate of objects. This model can predict the click-through rate of visiting users and the objects to be exposed.
[0062] If the recommendation model is fitted with user information-object information pairs that have been exposed in the past, it may introduce exposure bias, because the user information-object information used are all exposed objects. One way to solve the exposure bias is to sample unexposed samples and use them as negative samples to train the recommendation model.
[0063] In practice, when it is necessary to construct some unexposed negative samples, two methods can be adopted.
[0064] Implementation Method 1: The user's state at a certain moment can be used as the user state, the sample clicked by the user is used as the positive sample, and the sample exposed to the user but not clicked is used as the negative sample. At the same time, some samples that are not exposed can also be used as negative samples. Then, each training sample is input into the recommendation model for training. Each training sample includes a user information and a sample, which is either a positive sample or a negative sample.
[0065] Figure 1a This is a schematic diagram illustrating the training process of a recommendation model provided in one embodiment of this application, as shown below. Figure 1aAs shown, for user 1, user information 1 (user1), object identifier 1 (item1), and label 1 (label1) are used as one training sample; user information 1 (user1), object identifier 2 (item2), and label 2 (label2) are used as another training sample; user information 1 (user1), object identifier 3 (item3), and label 3 (label3) are used as another training sample; user information 1 (user1), object identifier 4 (item4), and label 4 (label4) are used as another training sample; and user information 1 (user1), object identifier 5 (item5), and label 5 (label5) are used as yet another training sample. The label in each training sample indicates whether the user clicked the corresponding object. For each training sample, user information (user) and object identifier (item) can be input into the recommendation model. The recommendation model can output the predicted label for the object indicated by that object identifier for that user. Based on this predicted label and the labels in the training samples, the recommendation model is trained.
[0066] It should be noted that in the above method, a user information-object identifier pair is used as a training sample. Each training sample requires the user information to be input into the recommendation model once to fit their labels. This requires a lot of repetitive calculations, which takes a long time, wastes computing resources, and reduces computing efficiency.
[0067] Implementation Method Two: This method can draw inspiration from recall models, using only the objects clicked by the user as positive samples, and randomly assigning all other samples as negative samples with a certain probability. In this method, no labels are needed in the training samples because the given user information and objects are all positive samples. After the recommendation model processes the user information, it can fit that the positive object label is 1, and the other object labels are 0.
[0068] It should be noted that the advantage of implementation method two compared to implementation method one is that, by inputting the user's training samples at a certain moment, multiple positive and negative samples for that user can be calculated at once. Since the user's features are identical at a certain moment, repeated calculations are unnecessary, thus significantly optimizing computation time and improving computational efficiency. However, in implementation method two, only user information is input; the object identifier only differs in the output of the last layer of the recommendation model, using only the object identifier for differentiation and not utilizing other object features.
[0069] Figure 1b This is a schematic diagram illustrating the training process of another recommendation model provided in one embodiment of this application, as shown below. Figure 1bAs shown, user information 1 (user1) and object identifier 1 (item1) are used as one training sample; user information 1 (user1) and object identifier 2 (item2) are used as one training sample; user information 2 (user2) and object identifier 2 (item2) are used as one training sample; user information 2 (user2) and object identifier 4 (item4) are used as one training sample; and user information 3 (user3) and object identifier 1 (item1) are used as one training sample. In this recommendation model, only user information (user) is input. After the recommendation model is applied, the object identifier of the fitted positive sample (e.g., item2) is 1, while the other object identifiers (item1, item3, item4) are 0.
[0070] Figure 1c This is a schematic diagram of an object recommendation process provided in an embodiment of this application, as shown below. Figure 1c As shown, the user's selected positive sample objects are averaged to generate a selected object feature vector; the user's search terms are averaged to obtain a search term feature vector; a geographic location is input to obtain a geographic location feature vector; and user information (age, gender, etc.) is input to obtain a user feature vector. The selected object feature vector, search term feature vector, geographic location feature vector, and user feature vector are processed through a three-layer neural network and then connected to a Softmax layer (normalization layer) to predict the user's next object of interest. The output is a probability distribution (i.e., category probability) across all candidate objects, which is also the viewing probability of each object. After training, the output of the last layer of the neural network serves as the user's encoded features, and the weights of the Softmax layer can be used as the object encoding representation of the currently predicted object.
[0071] It's important to note that since the recommendation model only receives user information as input, and only fits the object identifiers of positive samples at the final output layer, it doesn't consider object attributes or other information. Similarly, because it only processes user information, this information doesn't need to be calculated multiple times; each positive sample and N negative samples only require one complex information processing step, resulting in high computational efficiency. However, using only object identifiers for differentiation and ignoring detailed attribute information of different objects leads to poor prediction accuracy, reduces object recommendation performance, and impacts object conversion rates.
[0072] Therefore, this application provides a recommendation model with optimized structure. This model incorporates object attribute information, and the attribute information for a user and multiple objects only needs to be calculated and analyzed once. This improves the accuracy and efficiency of the model's prediction of recommendation values for each object, thereby enhancing the object recommendation effect and ensuring the object conversion rate. Furthermore, a counting module is added to the recommendation model to count the frequency of positive samples, filtering out unreliable prediction scores in subsequent actual prediction processes. Moreover, through a new loss function and evaluation method, the fitting results of the recommendation model can more closely approximate the actual performance after deployment, improving the prediction effect of the recommendation model.
[0073] This application provides an object recommendation method, and also relates to a recommendation model training method, an object recommendation device, a recommendation model training device, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.
[0074] Figure 2 A flowchart of an object recommendation method according to an embodiment of this application is shown, specifically including the following steps 202-208:
[0075] Step 202: Obtain the target user information of the target user, and the recommendation object identifier of at least one object to be recommended.
[0076] Specifically, the target user is the user to whom the object recommendation needs to be made; the object to be recommended is the optional object to be recommended to the user, and one or more objects can be selected from at least one object to be recommended to recommend to the target user.
[0077] It should be noted that, in order to determine the target objects to recommend to the target user, the target user's target user information and at least one recommendation object identifier can be obtained. The target user information includes information related to the target user, such as basic attribute information like age, gender, and level; it can also include historical preference information, such as the identifiers of objects liked, favorited, or shared by the target user before the current time; and it can also include historical selection information, such as the identifiers of a set number of objects recently selected by the target user before the current time. Furthermore, the recommendation object identifier can be used to uniquely identify an object, such as an object ID (identification number) or object name.
[0078] In practical applications, this object can refer to the object that the user searches for and wants to obtain. That is, the object is used to display to the target user for the target user to choose from. Such objects can be products, videos, articles, information, etc.
[0079] Step 204: Input the target user information into the first feature extraction layer of the recommendation model to obtain the target user feature vector.
[0080] It should be noted that the trained recommendation model can determine the target user feature vector corresponding to the target user information, as well as the object feature vector of at least one object to be recommended. The object feature vector is the feature vector corresponding to the object attribute information indicated by the recommended object identifier.
[0081] Specifically, the recommendation model is a pre-trained model that analyzes input user information and object identifiers, outputs recommendation values for each object identifier, and thus recommends objects to the target user based on these values. This recommendation model can be a deep neural network model, such as a DNN (Deep Neural Network). The recommendation model may include a first feature extraction layer, an attribute query layer, and a feature analysis layer. The attribute query layer includes an attribute information table and an attribute encoding table.
[0082] In practical applications, the target user information can be input into the first feature extraction layer in the recommendation model. This first feature extraction layer can extract features from the target user information to obtain the target user feature vector corresponding to the target user information.
[0083] In an optional implementation of this embodiment, the target user information includes basic attribute information, historical preference information, and historical selection information; the target user information is input into the first feature extraction layer of the recommendation model to obtain the target user feature vector, including:
[0084] Historical preference information and historical selection information are input into the attribute query layer of the recommendation model. The historical preference information is the object identifier of the preferred object, and the historical selection information is the object identifier of the historical selected object.
[0085] The second object attribute information corresponding to historical preference information is retrieved from the attribute information table in the attribute query layer, and the third object attribute information corresponding to historical selection information is retrieved from the attribute information table in the attribute query layer.
[0086] The basic attribute information, the second object attribute information, and the third object attribute information are input into the first feature extraction layer of the recommendation model. The first feature extraction layer determines the encoded feature representation corresponding to each second attribute in the basic attribute information, the second object attribute information, and the third object attribute information. The encoded feature representations corresponding to each second attribute are concatenated to obtain the target user feature vector of the target user.
[0087] It should be noted that target user information includes basic attribute information, historical preference information, and historical selection information. Basic attribute information is used to distinguish different users, such as username, age, gender, level, etc. Historical preference information and historical selection information are used to represent the user's historical behavioral preferences. Historical preference information can be the object identifiers of a set number of preferred objects that the target user has viewed, liked, favorited, or forwarded before the current time. Historical selection information is the object identifiers of a set number of objects that the target user has recently selected before the current time. In other words, both historical preference information and historical selection information are object identifiers representing the target user's historical preferred objects.
[0088] In practical applications, since historical preference information and historical selection information are both object identifiers, they can also be input into the attribute query layer of the recommendation model. The second object attribute information corresponding to the historical preference information and the third object attribute information corresponding to the historical selection information can be obtained through the attribute information table in the attribute query layer. Then, the basic attribute information, the second object attribute information and the third object attribute information are input into the first feature extraction layer of the recommendation model to comprehensively extract the target user feature vector of the target user.
[0089] In this embodiment of the application, when analyzing user information, not only are basic attribute information that can distinguish different users considered, but information representing users' historical behavioral preferences is also incorporated. The information representing users' historical behavioral preferences is converted into corresponding attribute information, which greatly improves the accuracy and efficiency of the subsequent model in predicting the recommendation value of each object to be recommended, thereby improving the object recommendation effect and ensuring the object conversion rate.
[0090] Step 206: Input the recommendation object identifier of at least one object to be recommended into the attribute query layer of the recommendation model, query the first object attribute information corresponding to the first recommendation object identifier through the attribute information table in the attribute query layer, and determine the encoded feature representation corresponding to each first attribute in the first object attribute information through the attribute encoding table in the attribute query layer. Concatenate the encoded feature representations corresponding to each first attribute to obtain the object feature vector corresponding to the first recommendation object identifier.
[0091] Here, the first recommended object identifier is any one of the recommended object identifiers of at least one object to be recommended, and the first object attribute information refers to the object attribute information corresponding to the first recommended object identifier. Object attribute information refers to information related to object attributes. Different object identifiers can correspond to the same attribute information or different attribute information. For example, object attribute information can be object category tag, type, price, category, duration, etc.
[0092] In practical applications, the recommendation object identifier of at least one object to be recommended can be input into the attribute query layer of the recommendation model. The attribute information table in the attribute query layer is used to query the first object attribute information corresponding to the first recommendation object identifier. The attribute encoding table in the attribute query layer is used to determine the encoded feature representation corresponding to each first attribute in the first object attribute information. The encoded feature representations corresponding to each first attribute are concatenated to obtain the object feature vector corresponding to the first recommendation object identifier. This process is repeated, and each recommendation object identifier can be used as the first recommendation object identifier to obtain the corresponding object feature vector. In other words, by inputting the recommendation object identifier of at least one object to be recommended into the attribute query layer of the recommendation model, the attribute query layer can convert each input recommendation object identifier into corresponding object attribute information, thereby obtaining the object feature vector corresponding to each recommendation object identifier.
[0093] This application optimizes the model structure of the recommendation model by adding an attribute query layer. This layer converts the input object identifier into corresponding attribute information and determines the object feature vector based on this attribute information. Thus, the trained recommendation model can determine the target user feature vector corresponding to the target user information, as well as the object feature vector corresponding to the object attribute information of at least one object to be recommended. The introduction of object attribute information in this recommendation model facilitates subsequent calculation and analysis of the target user feature vector and the object feature vector to determine the recommendation value for each object to be recommended. In other words, a user's information can be input into the recommendation model simultaneously along with multiple object identifiers for analysis and processing. A user's information and multiple objects only require one calculation and analysis, which greatly saves computational load and improves the model's efficiency in predicting the recommendation values of each object to be recommended. Furthermore, the recommendation model can first convert the object identifier into corresponding attribute information, and then extract the corresponding feature vector based on this attribute information. Thus, objects with the same or similar attributes will have the same content in their object feature vectors. The introduction of object attribute information into the recommendation model improves the accuracy of the model's prediction of the recommendation values of each object to be recommended, thereby improving the object recommendation effect and ensuring the object conversion rate.
[0094] It should be noted that the attribute information table refers to the correspondence between object identifiers and attribute information. Based on this attribute information table, the input first recommended object identifier can be queried to obtain the corresponding first object attribute information, which may include multiple first attributes. Additionally, the attribute encoding table refers to the correspondence between attributes and encoded feature representations. Based on this attribute encoding table, the encoded feature representation corresponding to each first attribute can be queried, and concatenating the encoded feature representations corresponding to each first attribute yields the object feature vector corresponding to the first recommended object identifier.
[0095] Example, Figure 3aThis is a schematic diagram of the structure of an attribute query layer provided in an embodiment of this application, as shown below. Figure 3a As shown, the attribute query layer includes an attribute information table and an attribute encoding table. Inputting recommended object identifier 1 (e.g., ID1), recommended object identifier 2 (e.g., ID2), and recommended object identifier 3 (e.g., ID3), the attribute information table yields object attribute information 1, object attribute information 2, and object attribute information 3 corresponding to ID1, ID2, and ID3. Then, object attribute information 1, object attribute information 2, and object attribute information 3 are processed through the attribute encoding table to obtain the encoded feature representation of each attribute in the object attribute information. These encoded feature representations can be concatenated into an object feature vector. That is, after processing through the attribute encoding table of the attribute query layer, object feature vector 1, object feature vector 2, and object feature vector 3 can be output.
[0096] As an example, taking an e-commerce scenario, the object is a product. Assume the recommended products are all related to figurines (A). The attribute query layer can first query an attribute information table to obtain the product's attribute information. At this point, the recommended product identifier can be converted into a series of attribute information such as <figurine A tag, figurine, 600-1000 yuan, posable>. Then, each attribute information is represented as a vector using an attribute encoding table. Finally, the product feature vector of the recommended product identifier is represented as a concatenated vector of its <figurine A tag, category, price, type> vectors.
[0097] In this embodiment, object attribute information is pre-introduced into the recommendation model to convert the recommended object identifier of the input object to be recommended into the corresponding object attribute information. Subsequently, the object feature vector corresponding to the object attribute information is analyzed, which improves the accuracy and efficiency of the subsequent model in predicting the recommendation value of each object to be recommended, thereby improving the object recommendation effect and ensuring the object conversion rate.
[0098] In an optional implementation of this embodiment, the recommendation model further includes an object counting layer; concatenating the encoded feature representations corresponding to each first attribute to obtain the object feature vector corresponding to the first recommended object identifier includes:
[0099] The concatenated feature representation is obtained by concatenating the encoded feature representations corresponding to each first attribute;
[0100] Obtain the object counting matrix from the object counting layer, where the object counting matrix is generated by the object counting layer for counting the positive sample object identifiers during the training process;
[0101] Based on the object counting matrix and the concatenated feature representation, the object feature vector corresponding to the first recommended object identifier is determined.
[0102] It should be noted that the embodiments of this application can further optimize the model structure of the recommendation model by introducing an object counting layer. This object counting layer can count the positive sample object identifiers that appear during the training of the recommendation model and generate an object counting matrix to record the positive sample object identifiers that appear during the training process. Thus, the object feature vector of the first recommended object identifier can be determined by combining the object counting matrix and the concatenated feature representation.
[0103] In practical applications, the object counting matrix can be a mask matrix. Positions in the object counting matrix where the count of positive sample object identifiers exceeds a set threshold are set to 1, indicating that the object frequently appears during training and is a high-frequency object. Positions where the count of positive sample object identifiers does not exceed the set threshold are set to 0, indicating that the object infrequently appears during training, or even never appears, and is a low-frequency object. The recommendation model can also include a second feature extraction layer. After concatenating the encoded feature representations corresponding to each first attribute to obtain the concatenated feature representation, the object counting matrix and the concatenated feature representation can be multiplied by the second feature extraction layer to obtain the object feature vector of the first recommended object identifier. This sets the feature vector of objects that appear less than a set threshold during training to 0. That is, if the number of times the first recommended object identifier appears as a positive sample is less than the threshold, the output object feature vector is a 0 vector; otherwise, it is a normal vector.
[0104] In this embodiment, the object counting module prevents untrained or insufficiently trained objects from appearing online and potentially receiving high recommendation values. Since online prediction often prioritizes objects with the highest recommendation values, even low-probability events can have a significant impact. In the recommendation model provided in this application, vectors are jointly represented by attributes, so the probability of object anomalies is not high. If it's necessary to recommend only objects trained during the training process, this object counting layer is needed. This layer ensures that objects that have appeared multiple times as positive samples during training receive higher recommendation values, thus preventing untrained or insufficiently trained objects from appearing online.
[0105] In one optional implementation of this embodiment, the recommendation model is trained using the following method:
[0106] Obtain the sample user information of the sample user, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample user. The positive sample object identifier is the identifier of the object selected by the sample user, and the negative sample object identifier is the identifier of other objects besides the object selected by the sample user.
[0107] Input the sample user information into the first feature extraction layer of the initial recommendation model to obtain the sample user feature vector;
[0108] The positive sample object identifier and negative sample object identifier are input into the attribute query layer of the initial recommendation model. The positive sample attribute information corresponding to the positive sample object identifier is queried through the attribute information table in the attribute query layer. The encoded feature representation corresponding to each positive sample attribute in the positive sample attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each positive sample attribute are concatenated to obtain the positive sample feature vector corresponding to the positive sample object identifier.
[0109] The negative sample attribute information corresponding to the negative sample object identifier is queried from the attribute information table in the attribute query layer, and the encoded feature representation corresponding to each negative sample attribute in the negative sample attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each negative sample attribute are concatenated to obtain the negative sample feature vector corresponding to the negative sample object identifier.
[0110] Based on the sample user feature vector and the positive sample feature vector, the positive sample prediction value is determined, and based on the sample user feature vector and the negative sample feature vector, the negative sample prediction value is determined. Based on the positive sample prediction value and the negative sample prediction value, the initial recommendation model is trained to obtain the trained recommendation model.
[0111] It should be noted that positive and negative samples corresponding to a sample user can be obtained. The sample user information, positive sample object identifier, and negative sample object identifier are used as a training sample. Through the initial recommendation model, the sample user feature vector, positive sample feature vector, and negative sample feature vector corresponding to the sample user information are determined. Based on the sample user feature vector, positive sample feature vector, and negative sample feature vector, the initial recommendation model is trained to obtain the trained recommendation model. In this way, the attribute information of a user and multiple objects only needs to be calculated and analyzed once, improving the accuracy and efficiency of the model's prediction of the recommendation value for each object to be recommended, thereby improving the object recommendation effect and ensuring the object conversion rate.
[0112] In practical applications, conventional methods can be used to supplement the negative samples with samples that were not exposed by the user at a certain time. Then, the user information and the positive and negative sample information (positive sample object identifier and negative sample object identifier) are fed together into the initial recommendation model.
[0113] Example, Figure 3b This is a schematic diagram illustrating the training process of another recommendation model provided in an embodiment of this application, as shown below. Figure 3bAs shown, User Information 1, Object Identifier 1, Object Identifier 2, Object Identifier 3, and Object Identifier 4 are used as a training sample, with Object Identifier 1 and Object Identifier 2 being positive sample object identifiers and Object Identifier 3 and Object Identifier 4 being negative sample object identifiers; User Information 1, Object Identifier 1, Object Identifier 3, Object Identifier 2, and Object Identifier 4 are used as a training sample, with Object Identifier 1 and Object Identifier 3 being positive sample object identifiers and Object Identifier 2 and Object Identifier 4 being negative sample object identifiers; User Information 2, Object Identifier 3, Object Identifier 2, and Object Identifier 4 are used as a training sample, with Object Identifier 3 being a positive sample object identifier and Object Identifier 2 and Object Identifier 4 being negative sample object identifiers; User Information 2, Object Identifier 2, Object Identifier 3, and Object Identifier 4 are used as a training sample, with Object Identifier 2 being a positive sample object identifier and Object Identifier 3 and Object Identifier 4 being negative sample object identifiers; User Information 3, Object Identifier 4, Object Identifier 1, and Object Identifier 3 are used as a training sample, with Object Identifier 4 being a positive sample object identifier and Object Identifier 1 and Object Identifier 3 being negative sample object identifiers.
[0114] like Figure 3b As shown, a training sample input to the initial recommendation model contains sample user information, positive sample object identifier, and negative sample object identifier. The initial recommendation model needs to fit the positive sample object identifier as 1 and the negative sample object identifier as 0. For example, for user information 1, the output to be fitted should be 1100.
[0115] It should be noted that the process of determining the feature vectors of sample users, positive samples, and negative samples during training is similar to the specific implementation process of determining the feature vectors of target users and objects in the actual recommendation process, and will not be elaborated here.
[0116] In one optional implementation of this embodiment, the initial recommendation model is trained based on the positive sample prediction value and the negative sample prediction value to obtain a trained recommendation model, including:
[0117] Based on the positive and negative sample prediction values, determine the loss value of the initial recommendation model;
[0118] Adjust the model parameters of the initial recommendation model based on the loss value, and return to the step of obtaining sample user information of sample users, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample users. If the loss value meets the training stopping condition, stop training and obtain the recommendation model that has been trained.
[0119] Among them, the training stopping condition is a pre-set condition for determining when the initial recommendation model has completed training, such as the loss value being less than the loss threshold or the number of training iterations reaching a preset number. When the training stopping condition is met, it means that the loss value of the initial recommendation model has been optimized and the training is complete. At this point, training can be stopped and the trained recommendation model can be obtained.
[0120] It should be noted that since multiple positive sample object identifiers and multiple negative sample object identifiers are input at once, the final optimization objective is still maximum likelihood estimation. Therefore, the loss value of the initial recommendation model can be determined based on the positive sample prediction value and the negative sample prediction value. Based on this loss value, the model parameters of the initial recommendation model can be optimized until the training stopping condition is reached, and the trained recommendation model is obtained.
[0121] In practical applications, the loss value of the initial recommendation model can be determined based on the positive sample prediction value and the negative sample prediction value, which can be achieved by the following formula (1):
[0122]
[0123] Where LOSS represents the loss value of the initial recommendation model; S i Let s represent the predicted value of the i-th positive sample. j denoted by , represents the predicted value of the j-th negative sample; Pmask represents the mask matrix of the positive samples, and Nmask represents the mask matrix of the negative samples; n represents the number of slots for positive samples, i.e., the number of positive samples pre-set in a training sample; m represents the number of slots for negative samples, i.e., the number of negative samples pre-set in a training sample; P represents the number of valid positive samples in a training sample, i.e., the actual number of positive samples included in a training sample; N represents the number of valid negative samples in a training sample, i.e., the actual number of negative samples included in a training sample. In other words, a training sample in this calculation consists of P+N valid samples; K represents the parameter for adjusting the weight of positive samples, i.e., adjusting the influence of positive and negative samples on the loss value. This value can be pre-set.
[0124] It's important to note that the number of positive and negative samples input at a time is pre-set, meaning the number of slots for positive and negative samples is fixed. If a slot is missing, it's padded with 0. For example, if there are 5 positive slots and 7 negative slots (n = 5, m = 7), and a training sample actually contains 5 positive and 7 negative samples, then P = 5, N = 7, and the mask matrix for positive samples is [1,1,1,1,1], and the mask matrix for negative samples is [1,1,1,1,1,1,1]. Alternatively, if a training sample contains only 3 positive and 4 negative samples, then P = 3, N = 4, and the mask matrix for positive samples is [1,1,1,0,0], and the mask matrix for negative samples is [1,1,1,1,0,0,0]. In other words, during calculation, the mask matrix indicates that if a position is 0, it is not included in the loss calculation.
[0125] Alternatively, the target metric can be maximized directly. In this case, instead of using log-loss as the loss function, the loss function can be determined based on the difference between the positive and negative sample predictions. The above formula (1) can be converted into the loss function shown in the following formula (2):
[0126]
[0127] Where Loss2 represents the loss value that needs to be maximized; Relu(s j -s i ) represents the difference between the positive sample estimate and the negative sample estimate.
[0128] In an optional implementation of this embodiment, the initial recommendation model further includes an object counting layer; after obtaining the sample user information of the sample users, and the positive and negative sample object identifiers corresponding to the sample users, it further includes:
[0129] The positive sample object identifiers are input into the object counting layer of the initial recommendation model. The object counting layer counts the positive sample object identifiers to generate an object counting matrix.
[0130] In one optional implementation of this embodiment, the positive sample object identifiers are counted through an object counting layer to generate an object counting matrix, including:
[0131] Determine the counting results for each positive sample object identifier, and generate an initial counting matrix based on the counting results;
[0132] Identify the first positive sample object identifier whose count exceeds a set threshold among all positive sample object identifiers, and set the value corresponding to the first positive sample object identifier in the initial counting matrix to 1;
[0133] Identify the second positive sample object identifier whose count result does not exceed the set threshold among all positive sample object identifiers, set the value corresponding to the second positive sample object identifier in the initial counting matrix to 0, and obtain the object counting matrix.
[0134] It's worth noting that the structure of the initial recommendation model was optimized by adding an object counting layer. This object counting layer is added to the subsequently trained recommendation model and records the frequency of each positive sample object identifier. Specifically, an embedding matrix (encoding matrix) filled with zeros can be initialized. After each value (key) is retrieved from the feature lookup, the sum is taken as the counter-loss value, and an optimizer is used with a learning rate of 1. Because the gradient of the counter-loss value with respect to each appearing feature is 1, each time the variable in the encoding matrix is queried, it increments by 1, thus counting the frequency of positive samples.
[0135] In this embodiment, an object counting layer is added to the trained recommendation module, enabling the online service to mask objects that are not sufficiently trained. During actual online prediction, the user side works the same as the training process, directly calculating the user feature vector. On the object identification side, the input object identifier is fed into the attribute query layer to obtain the initial object feature vector corresponding to the object attribute information, but the initial object feature vector is not directly output at this time. The object counting layer records the number of times each positive sample object identifier is trained. Therefore, a threshold can be set here, such as 100. A mask matrix (i.e., object counting matrix) is generated using the count in the object counting layer and the threshold. The value corresponding to the object identifier position below 100 will be set to 0, and the rest will be set to 1. Then, the mask matrix is multiplied by the initial object feature vector to obtain the final output object feature vector. That is, if the number of times the object identifier appears is less than the threshold, the output object feature vector is a 0 vector; otherwise, it is a normal vector.
[0136] In this embodiment, the object counting module prevents untrained or insufficiently trained objects from appearing online and potentially receiving high recommendation values. Since online prediction often prioritizes objects with the highest recommendation values, even low-probability events can have a significant impact. In the recommendation model provided in this application, vectors are jointly represented by attributes, so the probability of object anomalies is not high. If it's necessary to recommend only objects trained during the training process, this object counting layer is needed. This layer ensures that objects that have appeared multiple times as positive samples during training receive higher recommendation values, thus preventing untrained or insufficiently trained objects from appearing online.
[0137] In an optional implementation of this embodiment, after training the initial recommendation model based on the positive sample prediction value and the negative sample prediction value to obtain the trained recommendation model, the method further includes:
[0138] Obtain the test user information of the test user, as well as the positive test object identifier and negative test object identifier corresponding to the test user. The positive test object identifier is the identifier of the object selected by the test user, and the negative test object identifier is the identifier of other objects besides the object selected by the test user.
[0139] The recommendation model determines the test user feature vector, the positive test feature vector of the positive test object identifier, and the negative test feature vector of the negative test object identifier. Based on the test user feature vector, the positive test feature vector, and the negative test feature vector, the recommendation value corresponding to the positive and negative test object identifiers is determined.
[0140] Based on the recommended values corresponding to the positive and negative test object identifiers, determine the probability distribution of positive test object identifiers being ranked higher than negative test object identifiers, and evaluate the recommendation model based on the probability distribution.
[0141] In practical applications, the following steps can be taken: First, obtain the test user information, as well as the positive and negative test object identifiers corresponding to the test users. Then, input the test user information into the first feature extraction layer of the trained recommendation model to obtain the test user feature vector. Input the positive and negative test object identifiers into the attribute query layer of the recommendation model. Query the attribute information table in the attribute query layer to find the positive test attribute information corresponding to the positive test object identifier, and determine the encoded feature representation corresponding to each positive test attribute in the positive test attribute information through the attribute encoding table in the attribute query layer. Concatenate the encoded feature representations corresponding to each positive test attribute to obtain the positive test feature vector corresponding to the positive test object identifier. The feature vector is obtained by querying the negative test attribute information corresponding to the negative test object identifier in the attribute information table in the attribute query layer, and determining the encoded feature representation of each negative test attribute in the negative test attribute information through the attribute encoding table in the attribute query layer. The encoded feature representations of each negative test attribute are concatenated to obtain the negative test feature vector corresponding to the negative test object identifier. Then, the test user feature vector, positive test feature vector, and negative test feature vector are input into the feature analysis layer of the recommendation model to obtain the recommendation value corresponding to the positive and negative test object identifiers. Based on the recommendation value corresponding to the positive and negative test object identifiers, the probability distribution of the positive test object identifier being ranked before the negative test object identifier is determined, and the recommendation model is evaluated based on the probability distribution.
[0142] It should be noted that after the model training is completed, the trained recommendation model can also be evaluated. Generally, AUC (Area Under Curve, the area under the ROC curve) or GAUC (Group AUC, which measures the model's ability to rank different groups) can be used to represent the fitting effect of the model after training. In this application, when training the recommendation model, positive and negative samples can be input in a set order. For example, if the positive samples are placed before the negative samples, then the better fitting effect of the recommendation model is that the positive samples are placed before the negative samples in the fitted result. Therefore, the fitting effect can be directly evaluated by the distribution of the probability that the positive test object is placed before the negative test object among the P positive test object identifiers and negative test object identifiers of the test sample.
[0143] For example, suppose a test sample contains 5 positive test object identifiers and 5 negative test object identifiers. The optimal fitting result of the trained recommendation model is [1,1,1,1,1,1,0,0,0,0,0], meaning that the 5 positive test object identifiers are ranked before the 5 negative test object identifiers. If the fitting result of the trained recommendation model is [1,0,1,0,1,0,1,0,0,1], it means that two positive test object identifiers and two negative test object identifiers are misfitted. The probability that the positive test object identifiers are ranked before the negative test object identifiers in this test sample is 0.6, which means that the fitting effect of the recommendation model is not ideal. Therefore, the trained recommendation model can be evaluated based on the probability distribution of the positive test object identifiers being ranked before the negative test object identifiers.
[0144] In practical applications, based on the recommended values corresponding to the positive and negative test object identifiers, the probability distribution of the positive test object identifier ranking before the negative test object identifier is determined. The recommendation model is then evaluated based on the probability distribution, which can be achieved through the following formula (3):
[0145]
[0146] S2 = P 90 (p(S ki >S kj k∈[0, N) (3)
[0148] Where N represents the number of test samples, in practical applications, N can be the number of users, with each user corresponding to one test sample. k represents the k-th test sample, p(s ki >s kj ) refers to the probability that the positive test object identifier is ranked before the negative test object identifier in the k-th test sample (i.e., the probability that the positive sample prediction is greater than the negative sample prediction). It is equivalent to the probability that the positive test object identifier is ranked before the negative test object identifier when a positive test object identifier is randomly selected and a negative test object identifier is randomly selected. S1 represents the average probability that the positive test object identifier is ranked before the negative test object identifier in N test samples.
[0149] Additionally, P 90S2 refers to the 90th percentile of N test samples. It represents the probability distribution of a positive test object identifier appearing before a negative test object identifier in descending order of probability. "90" is a pre-set value, but in practice, it can be set to other values, such as 85 or 85. In other words, S2 represents the probability distribution of a positive test object identifier appearing before a negative test object identifier. For example, assuming there are 100 test samples with probabilities of 0.98, 0.95, 0.95, 0.94, 0.93, 0.92, 0.92, 0.90, 0.89, 0.88…, the 90th percentile of these 100 test samples is 0.88.
[0150] It should be noted that the larger S1 is, the greater the average probability that the positive test object identifier ranks before the negative test object identifier in the N test samples. The larger S2 is, the higher the 90th percentile of the N test samples. Therefore, the larger S1 and S2 are, the better the fitting effect of the recommendation model.
[0151] Step 208: Based on the target user feature vector and the object feature vector of at least one object to be recommended, determine the recommendation value of at least one object to be recommended, and recommend the target object to the target user based on the recommendation value.
[0152] In practical applications, when determining the recommendation value of at least one recommended object based on the target user feature vector and the object feature vector of at least one recommended object, the target user feature vector and the object feature vector of at least one recommended object can be input into the feature analysis layer of the recommendation model. This feature analysis layer can fit each object feature vector and output the recommendation value of each recommended object. A recommendation value of 1 indicates that the recommendation model has analyzed that the position is a positive sample, that is, an object that the target user may choose. If the recommendation value is 0, it indicates that the recommendation model has analyzed that the position is a negative sample, that is, the target user will not choose the object.
[0153] It should be noted that after obtaining the recommendation value for each object to be recommended, you can select the object with a recommendation value of 1 as the target object and recommend it to the target user. When there are multiple target objects, they can be randomly sorted or sorted according to other set sorting rules.
[0154] The object recommendation method provided in this application can simultaneously analyze at least one object to be recommended through a recommendation model. A single calculation and analysis is required for one user and multiple objects to be recommended, significantly reducing computational load and improving the efficiency of recommendation value prediction, thereby enhancing object recommendation efficiency. Furthermore, target user information and object identifiers can be input into the recommendation model. The attribute query layer in the recommendation model can convert the input object identifier into corresponding object attribute information. Then, the encoded feature representations corresponding to each object attribute in the object attribute information are searched, and concatenated to obtain the object feature vector. In other words, the object identifier can be converted into the indicated object attribute information, thus determining the object feature vector corresponding to the object attribute information. Then, combining the target user information and the object feature vector, the recommendation value of the object to be recommended is analyzed, thereby recommending the object to the user. Thus, the recommendation model adds an attribute query layer, which includes an attribute information table and an attribute encoding table. This allows the introduction of object attribute information corresponding to the object identifier, and since a single calculation and analysis is required for one user and multiple object attribute information, the model's accuracy and efficiency in predicting the recommendation value of each object to be recommended are improved, thereby enhancing the object recommendation effect and ensuring the object conversion rate.
[0155] Figure 4 A schematic diagram of a recommendation model according to an embodiment of this application is shown, as follows: Figure 4 As shown, the recommendation model includes a first feature extraction layer 402, an attribute query layer 404, and a feature analysis layer 406. The attribute query layer 404 is equipped with an attribute information table 4042 and an attribute encoding table 4044.
[0156] The first feature extraction layer 402 is used to receive target user information and output the target user feature vector corresponding to the target user information.
[0157] The attribute query layer 404 is used to receive at least one object identifier, and for the first object identifier, query the target object attribute information corresponding to the first object identifier from the attribute information table 4042, and query the encoded feature representation corresponding to each object attribute in the target object attribute information from the attribute encoding table 4044, and concatenate the encoded feature representation corresponding to each object attribute to obtain the object feature vector corresponding to the first object identifier; wherein, the first object identifier is any one of at least one object identifier;
[0158] The feature analysis layer 406 is used to analyze the target user feature vector and the object feature vector corresponding to at least one object identifier to determine the recommended value of at least one object identifier.
[0159] In an optional implementation of this embodiment, the recommendation model further includes an object counting layer;
[0160] The object counting layer is used to count the positive sample object identifiers in the training samples and generate an object counting matrix.
[0161] It should be noted that the subsequent attribute query layer can combine the generated object counting matrix and the concatenated feature representation to determine the object feature vector corresponding to the first recommended object identifier. In other words, the object counting matrix can be used by the attribute query layer to generate object feature vectors. This object counting module can prevent objects that have not been trained or have insufficient training from appearing online, and which might otherwise have excessively high recommendation values.
[0162] The recommendation model provided in this application adds an attribute query layer. This layer includes an attribute information table and an attribute encoding table. It converts the input object identifier into corresponding object attribute information, then searches for the encoded feature representations of each object attribute within the attribute information, and concatenates these representations to obtain the object feature vector. Thus, by adding the attribute query layer, the recommendation model can convert the input object identifier into the indicated object attribute information and determine the corresponding object feature vector. The introduction of object attribute information improves the accuracy of the recommendation model's prediction of the recommendation value for each object, thereby improving the object recommendation effect and ensuring the object conversion rate.
[0163] It should be noted that the above is an illustrative scheme of a recommendation model in this embodiment. It should also be noted that the technical solution of this recommendation model belongs to the same concept as the technical solution of the object recommendation method described above. Details not described in detail in the technical solution of the recommendation model can be found in the description of the technical solution of the object recommendation method described above.
[0164] Figure 5 A flowchart of a training method for a recommendation model according to an embodiment of this application is shown, specifically including the following steps 502-512:
[0165] Step 502: Obtain the sample user information of the sample user, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample user. The positive sample object identifier is the identifier of the object selected by the sample user, and the negative sample object identifier is the identifier of other objects besides the object selected by the sample user.
[0166] Step 504: Input the sample user information into the first feature extraction layer of the initial recommendation model to obtain the sample user feature vector.
[0167] Step 506: Input the positive sample object identifier and the negative sample object identifier into the attribute query layer of the initial recommendation model. Query the positive sample attribute information corresponding to the positive sample object identifier through the attribute information table in the attribute query layer, and determine the encoded feature representation corresponding to each positive sample attribute in the positive sample attribute information through the attribute encoding table in the attribute query layer. Concatenate the encoded feature representations corresponding to each positive sample attribute to obtain the positive sample feature vector corresponding to the positive sample object identifier.
[0168] Step 508: Query the negative sample attribute information corresponding to the negative sample object identifier through the attribute information table in the attribute query layer, and determine the encoded feature representation corresponding to each negative sample attribute in the negative sample attribute information through the attribute encoding table in the attribute query layer. Concatenate the encoded feature representations corresponding to each negative sample attribute to obtain the negative sample feature vector corresponding to the negative sample object identifier.
[0169] Step 510: Determine the positive sample prediction value based on the sample user feature vector and the positive sample feature vector, and determine the negative sample prediction value based on the sample user feature vector and the negative sample feature vector.
[0170] Step 512: Train the initial recommendation model based on the positive sample prediction value and the negative sample prediction value to obtain the trained recommendation model.
[0171] In one optional implementation of this embodiment, the initial recommendation model is trained based on the positive sample prediction value and the negative sample prediction value to obtain a trained recommendation model, including:
[0172] Based on the positive and negative sample prediction values, determine the loss value of the initial recommendation model;
[0173] Adjust the model parameters of the initial recommendation model based on the loss value, and return to the step of obtaining sample user information of sample users, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample users. If the loss value meets the training stopping condition, stop training and obtain the recommendation model that has been trained.
[0174] In an optional implementation of this embodiment, the initial recommendation model further includes an object counting layer; after obtaining the sample user information of the sample users, and the positive and negative sample object identifiers corresponding to the sample users, it further includes:
[0175] The positive sample object identifiers are input into the object counting layer of the initial recommendation model. The object counting layer counts the positive sample object identifiers to generate an object counting matrix.
[0176] In one optional implementation of this embodiment, the positive sample object identifiers are counted through an object counting layer to generate an object counting matrix, including:
[0177] Determine the counting results for each positive sample object identifier, and generate an initial counting matrix based on the counting results;
[0178] Identify the first positive sample object identifier whose count exceeds a set threshold among all positive sample object identifiers, and set the value corresponding to the first positive sample object identifier in the initial counting matrix to 1;
[0179] Identify the second positive sample object identifier whose count result does not exceed the set threshold among all positive sample object identifiers, set the value corresponding to the second positive sample object identifier in the initial counting matrix to 0, and obtain the object counting matrix.
[0180] The training method for the recommendation model provided in this application optimizes the model structure by adding an attribute query layer. This layer includes an attribute information table and an attribute encoding table. Using these tables, the object identifiers of positive and negative samples can be converted into their corresponding object attribute information, thereby determining the positive and negative sample feature vectors. Then, combining the sample user information and these positive and negative sample feature vectors, the initial recommendation model is trained to obtain a trained recommendation model. Furthermore, during model training, multiple positive and negative samples can be analyzed simultaneously. A single sample user and multiple positive and negative samples require only one computational analysis, significantly reducing computational load and improving model training efficiency.
[0181] In addition, the model structure can be further optimized by adding an object counting module to the recommendation model. This object counting module can prevent some objects that have not been trained or have not been trained sufficiently from appearing online and potentially resulting in a relatively large recommendation value.
[0182] Figure 6a This illustration shows a schematic diagram of another object recommendation process provided in an embodiment of this application, as follows: Figure 6a As shown, during the training process, the sample user information includes basic attribute information, historical preference information, and historical selection information. The historical preference information and historical selection information are input into the attribute query layer (T). The corresponding second object attribute information and third object attribute information are queried through the attribute information table. The basic attribute information and the obtained second object attribute information and third object attribute information are input into the first feature extraction layer to obtain the sample user feature vector.
[0183] The positive sample object identifier is input to the attribute query layer (T). The corresponding positive sample attribute information is obtained through the attribute information table. The encoded feature representation of each positive sample attribute is determined through the attribute encoding table. These encoded feature representations are then concatenated to obtain the positive sample feature vector. Similarly, the negative sample object identifier is input to the attribute query layer (T). The corresponding negative sample attribute information is obtained through the attribute information table. The encoded feature representation of each negative sample attribute is determined through the attribute encoding table. These encoded feature representations are then concatenated to obtain the negative sample feature vector.
[0184] By combining the feature vectors of sample users with the feature vectors of positive samples, we can obtain the positive sample prediction value S. i By combining the feature vectors of sample users with the feature vectors of negative samples, we can obtain the negative sample prediction value S. j Based on positive sample predictions, S i and negative sample prediction S j This allows us to determine the loss value and optimize the model parameters.
[0185] Meanwhile, positive sample object identifiers can also be input into the object counting layer (C), which counts the positive sample object identifiers that appear and generates an object counting matrix.
[0186] In the application phase, the target user information also includes basic attribute information, historical preference information, and historical selection information. The historical preference information and historical selection information are input into the attribute query layer (T). The corresponding second object attribute information and third object attribute information can be obtained through the attribute information table. The basic attribute information and the obtained second object attribute information and third object attribute information are input into the first feature extraction layer to obtain the target user feature vector.
[0187] The recommended object identifier of the object to be recommended is input into the attribute query layer (T). The corresponding first object attribute information is obtained through the attribute information table, and the encoded feature representation corresponding to each first attribute in the first object attribute information is determined through the attribute encoding table. These encoded feature representations are then concatenated to obtain the concatenated feature representation. The object counting matrix output from the object counting layer (C) and the concatenated feature representation are input into the second feature extraction layer. The second feature extraction layer multiplies the object counting matrix and the concatenated feature representation to obtain the final recommended object feature vector. Combining the target user feature vector and the final recommended object feature vector, the recommendation value for each object to be recommended is output.
[0188] In other words, such as Figure 6a As shown, Part ① plus Part ② constitutes the training process of the initial recommendation model, while Part ① plus Part ③ is the actual online prediction process of the trained recommendation model, i.e., the application process.
[0189] The object recommendation method provided in this application can simultaneously analyze at least one object to be recommended through a recommendation model. A single calculation and analysis is required for one user and multiple objects to be recommended, significantly reducing computational load and improving the efficiency of recommendation value prediction, thereby enhancing object recommendation efficiency. Furthermore, target user information and object identifiers can be input into the recommendation model. The attribute query layer in the recommendation model can convert the input object identifier into corresponding object attribute information. Then, the encoded feature representations corresponding to each object attribute in the object attribute information are searched, and concatenated to obtain the object feature vector. In other words, the object identifier can be converted into the indicated object attribute information, thus determining the object feature vector corresponding to the object attribute information. Then, combining the target user information and the object feature vector, the recommendation value of the object to be recommended is analyzed, thereby recommending the object to the user. Thus, the recommendation model adds an attribute query layer, which includes an attribute information table and an attribute encoding table. This allows the introduction of object attribute information corresponding to the object identifier, and since a single calculation and analysis is required for one user and multiple object attribute information, the model's accuracy and efficiency in predicting the recommendation value of each object to be recommended are improved, thereby enhancing the object recommendation effect and ensuring the object conversion rate.
[0190] The following is in conjunction with the appendix Figure 6b Taking the object recommendation method provided in this application as an example in an e-commerce scenario, this paper further explains the object recommendation method. Figure 6b The diagram illustrates a processing flowchart of an object recommendation method applied to an e-commerce scenario according to an embodiment of this application, specifically including the following steps:
[0191] Step 602: Obtain the sample user information of the sample users, as well as the exposed product identifiers and unexposed product identifiers corresponding to the sample users.
[0192] Step 604: Input the sample user information into the first feature extraction layer of the initial recommendation model to obtain the sample user feature vector.
[0193] Step 606: Input the exposed product identifier and the unexposed product identifier into the attribute query layer of the initial recommendation model. Query the exposed product attribute information corresponding to the exposed product identifier through the attribute information table in the attribute query layer, and determine the coded feature representation corresponding to each exposed product attribute in the exposed product attribute information through the attribute coding table in the attribute query layer. Concatenate the coded feature representations corresponding to each exposed product attribute to obtain the exposed product feature vector corresponding to the exposed product identifier.
[0194] Step 608: Query the attribute information table in the attribute query layer to find the attribute information of the unexposed product identifier, and determine the coded feature representation of each unexposed product attribute in the attribute information through the attribute coding table in the attribute query layer. Concatenate the coded feature representations of each unexposed product attribute to obtain the feature vector of the unexposed product identifier.
[0195] Step 610: Input the exposed product identifiers into the object counting layer of the initial recommendation model, and count the exposed product identifiers through the object counting layer to generate an exposed product counting matrix.
[0196] Step 612: Determine the estimated value of exposed products based on the sample user feature vector and the exposed product feature vector, and determine the estimated value of unexposed products based on the sample user feature vector and the unexposed product feature vector.
[0197] Step 614: Determine the loss value of the initial recommendation model based on the estimated value of exposed products and the estimated value of unexposed products, and adjust the model parameters of the initial recommendation model based on the loss value.
[0198] Return to step 602. If the loss value meets the training stopping condition, stop training and obtain the recommendation model that has been trained.
[0199] Step 616: Obtain the test user information, as well as the exposed product identifier and unexposed product identifier corresponding to the test user; input the test user information, exposed product identifier, and unexposed product identifier into the trained recommendation model to obtain the recommendation values of exposed and unexposed products output by the recommendation model; based on the recommendation values, determine the probability distribution of exposed products ranking before unexposed products, and evaluate the recommendation model based on the probability distribution.
[0200] If the evaluation results do not meet the requirements, you can return to step 602 to continue training the recommendation model until the evaluation results meet the requirements. Once trained, the recommendation model can be obtained and used for online prediction in the application phase.
[0201] Step 618: Obtain the user information of the user to be recommended, and the recommended product identifier of at least one product to be recommended.
[0202] Step 620: Input the information of the user to be recommended into the first feature extraction layer of the recommendation model to obtain the feature vector of the user to be recommended.
[0203] Step 622: Input the recommended product identifier of at least one product to be recommended into the attribute query layer of the recommendation model. Query the product attribute information corresponding to the first recommended product identifier through the attribute information table in the attribute query layer, and determine the coded feature representation corresponding to each attribute in the product attribute information through the attribute coding table in the attribute query layer. Concatenate the coded feature representations corresponding to each attribute to obtain the product feature vector corresponding to the first recommended product identifier.
[0204] The first recommended product identifier is any one of the recommended product identifiers of at least one product to be recommended.
[0205] Step 624: Based on the feature vector of the user to be recommended and the product feature vector of at least one product to be recommended, determine the estimated recommendation value of at least one product to be recommended, and recommend the target product to the user to be recommended based on the estimated recommendation value.
[0206] The object recommendation method provided in this application can simultaneously analyze at least one product to be recommended through a recommendation model. A user and multiple products only require a single calculation and analysis, significantly reducing computational load and improving the efficiency of recommendation value estimation, thereby enhancing product recommendation efficiency. Furthermore, the recommendation model can input user information and product identifiers. The attribute query layer in the model converts the input product identifier into corresponding product attribute information. Then, it searches for the encoded feature representations corresponding to each product attribute in the attribute information, concatenating them to obtain a product feature vector. In other words, the recommended product identifier can be converted into the indicated product attribute information, thus determining the product feature vector corresponding to the product attribute information. Then, combining the target user information and the product feature vector, the recommendation value of the product to be recommended is analyzed, thereby recommending the product to the user. Thus, the recommendation model adds an attribute query layer, which includes an attribute information table and an attribute encoding table. This allows the introduction of product attribute information corresponding to the recommended product identifier, and since a user and multiple product attribute information only require a single calculation and analysis, the model's accuracy and efficiency in predicting the recommendation value of each product to be recommended are improved, thereby enhancing product recommendation performance and ensuring product conversion rates.
[0207] Corresponding to the above method embodiments, this application also provides an object recommendation device embodiment. Figure 7 A schematic diagram of an object recommendation device according to an embodiment of this application is shown. Figure 7 As shown, the device includes:
[0208] The first acquisition module 702 is configured to acquire the target user information of the target user, and the recommendation object identifier of at least one object to be recommended;
[0209] The first acquisition module 704 is configured to input the target user information into the first feature extraction layer of the recommendation model to obtain the target user feature vector of the target user.
[0210] The first concatenation module 706 is configured to input the recommendation object identifier of at least one object to be recommended into the attribute query layer of the recommendation model, query the first object attribute information corresponding to the first recommendation object identifier through the attribute information table in the attribute query layer, determine the encoded feature representation corresponding to each first attribute in the first object attribute information through the attribute encoding table in the attribute query layer, and concatenate the encoded feature representations corresponding to each first attribute to obtain the object feature vector corresponding to the first recommendation object identifier; wherein, the first recommendation object identifier is any one of the recommendation object identifiers of at least one object to be recommended;
[0211] The recommendation module 708 is configured to determine the recommendation value of at least one object to be recommended based on the feature vector of the target user and the object feature vector of at least one object to be recommended, and recommend the target object to the target user based on the recommendation value.
[0212] Optionally, the target user information includes basic attribute information, historical preference information, and historical selection information; the first acquisition module 704 is further configured to:
[0213] Historical preference information and historical selection information are input into the attribute query layer of the recommendation model. The historical preference information is the object identifier of the preferred object, and the historical selection information is the object identifier of the historical selected object.
[0214] The second object attribute information corresponding to historical preference information is retrieved from the attribute information table in the attribute query layer, and the third object attribute information corresponding to historical selection information is retrieved from the attribute information table in the attribute query layer.
[0215] The basic attribute information, the second object attribute information, and the third object attribute information are input into the first feature extraction layer of the recommendation model. The first feature extraction layer determines the encoded feature representation corresponding to each second attribute in the basic attribute information, the second object attribute information, and the third object attribute information. The encoded feature representations corresponding to each second attribute are concatenated to obtain the target user feature vector of the target user.
[0216] Optionally, the recommendation model also includes an object counting layer; the first splicing module 706 is further configured to:
[0217] The concatenated feature representation is obtained by concatenating the encoded feature representations corresponding to each first attribute;
[0218] Obtain the object counting matrix from the object counting layer, where the object counting matrix is generated by the object counting layer counting the positive sample object identifiers during the training process;
[0219] Based on the object counting matrix and the concatenated feature representation, the object feature vector corresponding to the first recommended object identifier is determined.
[0220] Optionally, the device further includes a second training module configured to:
[0221] Obtain the sample user information of the sample user, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample user. The positive sample object identifier is the identifier of the object selected by the sample user, and the negative sample object identifier is the identifier of other objects besides the object selected by the sample user.
[0222] Input the sample user information into the first feature extraction layer of the initial recommendation model to obtain the sample user feature vector;
[0223] The positive sample object identifier and negative sample object identifier are input into the attribute query layer of the initial recommendation model. The positive sample attribute information corresponding to the positive sample object identifier is queried through the attribute information table in the attribute query layer. The encoded feature representation corresponding to each positive sample attribute in the positive sample attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each positive sample attribute are concatenated to obtain the positive sample feature vector corresponding to the positive sample object identifier.
[0224] The negative sample attribute information corresponding to the negative sample object identifier is queried from the attribute information table in the attribute query layer, and the encoded feature representation corresponding to each negative sample attribute in the negative sample attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each negative sample attribute are concatenated to obtain the negative sample feature vector corresponding to the negative sample object identifier.
[0225] Based on the sample user feature vector and the positive sample feature vector, the positive sample prediction value is determined, and based on the sample user feature vector and the negative sample feature vector, the negative sample prediction value is determined. Based on the positive sample prediction value and the negative sample prediction value, the initial recommendation model is trained to obtain the trained recommendation model.
[0226] Optionally, the second training module is further configured as follows:
[0227] Based on the positive and negative sample prediction values, determine the loss value of the initial recommendation model;
[0228] Adjust the model parameters of the initial recommendation model based on the loss value, and return to the step of obtaining sample user information of sample users, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample users. If the loss value meets the training stopping condition, stop training and obtain the recommendation model that has been trained.
[0229] Optionally, the initial recommendation model also includes an object counting layer; the second training module is further configured as follows:
[0230] The positive sample object identifiers are input into the object counting layer of the initial recommendation model. The object counting layer counts the positive sample object identifiers to generate an object counting matrix.
[0231] Optionally, the second training module is further configured as follows:
[0232] Determine the counting results for each positive sample object identifier, and generate an initial counting matrix based on the counting results;
[0233] Identify the first positive sample object identifier whose count exceeds a set threshold among all positive sample object identifiers, and set the value corresponding to the first positive sample object identifier in the initial counting matrix to 1;
[0234] Identify the second positive sample object identifier whose count result does not exceed the set threshold among all positive sample object identifiers, set the value corresponding to the second positive sample object identifier in the initial counting matrix to 0, and obtain the object counting matrix.
[0235] Optionally, the device also includes an evaluation module configured to:
[0236] Obtain the test user information of the test user, as well as the positive test object identifier and negative test object identifier corresponding to the test user. The positive test object identifier is the identifier of the object selected by the test user, and the negative test object identifier is the identifier of other objects besides the object selected by the test user.
[0237] The recommendation model determines the test user feature vector, the positive test feature vector of the positive test object identifier, and the negative test feature vector of the negative test object identifier. Based on the test user feature vector, the positive test feature vector, and the negative test feature vector, the recommendation value corresponding to the positive and negative test object identifiers is determined.
[0238] Based on the recommended values corresponding to the positive and negative test object identifiers, determine the probability distribution of positive test object identifiers being ranked higher than negative test object identifiers, and evaluate the recommendation model based on the probability distribution.
[0239] The object recommendation device provided in this application embodiment can simultaneously analyze at least one object to be recommended through a recommendation model. A single calculation and analysis is required for one user and multiple objects to be recommended, significantly reducing computational load and improving the efficiency of recommendation value prediction, thereby enhancing object recommendation efficiency. Furthermore, target user information and recommended object identifiers can be input into the recommendation model. The attribute query layer in the recommendation model can convert the input object identifier into corresponding object attribute information. Then, the encoded feature representations corresponding to each object attribute in the object attribute information are searched, and concatenated to obtain the object feature vector. In other words, the recommended object identifier can be converted into the object attribute information it indicates, thereby determining the object feature vector corresponding to the object attribute information. Then, combining the target user information and the object feature vector, the recommendation value of the object to be recommended is analyzed, thus recommending the object to the user. In this way, an attribute query layer is added to the recommendation model. This attribute query layer includes an attribute information table and an attribute encoding table, which can introduce the object attribute information corresponding to the recommended object identifier. Since a single calculation and analysis is required for one user and multiple object attribute information, the model's accuracy and efficiency in predicting the recommendation value of each object to be recommended are improved, thereby enhancing the object recommendation effect and ensuring the object conversion rate.
[0240] The above is an illustrative scheme of an object recommendation device according to this embodiment. It should be noted that the technical solution of this object recommendation device and the technical solution of the object recommendation method described above belong to the same concept. For details not described in detail in the technical solution of the object recommendation device, please refer to the description of the technical solution of the object recommendation method described above.
[0241] Corresponding to the above method embodiments, this application also provides embodiments of a training device for a recommendation model. Figure 8 A schematic diagram of a training device for a recommendation model according to an embodiment of this application is shown. Figure 8 As shown, the device includes:
[0242] The second acquisition module 802 is configured to acquire sample user information of the sample user, as well as positive sample object identifier and negative sample object identifier corresponding to the sample user, wherein the positive sample object identifier is the identifier of the object selected by the sample user, and the negative sample object identifier is the identifier of other objects besides the object selected by the sample user.
[0243] The second acquisition module 804 is configured to input sample user information into the first feature extraction layer of the initial recommendation model to obtain the sample user feature vector of the sample user.
[0244] The second splicing module 806 is configured to input the positive sample object identifier and the negative sample object identifier into the attribute query layer of the initial recommendation model, query the positive sample attribute information corresponding to the positive sample object identifier through the attribute information table in the attribute query layer, and determine the encoded feature representation corresponding to each positive sample attribute in the positive sample attribute information through the attribute encoding table in the attribute query layer, and splice the encoded feature representations corresponding to each positive sample attribute to obtain the positive sample feature vector corresponding to the positive sample object identifier.
[0245] The third splicing module 808 is configured to query the negative sample attribute information corresponding to the negative sample object identifier through the attribute information table in the attribute query layer, determine the encoded feature representation corresponding to each negative sample attribute in the negative sample attribute information through the attribute encoding table in the attribute query layer, and splice the encoded feature representation corresponding to each negative sample attribute to obtain the negative sample feature vector corresponding to the negative sample object identifier.
[0246] The first training module 810 is configured to determine the positive sample prediction value based on the sample user feature vector and the positive sample feature vector, and to determine the negative sample prediction value based on the sample user feature vector and the negative sample feature vector; and to train the initial recommendation model based on the positive sample prediction value and the negative sample prediction value to obtain the trained recommendation model.
[0247] Optionally, the first training module 810 is further configured as follows:
[0248] Based on the positive and negative sample prediction values, determine the loss value of the initial recommendation model;
[0249] Adjust the model parameters of the initial recommendation model based on the loss value, and return to the step of obtaining sample user information of sample users, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample users. If the loss value meets the training stopping condition, stop training and obtain the recommendation model that has been trained.
[0250] Optionally, the initial recommendation model also includes an object counting layer; the device also includes a counting module configured to:
[0251] The positive sample object identifiers are input into the object counting layer of the initial recommendation model. The object counting layer counts the positive sample object identifiers to generate an object counting matrix.
[0252] Optionally, the counting module is further configured as follows:
[0253] Determine the counting results for each positive sample object identifier, and generate an initial counting matrix based on the counting results;
[0254] Identify the first positive sample object identifier whose count exceeds a set threshold among all positive sample object identifiers, and set the value corresponding to the first positive sample object identifier in the initial counting matrix to 1;
[0255] Identify the second positive sample object identifier whose count result does not exceed the set threshold among all positive sample object identifiers, set the value corresponding to the second positive sample object identifier in the initial counting matrix to 0, and obtain the object counting matrix.
[0256] Optionally, the device also includes an evaluation module configured to:
[0257] Obtain the test user information of the test user, as well as the positive test object identifier and negative test object identifier corresponding to the test user. The positive test object identifier is the identifier of the object selected by the test user, and the negative test object identifier is the identifier of other objects besides the object selected by the test user.
[0258] The recommendation model determines the test user feature vector, the positive test feature vector of the positive test object identifier, and the negative test feature vector of the negative test object identifier. Based on the test user feature vector, the positive test feature vector, and the negative test feature vector, the recommendation value corresponding to the positive and negative test object identifiers is determined.
[0259] Based on the recommended values corresponding to the positive and negative test object identifiers, determine the probability distribution of positive test object identifiers being ranked higher than negative test object identifiers, and evaluate the recommendation model based on the probability distribution.
[0260] The training method for the recommendation model provided in this application optimizes the model structure by adding an attribute query layer. This layer includes an attribute information table and an attribute encoding table. Using these tables, the object identifiers of positive and negative samples can be converted into their corresponding object attribute information, thereby determining the positive and negative sample feature vectors. Then, combining the sample user information and these positive and negative sample feature vectors, the initial recommendation model is trained to obtain a trained recommendation model. Furthermore, during model training, multiple positive and negative samples can be analyzed simultaneously. A single sample user and multiple positive and negative samples require only one computational analysis, significantly reducing computational load and improving model training efficiency.
[0261] In addition, the model structure can be further optimized by adding an object counting module to the recommendation model. This object counting module can prevent some objects that have not been trained or have not been trained sufficiently from appearing online and potentially resulting in a relatively large recommendation value.
[0262] The above is a schematic scheme of a training device for a recommendation model according to this embodiment. It should be noted that the technical solution of this training device for the recommendation model belongs to the same concept as the technical solution of the object recommendation method described above. For details not described in detail in the technical solution of the training device for the recommendation model, please refer to the description of the technical solution of the object recommendation method described above.
[0263] Figure 9 A structural block diagram of a computing device 900 according to an embodiment of this application is shown. The components of the computing device 900 include, but are not limited to, a memory 910 and a processor 920. The processor 920 is connected to the memory 910 via a bus 930, and a database 950 is used to store data.
[0264] The computing device 900 also includes an access device 940, which enables the computing device 900 to communicate via one or more networks 960. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 940 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Controller (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0265] In one embodiment of this application, the aforementioned components of the computing device 900 and Figure 9 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 9 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.
[0266] The computing device 900 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 900 can also be a mobile or stationary server.
[0267] The processor 920 is configured to execute the following computer-executable instructions to implement the steps of any of the above-described object recommendation methods, or the steps of the above-described recommendation model training methods.
[0268] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the object recommendation method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the object recommendation method described above.
[0269] An embodiment of this application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the steps of any of the above-described object recommendation methods, or the steps of the above-described recommendation model training methods.
[0270] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium belongs to the same concept as the technical solution of the object recommendation method described above. Details not described in detail in the technical solution of the storage medium can be found in the description of the technical solution of the object recommendation method described above.
[0271] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0272] Computer instructions include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. Computer-readable media can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0273] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0274] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0275] The preferred embodiments disclosed above are merely illustrative of this application. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this application. These embodiments are selected and specifically described in this application to better explain the principles and practical applications of this application, thereby enabling those skilled in the art to better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.
Claims
1. A recommendation system, characterized in that, The recommendation system uses a recommendation model for recommendation, which includes a first feature extraction layer, an attribute query layer, and a feature analysis layer. The attribute query layer includes an attribute information table and an attribute encoding table. The first feature extraction layer is used to receive target user information and output the target user feature vector corresponding to the target user information; The attribute query layer is configured to receive at least one object identifier, and for a first object identifier, query the target object attribute information corresponding to the first object identifier from the attribute information table, and query the encoded feature representation corresponding to each object attribute in the target object attribute information from the attribute encoding table, and concatenate the encoded feature representations corresponding to each object attribute to obtain the object feature vector corresponding to the first object identifier; wherein, the first object identifier is any one of the at least one object identifier; The feature analysis layer is used to analyze the target user feature vector and the object feature vector corresponding to the at least one object identifier to determine the recommendation value of the at least one object identifier; The recommendation model further includes an object counting layer; concatenating the encoded feature representations corresponding to each object attribute to obtain the object feature vector corresponding to the first object identifier includes: concatenating the encoded feature representations corresponding to each object attribute to obtain a concatenated feature representation; obtaining an object counting matrix from the object counting layer; and determining the object feature vector corresponding to the first object identifier based on the object counting matrix and the concatenated feature representation. The object counting matrix is generated through the following operations: determining the counting result of each positive sample object identifier, and generating an initial counting matrix based on the counting result; determining the first positive sample object identifier whose counting result exceeds a set threshold, and setting the value corresponding to the first positive sample object identifier in the initial counting matrix to 1; determining the second positive sample object identifier whose counting result does not exceed the set threshold, and setting the value corresponding to the second positive sample object identifier in the initial counting matrix to 0, thereby obtaining the object counting matrix.
2. An object recommendation method, characterized in that, include: Obtain the target user information of the target user, and the recommendation object identifier of at least one object to be recommended; The target user information is input into the first feature extraction layer of the recommendation model to obtain the target user feature vector of the target user. The recommendation object identifier of the at least one object to be recommended is input into the attribute query layer of the recommendation model. The first object attribute information corresponding to the first recommendation object identifier is queried through the attribute information table in the attribute query layer. The encoded feature representation corresponding to each first attribute in the first object attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each first attribute are concatenated to obtain the object feature vector corresponding to the first recommendation object identifier. Wherein, the first recommendation object identifier is any one of the recommendation object identifiers of the at least one object to be recommended. Based on the target user feature vector and the object feature vector of the at least one object to be recommended, a recommendation value for the at least one object to be recommended is determined, and a target object is recommended to the target user based on the recommendation value; The recommendation model further includes an object counting layer; the step of concatenating the encoded feature representations corresponding to each of the first attributes to obtain the object feature vector corresponding to the first recommended object identifier includes: concatenating the encoded feature representations corresponding to each of the first attributes to obtain a concatenated feature representation; obtaining an object counting matrix from the object counting layer; and determining the object feature vector corresponding to the first recommended object identifier based on the object counting matrix and the concatenated feature representation. The object counting matrix is generated through the following operations: determining the counting result of each positive sample object identifier, and generating an initial counting matrix based on the counting result; determining the first positive sample object identifier whose counting result exceeds a set threshold, and setting the value corresponding to the first positive sample object identifier in the initial counting matrix to 1; determining the second positive sample object identifier whose counting result does not exceed the set threshold, and setting the value corresponding to the second positive sample object identifier in the initial counting matrix to 0, thereby obtaining the object counting matrix.
3. The object recommendation method according to claim 2, characterized in that, The target user information includes basic attribute information, historical preference information, and historical selection information; the step of inputting the target user information into the first feature extraction layer of the recommendation model to obtain the target user feature vector includes: The historical preference information and the historical selection information are input into the attribute query layer of the recommendation model, wherein the historical preference information is the object identifier of the preference object, and the historical selection information is the object identifier of the historical selection object; The second object attribute information corresponding to the historical preference information is queried from the attribute information table in the attribute query layer, and the third object attribute information corresponding to the historical selection information is queried from the attribute information table in the attribute query layer. The basic attribute information, the second object attribute information, and the third object attribute information are input into the first feature extraction layer of the recommendation model. The first feature extraction layer determines the encoded feature representation corresponding to each second attribute in the basic attribute information, the second object attribute information, and the third object attribute information. The encoded feature representations corresponding to each second attribute are concatenated to obtain the target user feature vector of the target user.
4. The object recommendation method according to any one of claims 2-3, characterized in that, The recommendation model was trained using the following method: Obtain sample user information of the sample user, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample user, wherein the positive sample object identifier is the identifier of the object selected by the sample user, and the negative sample object identifier is the identifier of other objects besides the object selected by the sample user; The sample user information is input into the first feature extraction layer of the initial recommendation model to obtain the sample user feature vector of the sample user. The positive sample object identifier and the negative sample object identifier are input into the attribute query layer of the initial recommendation model. The positive sample attribute information corresponding to the positive sample object identifier is queried through the attribute information table in the attribute query layer. The encoded feature representation corresponding to each positive sample attribute in the positive sample attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each positive sample attribute are concatenated to obtain the positive sample feature vector corresponding to the positive sample object identifier. The negative sample attribute information corresponding to the negative sample object identifier is queried from the attribute information table in the attribute query layer, and the encoded feature representation corresponding to each negative sample attribute in the negative sample attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each negative sample attribute are concatenated to obtain the negative sample feature vector corresponding to the negative sample object identifier. Based on the sample user feature vector and the positive sample feature vector, a positive sample prediction value is determined, and based on the sample user feature vector and the negative sample feature vector, a negative sample prediction value is determined; based on the positive sample prediction value and the negative sample prediction value, the initial recommendation model is trained to obtain a trained recommendation model.
5. The object recommendation method according to claim 4, characterized in that, The step of training the initial recommendation model based on the positive sample prediction value and the negative sample prediction value to obtain the trained recommendation model includes: Based on the positive sample prediction value and the negative sample prediction value, determine the loss value of the initial recommendation model; Adjust the model parameters of the initial recommendation model based on the loss value, and return to the step of obtaining the sample user information of the sample users, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample users. If the loss value meets the training stopping condition, stop training and obtain the recommendation model that has been trained.
6. The object recommendation method according to claim 4, characterized in that, After training the initial recommendation model based on the positive sample prediction value and the negative sample prediction value to obtain the trained recommendation model, the process further includes: Obtain the test user information of the test user, as well as the positive test object identifier and negative test object identifier corresponding to the test user, wherein the positive test object identifier is the identifier of the object selected by the test user, and the negative test object identifier is the identifier of other objects besides the object selected by the test user; The recommendation model determines the test user feature vector, the positive test feature vector of the positive test object identifier, and the negative test feature vector of the negative test object identifier, and determines the recommendation value corresponding to the positive and negative test object identifiers based on the test user feature vector, the positive test feature vector, and the negative test feature vector; Based on the recommendation values corresponding to the positive and negative test object identifiers, determine the probability distribution that the positive test object identifier ranks before the negative test object identifier, and evaluate the recommendation model based on the probability distribution.
7. A method for training a recommendation model, characterized in that, include: Obtain sample user information of the sample user, as well as the positive sample object identifier and negative sample object identifier corresponding to the sample user, wherein the positive sample object identifier is the identifier of the object selected by the sample user, and the negative sample object identifier is the identifier of other objects besides the object selected by the sample user; The sample user information is input into the first feature extraction layer of the initial recommendation model to obtain the sample user feature vector of the sample user. The positive sample object identifier and the negative sample object identifier are input into the attribute query layer of the initial recommendation model. The positive sample attribute information corresponding to the positive sample object identifier is queried through the attribute information table in the attribute query layer. The encoded feature representation corresponding to each positive sample attribute in the positive sample attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each positive sample attribute are concatenated to obtain the positive sample feature vector corresponding to the positive sample object identifier. The negative sample attribute information corresponding to the negative sample object identifier is queried from the attribute information table in the attribute query layer, and the encoded feature representation corresponding to each negative sample attribute in the negative sample attribute information is determined through the attribute encoding table in the attribute query layer. The encoded feature representations corresponding to each negative sample attribute are concatenated to obtain the negative sample feature vector corresponding to the negative sample object identifier. Based on the sample user feature vector and the positive sample feature vector, a positive sample prediction value is determined, and based on the sample user feature vector and the negative sample feature vector, a negative sample prediction value is determined; based on the positive sample prediction value and the negative sample prediction value, the initial recommendation model is trained to obtain a trained recommendation model; The initial recommendation model further includes an object counting layer; concatenating the encoded feature representations corresponding to each positive sample attribute to obtain the positive sample feature vector corresponding to the positive sample object identifier; concatenating the encoded feature representations corresponding to each positive sample attribute to obtain a concatenated feature representation; obtaining an object counting matrix from the object counting layer; and determining the positive sample feature vector corresponding to the positive sample object identifier based on the object counting matrix and the concatenated feature representation. The object counting matrix is generated through the following operations: determining the counting result of each positive sample object identifier, and generating an initial counting matrix based on the counting result; determining the first positive sample object identifier whose counting result exceeds a set threshold, and setting the value corresponding to the first positive sample object identifier in the initial counting matrix to 1; determining the second positive sample object identifier whose counting result does not exceed the set threshold, and setting the value corresponding to the second positive sample object identifier in the initial counting matrix to 0, thereby obtaining the object counting matrix.
8. An object recommendation device, characterized in that, include: The first acquisition module is configured to acquire the target user information of the target user, and the recommendation object identifier of at least one object to be recommended; The first acquisition module is configured to input the target user information into the first feature extraction layer of the recommendation model to obtain the target user feature vector of the target user. The first concatenation module is configured to input the recommendation object identifier of the at least one object to be recommended into the attribute query layer of the recommendation model, query the first object attribute information corresponding to the first recommendation object identifier through the attribute information table in the attribute query layer, determine the encoded feature representation corresponding to each first attribute in the first object attribute information through the attribute encoding table in the attribute query layer, and concatenate the encoded feature representations corresponding to each first attribute to obtain the object feature vector corresponding to the first recommendation object identifier; wherein, the first recommendation object identifier is any one of the recommendation object identifiers of the at least one object to be recommended. The recommendation module is configured to determine the recommendation value of the at least one object to be recommended based on the feature vector of the target user and the object feature vector of the at least one object to be recommended, and recommend the target object to the target user based on the recommendation value; The recommendation model further includes an object counting layer; the step of concatenating the encoded feature representations corresponding to each of the first attributes to obtain the object feature vector corresponding to the first recommended object identifier includes: concatenating the encoded feature representations corresponding to each of the first attributes to obtain a concatenated feature representation; obtaining an object counting matrix from the object counting layer; and determining the object feature vector corresponding to the first recommended object identifier based on the object counting matrix and the concatenated feature representation. The object counting matrix is generated through the following operations: determining the counting result of each positive sample object identifier, and generating an initial counting matrix based on the counting result; determining the first positive sample object identifier whose counting result exceeds a set threshold, and setting the value corresponding to the first positive sample object identifier in the initial counting matrix to 1; determining the second positive sample object identifier whose counting result does not exceed the set threshold, and setting the value corresponding to the second positive sample object identifier in the initial counting matrix to 0, thereby obtaining the object counting matrix.
9. A training device for a recommendation model, characterized in that, include: The second acquisition module is configured to acquire sample user information of the sample user, as well as positive sample object identifier and negative sample object identifier corresponding to the sample user, wherein the positive sample object identifier is the identifier of the object selected by the sample user, and the negative sample object identifier is the identifier of other objects besides the object selected by the sample user; The second acquisition module is configured to input the sample user information into the first feature extraction layer of the initial recommendation model to obtain the sample user feature vector of the sample user. The second concatenation module is configured to input the positive sample object identifier and the negative sample object identifier into the attribute query layer of the initial recommendation model, query the positive sample attribute information corresponding to the positive sample object identifier through the attribute information table in the attribute query layer, determine the encoded feature representation corresponding to each positive sample attribute in the positive sample attribute information through the attribute encoding table in the attribute query layer, and concatenate the encoded feature representations corresponding to each positive sample attribute to obtain the positive sample feature vector corresponding to the positive sample object identifier. The third splicing module is configured to query the negative sample attribute information corresponding to the negative sample object identifier through the attribute information table in the attribute query layer, determine the encoded feature representation corresponding to each negative sample attribute in the negative sample attribute information through the attribute encoding table in the attribute query layer, and splice the encoded feature representation corresponding to each negative sample attribute to obtain the negative sample feature vector corresponding to the negative sample object identifier. The first training module is configured to determine a positive sample prediction value based on the sample user feature vector and the positive sample feature vector, and to determine a negative sample prediction value based on the sample user feature vector and the negative sample feature vector; and to train the initial recommendation model based on the positive sample prediction value and the negative sample prediction value to obtain a trained recommendation model. The initial recommendation model further includes an object counting layer; concatenating the encoded feature representations corresponding to each positive sample attribute to obtain the positive sample feature vector corresponding to the positive sample object identifier; concatenating the encoded feature representations corresponding to each positive sample attribute to obtain a concatenated feature representation; obtaining an object counting matrix from the object counting layer; and determining the positive sample feature vector corresponding to the positive sample object identifier based on the object counting matrix and the concatenated feature representation. The object counting matrix is generated through the following operations: determining the counting result of each positive sample object identifier, and generating an initial counting matrix based on the counting result; determining the first positive sample object identifier whose counting result exceeds a set threshold, and setting the value corresponding to the first positive sample object identifier in the initial counting matrix to 1; determining the second positive sample object identifier whose counting result does not exceed the set threshold, and setting the value corresponding to the second positive sample object identifier in the initial counting matrix to 0, thereby obtaining the object counting matrix.
10. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the object recommendation method according to any one of claims 2-6, or the steps of the training method of the recommendation model according to claim 7.
11. A computer-readable storage medium, characterized in that, It stores computer-executable instructions that, when executed by a processor, implement the steps of the object recommendation method according to any one of claims 2-6, or the steps of the training method for the recommendation model according to claim 7.
12. A computer program product, characterized in that, The computer program product includes computer-executable instructions that, when executed by a processor, implement the steps of the object recommendation method according to any one of claims 2-6, or the steps of the training method for the recommendation model according to claim 7.
Citation Information
Patent Citations
Information recommendation and model training method, device and equipment and storage medium
CN110162700A