Recommendation model training, recommendation method, device, medium and equipment

By obtaining the target user's feature vector and historical object sequence, combining the label of the object to be recommended, inputting the recommendation model to output the prediction score, thereby determining the target recommended object, solving the problem of long-term sequence information loss and improving the recommendation effect.

CN114117213BActive Publication Date: 2025-04-29HANGZHOU NETEASE CLOUD MUSIC TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111342816.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-12
Publication Date
2025-04-29
Estimated Expiration
2041-11-12

AI Technical Summary

Technical Problem

The recommendation model based on long-term sequences has a loss of sequence information, resulting in poor recommendation results.

Method used

By obtaining the first feature vector and historical object sequence of the target user, combining the label of the object to be recommended, the recommendation model is input to output the prediction score, thereby determining the target recommended object.

Benefits of technology

Effectively utilize information in long-term sequences, reduce sequence information loss, and improve the recommendation effect of the recommendation system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114117213B_ABST
    Figure CN114117213B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a recommendation model training, recommendation method, device, medium and equipment. According to the scheme provided by the embodiment of the present disclosure, the historical object sequence can be determined from the historical objects of the target user according to the label of the object to be recommended and the label of the historical object of the target user, and then the predicted score of the object to be recommended can be obtained according to the first feature vector of the target user, the historical object sequence and the identifier of the object to be recommended, so that the target recommended object for the target user can be determined from the object to be recommended according to the predicted score. The scheme provided by the embodiment of the present disclosure can accurately obtain effective sequence information from the long-term sequence corresponding to the target user according to the label, make full use of the long-term sequence, reduce the sequence information loss of the long-term sequence, and improve the recommendation effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet technology, and in particular to a recommendation model training, recommendation method, device, medium and equipment. Background Art

[0002] Recommendation models based on object sequences corresponding to user behaviors are increasingly being used in production and life. Recommendation models based on object sequences corresponding to user behaviors aim to introduce users’ historical behaviors, thereby mining users’ preferences and recommending more objects of interest to users based on these preferences.

[0003] The object sequence corresponding to the user behavior can generally be divided into short-term sequence, medium-term sequence and long-term sequence according to the time length of the corresponding user behavior. Among them, the short-term sequence and medium-term sequence have a small amount of data and are widely used in the industry. The long-term sequence is more difficult to apply due to its huge amount of data. However, it is precisely because of the huge amount of long-term sequence data that it contains more valuable information. If it can be used properly, it will significantly improve the recommendation effect of the recommendation system.

[0004] Currently, when using long-term sequences to recommend objects of interest to users, in order to facilitate training and ensure online performance, the long-term sequences need to be intercepted or sampled, but this will obviously lose some sequence information and cannot guarantee the recommendation effect of the recommendation system. Summary of the invention

[0005] The embodiments of the present disclosure provide a recommendation model training, a recommendation method, an apparatus, a medium and a device, which are used to solve the problem that a recommendation model based on long-term sequences suffers from sequence information loss and poor recommendation effect.

[0006] In a first aspect, the present disclosure provides a recommendation method, the method comprising:

[0007] Obtain a first feature vector of a target user; determine a historical object sequence based on a label of an object to be recommended and a label of a historical object of the target user; input the first feature vector, the historical object sequence and the identifier of an object to be recommended into a recommendation model, and output a predicted score of the object to be recommended; determine a target recommended object from the objects to be recommended based on the predicted score.

[0008] In a second aspect, the present disclosure also provides a recommendation model training method, which includes, according to a pre-established recommendation model, performing the following operations for each sample data in a pre-acquired sample set: obtaining a first feature vector of the target user based on the sample data; determining a historical sample object sequence based on the label of the sample object to be recommended obtained from the sample data and the label of the historical sample object of the target user; after inputting the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended into the recommendation model, outputting a predicted score for the sample object to be recommended; performing back propagation with an optimizer based on the predicted score, the actual recommended label of the sample object to be recommended and a pre-set recommendation model loss function, and iteratively optimizing the recommendation model parameters until the recommendation model converges or the above operations are completed for each sample data in the pre-acquired sample set to obtain a trained recommendation model.

[0009] In a third aspect, the present disclosure further provides a recommendation device, the device comprising:

[0010] An acquisition module is used to acquire a first feature vector of a target user; a determination module is used to determine a historical object sequence based on a label of the object to be recommended and a label of the target user's historical objects; an output module is used to input the first feature vector, the historical object sequence and the identifier of the object to be recommended into a recommendation model, and then output a predicted score of the object to be recommended; a recommendation module is used to determine a target recommended object from the objects to be recommended based on the predicted score.

[0011] In a fourth aspect, the present disclosure further provides a recommendation model training device, which includes an input-output module and an iterative optimization module: the input-output module is used to perform the following operations for each sample data in a pre-acquired sample set according to a pre-established recommendation model: obtain a first feature vector of the target user according to the sample data; determine a historical sample object sequence according to the label of the sample object to be recommended obtained from the sample data and the label of the historical sample object of the target user; after inputting the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended into the recommendation model, output the predicted score of the sample object to be recommended; the iterative optimization module is used to perform back propagation with an optimizer for each sample data in the pre-acquired sample set according to the predicted score, the true recommended label of the sample object to be recommended and the pre-set recommendation model loss function, and iteratively optimize the recommendation model parameters until the recommendation model converges or the above operations are completed for each sample data in the pre-acquired sample set to obtain a trained recommendation model.

[0012] In a fifth aspect, the present disclosure further provides a non-volatile computer storage medium, wherein the computer storage medium stores an executable program, and the executable program is executed by a processor to implement the method as described above.

[0013] In a sixth aspect, the present disclosure further provides a recommendation device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0014] The memory is used to store computer programs; the processor is used to implement the recommended method steps as described above when executing the program stored in the memory.

[0015] In the seventh aspect, the present disclosure also provides a training device for a recommendation model, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the steps of the recommendation model training method as described above when executing the program stored in the memory.

[0016] According to the scheme provided by the embodiment of the present disclosure, the historical object sequence can be determined from the historical objects of the target user according to the label of the object to be recommended and the label of the historical objects of the target user, and then the predicted score of the object to be recommended can be obtained according to the first feature vector of the target user, the historical object sequence and the identifier of the object to be recommended, so that the target recommended object for the target user can be determined from the objects to be recommended according to the predicted score. The scheme provided by the embodiment of the present disclosure can accurately obtain effective sequence information from the long-term sequence corresponding to the target user according to the label, make full use of the long-term sequence, reduce the sequence information loss of the long-term sequence, and improve the recommendation effect.

[0017] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or be understood by practicing the present disclosure. The purpose and other advantages of the present disclosure can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1A flowchart of a recommended method provided by an embodiment of the present disclosure;

[0020] Figure 2 A flowchart of a recommendation model training method provided in an embodiment of the present disclosure;

[0021] Figure 3 A schematic diagram of the structure of a recommended device provided by an embodiment of the present disclosure;

[0022] Figure 4 A schematic diagram of the structure of a recommendation model training device provided in an embodiment of the present disclosure;

[0023] Figure 5 A flowchart of a recommendation model training and recommendation method provided in an embodiment of the present disclosure;

[0024] Figure 6 A schematic diagram of secondary labels obtained by clustering style and language labels provided in an embodiment of the present disclosure;

[0025] Figure 7 A schematic diagram of sample data acquisition steps provided in an embodiment of the present disclosure;

[0026] Figure 8 A schematic diagram of the main network structure of the recommendation model provided in an embodiment of the present disclosure;

[0027] Fig. 9 A schematic diagram of a network structure for generating a user sequence expression vector provided in an embodiment of the present disclosure;

[0028] Fig.10 A schematic diagram of retrieving a historical sample object sequence provided by an embodiment of the present disclosure;

[0029] Fig.11 A schematic diagram of the structure of a recommendation device / recommendation model training device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solutions and advantages of the present disclosure clearer, the present disclosure will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.

[0031] It should be noted that the "multiple or several" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0032] The terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in sequences other than those illustrated or described herein.

[0033] In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or inherent to these processes, methods, products, or apparatuses. The data involved in this disclosure may be data authorized by the user or fully authorized by all parties.

[0034] Based on the above description, the present disclosure provides a recommendation method, the steps of which can be as follows: Figure 1 As shown, including:

[0035] Step 101: Obtain a first feature vector of a target user.

[0036] In this step, a first feature vector of the target user may be obtained for the recommended target user.

[0037] That is to say, in this step, a feature vector for the target user can be obtained so as to perform object recommendation based on the feature vector of the target user.

[0038] Step 102: Determine a historical object sequence according to the label of the object to be recommended and the label of the historical objects of the target user.

[0039] In this step, the historical object sequence may be determined from the long-term sequence corresponding to the target user according to the label of the object to be recommended and the label of the historical object of the target user.

[0040] It should be noted that step 101 and step 102 may be performed in any order.

[0041] Step 103: After the first feature vector, the historical object sequence and the identifier of the object to be recommended are input into the recommendation model, the predicted score of the object to be recommended is output.

[0042] In this step, the obtained first feature vector, historical object sequence and identification of the object to be recommended (which can be understood as the encoding of the object to be recommended) can be used as inputs of a pre-trained recommendation model, and the pre-trained recommendation model can be used to output the predicted score of the object to be recommended.

[0043] Step 104: Determine the target recommended object from the objects to be recommended according to the predicted scores.

[0044] In this step, the target recommended object can be determined from the objects to be recommended according to the prediction score corresponding to each object to be recommended. For example, each object to be recommended can be sorted according to the corresponding prediction score to determine the object to be recommended to the target user.

[0045] In a possible implementation, the first feature vector of the target user may include a target user feature vector, which may be understood as a vector used to describe the characteristics of the target user. The target user characteristics may include, but are not limited to, at least one of the target user's basic attributes, the target user's device attributes, and the target user's preference attributes. The target user's basic attributes may include, but are not limited to, at least one of age, gender, and location. The target user's device attributes may include, but are not limited to, at least one of device model, operating system, and operator. The target user's preference attributes may be understood as the target user's preference for various features of the object to be recommended. For example, taking the object to be recommended as a song, the target user's preference attributes may include, but are not limited to, at least one of a preference for language, a preference for style, a preference for an artist, and a preference for an era.

[0046] Taking the case where the first feature vector of the target user includes the target user feature vector as an example, step 103 may include:

[0047] Process the historical object sequence and the identifier of the object to be recommended through the embedding layer to obtain the corresponding historical object sequence vector and the second feature vector of the object to be recommended;

[0048] The historical object sequence vector and the second feature vector are weighted and summed through the activation layer to obtain the user sequence expression vector;

