Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. Based on the embodiments of the present application, all other embodiments obtained by the person skilled in the art based on the present application are included in the scope of protection of the present application.
In the technical scheme of the application, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the user accord with the regulations of related laws and regulations, and the public order is not violated.
In order to improve the matching degree of the content recommended to the user and the interest of the user, the embodiment of the application provides a content recommendation method, a content recommendation device, electronic equipment and a storage medium.
The following first describes a content recommendation method provided by the embodiment of the present application. The content recommendation method provided by the embodiment of the application can be applied to a server. The server may be an APP (Application) server capable of content recommendation, may be a website server capable of content recommendation, and the server is not limited by the present application, and may be any server capable of executing the content recommendation method of the present application.
The content recommendation method provided by the embodiment of the application can comprise the following steps:
Determining an interest feature vector of a target user every time a trigger condition is met, wherein the interest feature vector characterizes each interest and the weight of each interest;
responding to any session scene to meet content recommendation conditions about a target user, determining content to be recommended based on the current interest feature vector of the target user, and recommending the content to be recommended to the target user in the session scene;
the determination mode of the interest feature vector comprises the following steps:
the method comprises the steps of obtaining a plurality of target sequences corresponding to historical behaviors respectively, wherein the historical behaviors are behaviors sent by a target user in at least two session scenes in a specified time period, and the target sequence corresponding to each historical behavior comprises description information of a plurality of dimensions of the historical behavior;
Grouping the obtained target sequences to obtain a plurality of session sequences, wherein each session sequence comprises at least one target sequence, the historical behaviors corresponding to the at least one target sequence belong to the same session scene, and the occurrence time is positioned in the same sub-period of the designated time period;
Determining interest analysis results corresponding to each session sequence;
For each session scene, based on interest analysis results corresponding to the session scene, determining an interest change vector of the target user in the session scene for representing an interest change trend, wherein the interest analysis results corresponding to the session scene comprise interest analysis results corresponding to each appointed sequence, and the appointed sequence is a session sequence of which the historical behavior corresponding to the included target sequence belongs to the session scene;
based on the determined interest change vector, an interest feature vector is determined.
According to the scheme, the interest feature vector of the target user is determined every time the triggering condition is met, the content recommendation condition related to the target user is met in response to any session scene, the content to be recommended is determined based on the current interest feature vector of the target user, and the content to be recommended is recommended to the target user in the session scene. The interest feature vector is determined by utilizing the interest change trend of the target user in each session scene, so that the interest feature vector can more comprehensively represent the interest of the user, and the content to be recommended determined by utilizing the interest feature vector has high matching degree with the interest of the user. Therefore, the scheme of the application can improve the matching degree of the content recommended to the user and the interest of the user.
The following describes a content recommendation method provided by an embodiment of the present application with reference to the accompanying drawings.
Fig. 1 is a schematic flow chart of a content recommendation method provided by the present application. As shown in fig. 1, the method includes:
S101, determining an interest feature vector of a target user every time a trigger condition is met, wherein the interest feature vector characterizes each interest and the weight of each interest;
The trigger condition is a specified trigger condition, and one or more trigger conditions can be adopted. For example, one or more of an account number of the target APP logged in by the user, a time point when the user performs a specified action at the target APP, and a time point when the user reaches to periodically determine the interest feature vector of the target user may be used as the trigger condition. The specified behavior may be a predetermined operation behavior of a plurality of types of users, for example, different types of operation behaviors such as a search behavior, an information viewing behavior, and a transaction behavior of the users. Different APP's, corresponding appointed behavior can be different, the application does not limit the appointed behavior.
The interest feature vector of the target user may characterize each interest of the target user and the weight of each interest, and each time a trigger condition is met, the interest feature vector of the target user may be determined, thereby obtaining the latest interest feature vector of the target user.
The method for determining the interest feature vector of the target user comprises the steps A1-A5.
A1, acquiring a plurality of target sequences corresponding to historical behaviors, wherein the historical behaviors are behaviors sent by a target user in at least two session scenes in a specified time period, and the target sequence corresponding to each historical behavior comprises description information of a plurality of dimensions of the historical behavior.
The specified time period may be a time period having the current time point as the end time and the target time length. The current time is the time satisfying the triggering condition. For example, the target time period is one week, and the specified time period may be a time period from the current time point to one week before the current time point, and the plurality of historical behaviors are historical behaviors performed by the target user in at least two session scenes of the APP in a time interval from the current time point to one week before the current time point. The target time length can be set according to actual requirements, which is not limited by the application.
At least two session scenes related to the plurality of historical behaviors can be all session scenes of the APP.
The description information of the plurality of dimensions of the historical behavior may include, for example, information describing the behavior, information describing the time of occurrence of the behavior, and information describing a session scene in which the behavior occurs. The description information of the multiple dimensions may be different for different APPs, which is not limited by the present application.
And A2, grouping the obtained target sequences to obtain a plurality of session sequences, wherein each session sequence comprises at least one target sequence, the historical behaviors corresponding to the at least one target sequence belong to the same session scene, and the occurrence time is positioned in the same sub-period of the designated time period.
The specified time period may be divided into a plurality of subintervals. Illustratively, the time length of the designated time period is 24 hours, and the time length of each sub-period is 1 hour, the designated time period may be divided into 24 sub-periods. The sub-period can be divided according to actual requirements, and the application is not limited to this.
A target sequence belonging to the same session scene and having an occurrence time located in one sub-period of the specified time period may be determined to belong to the same session sequence. The target sequences in each session sequence are time-ordered, and the target sequences in each session sequence can be ordered in time order.
Step A3, determining interest analysis results corresponding to each session sequence;
It is understood that the time length corresponding to each sub-period is generally shorter, and the behavior corresponding to each target sequence included in each session sequence may be understood as the behavior of the user operating continuously in a short period. Thus, the user interests represented by the behaviors corresponding to the respective target sequences included in each of the session sequences are generally the same interests, and of course, the user interests represented by the behaviors corresponding to the respective target sequences included in each of the session sequences may be a plurality of interests.
By analyzing each target sequence included in any session sequence, it is possible to determine the interest of the target user, in particular, the interest of the target user, in the sub-period corresponding to the session sequence, which is characterized by the interest analysis result.
Each session sequence comprises at least one target sequence, each target sequence comprises description information of multiple dimensions of historical behaviors corresponding to the target sequence, and the description information of the multiple dimensions of the at least one target sequence included in each session sequence can be analyzed to obtain interest analysis results corresponding to the session sequence.
For example, in a session sequence, the target user views stock A, stock B, and stock C, which are all stocks related to new energy, it may be determined that the target user's interest in the sub-period corresponding to the session sequence is new energy.
And A4, determining an interest change vector for representing an interest change trend of the target user in each session scene based on an interest analysis result corresponding to the session scene, wherein the interest analysis result corresponding to the session scene comprises interest analysis results corresponding to each appointed sequence, and the appointed sequence is a session sequence of which the history behavior corresponding to the included target sequence belongs to the session scene.
The time sequence is arranged between the sub-periods corresponding to each session scene, so that for each session scene, according to the time sequence of the sub-periods of each session sequence of the session scene and the interest analysis result of each session sequence, the interest change vector representing the interest change trend can be determined.
For example, in one search session, there are session sequence 1, session sequence 2, and session sequence 3, where the subinterval corresponding to session sequence 1 is farthest from the current time point, and the subinterval corresponding to session sequence 2 is next to the subinterval corresponding to session sequence 3 is closest to the current time point. The interest analysis result corresponding to the session sequence 1 is new energy, the interest analysis result corresponding to the session sequence 2 is artificial intelligence, and the interest analysis result corresponding to the session sequence 3 is photovoltaic. It can be determined that the interest trend of the target user is new energy-artificial intelligence-photovoltaic in the search session. Thereby, the interest change vector representing the change trend can be generated by utilizing the analyzed interest change trend.
And step A5, determining an interest feature vector based on the determined interest change vector.
Each session scene corresponds to an interest change vector, so that the current interest feature vector of the target user can be determined by using each interest change vector. Each session scene corresponds to an interest change vector, and the interest change vector can represent the interest change trend under the session scene. Specifically, for each interest represented by each interest change vector, an initial weight of each interest may be determined according to a time of each interest on the time line, and for any interest, the closer the time of the interest on the time line is to the current time point, the higher the corresponding initial weight. The plurality of interest change vectors can comprise the same interest, and the weighting summation processing can be performed by utilizing a plurality of initial weights corresponding to the same interest in the plurality of interest change vectors, so that the weight of the interest can be obtained. And generating the interest feature vector of the target user by using the weight of each interest.
For example, the interest change vector 1, the interest change vector 2 and the interest change vector 3 all include an interest a, in the interest change vector 1, the initial weight of the interest a is 0.5, the weighting coefficient is 0.2, in the interest change vector 2, the initial weight of the interest a is 0.4, the weighting coefficient is 0.3, in the interest change vector 3, the initial weight of the interest a is 0.6, and the weighting coefficient is 0.5, and then the weight of the interest is 0.5×0.2+0.4×0.3+0.6×0.5=0.52. The weighting coefficients corresponding to the different interest change vectors may be preset. For example, the weighting coefficient of the interest change vector corresponding to the session scene may be set according to the session scene. The application does not limit the setting mode of the weighting coefficients corresponding to different fun change vectors.
S102, determining contents to be recommended based on the current interest feature vector of the target user in response to any session scene meeting the content recommendation condition about the target user, and recommending the contents to be recommended to the target user in the session scene.
The content recommendation of the present application may be specifically video recommendation, information recommendation, stock recommendation, commodity recommendation, etc. The content recommendation referred to may be different among different APPs, and the present application is not limited to APP and specific category of content recommendation.
And within an APP there may be multiple session scenarios where there are content recommendations. For example, one session scenario is an information recommendation session scenario in which content recommendation conditions concerning a target user may be that the user clicks information refresh, and the user performs information search, etc. The content recommendation conditions may be different for different session scenarios, which is not limited by the present application.
When any of the session scenes meets the content recommendation condition about the target user, the current interest feature vector of the target user can be utilized to determine the content to be recommended, wherein the content to be recommended matches the user interest. The current interest feature vector of the target user is the interest feature vector which is determined latest in the step S101.
Recommending the content to be recommended to the target user in the session scene, specifically, displaying the content to be recommended in an interface corresponding to the session scene, thereby realizing recommendation to the user.
According to the scheme, the interest feature vector of the target user is determined every time the triggering condition is met, the content recommendation condition related to the target user is met in response to any session scene, the content to be recommended is determined based on the current interest feature vector of the target user, and the content to be recommended is recommended to the target user in the session scene. The interest feature vector is determined by utilizing the interest change trend of the target user in each session scene, so that the interest feature vector can more comprehensively represent the interest of the user, and the content to be recommended determined by utilizing the interest feature vector has high matching degree with the interest of the user. Therefore, the scheme of the application can improve the matching degree of the content recommended to the user and the interest of the user.
Optionally, the determining the interest analysis result corresponding to each session sequence includes:
Converting each session sequence into a feature vector to obtain a feature vector corresponding to each session sequence;
and carrying out interest analysis on the feature vector of each session sequence to obtain interest analysis results corresponding to each session sequence.
Each session sequence is converted into a feature vector by a stochastic vectorization method or a pre-training model such as the BERT model (Bidirectional Encoder Representation from Transformers, a pre-training model), the Word2Vec model (a correlation model used to generate Word vectors), etc. The implementation of the vectorization is not limited by the present application.
By carrying out interest analysis on the feature vector of each session sequence, the vector corresponding to the interest of the user in the sub-period corresponding to each session sequence can be determined, and the determined vector corresponding to the interest of the sub-period corresponding to each session sequence is the interest analysis result.
Optionally, the determining the interest feature vector of the target user is implemented by using an interest extraction model;
The interest extraction model comprises a behavior dividing layer, a basic coding layer and an interest extraction layer;
The behavior dividing layer is used for grouping the obtained target sequences after obtaining the target sequences corresponding to the historical behaviors respectively to obtain a plurality of session sequences;
the basic coding layer is used for converting each session sequence into a session feature vector to obtain a feature vector corresponding to each session sequence;
The interest extraction layer is used for carrying out interest analysis on the feature vector of each session sequence to obtain an interest analysis result corresponding to each session sequence, determining an interest change vector of the target user in each session scene based on the interest analysis result corresponding to the session scene and used for representing the interest change trend, and determining the interest feature vector of the target user based on the determined interest change vector.
In the present application, the steps executed by the behavior partitioning layer, the basic coding layer and the interest extraction layer of the interest extraction model are described in the above embodiments, and are not described in detail herein.
The interest extraction model has the specific structure of a behavior dividing layer, a basic coding layer and an interest extraction layer. Therefore, according to the scheme, each time the trigger condition is met, the target sequence corresponding to each of the plurality of historical behaviors is obtained, and after the obtained target sequence corresponding to each of the plurality of historical behaviors is input into the interest extraction model, the interest feature vector of the target user can be obtained. Therefore, according to the scheme provided by the application, the interest feature vector of the target user can be determined more efficiently by utilizing the interest extraction model.
Optionally, the interest extraction layer comprises a first self-attention mechanism layer, a long-short-period memory network LSTM and a second self-attention mechanism layer;
The first self-attention mechanism layer is used for carrying out interest analysis on the feature vector of each session sequence to obtain an interest analysis result corresponding to each session sequence;
the long-short-term memory network LSTM is used for determining an interest change vector of the target user in each session scene for representing an interest change trend based on an interest analysis result corresponding to the session scene;
the second self-attention mechanism layer is used for analyzing interest change vectors of various session scenes to determine the weight of each interest of the target user, and generating an interest feature vector of the target user based on the determined weight of each interest.
That is, the determining the interest feature vector of the target user based on the determined interest change vectors may include analyzing the interest change vectors of the respective session scenes to determine weights of interests of each of the target users, and generating the interest feature vector of the target user based on the determined weights of each of the interests.
In this embodiment, the interest extraction layer may have a specific structure including a first self-attention mechanism layer, a long-short-term memory network LSTM, and a second self-attention mechanism layer. In the first self-attention mechanism layer, there may be multiple first self-attention mechanism networks, and each first self-attention mechanism network may perform interest analysis on feature vectors of a session sequence at the same time to obtain interest analysis results corresponding to the session sequence, that is, there may be multiple first self-attention mechanism networks processing multiple session sequences in parallel. The plurality of first self-attention mechanism networks can process each session sequence in parallel, so that interest analysis on feature vectors of the session sequence can be effectively improved, and the processing efficiency of interest analysis results corresponding to the session sequence is obtained.
Self-Attention mechanism (Self-Attention) is characterized in that the Attention relation among elements is calculated inside the same input sequence. The self-attention mechanism of the present application may provide support for extracting interest changes. The self-attention mechanism is included in both the first self-attention mechanism layer and the second self-attention mechanism layer, but the functions implemented by the self-attention mechanisms in the first self-attention mechanism layer and the second self-attention mechanism layer are different in the present application.
Optionally, the interest extraction layer further comprises a full connection layer;
The full connection layer is used for converting the dimension of the interest change vector of each session scene into the same dimension before analyzing the interest change vector of each session scene.
Because the number of actions performed by the target user in different session scenes may be different, the dimensions of the determined interest change vectors of each session scene may not be the same, and in order to improve the efficiency of performing analysis on the interest change vectors of each session scene, the dimensions of the interest change vectors of each session scene may be converted into the same dimension.
Optionally, the determining the content to be recommended includes steps B1-B3 based on the current interest feature vector of the target user.
And B1, generating an interest activation feature vector corresponding to each candidate content based on the current interest feature vector of the target user and the feature vector of the candidate content, wherein the interest activation feature vector comprises a vector of each interest with a degree of correlation with the feature vector of the candidate content greater than the target degree in the current interest feature vector.
The feature vector of each candidate content is determined using the attribute features of the candidate content, for example, one candidate content is news information about new energy stocks, and the attribute features of the candidate content may include new energy.
In one implementation, for each candidate content, generating, based on the current interest feature vector of the target user and the feature vector of the candidate content, an interest activation feature vector corresponding to the candidate content includes:
And inputting the current interest feature vector of the target user and the feature vector of the candidate content into a target attention mechanism model aiming at each candidate content, so that the target attention mechanism model determines the attention weight of each interest and/or each interest combination represented by the current interest feature vector, and constructs an interest activation feature vector corresponding to the candidate content based on the determined attention weight, wherein the attention weight of each interest is determined by using the weight of the interest, and the attention weight of each interest combination is determined by using the weight of each interest included by the interest combination.
Determining individual interests and/or individual interest combined Attention weights for the current feature vector characterization refers to capturing the portion of the user that is more interested in the candidate content, and in particular, may be calculated using an Attention mechanism (Attention mechanism). The core idea of the Attention mechanism is to make the model automatically focus on the key part and ignore the secondary information when processing complex information, thereby improving the efficiency and accuracy of information processing.
The attention is understood as a degree of attention. The higher the matching degree (degree of correlation) of the interest of any one of the current interest feature vector characterizations with the feature vector of the candidate content, the higher the corresponding attention weight. The attention weight may be dynamically assigned based on the current candidate content. The attention weight of each interest may be determined using a degree of matching of the interest to candidate content. And the attention weight of each interest can be dynamically adjusted based on the weight corresponding to the interest according to the matching degree of the interest and the candidate content. And it will be appreciated that a candidate information content may be associated with multiple interests of the user. For example, the interest feature vector of the current user comprises digital product interest (interest weight 0.9), sports interest (interest weight 0.8), mobile phone evaluation interest (interest weight 0.6) and food interest 0.7. The candidate content is the content related to the wireless earphone, the interest matching degree of the wireless earphone and the digital product is high, the attention weight of the interest of the digital product can be obtained to be 0.95, the matching degree of the wireless earphone and the sports interest is low, the attention weight of the sports can be obtained to be 0.2, the matching degree of the wireless earphone and the mobile phone evaluation interest is medium, the attention weight of the mobile phone evaluation interest is 0.5, the matching degree of the wireless earphone and the food evaluation interest is low, the attention weight of the food interest is 0.05, and the attention weight of the food interest irrelevant to the candidate content is low and can be ignored.
The individual interests combine attention weights and may characterize cross-dimensional relationships between multiple interests. For example, when the candidate content is a new energy vehicle, the current user's interest feature vector includes a new energy battery and a vehicle, and then the new energy battery interest and the vehicle interest may be focused on a combination, which may be given a higher attention weight. The attention weight of each interest group may be determined based on the weights of the respective interests included in the interest group.
According to the embodiment, through the attention mechanism, interference of irrelevant interests can be eliminated (if candidate contents are related to wireless headphones, attention weights of the delicious interests in the interest feature vectors are low, the delicious interests can be ignored), cross-dimension interest relationships (such as combined features of new energy battery interests and vehicle interests) can be identified, and different interest combinations can be activated for different candidate contents.
The interest activation vector may be used to measure the user's interest in candidate content.
According to the implementation mode, the current interest feature vector of the target user and the feature vector of the candidate content can be input into the target attention mechanism model for processing, and the interest activation feature vector corresponding to the candidate content can be obtained, so that the processing efficiency can be effectively improved.
Each interest activation feature vector can also comprise an interest feature vector and a feature vector of candidate content corresponding to the interest activation feature vector on the basis of comprising the attention weight.
Step B2, determining estimated click probability of each candidate content based on the interest activation feature vector corresponding to each candidate content and the feature vector used for representing the user portrait of the target user;
In the application, the estimated click probability of each candidate content can be determined by using a click probability estimation model.
The user portraits of the target users may include, for example, portraits data such as age, gender, region, risk level, etc., and specific contents contained in the user portraits may be different in different APP, which is not limited in the present application.
Specifically, the click rate estimation model may be obtained by training sample features of a plurality of sample users and true values corresponding to the sample features. For each sample user, the sample features of the sample user can be multiple, each sample feature is constructed at least by using the sample interest activation feature vector of the sample user and the feature vector of the sample user portrait, and the true value of each sample feature is the probability that the sample user actually clicks the candidate content corresponding to the sample interest activation feature vector. In the training process of the click rate estimation model, parameters of the click rate estimation model can be adjusted according to the difference between the estimated probability determined by the click rate estimation model aiming at sample characteristics and the sample true value until the click rate estimation model converges.
The click rate estimation model can be trained periodically, so that the updated click rate estimation model can more accurately determine the estimated click probability of each candidate content. And training the model obtained by the last training when the click rate estimation model is trained.
The determining the estimated click probability of each candidate content based on the interest activation feature vector corresponding to each candidate content and the feature vector for representing the user portrait of the target user comprises:
and determining estimated click probability of each candidate content based on the interest activation feature vector corresponding to each candidate content, the feature vector used for representing the user portrait of the target user and the label click feature.
The tab click feature may include the number of clicks of the target user on each tab (tab), as well as the number of clicks each tab is clicked on by all users. Specifically, each recommended content has a corresponding label, and when the user clicks on the content, the user adds 1 to the number of labels corresponding to the recommended content, and different recommended contents may have the same label. The label clicking characteristics can represent personalized data of the users and general data of each user, so that clicking rate estimation is performed by utilizing the label clicking characteristics, and the accuracy of clicking rate estimation can be further improved.
In this embodiment, when the click rate estimation model is trained, each sample feature may use a sample interest activation feature vector of the sample user, a feature vector construction of a sample user portrait, and the tag click feature construction. In addition, the training of the click rate estimation model in this embodiment is the same as the training process of the click rate estimation model in the above embodiment, and will not be described in detail here.
And B3, arranging each candidate content according to the estimated click probability from large to small, and selecting N candidate contents which are arranged at the front as the contents to be recommended.
The number of N may be set according to actual requirements, which is not limited in the present application.
The higher the estimated click probability of the candidate content is, the higher the matching degree of the candidate content and the user interest is, so that the N candidate contents which are arranged at the front are N pieces with the highest matching degree with the user interest in each candidate content.
In the following, a content recommendation method according to the present application will be described by way of a specific embodiment.
Fig. 2 is a schematic structural diagram of a plurality of modules for implementing the content recommendation method of the present application.
The three modules for realizing the content recommendation method of the application as shown in fig. 2 are a data acquisition module, a model construction and training module and a model deployment module respectively.
In this implementation, the APP used by the user may be a financial APP, which may have functions of stock exchange, information recommendation, information search, and the like.
The data acquisition module can acquire various user behavior sequences, user day-level sequences, user portraits, pre-estimated portrayal features and other features from the App buried points and the attribute table. The user behavior sequence, the user level sequence, the user portraits, the pre-estimate portraits features and other features shown in fig. 2 are acquired by the data acquisition module.
The behavior sequence can comprise a behavior sequence corresponding to the behaviors of clicking, purchasing, browsing, searching and the like of a user and an account day-level state sequence, wherein the account day-level state sequence refers to the fund condition and the holding share of the user after closing the city every day for nearly X days, namely, the fund and the holding state change of the user. The X can be set according to actual requirements. The behavior sequence corresponds to the target sequence of the above embodiment. The other features may include the number of clicks of the target user on each tag (label) and the number of clicks of each tag by all users, specifically, each recommended content has a corresponding label, and if the user clicks on the content, the number of labels corresponding to the recommended content is added by 1 by the user, and different recommended contents may have the same label. The estimated portrait features are the feature vectors of the candidate contents.
And the step executed by the data acquisition module corresponds to the step of acquiring the target sequence corresponding to each of the plurality of historical behaviors.
The model construction module can fit the click rate of the characteristics of each sequence and the predicted portrait characteristics acquired by the data acquisition module.
The overall structure of the model building and training module is shown in fig. 3, and comprises 5 layers from bottom to top, specifically comprises a user behavior division layer (i.e. the behavior division layer of fig. 2), a feature vectorization representation layer (i.e. the feature representation layer of fig. 2), a user interest extraction layer (i.e. the interest extraction layer of fig. 2), a user interest activation layer (i.e. the interest adaptation layer of fig. 2) and a click rate estimation layer. The user's overall behavior sequence, target item features, user portraits, and other features are inputs to the model depicted in FIG. 3. The all behavior sequences of the user are all behavior sequences of the user, and the target item features are the pre-estimated portrait features.
And the user behavior dividing layer is used for dividing the user behaviors. Specifically, the behavior sequence of the user is divided into fine granularity, and the behavior sequence is divided into different behavior sessions according to scenes and time intervals, wherein each session is ordered according to time sequence, and the behavior sequence of the user in one or more similar scenes in a time period is represented.
The user behavior division layer corresponds to the behavior division layer in the above embodiment.
The user behavior sequence is divided into a user real-time behavior sequence and a user day-level state sequence according to the characteristic attribute.
For example, as shown in fig. 4, the user real-time behavior sequence may be divided into four session scenarios, user click session, user search session, user delegated session, and user undo session. In each session scenario, a plurality of session sequences may be included, session sequence 1-session sequence n. Each session sequence comprises at least one target sequence, the historical behaviors corresponding to the at least one target sequence belong to the same session scene, and the occurrence time is located in a subperiod of the designated time period.
As shown in fig. 5, the user day state sequence may be divided into a user fund state and a user stock state. The user fund status and the user stock status belong to a session sequence. The user fund state session sequence can comprise fund information of the user in a specified time period, and the user stock holding state session sequence can comprise information of stocks held by the user in the specified time period.
The feature representation layer is used for carrying out feature vectorization, and is a basic coding layer, a user finishes embedded coding on features such as a user behavior sequence, a user portrait, a pre-estimated information portrait and the like and outputs the features to the downstream in a dense vector mode, and a random vectorization method or a pre-training model (such as BERT and Word2 Vec) vectorization method is generally used for obtaining a vector Wembedding during vectorization. The position information is also important information when performing sequence processing, so that when vectorizing the user sequence, sequence information, namely a position vector Pembedding, is added, and the final vector expression PWembedding = Wembedding + Pembedding is obtained after the Wembedding and Pembedding are overlapped. Wherein Pembedding can be generated by referring to the following formula:
;
。
Wherein PE is position coding, i.e. a position vector, pos is a position number in the sequence, i is a dimension index of the embedded vector, and d is a total dimension of the embedded vector.
The process flow of the user interest extraction layer is shown in fig. 6, and is used for receiving dense vectors of different sessions of the user, extracting user interest for each session according to a self-attention mechanism (the self-attention mechanism corresponds to the first self-attention mechanism layer of the above embodiment), such as session 1-session n corresponding to a user delegated session and session 1-session n corresponding to a user revoked session, sending the results of different sessions of the same category into an LSTM, learning the evolution rule of the user interest through extracting the relationship between sessions, and sending the results to the next self-attention mechanism (the self-attention mechanism corresponds to the second self-attention mechanism layer of the above embodiment) together after unifying their dimensions by using a layer of full-connection layer, and extracting the most important interest points of the current user to form the user interest vector.
The user interest extraction layer of the present embodiment corresponds to the interest extraction layer of the above embodiment.
The user interest activation layer, as shown in fig. 7, is configured to receive the user interest vector generated by the user interest extraction layer, combine the attribute vector of the estimated information, that is, the estimated information vector, and extract, through an attention mechanism, a portion with the greatest relationship between the user interest vector and the current estimated information vector, that is, specifically, activate the interest path of the user interest related to the estimated target, so as to generate an activated vector after the user interest is activated, which is used for click rate estimation of the click rate estimation layer.
The step executed by the user interest activation layer corresponds to the interest activation feature vector corresponding to each candidate content based on the current interest feature vector of the target user and the feature vector of the candidate content. And the activated vector after the user interest is activated is the interest activated feature vector.
The click rate estimating layer is used for estimating the click rate as shown in fig. 8, and the click rate estimating layer is used for carrying out vector splicing on the activation vector generated by the user interest activating layer and the vector representation of the user portrait vector and other characteristics, namely other characteristic vectors, and then sending the vector to an MLP (multi-layer perceptron) to carry out click rate estimation. Concatate is a pointing quantity concatenation in fig. 8.
The click rate estimation layer executes the steps corresponding to the step of determining the content to be recommended based on the current interest feature vector of the target user. The click rate estimation layer in this embodiment corresponds to the click rate estimation model in the above embodiment.
The model deployment module belongs to an online real-time reasoning part, stores the model acquired by the previous module according to two stages and stores the model as a user interest extraction model and a click rate estimation model respectively, wherein the user interest extraction model comprises a user behavior classification layer, a feature vectorization representation layer and a user interest extraction layer, the user interest extraction model of the embodiment corresponds to the interest extraction model of the embodiment, and the click rate estimation model comprises a user interest adaptation layer and a click rate estimation layer.
And the user interest extraction service is used for starting the service when the user generates any appointed user behavior in the App, calculating the user interest again and storing the user interest into the memory. The step performed by the user interest extraction service corresponds to S101 described above. The user interest extraction in the model deployment module of fig. 2 is implemented using a user interest extraction model.
And the click rate estimation service is triggered when the user requests the recommended scene, the reasoning service performs recall and click rate estimation operation, and when the click rate is estimated, the information attribute of each recall is used for matching the user interest, and then the user portrait and other features are combined for click rate estimation and score sorting calculation. The click rate estimation service corresponds to the click rate estimation model of the above embodiment. Click rate estimation in the model deployment module of fig. 2 is implemented using a click rate estimation model.
As shown in fig. 9, when the App sends out a specified user behavior, the user interest extraction service is triggered, the user interest is calculated, and the interest feature of the user is obtained and stored in the Redis (a memory). The interest extraction service specifically realizes user interest extraction by using a model.
And after the user sends out a user request at the App, the model can be triggered to estimate the click rate, and the recommendation service is performed according to the estimated click rate so as to recommend the determined recommendation result to the user.
The content recommendation method of the embodiment is not limited in length of the user behavior sequence, and can be suitable for an ultra-long sequence, namely, the scheme can be used for processing no matter how many users act on the user, and can be used for rapidly processing even if the number of the users act on the user is large due to the model structure related to the scheme of the application, so that the processing efficiency is high. The scheme of the embodiment is not limited to the type of the user behavior sequence, and the behavior sequences of various session scenes can be applied to the scheme of the application. The method has higher scheme efficiency, namely the parallel calculation of the attention mechanism can improve the timeliness of model training and calculation. The scheme of the application is simple and convenient to operate, the model structure can be suitable for various recommended scenes, and the adaptability is high. The method and the device can improve the accuracy and the precision of content recommendation, wherein the model can accurately extract the user interests and the local activation interests, can improve the recall rate of the model, and finally shows the online benefits, namely the accuracy of online recommendation effects is improved.
Based on the embodiment content of the content recommendation method, the embodiment of the application also provides a content recommendation device. Fig. 10 is a schematic structural diagram of a video recommendation device according to an embodiment of the present application, and as shown in fig. 10, the video recommendation device may include:
a determining module 1001, configured to determine an interest feature vector of a target user each time a trigger condition is satisfied, where the interest feature vector characterizes each interest and a weight of each interest;
A recommendation module 1002, configured to determine content to be recommended based on a current interest feature vector of a target user in response to any session scene meeting a content recommendation condition about the target user, and recommend the content to be recommended to the target user in the session scene;
the determination mode of the interest feature vector comprises the following steps:
the method comprises the steps of obtaining a plurality of target sequences corresponding to historical behaviors respectively, wherein the historical behaviors are behaviors sent by a target user in at least two session scenes in a specified time period, and the target sequence corresponding to each historical behavior comprises description information of a plurality of dimensions of the historical behavior;
Grouping the obtained target sequences to obtain a plurality of session sequences, wherein each session sequence comprises at least one target sequence, the historical behaviors corresponding to the at least one target sequence belong to the same session scene, and the occurrence time is positioned in the same sub-period of the designated time period;
Determining interest analysis results corresponding to each session sequence;
for each session scene, based on interest analysis results corresponding to the session scene, an interest change vector of the target user in the session scene for representing an interest change trend is determined, wherein the interest analysis results corresponding to the session scene comprise interest analysis results corresponding to each designated sequence, the designated sequence is a session sequence of which the historical behaviors corresponding to the included target sequence belong to the session scene, and based on the determined interest change vector, an interest feature vector is determined.
Optionally, the determining the interest analysis result corresponding to each session sequence includes:
Converting each session sequence into a feature vector to obtain a feature vector corresponding to each session sequence;
and carrying out interest analysis on the feature vector of each session sequence to obtain interest analysis results corresponding to each session sequence.
Optionally, the recommendation module includes:
The generation unit is used for generating an interest activation feature vector corresponding to each candidate content based on the current interest feature vector of the target user and the feature vector of the candidate content, wherein the interest activation feature vector comprises a vector of each interest with a degree of correlation with the feature vector of the candidate content being greater than a target degree in the current interest feature vector;
The determining unit is used for determining estimated click probability of each candidate content based on the interest activation feature vector corresponding to each candidate content and the feature vector used for representing the user portrait of the target user;
And the selecting unit is used for arranging each candidate content from large to small according to the estimated click probability and selecting N candidate contents which are arranged at the front as the contents to be recommended.
Optionally, the determining the interest feature vector of the target user is implemented by using an interest extraction model;
The interest extraction model comprises a behavior dividing layer, a basic coding layer and an interest extraction layer;
The behavior dividing layer is used for grouping the obtained target sequences after obtaining the target sequences corresponding to the historical behaviors respectively to obtain a plurality of session sequences;
the basic coding layer is used for converting each session sequence into a session feature vector to obtain a feature vector corresponding to each session sequence;
The interest extraction layer is used for carrying out interest analysis on the feature vector of each session sequence to obtain an interest analysis result corresponding to each session sequence, determining an interest change vector of the target user in each session scene based on the interest analysis result corresponding to the session scene and used for representing the interest change trend, and determining the interest feature vector of the target user based on the determined interest change vector.
Optionally, the interest extraction layer comprises a first self-attention mechanism layer, a long-short-period memory network LSTM and a second self-attention mechanism layer;
The first self-attention mechanism layer is used for carrying out interest analysis on the feature vector of each session sequence to obtain an interest analysis result corresponding to each session sequence;
the long-short-term memory network LSTM is used for determining an interest change vector of the target user in each session scene for representing an interest change trend based on an interest analysis result corresponding to the session scene;
the second self-attention mechanism layer is used for analyzing interest change vectors of various session scenes to determine the weight of each interest of the target user, and generating an interest feature vector of the target user based on the determined weight of each interest.
Optionally, the interest extraction layer further comprises a full connection layer;
The full connection layer is used for converting the dimension of the interest change vector of each session scene into the same dimension before analyzing the interest change vector of each session scene.
Optionally, the generating unit includes:
And the construction subunit is used for inputting the current interest feature vector of the target user and the feature vector of the candidate content into a target attention mechanism model aiming at each candidate content, so that the target attention mechanism model determines the attention weight of each interest and/or each interest combination represented by the current interest feature vector, and constructs an interest activation feature vector corresponding to the candidate content based on the determined attention weight, wherein the attention weight of each interest is determined by using the weight of the interest, and the attention weight of each interest combination is determined by using the weight of each interest included by the interest combination.
The embodiment of the invention also provides an electronic device, as shown in fig. 11, which comprises a processor 1101, a communication interface 1102, a memory 1103 and a communication bus 1104, wherein the processor 1101, the communication interface 1102 and the memory 1103 complete communication with each other through the communication bus 1104.
A memory 1103 for storing a computer program;
the processor 1101 is configured to implement any of the content recommendation methods described above when executing the program stored in the memory 1103.
The communication bus mentioned above for the electronic device may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The Processor may be a general-purpose Processor including a central processing unit (Central Processing Unit, CPU), a network Processor (Network Processor, NP), etc., or may be a digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components.
In yet another embodiment of the present invention, there is also provided a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of any of the content recommendation methods described above.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the content recommendation method of any of the above embodiments.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present invention, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, by wired (e.g., coaxial cable, optical fiber, digital Subscriber Line (DSL)), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk Solid STATE DISK (SSD)), etc.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.