[0049] After the target user feature vector and the user sequence expression vector are concatenated, they pass through a fully connected layer and a sigmoid function to output the predicted score of the object to be recommended.

[0050] That is, in a possible implementation, each historical object identifier in the historical object sequence can be processed by an embedding layer to obtain a corresponding historical object vector, thereby obtaining a historical object sequence vector composed of each historical object vector. The identifier of the object to be recommended can also be processed by an embedding layer to obtain a corresponding second feature vector of the object to be recommended.

[0051] Furthermore, the historical object sequence vector and the second feature vector of the object to be recommended can be input into the activation layer to learn the similarity between each historical object vector and the second feature vector of the object to be recommended, and the weight corresponding to each historical object vector is obtained, and then the user sequence expression vector is obtained by weighted summation of each historical object vector.

[0052] After obtaining the user sequence expression vector, the target user feature vector and the user sequence expression vector can be concatenated, and the predicted score of the object to be recommended can be output after passing through the fully connected layer and the sigmoid function. That is, in a possible implementation, the predicted score of the object to be recommended can be obtained based on the target user feature vector and the user sequence expression vector to accurately determine the predicted score.

[0053] In another possible implementation, the first feature vector of the target user may also include a context feature vector, which may be understood as a vector used to describe the recommendation environment features associated with the target user for this recommendation. The recommendation environment features associated with the target user for this recommendation may include, but are not limited to, at least one of the time when this recommendation occurs, the recommendation scene (taking songs as an example, the recommendation scene may include, but is not limited to, daily recommendation scenes, ranking recommendation scenes, song list recommendation scenes, etc.), the device used by the target user for this recommendation, and the location of the target user for this recommendation.

[0054] In this embodiment, a third feature vector of the object to be recommended may be further obtained, and the third feature vector of the object to be recommended may be understood as a vector used to describe the characteristics of the object to be recommended. The characteristics of the object to be recommended may include, but are not limited to, the basic attributes of the object to be recommended. Taking the object to be recommended as a song as an example, the basic attributes of the object to be recommended may include, but are not limited to, at least one of the following: style, language, lyrics, composer, singer, playback quality, song duration, number of song reviews, song type, song quality, playback popularity, release time, and release version.

[0055] It should be pointed out that the third feature vector of the object to be recommended and the second feature vector of the object to be recommended mentioned above are two vectors with different meanings. The third feature vector of the object to be recommended is used to describe the characteristics of the object to be recommended, and the second feature vector of the object to be recommended is used to describe the vector obtained after the identifier of the object to be recommended is processed by the embedding layer.

[0056] On the basis of obtaining the third feature vector of the object to be recommended, in this embodiment, the cross feature vector of the target user feature vector and the third feature vector can be further calculated. The cross feature vector can be understood as a vector used to describe the target user's preference characteristics in different dimensions relative to the object to be recommended. Taking the object to be recommended as a song as an example, the target user's preference characteristics in different dimensions relative to the object to be recommended may include but are not limited to at least one of the target user's preference for the language of the recommended song, the target user's preference for the singer of the recommended song, etc.

[0057] After obtaining the user sequence expression vector, in step 103, the target user feature vector, the third feature vector, the context feature vector, the cross feature vector and the user sequence expression vector may be concatenated, and then the predicted score of the object to be recommended may be output after passing through a fully connected layer and a sigmoid function. In other words, in another possible implementation, the predicted score of the object to be recommended may be obtained based on the target user feature vector, the context feature vector, the feature vector of the object to be recommended, the cross feature vector and the user sequence expression vector, so as to more accurately determine the predicted score.

[0058] In addition, in a possible implementation, before step 102 is executed, the primary tags of the historical objects of the target user may be obtained, the historical objects with the same primary tags may be grouped into a cluster, and the secondary tags of the historical objects may be obtained through a clustering algorithm. That is to say, the disclosed embodiment also proposes that secondary tags may be obtained through a clustering algorithm on the basis of the primary tags, and then sequence information may be obtained based on the secondary tags, thereby further improving the accuracy of the obtained sequence information. At this time, step 102 may include: when the tag of the object to be recommended includes a secondary tag, determining from the secondary tags of the historical objects the target historical objects whose identicalness or similarity with the secondary tags of the object to be recommended reaches a threshold.

[0059] Furthermore, in a possible implementation, a secondary label of the historical object is obtained by a clustering algorithm, including:

[0060] The offline pre-trained matrix corresponding to each historical object is multiplied by the second code to obtain the offline vector corresponding to each historical object, wherein the second code is obtained by representing the first code with one bit of effective encoding, and the first code is obtained by encoding and mapping the historical object identifier; according to the determined offline vector corresponding to each historical object, a secondary label of the historical object is obtained through a clustering algorithm.

[0061] Furthermore, according to the offline vector corresponding to each determined historical object, a secondary label of the historical object is obtained through a clustering algorithm, which may include:

[0062] The cluster corresponding to the historical objects with the same primary label is taken as the split cluster. According to the offline vector corresponding to each historical object, the center point and cluster cost function of the split cluster are determined. According to the center point and cluster cost function of the split cluster, the binary cluster corresponding to the split cluster is determined. The binary cluster with the smallest cost function is selected as the next split cluster. This step is repeated until the conditions for terminating clustering are met to obtain the secondary label of the historical object.

[0063] Furthermore, determining the binary cluster corresponding to the split cluster may include:

[0064] Randomly select a historical object from the split cluster as the first subcluster, randomly select another historical object from the split cluster as the second subcluster, and determine the center points and cluster cost functions of the two clusters according to the offline vectors corresponding to the randomly selected historical objects; select a historical object that is not divided into the first subcluster and the second subcluster from the split cluster, and determine the distance from the historical object to the center points of the first subcluster and the second subcluster according to the offline vectors corresponding to the historical object, select a cluster with a smaller corresponding distance from the first subcluster and the second subcluster, and include the selected historical object in the cluster; re-determine the center points and cluster cost functions of the first subcluster and the second subcluster, and repeat this step until all historical objects in the split cluster are divided into the first subcluster or the second subcluster.

[0065] In addition, it should be noted that the offline pre-trained matrix corresponding to each historical object can be obtained by, but not limited to, the following methods:

[0066] According to the pre-established offline model, for each sample pair in the sample set, the following operations are performed:

[0067] The first matrix to be trained is multiplied by the second code corresponding to the identifier of the object to be predicted in a sample pair to obtain a vector to be predicted, and the second matrix to be trained is multiplied by the second code corresponding to the identifier of the target prediction object in the sample pair to obtain a target prediction vector; the prediction score is output according to the correlation score obtained by summing the dot product of the vector to be predicted and the target prediction vector; according to the prediction score output by the offline model, the label score corresponding to the sample pair used for training this time, and the preset offline model loss function, the optimizer is used to perform back propagation to iteratively optimize the offline model parameters until the offline model converges or the above operation is completed for each sample pair in the sample set to obtain the trained offline model. Model, the first matrix in the trained offline model is the matrix obtained by offline pre-training; wherein, the sample pair includes a positive sample pair and a negative sample pair; the target prediction object identifier included in the positive sample pair is any object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length, and the to-be-predicted object identifier included in the positive sample pair is an object identifier other than the target prediction object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length; the label score corresponding to the positive sample pair is a first set value; relative to the positive sample pair, the to-be-predicted object identifier of the negative sample pair is obtained by random sampling; the label score corresponding to the negative sample pair is a second set value.

[0068] Based on the same inventive concept as the above recommendation method, the present disclosure further provides a recommendation model training method, the steps of which can be as follows: Figure 2 As shown, including:

[0069] Step 201: Perform an operation on each sample data in a pre-acquired sample set according to a pre-established recommendation model.

[0070] According to the pre-established recommendation model, the following operations are performed for each sample data in the pre-acquired sample set:

[0071] A first feature vector of the target user is obtained based on the sample data; a historical sample object sequence is determined based on the label of the sample object to be recommended obtained from the sample data and the label of the historical sample object of the target user; after the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended are input into the recommendation model, a predicted score of the sample object to be recommended is output.

[0072] Step 202: Based on the predicted scores, the actual recommended labels of the sample objects to be recommended, and the pre-set recommendation model loss function, the optimizer is used to perform back propagation to iteratively optimize the recommendation model parameters until the recommendation model converges or the above operations are completed for each sample data in the pre-acquired sample set to obtain a trained recommendation model.

[0073] Similar to the use process of the recommendation model, in a possible implementation, the first feature vector may include a target user feature vector;

[0074] After the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended are input into the recommendation model, the predicted score of the sample object to be recommended is output, which may include:

[0075] The historical sample object sequence and the identifier of the sample object to be recommended are processed by the embedding layer to obtain the corresponding historical sample object sequence vector and the second feature vector of the sample object to be recommended; the historical sample object sequence vector and the second feature vector are weighted summed by the activation layer to obtain the user sequence expression vector; the target user feature vector and the user sequence expression vector are concatenated, and then passed through the fully connected layer and the sigmoid function to output the predicted score of the sample object to be recommended.

[0076] In another possible implementation, the first feature vector may also include a context feature vector. In this embodiment, the third feature vector of the sample object to be recommended may also be obtained, and the cross feature vector of the target user feature vector and the third feature vector may be calculated; at this time, after obtaining the user sequence expression vector, the target user feature vector, the third feature vector, the context feature vector, the cross feature vector and the user sequence expression vector may be concatenated, and then passed through a fully connected layer and a sigmoid function to output the predicted score of the sample object to be recommended.

[0077] In addition, similar to the use process of the recommendation model, in the training process of the recommendation model, before determining the sequence of historical sample objects based on the labels of the sample objects to be recommended and the labels of the historical sample objects of the target user, the primary labels of the historical sample objects of the target user can be obtained; the historical sample objects with the same primary labels are grouped into a cluster; and the secondary labels of the historical sample objects are obtained through a clustering algorithm. Furthermore, determining the sequence of historical sample objects based on the labels of the sample objects to be recommended and the labels of the historical sample objects of the target user may include: when the labels of the recommended sample objects include secondary labels, determining the target historical sample objects from the secondary labels of the historical sample objects whose identicalness or similarity with the secondary labels of the recommended sample objects reaches a threshold; and determining the sequence of historical sample objects based on the target historical sample objects.

[0078] In a possible implementation, obtaining the secondary labels of the historical sample objects through a clustering algorithm may include:

[0079] The offline pre-trained matrix corresponding to each historical sample object is multiplied by the second code to obtain the offline vector corresponding to each historical sample object, wherein the second code is obtained by performing one-bit effective coding representation on the obtained first code, and the first code is obtained by coding and mapping the historical sample object identifier; according to the offline vector corresponding to each historical sample object determined, the secondary label of the historical sample object is obtained through a clustering algorithm. Further, according to the offline vector corresponding to each historical sample object determined, the secondary label of the historical sample object is obtained through a clustering algorithm, which may include: taking the cluster corresponding to the historical sample objects with the same primary label as a split cluster, determining the center point and cluster cost function of the split cluster according to the offline vector corresponding to each historical sample object determined; determining the binary cluster corresponding to the split cluster according to the center point and cluster cost function of the determined split cluster, selecting the binary cluster with the smallest cost function as the next split cluster, and repeating this step until the condition for terminating clustering is met to obtain the secondary label of the historical sample object. Furthermore, determining the binary cluster corresponding to the split cluster may include: randomly selecting a historical sample object from the split cluster as the first subcluster, randomly selecting another historical sample object from the split cluster as the second subcluster, and determining the center points and cluster cost functions of the two clusters according to the offline vectors corresponding to the randomly selected historical sample objects; selecting a historical sample object from the split cluster that is not divided into the first subcluster and the second subcluster, and determining the distance from the historical sample object to the center points of the first subcluster and the second subcluster according to the offline vectors corresponding to the historical sample object, selecting a cluster with a smaller corresponding distance from the first subcluster and the second subcluster, and incorporating the selected historical sample object into the cluster; re-determining the center points and cluster cost functions of the first subcluster and the second subcluster, and repeating this step until all historical sample objects in the split cluster are divided into the first subcluster or the second subcluster.

[0080] In addition, in a possible implementation, the offline pre-trained matrix corresponding to each historical sample object can be obtained by, but not limited to, the following methods:

[0081] According to the pre-established offline model, for each sample pair in the sample set, the following operations are performed:

[0082] The first matrix to be trained is multiplied by the second code corresponding to the identifier of the object to be predicted in a sample pair to obtain a vector to be predicted, and the second matrix to be trained is multiplied by the second code corresponding to the identifier of the target prediction object in the sample pair to obtain a target prediction vector; the prediction score is output according to the correlation score obtained by summing the dot product of the vector to be predicted and the target prediction vector; according to the prediction score output by the offline model, the label score corresponding to the sample pair used for training this time, and the preset offline model loss function, the optimizer is used to perform back propagation to iteratively optimize the offline model parameters until the offline model converges or the above operation is completed for each sample pair in the sample set to obtain the trained offline model. Model, the first matrix in the trained offline model is the matrix obtained by offline pre-training; wherein, the sample pair includes a positive sample pair and a negative sample pair; the target prediction object identifier included in the positive sample pair is any object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length, and the to-be-predicted object identifier included in the positive sample pair is an object identifier other than the target prediction object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length; the label score corresponding to the positive sample pair is a first set value; relative to the positive sample pair, the to-be-predicted object identifier of the negative sample pair is obtained by random sampling; the label score corresponding to the negative sample pair is a second set value.

[0083] Corresponding to the provided method, the following device is further provided.

[0084] The present disclosure provides a recommendation device, the structure of which can be as follows: Figure 3 As shown, including:

[0085] The acquisition module 01 is used to obtain the first feature vector of the target user; the determination module 02 is used to determine the historical object sequence according to the label of the object to be recommended and the label of the historical object of the target user; the output module 03 is used to input the first feature vector, the historical object sequence and the identifier of the object to be recommended into the recommendation model, and then output the predicted score of the object to be recommended; the recommendation module 04 is used to determine the target recommended object from the objects to be recommended according to the predicted score.

[0086] In a possible implementation, the device further includes a clustering module 05:

[0087] The clustering module 05 is used for the determination module to obtain the primary labels of the historical objects of the target user before determining the historical object sequence according to the labels of the objects to be recommended and the labels of the historical objects of the target user; group the historical objects with the same primary labels into a cluster; and obtain the secondary labels of the historical objects through a clustering algorithm.

[0088] In a possible implementation, the determination module 02 is specifically used to determine, from the secondary tags of the historical objects, a target historical object whose identity or similarity with the secondary tag of the object to be recommended reaches a threshold when the tag of the object to be recommended includes a secondary tag; and determine a historical object sequence based on the target historical object.

[0089] In a possible implementation, the first feature vector includes: a target user feature vector;

[0090] The output module 03 is specifically used to process the historical object sequence and the identifier of the object to be recommended through the embedding layer to obtain the corresponding historical object sequence vector and the second feature vector of the object to be recommended; obtain the user sequence expression vector after weighted summation of the historical object sequence vector and the second feature vector through the activation layer; splice the target user feature vector and the user sequence expression vector, and then output the predicted score of the object to be recommended after passing through the fully connected layer and the sigmoid function.

[0091] In a possible implementation, the first feature vector also includes: a context feature vector; the acquisition module 01 is also used to obtain a third feature vector of the object to be recommended; calculate the cross feature vector of the target user feature vector and the third feature vector; the output module 03 is also used to concatenate the target user feature vector, the third feature vector, the context feature vector, the cross feature vector and the user sequence expression vector, and then output the predicted score of the object to be recommended after passing through a fully connected layer and a sigmoid function.

[0092] In a possible implementation, the clustering module 05 obtains the secondary label of the historical object through a clustering algorithm, including:

[0093] The offline pre-trained matrix corresponding to each historical object is multiplied by the second code to obtain the offline vector corresponding to each historical object, wherein the second code is obtained by performing one-bit effective encoding representation on the obtained first code, and the first code is obtained by encoding and mapping the historical object identifier; according to the determined offline vector corresponding to each historical object, a secondary label of the historical object is obtained through a clustering algorithm.

[0094] In a possible implementation, the clustering module 05 obtains the secondary label of each historical object through a clustering algorithm according to the offline vector corresponding to each historical object, including:

[0095] The cluster corresponding to the historical objects with the same primary label is taken as the split cluster. According to the offline vector corresponding to each historical object, the center point and cluster cost function of the split cluster are determined. According to the center point and cluster cost function of the determined split cluster, the binary cluster corresponding to the split cluster is determined, and the binary cluster with the smallest cost function is selected as the next split cluster. This step is repeated until the condition for terminating clustering is met to obtain the secondary label of the historical object.

[0096] In a possible implementation, the clustering module 05 determines the binary cluster corresponding to the split cluster, including:

[0097] Randomly select a historical object from the split cluster as the first subcluster, randomly select another historical object from the split cluster as the second subcluster, and determine the center points and cluster cost functions of the two clusters according to the offline vectors corresponding to the randomly selected historical objects; select a historical object that is not divided into the first subcluster and the second subcluster from the split cluster, and determine the distance from the historical object to the center points of the first subcluster and the second subcluster according to the offline vectors corresponding to the historical object, select a cluster with a smaller corresponding distance from the first subcluster and the second subcluster, and include the selected historical object in the cluster; re-determine the center points and cluster cost functions of the first subcluster and the second subcluster, and repeat this step until all historical objects in the split cluster are divided into the first subcluster or the second subcluster.

[0098] In a possible implementation, the device further includes an offline training module 06, which is used to obtain an offline pre-trained matrix corresponding to each historical object in the following manner:

[0099] According to the pre-established offline model, for each sample pair in the sample set, the following operations are performed:

[0100] The first matrix to be trained is multiplied by the second code corresponding to the identifier of the object to be predicted in a sample pair to obtain a vector to be predicted, and the second matrix to be trained is multiplied by the second code corresponding to the identifier of the target prediction object in the sample pair to obtain a target prediction vector; a prediction score is output according to a correlation score obtained by summing the dot product of the vector to be predicted and the target prediction vector; and an optimizer is used to perform back propagation according to the prediction score output by the offline model, the label score corresponding to the sample pair used for training this time, and a preset offline model loss function to iteratively optimize the offline model parameters until the offline model converges or the above operation is completed for each sample pair in the sample set to obtain a trained offline model. The first matrix in the trained offline model is the matrix obtained by offline pre-training; wherein, the sample pair includes a positive sample pair and a negative sample pair; the target prediction object identifier included in the positive sample pair is any object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length, and the to-be-predicted object identifier included in the positive sample pair is an object identifier other than the target prediction object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length; the label score corresponding to the positive sample pair is a first set value; relative to the positive sample pair, the to-be-predicted object identifier of the negative sample pair is obtained by random sampling; the label score corresponding to the negative sample pair is a second set value.

[0101] The present disclosure provides a recommendation model training device. The structure of the device can be as follows: Figure 4 As shown, it includes an input-output module 11 and an iterative optimization module 12:

[0102] The input-output module 11 is used to perform the following operations for each sample data in the pre-acquired sample set according to the pre-established recommendation model: obtain the first feature vector of the target user according to the sample data; determine the historical sample object sequence according to the label of the sample object to be recommended obtained from the sample data and the label of the historical sample object of the target user; after inputting the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended into the recommendation model, output the predicted score of the sample object to be recommended; the iterative optimization module 12 is used to perform back propagation with the optimizer for each sample data in the pre-acquired sample set according to the predicted score, the real recommended label of the sample object to be recommended and the pre-set recommendation model loss function, and iteratively optimize the recommendation model parameters until the recommendation model converges or the above operations are completed for each sample data in the pre-acquired sample set to obtain a trained recommendation model.

[0103] In a possible implementation, the device further includes a clustering module 13:

[0104] The clustering module is used for the input-output module to obtain the primary labels of the historical sample objects of the target user before determining the sequence of historical sample objects according to the labels of the sample objects to be recommended and the labels of the historical sample objects of the target user; group the historical sample objects with the same primary labels into a cluster; and obtain the secondary labels of the historical sample objects through a clustering algorithm.

[0105] In a possible implementation, the input-output module 11 determines a sequence of historical sample objects based on the label of the sample object to be recommended and the label of the historical sample object of the target user, including: when the label of the recommended sample object includes a secondary label, determining a target historical sample object from the secondary labels of the historical sample object whose identity or similarity with the secondary label of the recommended sample object reaches a threshold; and determining a sequence of historical sample objects based on the target historical sample object.

[0106] In a possible implementation, the first feature vector includes: a target user feature vector;

[0107] After the input-output module 11 inputs the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended into the recommendation model, the predicted score of the sample object to be recommended is output, including:

[0108] The historical sample object sequence and the identifier of the sample object to be recommended are processed by the embedding layer to obtain the corresponding historical sample object sequence vector and the second feature vector of the sample object to be recommended; the historical sample object sequence vector and the second feature vector are weighted summed by the activation layer to obtain the user sequence expression vector; the target user feature vector and the user sequence expression vector are concatenated, and then passed through the fully connected layer and the sigmoid function to output the predicted score of the sample object to be recommended.

[0109] In a possible implementation, the first feature vector further includes: a context feature vector;

[0110] The input-output module 11 is also used to obtain a third feature vector of the sample object to be recommended; calculate a cross feature vector of the target user feature vector and the third feature vector;

[0111] After the input-output module 11 inputs the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended into the recommendation model, the predicted score of the sample object to be recommended is output, and the following further includes:

[0112] After the target user feature vector, the third feature vector, the context feature vector, the cross feature vector and the user sequence expression vector are concatenated, the prediction score of the sample object to be recommended is output after passing through a fully connected layer and a sigmoid function.

[0113] In a possible implementation, the clustering module 13 obtains the secondary label of the historical sample object through a clustering algorithm, including:

[0114] The offline pre-trained matrix corresponding to each historical sample object is multiplied by the second code to obtain the offline vector corresponding to each historical sample object, wherein the second code is obtained by performing one-bit effective encoding representation on the obtained first code, and the first code is obtained by encoding and mapping the historical sample object identifier; according to the determined offline vector corresponding to each historical sample object, a secondary label of the historical sample object is obtained through a clustering algorithm.

[0115] In a possible implementation, the clustering module 13 obtains the secondary label of each historical sample object through a clustering algorithm according to the offline vector corresponding to each determined historical sample object, including:

[0116] The cluster corresponding to the historical sample objects with the same primary label is taken as the split cluster. According to the offline vector corresponding to each historical sample object, the center point and cluster cost function of the split cluster are determined. According to the center point and cluster cost function of the determined split cluster, the binary cluster corresponding to the split cluster is determined, and the binary cluster with the smallest cost function is selected as the next split cluster. This step is repeated until the conditions for terminating clustering are met to obtain the secondary label of the historical sample object.

[0117] In a possible implementation, the clustering module 13 determines the binary cluster corresponding to the split cluster, including:

[0118] Randomly select a historical sample object from the split cluster as the first subcluster, randomly select another historical sample object from the split cluster as the second subcluster, and determine the center points and cluster cost functions of the two clusters according to the offline vectors corresponding to the randomly selected historical sample objects; select a historical sample object that is not divided into the first subcluster and the second subcluster from the split cluster, and determine the distance from the historical sample object to the center points of the first subcluster and the second subcluster according to the offline vectors corresponding to the historical sample object, select a cluster with a smaller corresponding distance from the first subcluster and the second subcluster, and include the selected historical sample object in the cluster; re-determine the center points and cluster cost functions of the first subcluster and the second subcluster, and repeat this step until all historical sample objects in the split cluster are divided into the first subcluster or the second subcluster.

[0119] In a possible implementation, the device further includes an offline training module 14, which is used to obtain an offline pre-trained matrix corresponding to each historical sample object in the following manner:

[0120] According to the pre-established offline model, for each sample pair in the sample set, the following operations are performed:

[0121] The first matrix to be trained is multiplied by the second code corresponding to the identifier of the object to be predicted in a sample pair to obtain a vector to be predicted, and the second matrix to be trained is multiplied by the second code corresponding to the identifier of the target prediction object in the sample pair to obtain a target prediction vector; a prediction score is output according to a correlation score obtained by summing the dot product of the vector to be predicted and the target prediction vector; and an optimizer is used to perform back propagation according to the prediction score output by the offline model, the label score corresponding to the sample pair used for training this time, and a preset offline model loss function to iteratively optimize the offline model parameters until the offline model converges or the above operation is completed for each sample pair in the sample set to obtain a trained offline model. The first matrix in the trained offline model is the matrix obtained by offline pre-training; wherein, the sample pair includes a positive sample pair and a negative sample pair; the target prediction object identifier included in the positive sample pair is any object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length, and the to-be-predicted object identifier included in the positive sample pair is an object identifier other than the target prediction object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length; the label score corresponding to the positive sample pair is a first set value; relative to the positive sample pair, the to-be-predicted object identifier of the negative sample pair is obtained by random sampling; the label score corresponding to the negative sample pair is a second set value.

[0122] The functions of each functional unit of each device provided in the above embodiments of the present disclosure can be implemented through the steps of the above corresponding methods. Therefore, the possible working processes and beneficial effects of each functional unit in each device provided in the embodiments of the present disclosure are not repeated here.

[0123] The following uses songs as an example to illustrate the recommendation model training and recommendation method provided by the embodiments of the present disclosure.

[0124] The disclosed embodiment further provides a recommendation model training and recommendation method. A modeling method based on user long-term sequences is proposed. First, the user's daily behavior sequence is collected, and then summarized to form the user's long-term behavior sequence. Then, the user's behavior sequence is split according to the label dimension, and the sequence with the same label as the recommended object is found as the input sequence of the model, and then the model is trained for online prediction. The steps of this method can be as follows: Figure 5 As shown, it may include:

[0125] Step 501: Obtain sample data.

[0126] This step can provide data for the input of model training and the input of online real-time prediction of the trained model. This embodiment mainly takes the acquisition of model training process data as an example for explanation. The acquisition method of real-time prediction process model data is similar to the acquisition method of model training process data, and this embodiment will not be repeated. Among them, for at least two target users, the first historical object sequence corresponding to the target user can be obtained respectively, and the first historical object sequence can be understood as a set of historical object identifiers (for example, song numbers) corresponding to the target user in a period greater than the set time. Different user behaviors express different user interests, and the number of different user behaviors is also different. Considering user interests and data sparsity, in a possible implementation method, the first historical object sequence can be understood, but not limited to, as a set of historical object identifiers that interact with the behavior of the target user playing the song completely in a period greater than the set time. In addition, collecting user historical behavior data can include two parts: daily user data collection and multi-day user data collection. Songs corresponding to the complete playback behavior can be extracted from the log, and organized in chronological order to form a song sequence. In the formed song sequence, deduplication can be performed to retain only the songs corresponding to the last complete playback behavior. In addition, we can also eliminate those complete playback behaviors suspected of cheating, such as swiping songs, songs shared by multiple people, etc., so as to obtain daily user data. By organizing the song sequences corresponding to the user's daily life in chronological order, we can obtain multi-day user data. In order to ensure the integrity of user data, we can obtain the song sequences corresponding to the user's complete playback behaviors in the past five years. Since the song sequence is long. If we want to make full use of the long-term sequence corresponding to the user, we need to extract the most valuable subsequences in the long-term sequence for the songs to be recommended, but the previous splitting method will result in the loss of sequence information.

[0127] In the solution provided by the embodiments of the present disclosure, for a target object, after obtaining the first historical object sequence corresponding to the target user, for each sample object to be recommended, according to the label of the sample object to be recommended and the label of each historical object, the historical sample object sequence corresponding to the sample object to be recommended can be obtained from the first historical object sequence. In each embodiment of the present disclosure, the setting of labels needs to meet two conditions: one is that they cannot be too coarse, and there must be a certain degree of distinction between labels, and the other is that they cannot be too detailed, which will cause data sparseness and is not conducive to model training.

[0128] The inventor of this case has found that songs generally have language tags, for example, including Chinese, Japanese, Korean, Europe and America, and small languages, and generally have style tags, for example, including pop, electronic, folk, children's songs, light music, jazz, and two-dimensional. Therefore, the disclosed embodiment can consider using the existing tags of songs to screen the historical sample object sequence. Considering that the language tags are relatively rough and the discrimination is not enough, the playback behavior of each user is generally concentrated in one or two languages. And the style tags generally only have style tags for the head songs, and the coverage is not enough. Therefore, in this embodiment, the language tags and style tags can be combined to form language style tags to complement each other and obtain a tag system with high discrimination and comprehensive coverage. Among them, the style tags can take advantage of the wide coverage of the language tags, and for songs without style tags, they can still be split according to the language tags. And the language tags can take advantage of the high discrimination of the style tags, and for the head songs, such as the head songs in Chinese and English, they can still be subdivided. In this embodiment, the language style tags can be used as the primary tags of the songs.

[0129] In a possible implementation, after setting the language style label system, each historical object corresponding to the target user can be split according to the label system and finally stored in the form of KKV, where the first K is the user ID, the second K is the label ID, and V is the song ID. According to the set language style label, that is, according to the label of the sample object to be recommended and the label of each historical object, a historical sample object sequence with the same language style label as the sample object to be recommended can be obtained from the first historical object sequence.

[0130] Furthermore, the inventors of this case have found that the style and language tag system still has the phenomenon of head concentration and long tail. For example, Chinese pop songs account for as high as 22%, European and American electronic songs account for as high as 20%, European and American pop songs account for about 16%, and some songs with niche tags account for less than 1%. The existence of this situation will cause some users' popular tag song sequences to be very long, and there is still the problem of poor tag differentiation.

[0131] Therefore, the disclosed embodiment further proposes the concept of virtual tags. After obtaining the primary tags of the historical objects of the target user, the historical objects with the same primary tags can be grouped into a cluster, and the secondary tags of the historical objects can be obtained through a clustering algorithm. In other words, the disclosed embodiment further proposes that the historical sample object sequence can be screened by combining the secondary tags of the songs obtained by clustering on the basis of using the existing tags of the songs to screen the historical sample object sequence.

[0132] When determining the secondary label, the songs can be classified according to the offline vector corresponding to each song by unsupervised clustering to obtain the secondary label (i.e., virtual label) of the song. The offline vector corresponding to each song can be obtained by the following method: the song identifier is encoded and mapped to obtain the first code; the first code is represented by one-bit effective coding to obtain the second code; the second code is multiplied by the matrix pre-trained offline to obtain the offline vector corresponding to the song.

[0133] Furthermore, the offline pre-trained matrix can be obtained by, but is not limited to, the following methods:

[0134] First, obtain positive sample pairs and negative sample pairs. When obtaining positive sample pairs, the song identification sequence collected and played within the time length set by the user (for example, within the last week) can be split, and any one of the song identifications can be used as the target prediction object identification, and any song identification other than the target prediction object identification can be used as the object identification to be predicted. At this time, the target prediction object identification and the object identification to be predicted constitute a positive sample pair, and the positive sample pair is marked with a positive sample label 1, that is, the label score corresponding to the positive sample pair can be 1. When obtaining negative sample pairs, the negative sample pair is obtained by random sampling relative to the positive sample pair, and the negative sample pair can be marked with a negative sample label 0, that is, the label score corresponding to the negative sample pair can be 0. Secondly, the pre-established offline model is trained using the obtained positive sample pairs and negative sample pairs to obtain an offline pre-trained matrix.

[0135] Taking the song identification sequence including Id1, Id2 and Id3 that are collected and played within the user-set time period (for example, within the last week) as an example, a positive sample pair can be formed and marked with positive sample pair label 1, indicating that the two songs in the sample pair are related. The obtained positive sample pairs may include: (Id1, Id2, 1), (Id1, Id3, 1), (Id2, Id3, 1), (Id2, Id1, 1), (Id3, Id1, 1) and (Id3, Id2, 1).

[0136] In addition, some songs can be randomly sampled to form negative sample pairs, and marked with negative sample label 0, indicating that the two songs in the sample pair are unrelated. It is assumed that the obtained negative sample pairs include: (Id1, Id4, 0), (Id2, Id5, 0), etc.

[0137] After obtaining the positive and negative sample pairs, the second code corresponding to the song identifier can be determined. It should be noted that a first matrix to be trained (which can be recorded as W1) and a second matrix to be trained (which can be recorded as W2) are set in the pre-established offline model. According to the pre-established offline model, the following operations can be performed for each sample pair in the sample set:

[0138] The first matrix to be trained is multiplied by the second code corresponding to the identifier of the object to be predicted in a sample pair to obtain a vector to be predicted (which can be recorded as V1), and the second matrix to be trained is multiplied by the second code corresponding to the identifier of the target predicted object in the sample pair to obtain a target prediction vector (which can be recorded as V2); the sample pair label is fitted according to the correlation score obtained by the dot product sum of the vector to be predicted and the target prediction vector, and the prediction score is output; then the cross entropy loss can be calculated according to the prediction score output by the offline model and the label score corresponding to the sample pair used for training this time, and the SGD Optimizer is used for optimization and back propagation, and the offline model parameters are iteratively optimized until the offline model converges or the above operations are completed for each sample pair in the sample set to obtain a trained offline model, and the first matrix in the trained offline model is the offline pre-trained matrix obtained. Taking the training of offline models using positive sample pairs (Id1, Id2, 1) as an example, we can first multiply the one-hot code corresponding to Id1 by W1 to obtain the vector V1 corresponding to Id1, and multiply the oneHot code corresponding to Id2 by W2 to obtain the vector V2 corresponding to Id2. Then, we perform dot product of V1 and V2 to obtain the correlation score of Id1 and Id2. Then, we calculate the cross entropy loss based on the correlation score and the sample label score, and use the SGDOptimizer optimizer for optimization and back propagation. After obtaining the offline pre-trained matrix, we can obtain the offline vector corresponding to each song. After obtaining the song offline vector, we can further split the song corresponding to the first-level label into songs corresponding to M sub-labels through the clustering algorithm based on the song offline vector. The process of further splitting the second-level label of songs labeled as Chinese pop songs through the clustering algorithm based on the song offline vector can be as follows:

[0139] First, all Chinese pop songs are regarded as a cluster. According to the offline vector corresponding to each Chinese pop song, the cluster center (the average of all songs' offline vectors) and the cluster cost function (the sum of the distances of each song's offline vector from the cluster center) are calculated. Then, the current cluster is subjected to binary clustering calculation, and the binary cluster with the minimum cost function is selected as the next split cluster until the condition for terminating clustering is met, such as obtaining M clusters. For example, suppose that a binary clustering calculation is performed for Chinese pop songs, and two clusters are obtained, which are respectively recorded as Chinese pop-1 and Chinese pop-2. At this time, the binary cluster with the minimum cost function is selected as the next split cluster. Assuming that the cluster cost function of Chinese pop-1 is 0.3 and the cluster cost function of Chinese pop-2 is 0.2, then Chinese pop-2 will be selected as the next split cluster. Assuming that a binary clustering calculation is performed on Chinese pop-2, two clusters are further obtained, which are respectively recorded as Chinese pop-21 and Chinese pop-22. Then, at this time, the cluster with the smallest cost function can be selected from Chinese pop-1, Chinese pop-21 and Chinese pop-22 for further splitting until M sub-clusters are obtained. The obtained M sub-clusters can be recorded as corresponding labels Chinese pop-1, Chinese pop-2... and Chinese pop-M, but not limited to them. The process of calculating the binary cluster can be as follows: randomly select a song from the cluster as a sub-cluster, and any other song as another sub-cluster. According to the offline vectors corresponding to the songs, calculate the cluster center points and cluster cost functions of the two clusters, select an unclassified song, calculate the distance from the song to the two cluster centers, select the cluster with the smaller distance, and include the song in the cluster, and recalculate the cluster center points and cluster cost functions of the two clusters until all songs are calculated.

[0140] Figure 6 This is a schematic diagram of the secondary labels obtained by clustering style language labels. Figure 6 In the example, the songs with the style and language labels of European and American pop, Chinese pop and European and American electronic music are clustered to obtain the secondary labels. Of course, the songs with other style and language labels can also be clustered to obtain the secondary labels, not limited to the songs with the style and language labels of European and American pop, Chinese pop and European and American electronic music. Figure 6As shown, for songs with a style and language label of European and American pop, it is possible but not limited to further clustering to obtain songs with secondary labels of European and American pop-1, European and American pop-2 and European and American pop-3. For songs with a style and language label of Chinese pop, it is possible but not limited to further clustering to obtain songs with secondary labels of Chinese pop-1, Chinese pop-2 and Chinese pop-3. For songs with a style and language label of European and American electronic, it is possible but not limited to further clustering to obtain songs with secondary labels of European and American electronic-1, European and American electronic-2 and European and American electronic-3. After obtaining the secondary labels, each historical object corresponding to the target user can still be stored in the form of KKV, where the first K is the user identifier, the second K is the tag identifier, and V represents the song identifier.

[0141] It can be understood that in the sample data acquisition step, after collecting user historical data, songs can be split according to style and language tags, and songs can be further split according to virtual tags.

[0142] The disclosed embodiment can further split the popular tags through virtual tags to further improve the differentiation of tags. In this way, when the sample songs to be recommended include secondary tags, songs with the same secondary tags can be retrieved from the first historical object sequence to obtain a historical sample object sequence. When the sample songs to be recommended do not include secondary tags, songs with the same primary tags can be retrieved from the first historical object sequence to obtain a historical sample object sequence. The sample data acquisition step can be understood as further including three steps: collecting user historical data, splitting user historical data, and retrieving user historical data. Figure 7 As shown, in the step of collecting user historical data, the daily user data collection can be realized first, and then the multi-day user data collection can be realized. In the stage of splitting the user historical data, the data can be split according to the style language label first, and then the data can be further split according to the virtual label. In this way, in the stage of retrieving user historical data, historical data can be retrieved according to the label. In addition, in the sample data acquisition step, in addition to obtaining the historical sample object sequence, the target user feature vector, the context feature vector, and the third feature vector of the sample song to be recommended can be obtained for the target user, and the cross feature vector can be obtained based on the target user feature vector and the third feature vector.

[0143] In a possible implementation, the target user feature vector may include a target user offline vector. The target user offline vector is the average value of the offline vectors corresponding to the specified objects, and the specified objects include each object that interacts with the target user's specified behavior (e.g., complete playback behavior) within a specified time period (e.g., within the last week). In other words, the target user offline vector can also be understood as a vector used to describe the target user's characteristics.

[0144] In a possible implementation, it can be understood that the target user feature vector may include a target user offline vector in addition to a vector for describing at least one of the basic attributes of the target user, the device attributes of the target user, and the preferred attributes of the target user. In a possible implementation, the target user feature vector can be formed by splicing vectors in a specified order. The context feature vector may include a vector for describing at least one of the time when this recommendation occurs, the recommendation scene (taking the song as an example, the recommendation scene may include but is not limited to daily recommendation scenes, ranking recommendation scenes, song list recommendation scenes, etc.), the device used by the target user at the time of this recommendation, and the location of the target user at the time of this recommendation. In a possible implementation, the context feature vector can also be formed by splicing vectors in a specified order.

[0145] In a possible implementation, the third feature vector of the object to be recommended may include an offline vector corresponding to the object to be recommended. That is, the offline vector corresponding to the object to be recommended may also be understood as a vector for describing the features of the object to be recommended.

[0146] In a possible implementation, it can be understood that the third feature vector of the object to be recommended may include an offline vector corresponding to the object to be recommended in addition to a vector for describing the basic attributes of the object to be recommended. In a possible implementation, the third feature vector of the object to be recommended may be formed by concatenating vectors in a specified order. The cross-feature vector may include a vector for describing at least one of the target user's preference for the language of the recommended song, the target user's preference for the singer of the recommended song, etc. In a possible implementation, the cross-feature vector may also be formed by concatenating vectors in a specified order.

[0147] It should be further pointed out that in the sample data acquisition step, the first historical object sequence and the historical sample object sequence need to be processed by sequence processing. In the process of obtaining the target user feature vector, context feature vector, the third feature vector of the sample song to be recommended, and the cross feature vector, some data can be used directly, such as song popularity, etc., and some data need to be discretized, such as age, gender, song identification, song type, song quality, song style and song language, etc., and the cross feature vector needs to be obtained by cross-processing the data according to the song to be recommended and the target user.

[0148] Step 502: Sample generation.

[0149] After the data is obtained in the sample data acquisition step, the sample generation step can be entered. In this embodiment, the generated sample may include a target user feature vector, a context feature vector, a third feature vector of the sample object to be recommended, a cross feature vector, a historical sample object sequence, and an identifier of the sample object to be recommended. At the same time, a real recommendation label of the sample object to be recommended can also be generated for the sample object to be recommended. In a possible implementation, when the sample object to be recommended is a sample object that can be recommended to the target user, the real recommendation label of the sample object to be recommended can be recorded as 1, otherwise, it can be recorded as 0.

[0150] Step 503: Model training.

[0151] In a possible implementation, in the design of the recommendation model provided in this embodiment, the main network structure can be as follows: Figure 8 As shown. The feature layer at the bottom includes the target user feature vector, the context feature vector, the third feature vector of the sample object to be recommended, the cross feature vector and the historical sample object sequence. These features are concatenated in order to form the final sample vector. Then, the different weights of the features can be learned through two fully connected layers. There can be an activation function after each layer of full connection, the purpose of which is to discard those unimportant features. The activation function used in this embodiment can be ReLU (Rectified Linear Unit), and its calculation formula is:

[0152] f(x)=max(0,x)

[0153] In addition, in order to prevent overfitting in engineering practice, dropout operations can be added in the process of learning different weights of features. In addition, in order to maintain parameter stability, normalization operations can be added after the fully connected layer, which can be converted into probability value outputs between 0 and 1 through the sigmoid function to obtain the predicted score. The calculation formula of the sigmoid function is:

[0154]

[0155] In addition, the network structure diagram for generating user sequence expression vectors based on the historical sample object sequence and the identifier of the sample object to be recommended can be as follows: Fig. 9 As shown. Fig. 9The bottom-level input of the network shown is the identifier of the sample object to be recommended, and the sequence of historical sample objects retrieved from the first historical object sequence that is consistent with the label of the sample object to be recommended. Because the identifier of the sample object to be recommended and each historical sample object identifier in the historical sample object sequence are identifiers and cannot be directly entered into the model for training, these identifier features can be converted into dense feature vectors, i.e., object vectors, through an embedding layer. Next, an activation layer can be passed to calculate the similarity weight of each historical sample object vector and the sample object vector to be recommended, so as to extract the importance of each historical sample object to the sample object to be recommended. The formula for calculating the similarity weight of the historical sample object vector and the sample object vector to be recommended can be, but is not limited to, as follows:

[0156] W(V t ,V i )=DNN(concat(V t ,V i ,V t -V i ,V t ×V i ))

[0157]

[0158] in:

[0159] V t V represents the sample object vector to be recommended; i V represents the i-th historical sample object vector; t -V i Represents a vector bitwise reduction operation; V t ×V i represents the bitwise multiplication of vectors; concat() represents vector concatenation; DNN() represents a deep neural network; W(V t ,V i ) represents the calculated V i The weight of i V after normalization i The weight of .

[0160] The deep neural network in this embodiment may include three fully connected layers, the activation function used in each fully connected layer may be a sigmoid function, and the output dimension of the last layer is 1. After calculating the similarity weights of the historical sample object vector and the sample object vector to be recommended, a weighted sum is performed on each historical sample object vector in the historical sample object sequence, and the user sequence expression vector can be obtained, and its formula is:

[0161]

[0162] Where n represents the length of the historical sample object sequence.

[0163] When retrieving a historical sample object sequence that is consistent with the label of the sample object to be recommended from the first historical object sequence, the label of the sample object to be recommended and the label of each historical object in the first historical object sequence can be first obtained, and the label can include a language style label and a virtual label. Then, the historical object that is consistent with the label of the sample object to be recommended can be queried from the first historical object sequence. If the label of the sample object to be recommended includes a virtual label, the historical object with the same virtual label in the first historical object sequence can be directly retrieved, and the historical object sequence retrieved according to the virtual label is used as the historical sample object sequence.

[0164] In a possible implementation, a retrieval result judgment condition may also be set (e.g., the length of the historical sample object sequence retrieved according to the virtual label is not shorter than a specified length, for example, not less than K). If the retrieval result does not meet the judgment condition, the retrieval may be performed again according to the language style label. If the retrieval result meets the judgment condition, the historical object sequence retrieved according to the virtual label may be used as the historical sample object sequence. If the sample object label to be recommended does not include the virtual label, the retrieval may be performed directly according to the language style label, and the historical object sequence retrieved from the first historical object sequence according to the language style label may be used as the historical sample object sequence.

[0165] Fig.10 To retrieve a schematic diagram of a sequence of historical sample objects, assume that the label corresponding to the sample song to be recommended is recorded as label 1 (the label corresponding to the sample song to be recommended may include a secondary label or may not include a secondary label), then from the corresponding first historical object sequence (assuming that the first historical object sequence includes historical object 1 with a corresponding label of label 1, historical object 2 with a corresponding label of label 2, historical object 3 with a corresponding label of label 3, historical object 4 with a corresponding label of label 1, historical object 5 with a corresponding label of label 2 and historical object 6 with a corresponding label of label 1, and the label corresponding to each historical object may include a secondary label or may not include a secondary label), retrieve historical object 1, historical object 4 and historical object 6 with a corresponding label of label 1 to obtain a sequence of historical sample objects. After designing the network according to the prediction target, the objective function can be further designed. In one possible implementation, the loss function can adopt a cross entropy loss function, which can be expressed as follows:

[0166]

[0167] Where N represents the number of samples, y i represents the ground truth label corresponding to the i-th sample, p iRepresents the predicted score corresponding to the i-th sample. After completing the design of the objective function, the model can be trained according to the designed network and objective function. The optimizer used in the training phase can be AdamOptimizer. The Loss of the sample can be calculated according to the designed loss function, and the optimizer can be used for back propagation to iteratively optimize the model parameters until the model converges or reaches the convergence condition. In one possible implementation, batch processing can be used for training, and a batch of samples is optimized each time. The batch size can be set to, but is not limited to, 4096.

[0168] It can be understood that the model training step further includes three steps: designing the network according to the prediction target, designing the objective function and model training.

[0169] Step 504: Model output.

[0170] After the trained recommendation model is obtained, the model can be output. The offline trained model parameters are solidified and uploaded online for real-time song recommendations.

[0171] Step 505: Online prediction.

[0172] Online, the data uploaded offline and the data obtained online in real time can be assembled into the format data required by the recommendation model, and then the trained recommendation model is input to predict the prediction score p corresponding to the recommended object. i , then multiple objects to be recommended can be sorted according to the predicted scores, and the sorting results can be returned to the upstream for display, so as to select objects to be recommended to the target user from the objects to be recommended. According to the scheme provided by the embodiment of the present disclosure, on the one hand, following the idea of ​​"making it long", the user behavior sequence (long-term sequence) is organized according to time, and subsequences with the same or similar labels as the objects to be recommended are screened out, and then deep learning technology is used for training and prediction, and the user's long-term interests are mined, and recommendations are made to users on this basis. On the other hand, following the idea of ​​"making it wide", in addition to using the information of the behavior sequence, user characteristics, contextual characteristics generated by user behavior, and cross-features between users and objects to be recommended, etc. are also considered, so as to introduce more valuable user information, enrich user information, and then more accurately mine the user's interest expression in subsequent models, and further improve the accuracy of recommendations.

[0173] The disclosed embodiment proposes a modeling method based on long-term sequences. According to the language style labels of the objects to be recommended, subsequences of the same language style labels in the user behavior sequence are filtered out as the input sequence of the model, and then the attention mechanism is used to mine the user's long-term interests to improve the accuracy of the model prediction. In order to more effectively utilize the user behavior sequence, the head label can be further split and virtual labels can be introduced to realize a label system of "language style labels" plus "virtual labels". For active users with rich behaviors, the user's long-term sequence can be better extracted for sequence information, and the user's expression information can be extracted more accurately and effectively, so as to achieve the purpose of more accurately and meticulously mining the user's long-term interests, thereby further improving the accuracy of the model prediction.

[0174] Based on the same inventive concept, the embodiments of the present disclosure provide the following devices and media.

[0175] The present disclosure provides a recommendation device, the structure of which can be as follows: Fig.11 As shown, it includes a processor 21, a communication interface 22, a memory 23 and a communication bus 24, wherein the processor 21, the communication interface 22, and the memory 23 communicate with each other through the communication bus 24;

[0176] The memory 23 is used to store computer programs; the processor 21 is used to implement the steps described in the above-mentioned recommended method embodiment of the present disclosure when executing the program stored in the memory.

[0177] Optionally, the processor 21 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), may be one or more integrated circuits for controlling program execution, may be a hardware circuit developed using a field programmable gate array (FPGA), or may be a baseband processor.

[0178] Optionally, the processor 21 may include at least one processing core.

[0179] Optionally, the memory 23 may include a read-only memory (ROM), a random access memory (RAM) and a disk memory. The memory 23 is used to store data required by at least one processor 21 when it is running. The number of memories 23 may be one or more.

[0180] The disclosed embodiment also provides a recommendation model training device, the structure of which can also be as follows: Fig.11The processor 21 is used to implement the steps described in the above-mentioned recommendation model training method embodiment of the present disclosure when executing the program stored in the memory.

[0181] An embodiment of the present disclosure further provides a non-volatile computer storage medium, wherein the computer storage medium stores an executable program. When the executable program is executed by a processor, the method provided by the above method embodiment of the present disclosure is implemented.

[0182] In a possible implementation process, the computer storage medium may include: Universal Serial Bus Flash Drive (USB), mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, and other storage media that can store program code.

[0183] In the embodiments of the present disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0184] The functional units in the embodiments of the present disclosure may be integrated into one processing unit, or the units may be independent physical modules.

[0185] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device, such as a personal computer, a server, or a network device, or a processor to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: a Universal Serial Bus Flash Drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, and other media that can store program codes.

[0186] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0187] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0188] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0189] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0190] Although the preferred embodiments of the present disclosure have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present disclosure.

[0191] Obviously, those skilled in the art can make various changes and modifications to the present disclosure without departing from the spirit and scope of the present disclosure. Thus, if these modifications and variations of the present disclosure fall within the scope of the claims of the present disclosure and their equivalents, the present disclosure is also intended to include these modifications and variations.

Claims

1. A recommendation method, characterized in that: The method comprises: Obtaining the first feature vector of the target user; Obtaining a primary label of a historical object of the target user, where the historical object represents an object corresponding to the historical behavior of the target user; Group historical objects with the same first-level label into one cluster; The clusters corresponding to the historical objects with the same primary labels are taken as split clusters, and the secondary labels of the historical objects are obtained through a clustering algorithm; Determining a historical object sequence according to the label of the object to be recommended and the label of the historical object of the target user, including: when the label of the object to be recommended includes a secondary label, determining a target historical object from the secondary label of the historical object that is identical to the secondary label of the object to be recommended or has a similarity reaching a threshold; determining a historical object sequence according to the target historical object; After inputting the first feature vector, the historical object sequence and the identifier of the object to be recommended into the recommendation model, outputting the predicted score of the object to be recommended; According to the predicted score, a target recommended object is determined from the objects to be recommended.

2. The method according to claim 1, characterized in that The first feature vector includes: a target user feature vector; After the first feature vector, the historical object sequence and the identifier of the object to be recommended are input into the recommendation model, the predicted score of the object to be recommended is output, including: Processing the historical object sequence and the identifier of the object to be recommended through an embedding layer to obtain a corresponding historical object sequence vector and a second feature vector of the object to be recommended; The historical object sequence vector and the second feature vector are weighted and summed through an activation layer to obtain a user sequence expression vector; After the target user feature vector and the user sequence expression vector are concatenated, they are passed through a fully connected layer and a sigmoid function to output the predicted score of the object to be recommended.

3. The method according to claim 2, characterized in that The first feature vector also includes: a context feature vector; The method further comprises: obtaining a third feature vector of the object to be recommended; Calculating a cross feature vector of the target user feature vector and a third feature vector; After inputting the first feature vector, the historical object sequence and the identifier of the object to be recommended into the recommendation model, outputting the predicted score of the object to be recommended also includes: The target user feature vector, the third feature vector, the context feature vector, the cross feature vector and the user sequence expression vector are concatenated and then passed through a fully connected layer and a sigmoid function to output the predicted score of the object to be recommended.

4. The method according to claim 1, characterized in that The secondary labels of the historical objects are obtained by clustering algorithms, including: The offline pre-trained matrix corresponding to each historical object is multiplied by the second code to obtain an offline vector corresponding to each historical object, wherein the second code is obtained by performing one-bit effective encoding representation on the obtained first code, and the first code is obtained by encoding and mapping the historical object identifier; According to the determined offline vector corresponding to each historical object, a secondary label of the historical object is obtained through a clustering algorithm.

5. The method according to claim 4, characterized in that According to the offline vector corresponding to each determined historical object, a secondary label of the historical object is obtained through a clustering algorithm, including: The clusters corresponding to the historical objects with the same primary labels are taken as split clusters, and the center point and cluster cost function of the split cluster are determined according to the offline vectors corresponding to each historical object; According to the determined center point and cluster cost function of the split cluster, the binary cluster corresponding to the split cluster is determined, and the binary cluster with the smallest cost function is selected as the next split cluster. This step is repeated until the condition for terminating clustering is met to obtain the secondary label of the historical object.

6. The method according to claim 5, characterized in that Determine the binary clusters corresponding to the split cluster, including: Randomly select a historical object from the split cluster as the first sub-cluster, randomly select another historical object from the split cluster as the second sub-cluster, and determine the center points and cluster cost functions of the two clusters according to the offline vectors corresponding to the randomly selected historical objects; Select a historical object that is not divided into the first subcluster and the second subcluster from the split cluster, determine the distance from the historical object to the center point of the first subcluster and the second subcluster based on the offline vector corresponding to the historical object, select a cluster with a smaller corresponding distance from the first subcluster and the second subcluster, and include the selected historical object in the cluster; re-determine the center point and cluster cost function of the first subcluster and the second subcluster, and repeat this step until all historical objects in the split cluster are divided into the first subcluster or the second subcluster.

7. The method according to claim 4, characterized in that The offline pre-trained matrix corresponding to each historical object is obtained in the following way: According to the pre-established offline model, for each sample pair in the sample set, the following operations are performed: The first matrix to be trained is multiplied by the second code corresponding to the identifier of the object to be predicted in a sample pair to obtain a vector to be predicted, and the second matrix to be trained is multiplied by the second code corresponding to the identifier of the target prediction object in the sample pair to obtain a target prediction vector; Outputting a prediction score according to a correlation score obtained by summing the dot product of the vector to be predicted and the target prediction vector; According to the prediction score output by the offline model, the label score corresponding to the sample pair used for training this time, and the preset offline model loss function, the optimizer is used to perform back propagation to iteratively optimize the offline model parameters until the offline model converges or the above operation is completed for each sample pair in the sample set, and a trained offline model is obtained, and the first matrix in the trained offline model is the offline pre-trained matrix obtained; Wherein, the sample pairs include positive sample pairs and negative sample pairs; The target prediction object identifier included in the positive sample pair is any object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length, and the to-be-predicted object identifier included in the positive sample pair is an object identifier other than the target prediction object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length; the label score corresponding to the positive sample pair is a first set value; The identification of the object to be predicted of the negative sample pair is obtained by random sampling relative to the positive sample pair; and the label score corresponding to the negative sample pair is a second set value.

8. A recommendation model training method, characterized in that: The method includes, according to a pre-established recommendation model, performing the following operations for each sample data in a pre-acquired sample set: Acquire a first feature vector of the target user according to the sample data; Obtaining a primary label of a historical sample object of a target user, where the historical sample object represents an object corresponding to a historical sample behavior of the target user; Group historical sample objects with the same first-level label into one cluster; The clusters corresponding to the historical sample objects with the same primary labels are taken as split clusters, and the secondary labels of the historical sample objects are obtained through a clustering algorithm; Determining a historical sample object sequence according to the label of the sample object to be recommended obtained from the sample data and the label of the historical sample object of the target user, including: when the label of the sample object to be recommended includes a secondary label, determining a target historical sample object from the secondary labels of the historical sample objects that is identical to the secondary label of the sample object to be recommended or whose similarity reaches a threshold; determining a historical sample object sequence according to the target historical sample object; After inputting the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended into the recommendation model, outputting the predicted score of the sample object to be recommended; According to the predicted score, the real recommendation label of the sample object to be recommended and the preset recommendation model loss function, the optimizer is used to perform back propagation to iteratively optimize the recommendation model parameters until the recommendation model converges or the above operation is completed for each sample data in the pre-acquired sample set to obtain a trained recommendation model.

9. The method according to claim 8, characterized in that The first feature vector includes: a target user feature vector; After the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended are input into the recommendation model, the predicted score of the sample object to be recommended is output, including: Processing the historical sample object sequence and the identifier of the sample object to be recommended through an embedding layer to obtain a corresponding historical sample object sequence vector and a second feature vector of the sample object to be recommended; The historical sample object sequence vector and the second feature vector are weighted and summed through an activation layer to obtain a user sequence expression vector; After the target user feature vector and the user sequence expression vector are concatenated, they are passed through a fully connected layer and a sigmoid function to output the predicted score of the sample object to be recommended.

10. The method according to claim 9, characterized in that The first feature vector also includes: a context feature vector; The method further comprises: obtaining a third feature vector of the sample object to be recommended; Calculating a cross feature vector of the target user feature vector and a third feature vector; After inputting the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended into the recommendation model, outputting the predicted score of the sample object to be recommended also includes: After the target user feature vector, the third feature vector, the context feature vector, the cross feature vector and the user sequence expression vector are concatenated, the prediction score of the sample object to be recommended is output after passing through a fully connected layer and a sigmoid function.

11. The method according to claim 8, characterized in that The secondary labels of the historical sample objects are obtained by clustering algorithms, including: The offline pre-trained matrix corresponding to each historical sample object is multiplied by the second code to obtain an offline vector corresponding to each historical sample object, wherein the second code is obtained by performing one-bit effective encoding representation on the obtained first code, and the first code is obtained by encoding and mapping the historical sample object identifier; According to the determined offline vector corresponding to each historical sample object, a secondary label of the historical sample object is obtained through a clustering algorithm.

12. The method according to claim 11, characterized in that According to the determined offline vector corresponding to each historical sample object, a secondary label of the historical sample object is obtained through a clustering algorithm, including: The cluster corresponding to the historical sample objects with the same primary label is taken as the split cluster, and the center point and cluster cost function of the split cluster are determined according to the offline vector corresponding to each historical sample object; According to the determined center point and cluster cost function of the split cluster, the binary cluster corresponding to the split cluster is determined, and the binary cluster with the smallest cost function is selected as the next split cluster. This step is repeated until the condition for terminating clustering is met to obtain the secondary label of the historical sample object.

13. The method according to claim 12, characterized in that Determine the binary clusters corresponding to the split cluster, including: Randomly select a historical sample object from the split cluster as the first sub-cluster, randomly select another historical sample object from the split cluster as the second sub-cluster, and determine the center points and cluster cost functions of the two clusters according to the offline vectors corresponding to the randomly selected historical sample objects; A historical sample object that is not divided into the first subcluster and the second subcluster is selected from the split cluster, and the distance from the historical sample object to the center point of the first subcluster and the second subcluster is determined according to the offline vector corresponding to the historical sample object, and a cluster with a smaller corresponding distance is selected from the first subcluster and the second subcluster, and the selected historical sample object is included in the cluster; the center point and cluster cost function of the first subcluster and the second subcluster are re-determined, and this step is repeated until all historical sample objects in the split cluster are divided into the first subcluster or the second subcluster.

14. The method according to claim 11, characterized in that The offline pre-trained matrix corresponding to each historical sample object is obtained in the following way: According to the pre-established offline model, for each sample pair in the sample set, the following operations are performed: The first matrix to be trained is multiplied by the second code corresponding to the identifier of the object to be predicted in a sample pair to obtain a vector to be predicted, and the second matrix to be trained is multiplied by the second code corresponding to the identifier of the target prediction object in the sample pair to obtain a target prediction vector; Outputting a prediction score according to a correlation score obtained by summing the dot product of the vector to be predicted and the target prediction vector; According to the prediction score output by the offline model, the label score corresponding to the sample pair used for training this time, and the preset offline model loss function, the optimizer is used to perform back propagation to iteratively optimize the offline model parameters until the offline model converges or the above operation is completed for each sample pair in the sample set, and a trained offline model is obtained, and the first matrix in the trained offline model is the offline pre-trained matrix obtained; Wherein, the sample pairs include positive sample pairs and negative sample pairs; The target prediction object identifier included in the positive sample pair is any object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length, and the to-be-predicted object identifier included in the positive sample pair is an object identifier other than the target prediction object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length; the label score corresponding to the positive sample pair is a first set value; The identification of the object to be predicted of the negative sample pair is obtained by random sampling relative to the positive sample pair; and the label score corresponding to the negative sample pair is a second set value.

15. A recommendation device, characterized in that: The device comprises: An acquisition module, used to acquire a first feature vector of a target user; A determination module, used to determine a sequence of historical objects according to the label of the object to be recommended and the label of the historical objects of the target user, wherein the historical objects represent objects corresponding to the historical behaviors of the target user; an output module, configured to output a predicted score of the object to be recommended after inputting the first feature vector, the historical object sequence and the identifier of the object to be recommended into the recommendation model; A recommendation module, configured to determine a target recommended object from the objects to be recommended according to the predicted scores; The device also includes a clustering module: The clustering module is used for the determination module to obtain the primary labels of the historical objects of the target user before determining the historical object sequence according to the labels of the objects to be recommended and the labels of the historical objects of the target user; group the historical objects with the same primary labels into a cluster; and use the clusters corresponding to the historical objects with the same primary labels as split clusters to obtain the secondary labels of the historical objects through a clustering algorithm; The determination module is specifically used to determine, when the label of the object to be recommended includes a secondary label, a target historical object from the secondary labels of the historical objects that is identical to the secondary label of the object to be recommended or whose similarity reaches a threshold; and determine a historical object sequence according to the target historical object.

16. The device according to claim 15, characterized in that The first feature vector includes: a target user feature vector; The output module is specifically used to process the historical object sequence and the identifier of the object to be recommended through the embedding layer to obtain the corresponding historical object sequence vector and the second feature vector of the object to be recommended; obtain the user sequence expression vector after weighted summation of the historical object sequence vector and the second feature vector through the activation layer; splice the target user feature vector and the user sequence expression vector, and then output the predicted score of the object to be recommended after passing through the fully connected layer and the sigmoid function.

17. The device according to claim 16, characterized in that The first feature vector also includes: a context feature vector; The acquisition module is further used to acquire a third feature vector of the object to be recommended; and calculate a cross feature vector of the target user feature vector and the third feature vector; The output module is also used to splice the target user feature vector, the third feature vector, the context feature vector, the cross feature vector and the user sequence expression vector, and then output the predicted score of the object to be recommended after passing through a fully connected layer and a sigmoid function.

18. The device according to claim 15, characterized in that The clustering module obtains the secondary label of the historical object through a clustering algorithm, including: The offline pre-trained matrix corresponding to each historical object is multiplied by the second code to obtain the offline vector corresponding to each historical object, wherein the second code is obtained by performing one-bit effective encoding representation on the obtained first code, and the first code is obtained by encoding and mapping the historical object identifier; according to the determined offline vector corresponding to each historical object, a secondary label of the historical object is obtained through a clustering algorithm.

19. The device according to claim 18, characterized in that The clustering module obtains the secondary label of each historical object through a clustering algorithm according to the offline vector corresponding to each historical object, including: The clusters corresponding to the historical objects with the same primary labels are taken as split clusters, and the center point and cluster cost function of the split cluster are determined according to the offline vectors corresponding to each historical object; According to the determined center point and cluster cost function of the split cluster, the binary cluster corresponding to the split cluster is determined, and the binary cluster with the smallest cost function is selected as the next split cluster. This step is repeated until the condition for terminating clustering is met to obtain the secondary label of the historical object.

20. The device according to claim 19, characterized in that The clustering module determines the binary cluster corresponding to the split cluster, including: Randomly select a historical object from the split cluster as the first sub-cluster, randomly select another historical object from the split cluster as the second sub-cluster, and determine the center points and cluster cost functions of the two clusters according to the offline vectors corresponding to the randomly selected historical objects; Select a historical object that is not divided into the first subcluster and the second subcluster from the split cluster, determine the distance from the historical object to the center point of the first subcluster and the second subcluster based on the offline vector corresponding to the historical object, select a cluster with a smaller corresponding distance from the first subcluster and the second subcluster, and include the selected historical object in the cluster; re-determine the center point and cluster cost function of the first subcluster and the second subcluster, and repeat this step until all historical objects in the split cluster are divided into the first subcluster or the second subcluster.

21. The device according to claim 18, characterized in that The device also includes an offline training module, which is used to obtain an offline pre-trained matrix corresponding to each historical object in the following manner: According to the pre-established offline model, for each sample pair in the sample set, the following operations are performed: The first matrix to be trained is multiplied by the second code corresponding to the identifier of the object to be predicted in a sample pair to obtain a vector to be predicted, and the second matrix to be trained is multiplied by the second code corresponding to the identifier of the target prediction object in the sample pair to obtain a target prediction vector; Outputting a prediction score according to a correlation score obtained by summing the dot product of the vector to be predicted and the target prediction vector; According to the prediction score output by the offline model, the label score corresponding to the sample pair used for training this time, and the preset offline model loss function, the optimizer is used to perform back propagation to iteratively optimize the offline model parameters until the offline model converges or the above operation is completed for each sample pair in the sample set, and a trained offline model is obtained, and the first matrix in the trained offline model is the offline pre-trained matrix obtained; Wherein, the sample pairs include positive sample pairs and negative sample pairs; The target prediction object identifier included in the positive sample pair is any object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length, and the to-be-predicted object identifier included in the positive sample pair is an object identifier other than the target prediction object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length; the label score corresponding to the positive sample pair is a first set value; The identification of the object to be predicted of the negative sample pair is obtained by random sampling relative to the positive sample pair; and the label score corresponding to the negative sample pair is a second set value.

22. A recommendation model training device, characterized in that: The device includes an input-output module and an iterative optimization module: The input-output module is used to perform the following operations for each sample data in the pre-acquired sample set according to the pre-established recommendation model: obtain the first feature vector of the target user according to the sample data; determine the historical sample object sequence according to the label of the sample object to be recommended obtained from the sample data and the label of the historical sample object of the target user, wherein the historical sample object represents the object corresponding to the historical sample behavior of the target user; after inputting the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended into the recommendation model, output the predicted score of the sample object to be recommended; The iterative optimization module is used to perform back propagation using an optimizer for each sample data in the pre-acquired sample set according to the predicted score, the real recommendation label of the sample object to be recommended and the pre-set recommendation model loss function, and perform iterative optimization of the recommendation model parameters until the recommendation model converges or the above operation is completed for each sample data in the pre-acquired sample set to obtain a trained recommendation model; The device also includes a clustering module: The clustering module is used for the input-output module to obtain the primary labels of the historical sample objects of the target user before determining the sequence of historical sample objects according to the labels of the sample objects to be recommended and the labels of the historical sample objects of the target user; group the historical sample objects with the same primary labels into one cluster; and use the clusters corresponding to the historical sample objects with the same primary labels as split clusters, and obtain the secondary labels of the historical sample objects through a clustering algorithm; The input-output module determines a historical sample object sequence according to the label of the sample object to be recommended and the label of the historical sample object of the target user, including: when the label of the sample object to be recommended includes a secondary label, determining a target historical sample object from the secondary labels of the historical sample objects that is identical to the secondary label of the sample object to be recommended or whose similarity reaches a threshold; and determining a historical sample object sequence according to the target historical sample object.

23. The device according to claim 22, characterized in that The first feature vector includes: a target user feature vector; The input-output module inputs the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended into the recommendation model, and then outputs the predicted score of the sample object to be recommended, including: The historical sample object sequence and the identifier of the sample object to be recommended are processed by the embedding layer to obtain the corresponding historical sample object sequence vector and the second feature vector of the sample object to be recommended; the historical sample object sequence vector and the second feature vector are weighted summed by the activation layer to obtain the user sequence expression vector; the target user feature vector and the user sequence expression vector are concatenated, and then passed through the fully connected layer and the sigmoid function to output the predicted score of the sample object to be recommended.

24. The device according to claim 23, characterized in that The first feature vector also includes: a context feature vector; The input-output module is further used to obtain a third feature vector of the sample object to be recommended; calculate a cross feature vector of the target user feature vector and the third feature vector; The input-output module, after inputting the first feature vector, the historical sample object sequence and the identifier of the sample object to be recommended into the recommendation model, outputs the predicted score of the sample object to be recommended, and further includes: After the target user feature vector, the third feature vector, the context feature vector, the cross feature vector and the user sequence expression vector are concatenated, the prediction score of the sample object to be recommended is output after passing through a fully connected layer and a sigmoid function.

25. The device according to claim 22, characterized in that The clustering module obtains the secondary label of the historical sample object through a clustering algorithm, including: The offline pre-trained matrix corresponding to each historical sample object is multiplied by the second code to obtain the offline vector corresponding to each historical sample object, wherein the second code is obtained by performing one-bit effective encoding representation on the obtained first code, and the first code is obtained by encoding and mapping the historical sample object identifier; according to the determined offline vector corresponding to each historical sample object, a secondary label of the historical sample object is obtained through a clustering algorithm.

26. The device according to claim 25, characterized in that The clustering module obtains the secondary label of each historical sample object through a clustering algorithm according to the offline vector corresponding to each historical sample object determined, including: The cluster corresponding to the historical sample objects with the same primary label is taken as the split cluster, and the center point and cluster cost function of the split cluster are determined according to the offline vector corresponding to each historical sample object; According to the determined center point and cluster cost function of the split cluster, the binary cluster corresponding to the split cluster is determined, and the binary cluster with the smallest cost function is selected as the next split cluster. This step is repeated until the condition for terminating clustering is met to obtain the secondary label of the historical sample object.

27. The device according to claim 26, characterized in that The clustering module determines the binary cluster corresponding to the split cluster, including: Randomly select a historical sample object from the split cluster as the first sub-cluster, randomly select another historical sample object from the split cluster as the second sub-cluster, and determine the center points and cluster cost functions of the two clusters according to the offline vectors corresponding to the randomly selected historical sample objects; A historical sample object that is not divided into the first subcluster and the second subcluster is selected from the split cluster, and the distance from the historical sample object to the center point of the first subcluster and the second subcluster is determined according to the offline vector corresponding to the historical sample object, and a cluster with a smaller corresponding distance is selected from the first subcluster and the second subcluster, and the selected historical sample object is included in the cluster; the center point and cluster cost function of the first subcluster and the second subcluster are re-determined, and this step is repeated until all historical sample objects in the split cluster are divided into the first subcluster or the second subcluster.

28. The device according to claim 25, characterized in that The device also includes an offline training module, which is used to obtain an offline pre-trained matrix corresponding to each historical sample object in the following manner: According to the pre-established offline model, for each sample pair in the sample set, the following operations are performed: The first matrix to be trained is multiplied by the second code corresponding to the identifier of the object to be predicted in a sample pair to obtain a vector to be predicted, and the second matrix to be trained is multiplied by the second code corresponding to the identifier of the target prediction object in the sample pair to obtain a target prediction vector; Outputting a prediction score according to a correlation score obtained by summing the dot product of the vector to be predicted and the target prediction vector; According to the prediction score output by the offline model, the label score corresponding to the sample pair used for training this time, and the preset offline model loss function, the optimizer is used to perform back propagation to iteratively optimize the offline model parameters until the offline model converges or the above operation is completed for each sample pair in the sample set, and a trained offline model is obtained, and the first matrix in the trained offline model is the offline pre-trained matrix obtained; Wherein, the sample pairs include positive sample pairs and negative sample pairs; The target prediction object identifier included in the positive sample pair is any object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length, and the to-be-predicted object identifier included in the positive sample pair is an object identifier other than the target prediction object identifier in the object identifier sequence corresponding to the object that interacts with the user behavior within the set time length; the label score corresponding to the positive sample pair is a first set value; The identification of the object to be predicted of the negative sample pair is obtained by random sampling relative to the positive sample pair; and the label score corresponding to the negative sample pair is a second set value.

29. A non-volatile computer storage medium, characterized in that: The computer storage medium stores an executable program, and the executable program is executed by a processor to implement any method described in claims 1 to 14.

30. A recommendation device, characterized in that The device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to implement the method steps described in any one of claims 1 to 14 when executing the program stored in the memory.

Citation Information

Patent Citations

  • Information recommendation method, device and equipment and storage medium

    CN111797318A

  • Commodity recommendation model training method, commodity recommendation method and device

    CN112598467A