CN110795618A - Content recommendation method, device, equipment and computer readable storage medium - Google Patents

Content recommendation method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN110795618A
CN110795618A CN201910869110.4A CN201910869110A CN110795618A CN 110795618 A CN110795618 A CN 110795618A CN 201910869110 A CN201910869110 A CN 201910869110A CN 110795618 A CN110795618 A CN 110795618A
Authority
CN
China
Prior art keywords
session
neighbor
current
recommendation
content
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910869110.4A
Other languages
Chinese (zh)
Inventor
张峻旗
白冰
林�也
白琨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910869110.4A priority Critical patent/CN110795618A/en
Publication of CN110795618A publication Critical patent/CN110795618A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/048Activation functions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent

Abstract

The embodiment of the application discloses a content recommendation method, a content recommendation device, content recommendation equipment and a computer readable storage medium, wherein the method comprises the following steps: coding the current conversation based on the trained recommendation model to obtain the current conversation code; based on the current session coding, coding the neighbor sessions in the neighbor session set by adopting an attention mechanism to obtain neighbor session codes; wherein the neighbor session set comprises a session set formed by selecting based on similarity with the current session, and the occurrence time of neighbor sessions in the neighbor session set is before the occurrence time of the current session; and generating a recommendation result of the next content of the current session according to the current session code and the neighbor session code. By the aid of the method and the device, the problem that the accuracy of the recommendation result is low in a traditional recommendation mode can be solved, and the accuracy of the recommendation result is improved.

Description

Content recommendation method, device, equipment and computer readable storage medium
Technical Field
The present application relates to the field of content recommendation technologies, and in particular, to a content recommendation method, apparatus, device, and computer-readable storage medium.
Background
With the rapid development of networks, how to accurately find the information needed by the user in a huge information base is a research hotspot of the technicians in the field.
In the prior art, the conventional recommendation technology mainly includes the following two recommendation methods: the first category is content-based recommendation methods; the second category is collaborative filtering based recommendation methods. The recommendation method based on content matching or collaborative filtering requires user identity information, namely, the user needs to perform login operation; in some practical scenarios, this condition is not met, for example, some users pay great attention to privacy, or current operations occur on strange devices. Therefore, recommendation based on a session initiated by an anonymous user is a more adaptable recommendation mode.
Based on the recommendation of a session initiated by a non-named user, a recommendation method for modeling a current session by using a Recurrent Neural Network (RNN) is used in the prior art, and the method mainly comprises a session recommendation algorithm based on the Recurrent Neural Network (RNN) and an improvement thereof. However, the recommendation method for modeling the current session using the recurrent neural network is limited by some undesirable characteristics of the session because subsequent recommendations are made based on the current session only, and not only is the length of the session short and the information contained in the session is limited, but also a lot of noise exists in the session, that is, there is a possibility that the user may operate by mistake or operate unintentionally.
Based on the recommendation of the Session initiated by the user without name, a Session-based K-nearest neighbor recommendation method (Session-based KNN, SKNN) is also available in the prior art, and is a relatively traditional method. Firstly, artificially setting a similarity measurement, calculating the similarity between a current session and each historical session, and selecting N adjacent sessions which are most similar to the current session; then, for the articles contained in the neighboring conversation, the method carries out weighted summation according to the corresponding similarity to obtain the relevance measurement of each article and the current conversation, thereby carrying out recommendation. The method acquires relevant information from historical conversations for recommendation, and the performance of the method depends on the establishment of manual rules, namely how to select neighbor conversations, however, the manually established rules cannot guarantee the optimal results. In addition, the method ignores the local information of the current session, and the accuracy of the recommendation result is not high.
Disclosure of Invention
The embodiment of the application provides a content recommendation method, a related device, equipment and a computer readable storage medium, which can solve the problem that the accuracy of a recommendation result is not high in a traditional recommendation mode and improve the accuracy of the recommendation result.
In a first aspect, an embodiment of the present application provides a content recommendation method, where the method includes:
coding the current conversation based on the trained recommendation model to obtain the current conversation code;
based on the current session coding, coding the neighbor sessions in the neighbor session set by adopting an attention mechanism to obtain neighbor session codes; wherein the neighbor session set comprises a session set formed by selecting based on similarity with the current session, and the occurrence time of neighbor sessions in the neighbor session set is before the occurrence time of the current session;
and generating a recommendation result of the next content of the current session according to the current session code and the neighbor session code.
By implementing the embodiment of the application, the content condition in the similar conversation is dynamically considered, the accuracy of content recommendation is improved, specifically, the attention mechanism is introduced, the modeling capability of the current conversation and the auxiliary information introduced by the neighbor method are organically combined, the dependence of the traditional recommendation method on artificial rules is reduced, and the accuracy of content recommendation is improved. In order to achieve the content recommendation accuracy of the application, the application dynamically considers the content situation in the similar conversation and introduces the attention mechanism, so that compared with the prior art, the operation efficiency is higher, the occupied computer operation resources are less, and the computer performance can be improved.
In one possible implementation manner, the encoding, based on the current session encoding, a neighbor session in a neighbor session set by using an attention mechanism to obtain a neighbor session encoding includes:
based on the current session encoding, calculating an attention score of each content of the current session and a neighboring session in the set of neighboring sessions respectively by adopting an attention mechanism;
and summing the attention scores of each content in the neighbor sessions according to the calculated attention scores to obtain neighbor session codes.
That is to say, the embodiment of the present application considers the specific situation of the current session, dynamically senses each content in the neighbor session, and obtains the neighbor session code for subsequent content recommendation, so that the accuracy of content recommendation can be improved.
In one possible implementation, the calculating, based on the current session encoding, an attention score of each content of the current session and a neighboring session in the set of neighboring sessions by using an attention mechanism includes:
converting the neighbor sessions in the neighbor session set into embedded layer representations to obtain embedded layer representations corresponding to each content of the neighbor sessions;
respectively calculating the correlation of the current session coding and the embedded layer representation corresponding to each content;
and carrying out weight normalization on the calculated correlation to obtain the attention score.
According to the embodiment of the application, the relevance of the current session code and the embedded layer representation corresponding to each content is calculated, and then weight normalization is carried out, so that subsequent content recommendation can be completed more accurately and efficiently.
In one possible implementation manner, the encoding the current session based on the trained recommendation model to obtain a current session code includes:
converting the current conversation into embedded layer representation to obtain embedded layer representation corresponding to the content in the current conversation;
and inputting the embedded layer representation corresponding to the content in the current conversation into a neural network as a sequence, and outputting to obtain the current conversation code.
In one possible implementation manner, before encoding a neighbor session in a neighbor session set based on the current session encoding by using an attention mechanism, the method further includes:
obtaining a candidate session set according to the occurrence time of the current session; the occurrence time of the sessions in the candidate session set is before the occurrence time of the current session;
calculating the similarity between the current session and the sessions in the candidate session set;
and selecting the sessions with the similarity meeting the requirement from the candidate session set to form a neighbor session set.
According to the embodiment of the application, the specific information of the current conversation is considered, and the historical conversations with high similarity are combined with the similarity of the current conversation to form the neighbor conversation set, so that the subsequent content recommendation can be completed more accurately and efficiently.
In one possible implementation manner, the generating a recommendation result of the next content of the current session according to the current session encoding and the neighbor session encoding includes:
inputting the current session code and the neighbor session code into a full connection layer, and outputting to obtain a demand code of the current session;
and calculating the recommendation degree of the contents to be recommended of the current session according to the requirement codes, and taking one or more contents to be recommended with the recommendation degree meeting requirements as the next contents of the current session.
In one possible implementation manner, the encoding of the current session based on the trained recommendation model further includes training the recommendation model before the current session is encoded;
the training the recommendation model comprises:
coding the sample session based on the recommendation model to obtain a sample session code;
based on the sample session coding, coding the neighbor sample session in the neighbor sample session set by adopting an attention mechanism to obtain neighbor sample session coding; wherein the neighbor sample session set comprises a session set composed based on similarity to the sample session, and the occurrence time of a neighbor session in the neighbor sample session set is before the occurrence time of the sample session;
and generating a sample recommendation result of the next content of the sample session according to the sample session code and the neighbor sample session code, and updating parameters of the recommendation model by taking the last content in the sample session as a target recommendation result, so that the generated sample recommendation result is matched with the target recommendation result.
The method and the device can perform offline training on a preset recommendation model, can use one of historical conversations as a sample conversation, use the last content appearing in the sample conversation as a target recommendation result, and introduce an attention mechanism to combine sample conversation coding and neighbor sample conversation coding to train the recommendation model, so that the trained recommendation model is obtained.
In a second aspect, an embodiment of the present application provides a content recommendation apparatus, which includes means for performing the method of the first aspect. In particular, the device may comprise at least:
the first coding unit is used for coding the current conversation based on the trained recommendation model to obtain the current conversation code;
the second encoding unit is used for encoding the neighbor sessions in the neighbor session set by adopting an attention mechanism based on the current session encoding to obtain neighbor session encoding; wherein the neighbor session set comprises a session set formed by selecting based on similarity with the current session, and the occurrence time of neighbor sessions in the neighbor session set is before the occurrence time of the current session;
and the recommendation result generation unit is used for generating a recommendation result of the next content of the current session according to the current session code and the neighbor session code.
In a third aspect, an embodiment of the present application provides a content recommendation device, including a processor, where the processor is configured to call stored program instructions to execute the method of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium storing a computer program comprising program instructions that, when executed by a processor, cause the processor to perform the method of the first aspect.
In a fifth aspect, embodiments of the present application further provide a computer program, where the computer program includes program instructions, and the program instructions, when executed by a processor, cause the processor to execute the method of the first aspect.
It should be understood that the second to fifth aspects of the present application are consistent with the technical solutions of the first aspect of the present application, and the beneficial effects obtained by the aspects and the corresponding possible embodiments are similar, and are not described again.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings used in the description of the embodiments will be briefly introduced below.
Fig. 1 is a schematic diagram of an architecture of a content recommendation system according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a content recommendation method according to an embodiment of the present application;
fig. 3 is a schematic diagram illustrating a recommendation principle of a content recommendation method according to an embodiment of the present application;
FIG. 4 is a schematic flowchart of a recommendation model training method provided in an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating a content recommendation method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a content recommendation device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a content recommendation device according to an embodiment of the present application;
fig. 8 is a schematic block diagram of another content recommendation apparatus in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
In order to better understand the content recommendation method provided by the embodiment of the present application, some concepts related to the present application are explained first.
The session in this embodiment of the present application refers to a click behavior or a browsing behavior of the anonymous user in a time interval when the anonymous user communicates with the interactive system or the interactive platform or the interactive application (hereinafter, collectively referred to as the interactive system). A user without a name is a user who has not logged in for the user identity.
The conversation in the embodiment of the application includes content (or referred to as an article), and the content in the conversation may be different according to different interactive systems, for example, if the interactive system is a news information system, the content in the conversation may be news; if the interactive system is a life sharing system, the content of the conversation can be life information shared by other users; if the interactive system is a multimedia sharing system, the content of the session can be multimedia information such as video and audio.
The content recommendation in the embodiment of the application may be to recommend the next content to the unknown user by combining the neighboring session corresponding to the current session according to the part of the unknown user where the current session has occurred.
Specifically, the content recommendation method according to the embodiment of the present application may be applied to the following scenario a, scenario B, and scenario C, but the content recommendation method according to the embodiment of the present application is not limited to these three application scenarios. The following briefly introduces scene a, scene B, and scene C, respectively.
Scene A:
when a certain anonymous user opens a news information system and enters a news information browsing page, the anonymous user can browse news in the current page based on the current page, the current news browsing behavior forms a current session, and the next news can be recommended to the anonymous user on line by the content recommendation method of the embodiment of the application in the process of browsing the news.
Scene B:
a certain anonymous user opens a life sharing system, after entering a browsing page of the life sharing of the system, the user can upload shared life information including life information such as tourism, makeup, diet and the like to other users based on the current page, the current behavior of browsing the life information forms a current session, and the user can recommend next life information to the user online through the content recommendation method of the embodiment of the application in the process of browsing the life information.
Scene C:
the method comprises the steps that a certain user without a name opens a multimedia sharing system, after the user without a name enters a browsing page of the system for multimedia sharing, shared multimedia information can be uploaded on the browsing system or other users based on a current page, the behavior of the current browsing multimedia information forms a current session, and the user without a name can recommend next multimedia information to the user without a name on line through the content recommendation method of the embodiment of the application in the process of browsing multimedia information.
Since the embodiments of the present application relate to the application of a neural network, for the convenience of understanding, the related terms and related concepts such as the neural network related to the embodiments of the present application will be described below.
(1) Neural network
The neural network may be composed of neural units, the neural units may refer to operation units with xs and intercept 1 as inputs, and the output of the operation units may be:
where s is 1, 2, … … n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is an activation function (activation functions) of the neural unit for introducing a nonlinear characteristic into the neural network to convert an input signal in the neural unit into an output signal. The output signal of the activation function may be used as an input to the next convolutional layer. The activation function may be a sigmoid function. A neural network is a network formed by a number of the above-mentioned single neural units joined together, i.e. the output of one neural unit may be the input of another neural unit. The input of each neural unit can be connected with the local receiving domain of the previous layer to extract the characteristics of the local receiving domain, and the local receiving domain can be a region composed of a plurality of neural units.
(2) Deep neural network
Deep Neural Networks (DNNs), also known as multi-layer neural networks, can be understood as neural networks having many hidden layers, where "many" has no particular metric. From the division of DNNs by the location of different layers, neural networks inside DNNs can be divided into three categories: input layer, hidden layer, output layer. Generally, the first layer is an input layer, the last layer is an output layer, and the middle layers are hidden layers. Layer andthe layers are all connected, that is, any neuron in the ith layer is necessarily connected with any neuron in the (i + 1) th layer. Although DNN appears complex, it is not really complex in terms of the work of each layer, simply the following linear relational expression:
Figure BDA0002201440780000072
wherein the content of the first and second substances,
Figure BDA0002201440780000073
is the input vector of the input vector,
Figure BDA0002201440780000074
is the output vector, b is the offset vector, W is the weight matrix (also called coefficient), α () is the activation function
Figure BDA0002201440780000075
Obtaining the output vector through such simple operation
Figure BDA0002201440780000076
Due to the large number of DNN layers, the number of coefficients W and offset vectors b is also large. The definition of these parameters in DNN is as follows: taking coefficient W as an example: assume that in a three-layer DNN, the linear coefficients of the 4th neuron of the second layer to the 2 nd neuron of the third layer are defined as
Figure BDA0002201440780000077
The superscript 3 represents the number of layers in which the coefficient W is located, while the subscripts correspond to the third layer index 2 of the output and the second layer index 4 of the input. The summary is that: the coefficients of the kth neuron of the L-1 th layer to the jth neuron of the L-1 th layer are defined as
Figure BDA0002201440780000078
Note that the input layer is without the W parameter. In deep neural networks, more hidden layers make the network more able to depict complex situations in the real world. Theoretically, the more parameters the higher the model complexity, the "capacity" isThe larger the "the more complex the learning task it means. The final goal of the process of training the deep neural network, i.e., learning the weight matrix, is to obtain the weight matrix (the weight matrix formed by the vectors W of many layers) of all the layers of the deep neural network that is trained.
(3) Convolutional neural network
A Convolutional Neural Network (CNN) is a deep neural network with a convolutional structure. The convolutional neural network includes a feature extractor consisting of convolutional layers and sub-sampling layers. The feature extractor may be viewed as a filter and the convolution process may be viewed as convolving an input image or convolved feature plane (feature map) with a trainable filter. The convolutional layer is a neuron layer for performing convolutional processing on an input signal in a convolutional neural network. In convolutional layers of convolutional neural networks, one neuron may be connected to only a portion of the neighbor neurons. In a convolutional layer, there are usually several characteristic planes, and each characteristic plane may be composed of several neural units arranged in a rectangular shape. The neural units of the same feature plane share weights, where the shared weights are convolution kernels. Sharing weights may be understood as the way image information is extracted is location independent. The underlying principle is: the statistics of a certain part of the image are the same as the other parts. Meaning that image information learned in one part can also be used in another part. The same learned image information can be used for all positions on the image. In the same convolution layer, a plurality of convolution kernels can be used to extract different image information, and generally, the greater the number of convolution kernels, the more abundant the image information reflected by the convolution operation.
The convolution kernel can be initialized in the form of a matrix of random size, and can be learned to obtain reasonable weights in the training process of the convolutional neural network. In addition, sharing weights brings the direct benefit of reducing connections between layers of the convolutional neural network, while reducing the risk of overfitting.
(4) Recurrent Neural Networks (RNNs) are used to process sequence data. In the traditional neural network model, from the input layer to the hidden layer to the output layer, the layers are all connected, and each node between every two layers is connectionless. Although the common neural network solves a plurality of problems, the common neural network still has no capability for solving a plurality of problems. For example, you would typically need to use the previous word to predict what the next word in a sentence is, because the previous and next words in a sentence are not independent. The RNN is called a recurrent neural network, i.e., the current output of a sequence is also related to the previous output. The concrete expression is that the network memorizes the previous information and applies the previous information to the calculation of the current output, namely, the nodes between the hidden layers are not connected any more but connected, and the input of the hidden layer not only comprises the output of the input layer but also comprises the output of the hidden layer at the last moment. In theory, RNNs can process sequence data of any length. The training for RNN is the same as for conventional CNN or DNN. The error back-propagation algorithm is also used, but with a little difference: that is, if the RNN is network-deployed, the parameters therein, such as W, are shared; this is not the case with the conventional neural networks described above by way of example. And in using the gradient descent algorithm, the output of each step depends not only on the network of the current step, but also on the state of the networks of the previous steps. This learning algorithm is referred to as the Time-based Back Propagation Through Time (BPTT).
Now that there is a convolutional neural network, why is a circular neural network? For simple reasons, in convolutional neural networks, there is a precondition assumption that: the elements are independent of each other, as are inputs and outputs, such as cats and dogs. However, in the real world, many elements are interconnected, such as stock changes over time, and for example, a person says: i like to travel, wherein the favorite place is Yunnan, and the opportunity is in future to go. Here, to fill in the blank, humans should all know to fill in "yunnan". Because humans infer from the context, but how do the machine do it? The RNN is generated. RNNs aim at making machines capable of memory like humans. Therefore, the output of the RNN needs to be dependent on the current input information and historical memory information.
(5) Loss function
In the process of training the deep neural network, because the output of the deep neural network is expected to be as close to the value really expected to be predicted as possible, the weight vector of each layer of the neural network can be updated according to the difference between the predicted value of the current network and the really expected target value (of course, the process is usually carried out before the first updating, namely parameters are configured in advance for each layer in the deep neural network), for example, if the predicted value of the network is high, the weight vector is adjusted to be slightly lower, and the adjustment is carried out continuously until the deep neural network can predict the really expected target value or the value which is very close to the really expected target value. Therefore, it is necessary to define in advance "how to compare the difference between the predicted value and the target value", which are loss functions (loss functions) or objective functions (objective functions), which are important equations for measuring the difference between the predicted value and the target value. Taking the loss function as an example, if the higher the output value (loss) of the loss function indicates the larger the difference, the training of the deep neural network becomes the process of reducing the loss as much as possible.
(6) Back propagation algorithm
The convolutional neural network can adopt a Back Propagation (BP) algorithm to correct the size of the parameters in the initial sample generator in the training process, so that the reconstruction error loss of the initial sample generator is smaller and smaller. Specifically, an error loss occurs when an input signal is transmitted in a forward direction until an output, and parameters in an initial sample generator are updated by back-propagating error loss information, so that the error loss is converged. The back propagation algorithm is an error-loss dominated back propagation motion aimed at obtaining optimal parameters of the target sample generator, such as a weight matrix.
(7) Generative countermeasure network
Generative Adaptive Networks (GANs) are a deep learning model. The model comprises at least two modules: one module is a generative model (also referred to as a generative network in the embodiment of the present application), and the other module is a discriminant model (also referred to as a discriminant network in the embodiment of the present application), and the two modules perform game learning with each other, so as to generate better output. The generative model and the discriminant model may be both neural networks, specifically, deep neural networks, or convolutional neural networks. The basic principle of GAN is as follows: taking GAN for generating pictures as an example, assume that there are two networks, G (generator) and d (discriminator), where G is a network for generating pictures, which receives a random noise z, and generates pictures by this noise, denoted as G (z); d is a discrimination network for discriminating whether a picture is "real". The input parameter is x, x represents a picture, and the output D (x) represents the probability that x is a real picture, if the probability is 1, 100% of the picture is a real picture, and if the probability is 0, the picture cannot be a real picture. In the process of training the generating countermeasure network, the aim of generating the network G is to generate a real picture as much as possible to deceive the discrimination network D, and the aim of discriminating the network D is to distinguish the picture generated by G from the real picture as much as possible. Thus, G and D constitute a dynamic "gaming" process, i.e., "play" in a "generative play network". As a result of the final game, in an ideal state, G can generate enough pictures G (z) to be "fake" and D cannot easily determine whether the generated pictures are true or not, i.e., D (G (z)) is 0.5. This results in an excellent generative model G which can be used to generate pictures.
The system architecture provided by the embodiments of the present application is described below.
Referring to fig. 1, an embodiment of the present application provides a schematic diagram of a content recommendation system architecture, such as a system architecture 100 for content recommendation in the figure, which includes a model offline training process and an online recommendation process. Wherein the content of the first and second substances,
the neighbor session retrieval is used for forming a neighbor session set by calculating the similarity between an input session and a historical session based on the input session; specifically, with reference to the session-based K-nearest neighbor recommendation method, N nearest neighbor sessions are retrieved from the history record according to the input session, and a nearest neighbor session set is formed.
The recommendation model can be preset, parameters in the adjustment model are updated through offline training, and the trained recommendation model is obtained finally.
In the off-line training process, for any session in the historical session record, the previous content sequence is used as an input session, and a neighbor session set occurring before the session is retrieved according to the input session; and then, taking the last content (such as news) in the input session as a recommendation result, training a recommendation model, updating parameters in the adjustment model, and finally obtaining the trained recommendation model.
In the online recommendation process, a newly-initiated session is taken as an input session, a neighbor session set is searched in the whole historical session record, and then recommendation is performed through a trained recommendation model to obtain a content recommendation result.
It should be noted that fig. 1 is only a schematic diagram of a system architecture provided in an embodiment of the present application, and the positional relationship between the devices, modules, and the like shown in the diagram does not constitute any limitation.
The structure of the proposed model in the embodiments of the present application is described below with reference to the accompanying drawings.
As shown in fig. 2, the flowchart of the content recommendation method according to the embodiment of the present application may include the following steps:
step S200: coding the current conversation based on the trained recommendation model to obtain the current conversation code;
specifically, reference may be made to a recommendation principle schematic diagram of the content recommendation method provided in the embodiment of the present application shown in fig. 3, and the current session may be converted into an embedded layer representation, so as to obtain an embedded layer representation corresponding to the content in the current session. Taking the content as news for example, the input part may be the news number i of the current conversation, and the output result is the embedded layer representation epsilon of the news i in the current conversationiThe layers represented by the embedded layer may be trained offline.
The content in the current session is processedCorresponding embedding layer representation epsiloniInputting the sequence into a neural network, outputting to obtain the current session code hs. The neural network can be a circular neural network, a convolutional neural network or a fully-connected neural network.
Step S202: based on the current session coding, coding the neighbor sessions in the neighbor session set by adopting an attention mechanism to obtain neighbor session codes;
wherein the neighbor session set comprises a session set formed by selecting based on similarity with the current session, and the occurrence time of neighbor sessions in the neighbor session set is before the occurrence time of the current session;
specifically, an attention score for each content of the current session and a neighboring session in the set of neighboring sessions can be calculated separately using an attention mechanism based on the current session encoding; and summing the attention scores of each content in the neighbor sessions according to the calculated attention scores to obtain neighbor session codes.
In one possible implementation, a neighbor session in the neighbor session set may be converted into an embedded layer representation, resulting in an embedded layer representation e corresponding to each content of the neighbor sessioni(ii) a Respectively calculating the correlation of the current session coding and the embedded layer representation corresponding to each content;
this can be calculated, for example, by the following equation 2:
Figure BDA0002201440780000121
wherein h issEncoding the current session; e.g. of the typeiAn embedded layer representation corresponding to content i of the neighbor session; wheIs a weight, is one of the parameters of the recommendation model. The current session code h can be calculated by formula 2sEmbedded layer representation e corresponding to content i of a neighbor sessioniα ofsi
Wherein the subscript s in the embodiments of the present application represents the session, hereinafterThe index I represents the content (e.g. news), e.g. if there are S sessions, I content, then IiI.e. representing the content numbered i, SsI.e. representing session S, if the click order of the content in session 5 is 1, 5, 4, 7, there is S5=[I1,I5,I4,I7]。
Is a session-content matrix, where r is the content i if a session s contains contentsiOtherwise, it is 0.
The calculated correlations may then be weight normalized to obtain an attention score. For example, the weight normalization can be performed using a softmax function, as shown in equation 3 below:
Figure BDA0002201440780000123
in one possible implementation, the attention score of each content in the neighbor session can be summed by the following formula 4 to obtain a neighbor session code es
Figure BDA0002201440780000124
In one possible embodiment, the neighbor sessions in fig. 4 are composed or generated prior to step S302. Before step S302, obtaining a candidate session set according to the occurrence time of the current session; the occurrence time of the sessions in the candidate session set is before the occurrence time of the current session; calculating the similarity between the current session and the sessions in the candidate session set; and selecting the sessions with the similarity meeting the requirement from the candidate session set to form a neighbor session set.
Specifically, based on a given input session s and the session-content matrix R, a neighbor session of the input session may be obtained by:
1. according to input conversation sTime, obtaining a candidate session set Cs. I.e. CsS, occurs at a time before s.
2. For candidate session set CsMiddle arbitrary conversation scCalculating input sessions s and s using cosine similarity as a measurecThe similarity of (c). I.e., similarity (s, s)c)=cosine(rs,rsc)。
3. According to the similarity obtained in the step 2, taking N conversations most similar to s to form a neighbor conversation set Ns. Specifically, a similarity threshold may be set as a requirement or a condition, and a session with a similarity greater than or equal to the threshold, that is, a session meeting the requirement, forms a neighbor session set; or the sorting result of the similarity can be set as a requirement or a condition, and the top N sessions, i.e., sessions meeting the requirement, sorted from large to small in similarity form a neighbor session set.
Step S204: and generating a recommendation result of the next content of the current session according to the current session code and the neighbor session code.
Specifically, the current session code and the neighboring session code may be input to a full connection layer, and output to obtain a requirement code of the current session; the requirement code q of the current session can be obtained, for example, by the following equation 5s
qs=σ(Wqhhs+Wqees+bq) (5)
Wherein, Wqh、WqeIs a weight, bqThe bias parameters are all parameters of the recommended model.
Then coding q according to said requirementssCalculating the recommendation degree r of the content to be recommended of the current sessionsAnd taking one or more contents to be recommended with recommendation degrees meeting requirements as the next content of the current session. The recommendation degree r can be calculated by, for example, equation 6s
rs=softmax(Wrqqs+br) (6)
Specifically, for example, the recommendation degree r may be setsAnd performing descending sorting, outputting a plurality of results with the highest recommendation degree, and recommending the content of the current conversation. Wherein WrqThe number of lines of (d) represents how many candidate recommended contents exist, and the recommendation degree r for each candidate recommended contentsAnd (4) sorting in a descending order, inputting the top 10 contents with the highest recommendation degree sorting, and recommending the contents to the user.
In one possible embodiment, the recommendation degree can also be calculated by equation 7:
specifically, for example, the recommendation degree r may be setsiAnd performing descending sorting, outputting a plurality of results with the highest recommendation degree, and recommending the content of the current conversation.
In one possible implementation manner, the method further comprises the step of training the recommendation model before the current session is coded based on the trained recommendation model to obtain the current session code;
as shown in fig. 4, a flowchart of a recommendation model training method provided in the embodiment of the present application is schematically illustrated, where the training of the recommendation model in the embodiment of the present application may include the following steps:
step S400: coding the sample session based on the recommendation model to obtain a sample session code;
specifically, the sample session in the embodiment of the present application may be any session in the historical session record, and the sample session code is obtained by encoding the input sample session.
Step S402: based on the sample session coding, coding the neighbor sample session in the neighbor sample session set by adopting an attention mechanism to obtain neighbor sample session coding;
wherein the neighbor sample session set comprises a session set composed based on similarity to the sample session, and the occurrence time of a neighbor session in the neighbor sample session set is before the occurrence time of the sample session;
step S404: and generating a sample recommendation result of the next content of the sample session according to the sample session code and the neighbor sample session code, and updating parameters of the recommendation model by taking the last content in the sample session as a target recommendation result, so that the generated sample recommendation result is matched with the target recommendation result. And finally, obtaining a trained recommendation model for subsequent online recommendation.
The following description is made with reference to fig. 5 for a schematic diagram of a content recommendation method according to an embodiment of the present application.
In the off-line training stage, any historical conversation can be used as a sample conversation to be input, a candidate conversation set is obtained according to input conversation occurrence time, then the similarity between the input conversation and each candidate conversation is calculated, and finally a neighbor conversation set is obtained according to the similarity. And then respectively converting the input conversation and the conversation in the neighbor conversation set into embedded layer representations, performing RNN coding on the input conversation, calculating the attention scores of the input conversation and the neighbor conversation to obtain neighbor conversation codes, finally generating a recommendation result according to the input conversation codes and the neighbor conversation codes, and updating parameters of the recommendation model according to the last content in the sample conversation as a target recommendation result until the training of the recommendation model based on the neighbor conversation dynamic perception is finished.
In the online recommendation stage, a new session is initiated, a candidate session set is obtained according to the occurrence time of the initiated current session, then the similarity between the current session and each candidate session is calculated, and finally a neighbor session set is obtained according to the similarity. And then respectively converting the input current conversation and the conversation in the neighbor conversation set into embedded layer representation, performing RNN coding on the input current conversation, then calculating the attention scores of the input current conversation and the input neighbor conversation to obtain neighbor conversation codes, finally generating a recommendation result according to the input current conversation codes and the input neighbor conversation codes, and recommending to the unknown user.
In particular, in encoding in a neighbor session in various embodiments of the present application, a variety of attention score calculation mechanisms may be used, such as a multi-head attention mechanism, a change activation function, and so on.
By implementing the embodiment of the application, the content condition in the similar conversation is dynamically considered, the accuracy of content recommendation is improved, specifically, the attention mechanism is introduced, the modeling capability of the current conversation and the auxiliary information introduced by the neighbor method are organically combined, the dependence of the traditional recommendation method on artificial rules is reduced, and the accuracy of content recommendation is improved.
In order to better implement the above-mentioned solution of the embodiment of the present application, the present application further provides a content recommendation device, as shown in fig. 6, which is a schematic structural diagram of the content recommendation device provided in the embodiment of the present application, and the content recommendation device 60 includes: a first encoding unit 600, a second encoding unit 602, and a recommendation result generating unit 604, wherein,
the first encoding unit 600 is configured to encode the current session based on the trained recommendation model to obtain a current session code;
the second encoding unit 602 is configured to encode, based on the current session encoding, a neighbor session in a neighbor session set by using an attention mechanism, so as to obtain a neighbor session encoding; wherein the neighbor session set comprises a session set formed by selecting based on similarity with the current session, and the occurrence time of neighbor sessions in the neighbor session set is before the occurrence time of the current session;
the recommendation result generating unit 604 is configured to generate a recommendation result of a next content of the current session according to the current session code and the neighboring session code.
In one possible implementation, the second encoding unit 602 may specifically include a first calculating unit and a weighted average unit, where the first calculating unit is configured to calculate, based on the current session encoding, an attention score of each content of the current session and a neighboring session in the set of neighboring sessions respectively by using an attention mechanism; and the weighted average unit is used for carrying out weighted average on each content in the neighbor conversation according to the calculated attention score to obtain neighbor conversation codes.
In one possible implementation, the first computing unit may be specifically configured to convert a neighboring session in the set of neighboring sessions into an embedded layer representation, resulting in an embedded layer representation corresponding to each content of the neighboring session; respectively calculating the correlation of the current session coding and the embedded layer representation corresponding to each content; and carrying out weight normalization on the calculated correlation to obtain the attention score.
In one possible implementation, the first encoding unit 600 may specifically be configured to convert the current session into an embedded layer representation, and obtain an embedded layer representation corresponding to content in the current session; and inputting the embedded layer representation corresponding to the content in the current conversation into a neural network as a sequence, and outputting to obtain the current conversation code.
In one possible implementation, the content recommendation apparatus 60 may further include a neighboring session generation unit, configured to obtain a candidate session set according to an occurrence time of the current session before the second encoding unit 602 encodes, based on the current session encoding, a neighboring session in a neighboring session set by using an attention mechanism to obtain a neighboring session encoding; the occurrence time of the sessions in the candidate session set is before the occurrence time of the current session; calculating the similarity between the current session and the sessions in the candidate session set; and selecting the sessions with the similarity meeting the requirement from the candidate session set to form a neighbor session set.
In one possible implementation, the recommendation generation unit 604 may include a full-connection unit and a second calculation unit, where the full-connection unit is configured to input the current session code and the neighboring session code into a full-connection layer, and output a requirement code of the current session; the second calculating unit is used for calculating the recommendation degree of the content to be recommended in the current session according to the requirement code, and taking one or more contents to be recommended with the recommendation degree meeting requirements as the next content of the current session.
In one possible implementation manner, the content recommendation apparatus 60 may further include a model training unit, configured to train the recommendation model before the first encoding unit 600 encodes the current session based on the trained recommendation model, and obtains the current session encoding. In particular, it can be used for:
coding the sample session based on the recommendation model to obtain a sample session code;
based on the sample session coding, coding the neighbor sample session in the neighbor sample session set by adopting an attention mechanism to obtain neighbor sample session coding; wherein the neighbor sample session set comprises a session set composed based on similarity to the sample session, and the occurrence time of a neighbor session in the neighbor sample session set is before the occurrence time of the sample session;
and generating a sample recommendation result of the next content of the sample session according to the sample session code and the neighbor sample session code, and updating parameters of the recommendation model by taking the last content in the sample session as a target recommendation result, so that the generated sample recommendation result is matched with the target recommendation result.
Each unit of the content recommendation apparatus 60 in this embodiment of the application is configured to correspondingly execute the step executed by the execution device in the content recommendation method in the embodiments of fig. 1 to fig. 5 in the above method embodiments, which is not described herein again.
Fig. 7 is a schematic structural diagram of a content recommendation device according to an embodiment of the present application. The content recommendation device 700 shown in fig. 7 (which may be specifically a computer device) includes a memory 701, a processor 702, a communication interface 703 and a bus 704. The memory 701, the processor 702, and the communication interface 703 are communicatively connected to each other via a bus 704.
The Memory 701 may be a Read Only Memory (ROM), a static Memory device, a dynamic Memory device, or a Random Access Memory (RAM). The memory 701 may store a program, and the processor 702 and the communication interface 703 are used to perform the steps of the content recommendation method of the embodiment of the present application when the program stored in the memory 701 is executed by the processor 702.
The processor 702 may be a general-purpose Central Processing Unit (CPU), a microprocessor, an Application Specific Integrated Circuit (ASIC), a Graphics Processing Unit (GPU), or one or more Integrated circuits, and is configured to execute related programs to execute the content recommendation method according to the embodiment of the present invention.
The processor 702 may also be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the training method of the sample generator of the present application may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 702. The processor 702 may also be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 701, and the processor 702 reads information in the memory 701, and completes the content recommendation method according to the embodiment of the application method in combination with hardware thereof.
In one possible implementation, the content recommendation device 700 may not include the memory 701, and the processor 702 may obtain a program stored in a cloud through the communication interface 703 to execute the steps of the content recommendation method of the application method embodiment.
The communication interface 703 enables communication between the apparatus 700 and other devices or communication networks using transceiver means such as, but not limited to, transceivers. For example, training data may be obtained through the communication interface 703.
Bus 704 may include a pathway to transfer information between various components of apparatus 700, such as memory 701, processor 702, and communication interface 703.
For specific implementation of each functional device, reference may be made to related descriptions in the above method embodiments, and details are not described in this application embodiment.
FIG. 8 is a schematic block diagram of another content recommendation device in an embodiment of the present application; the content recommendation device 800 shown in fig. 8 (the apparatus 800 may be specifically a terminal) includes a memory 801, a baseband chip 802, a radio frequency module 803, a peripheral system 804, and a sensor 805. The baseband chip 802 includes at least one processor 8021, e.g., a CPU, a clock module 8022 and a power management module 8023; the peripheral system 804 includes a camera 8041, an audio module 8042, a touch display 8043, and the like, and further, the sensor 805 may include a light sensor 8051, an acceleration sensor 8052, a fingerprint sensor 8053, and the like; the modules included in the peripheral system 804 and the sensor 805 may be increased or decreased as desired. Any two connected modules may be specifically connected by a bus, where the bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an extended standard architecture (EISA) bus, or the like.
The radio frequency module 803 may include an antenna and a transceiver (including a modem) for converting electromagnetic waves received by the antenna into electric current and finally into digital signals, and correspondingly, for converting digital signal data to be output by the handset into electric current and then into electromagnetic waves, and finally transmitting the electromagnetic waves into free space through the antenna. The radio frequency module 803 may further include at least one amplifier for amplifying the signal. Generally, Wireless transmission, such as Bluetooth (english: Bluetooth) transmission, Wireless Fidelity (WI-FI) transmission, third Generation mobile communication (3 rd-Generation, 3G) transmission, fourth Generation mobile communication (4G) transmission, etc., can be performed through the rf module 803.
The touch display screen 8043 may be used to display information input by a user or display information to the user, the touch display screen 8043 may include a touch panel and a display panel, and optionally, the display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel may cover the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel transmits the touch operation to the processor 8021 to determine the type of the touch event, and then the processor 8021 provides a corresponding visual output on the display panel according to the type of the touch event. The touch panel and the display panel are two separate components to implement the input and output functions of the content recommendation device 800, but in some embodiments, the touch panel and the display panel may be integrated to implement the input and output functions of the content recommendation device 800.
The camera 8041 is used to acquire images.
The audio input module 8042 may be a microphone, and may obtain voice and input the voice to the trained content recommendation network.
The sensor 805 may include a light sensor 8051, an acceleration sensor 8052, and a fingerprint sensor 8052, where the light sensor 8051 is used to obtain the light intensity of the environment, the acceleration sensor 8052 (such as a gyroscope, etc.) may obtain the motion state of the content recommendation device 800, and the fingerprint sensor 8053 may input fingerprint information; the sensor 805, upon sensing the relevant signal, quantizes the signal into a digital signal and passes the digital signal to the processor 8021 for further processing.
The memory 801 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 801 may optionally further include at least one storage device located remotely from the aforementioned processor 8021, and the memory 801 may specifically include a storage instruction area for storing programs such as an operating system, a user interface program, a communication interface program, and a storage data area for storing data required by the process in performing the relevant operations or data generated by the relevant operations.
The processor 8021 is a control center of the content recommendation apparatus 800, connects the respective parts of the entire cellular phone by using various interfaces and lines, and executes the respective functions of the content recommendation apparatus 800 by executing the program stored in the memory 801 and calling the data stored in the memory 801. Optionally, the processor 8021 may include one or more application processors that primarily handle operating systems, user interfaces, application programs, and the like. In the embodiment of the present application, the processor 8021 reads information in the memory 801, and completes the content recommendation method of the embodiment of the present application in combination with hardware thereof.
The user realizes the communication function of the content recommendation device 800 through the radio frequency module 803.
It should be noted that, for specific implementation of each functional unit, reference may be made to relevant descriptions in each method embodiment described above, and details are not described in this embodiment of the application. The specific implementation and advantages of the above operations may also correspond to the corresponding descriptions provided in the embodiments and possible embodiments of fig. 1 to 6.
In a specific implementation, the content recommendation Device may be a terminal or a server, and specifically, its representation may include various devices that can be used by a user, such as a Mobile phone, a tablet computer, a Personal Digital Assistant (PDA), a Mobile Internet Device (MID), and the like, which are not limited in the embodiments of the present invention.
It should be understood that the application scenario to which the method provided in the embodiment of the present application may be applied is only an example, and is not limited to this in practical application.
It should also be understood that the reference to first, second, third and various numerical designations in this application are merely for convenience of description and do not limit the scope of this application.
It should be understood that the term "and/or" in this application is only one type of association relationship that describes the associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in this application generally indicates that the former and latter related objects are in an "or" relationship.
In addition, in each embodiment of the present application, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiment of the present application.
Those of ordinary skill in the art will appreciate that the various illustrative elements and method steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It will be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules and units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, and may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present application.
In addition, functional units related to the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in a form of hardware, or may be implemented in a form of software functional unit, which is not limited in this application.
Embodiments of the present invention also provide a computer storage medium having stored therein instructions, which when executed on a computer or processor, cause the computer or processor to perform one or more steps of a method according to any of the above embodiments. Based on the understanding that the constituent modules of the above-mentioned apparatus, if implemented in the form of software functional units and sold or used as independent products, may be stored in the computer-readable storage medium, and based on this understanding, the technical solutions of the present application, in essence, or a part contributing to the prior art, or all or part of the technical solutions, may be embodied in the form of software products, and the computer products are stored in the computer-readable storage medium.
The computer readable storage medium may be an internal storage unit of the device according to the foregoing embodiment, such as a hard disk or a memory. The computer readable storage medium may be an external storage device of the above-described apparatus, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the computer-readable storage medium may include both an internal storage unit and an external storage device of the device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the apparatus. The above-described computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the above embodiments of the methods when the computer program is executed. And the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs.
The modules in the device can be merged, divided and deleted according to actual needs.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A content recommendation method, comprising:
coding the current conversation based on the trained recommendation model to obtain the current conversation code;
based on the current session coding, coding the neighbor sessions in the neighbor session set by adopting an attention mechanism to obtain neighbor session codes; wherein the neighbor session set comprises a session set formed by selecting based on similarity with the current session, and the occurrence time of neighbor sessions in the neighbor session set is before the occurrence time of the current session;
and generating a recommendation result of the next content of the current session according to the current session code and the neighbor session code.
2. The method of claim 1, wherein the encoding neighboring sessions in a set of neighboring sessions using an attention mechanism based on the current session encoding to obtain a neighboring session encoding comprises:
based on the current session encoding, calculating an attention score of each content of the current session and a neighboring session in the set of neighboring sessions respectively by adopting an attention mechanism;
and summing the attention scores of each content in the neighbor sessions according to the calculated attention scores to obtain neighbor session codes.
3. The method of claim 2, wherein the calculating an attention score for each content of the current session and a neighbor session in the set of neighbor sessions, respectively, using an attention mechanism based on the current session encoding comprises:
converting the neighbor sessions in the neighbor session set into embedded layer representations to obtain embedded layer representations corresponding to each content of the neighbor sessions;
respectively calculating the correlation of the current session coding and the embedded layer representation corresponding to each content;
and carrying out weight normalization on the calculated correlation to obtain the attention score.
4. The method of claim 1, wherein encoding the current session to obtain a current session code comprises:
converting the current conversation into embedded layer representation to obtain embedded layer representation corresponding to the content in the current conversation;
and inputting the embedded layer representation corresponding to the content in the current conversation into a neural network as a sequence, and outputting to obtain the current conversation code.
5. The method of claim 1, wherein the encoding neighboring sessions in a set of neighboring sessions using an attention mechanism based on the current session encoding, before obtaining neighboring session encoding, further comprises:
obtaining a candidate session set according to the occurrence time of the current session; the occurrence time of the sessions in the candidate session set is before the occurrence time of the current session;
calculating the similarity between the current session and the sessions in the candidate session set;
and selecting the sessions with the similarity meeting the requirement from the candidate session set to form a neighbor session set.
6. The method of claim 1, wherein generating the recommendation of the next content for the current session based on the current session encoding and the neighbor session encoding comprises:
inputting the current session code and the neighbor session code into a full connection layer, and outputting to obtain a demand code of the current session;
and calculating the recommendation degree of the contents to be recommended of the current session according to the requirement codes, and taking one or more contents to be recommended with the recommendation degree meeting requirements as the next contents of the current session.
7. The method according to any one of claims 1-6, wherein the encoding the current session based on the trained recommendation model further comprises training the recommendation model before obtaining the current session encoding;
the training the recommendation model comprises:
coding the sample session based on the recommendation model to obtain a sample session code;
based on the sample session coding, coding the neighbor sample session in the neighbor sample session set by adopting an attention mechanism to obtain neighbor sample session coding; wherein the neighbor sample session set comprises a session set composed based on similarity to the sample session, and the occurrence time of a neighbor session in the neighbor sample session set is before the occurrence time of the sample session;
and generating a sample recommendation result of the next content of the sample session according to the sample session code and the neighbor sample session code, and updating parameters of the recommendation model by taking the last content in the sample session as a target recommendation result, so that the generated sample recommendation result is matched with the target recommendation result.
8. A content recommendation apparatus characterized by comprising:
the first coding unit is used for coding the current conversation based on the trained recommendation model to obtain the current conversation code;
the second encoding unit is used for encoding the neighbor sessions in the neighbor session set by adopting an attention mechanism based on the current session encoding to obtain neighbor session encoding; wherein the neighbor session set comprises a session set formed by selecting based on similarity with the current session, and the occurrence time of neighbor sessions in the neighbor session set is before the occurrence time of the current session;
and the recommendation result generation unit is used for generating a recommendation result of the next content of the current session according to the current session code and the neighbor session code.
9. A content recommendation device comprising a processor configured to invoke stored program instructions to perform the method of any one of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-7.
CN201910869110.4A 2019-09-12 2019-09-12 Content recommendation method, device, equipment and computer readable storage medium Pending CN110795618A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910869110.4A CN110795618A (en) 2019-09-12 2019-09-12 Content recommendation method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910869110.4A CN110795618A (en) 2019-09-12 2019-09-12 Content recommendation method, device, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN110795618A true CN110795618A (en) 2020-02-14

Family

ID=69427095

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910869110.4A Pending CN110795618A (en) 2019-09-12 2019-09-12 Content recommendation method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110795618A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111581519A (en) * 2020-05-25 2020-08-25 中国人民解放军国防科技大学 Item recommendation method and system based on user intention in session
CN112800209A (en) * 2021-01-28 2021-05-14 上海明略人工智能(集团)有限公司 Conversation corpus recommendation method and device, storage medium and electronic equipment
CN113344177A (en) * 2021-05-10 2021-09-03 电子科技大学 Depth recommendation method based on graph attention
CN113704438A (en) * 2021-09-06 2021-11-26 中国计量大学 Conversation recommendation method of abnormal picture based on layered attention mechanism

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015143096A1 (en) * 2014-03-18 2015-09-24 Staples, Inc. Clickstream purchase prediction using hidden markov models
CN109871485A (en) * 2019-02-13 2019-06-11 北京航空航天大学 A kind of personalized recommendation method and device
CN109960761A (en) * 2019-03-28 2019-07-02 腾讯科技(深圳)有限公司 Information recommendation method, device, equipment and computer readable storage medium
CN110008408A (en) * 2019-04-12 2019-07-12 山东大学 A kind of session recommended method, system, equipment and medium
CN110119467A (en) * 2019-05-14 2019-08-13 苏州大学 A kind of dialogue-based item recommendation method, device, equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015143096A1 (en) * 2014-03-18 2015-09-24 Staples, Inc. Clickstream purchase prediction using hidden markov models
CN109871485A (en) * 2019-02-13 2019-06-11 北京航空航天大学 A kind of personalized recommendation method and device
CN109960761A (en) * 2019-03-28 2019-07-02 腾讯科技(深圳)有限公司 Information recommendation method, device, equipment and computer readable storage medium
CN110008408A (en) * 2019-04-12 2019-07-12 山东大学 A kind of session recommended method, system, equipment and medium
CN110119467A (en) * 2019-05-14 2019-08-13 苏州大学 A kind of dialogue-based item recommendation method, device, equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111581519A (en) * 2020-05-25 2020-08-25 中国人民解放军国防科技大学 Item recommendation method and system based on user intention in session
CN111581519B (en) * 2020-05-25 2022-10-18 中国人民解放军国防科技大学 Item recommendation method and system based on user intention in conversation
CN112800209A (en) * 2021-01-28 2021-05-14 上海明略人工智能(集团)有限公司 Conversation corpus recommendation method and device, storage medium and electronic equipment
CN113344177A (en) * 2021-05-10 2021-09-03 电子科技大学 Depth recommendation method based on graph attention
CN113704438A (en) * 2021-09-06 2021-11-26 中国计量大学 Conversation recommendation method of abnormal picture based on layered attention mechanism
CN113704438B (en) * 2021-09-06 2022-02-22 中国计量大学 Conversation recommendation method of abnormal picture based on layered attention mechanism

Similar Documents

Publication Publication Date Title
CN110084281B (en) Image generation method, neural network compression method, related device and equipment
WO2021120719A1 (en) Neural network model update method, and image processing method and device
WO2022083536A1 (en) Neural network construction method and apparatus
CN110795618A (en) Content recommendation method, device, equipment and computer readable storage medium
WO2021233199A1 (en) Search recommendation model training method, and search result sorting method and device
WO2022042713A1 (en) Deep learning training method and apparatus for use in computing device
WO2021022521A1 (en) Method for processing data, and method and device for training neural network model
CN112446476A (en) Neural network model compression method, device, storage medium and chip
CN110222717B (en) Image processing method and device
WO2021218517A1 (en) Method for acquiring neural network model, and image processing method and apparatus
CN112487217A (en) Cross-modal retrieval method, device, equipment and computer-readable storage medium
WO2021008206A1 (en) Neural architecture search method, and image processing method and device
WO2024041479A1 (en) Data processing method and apparatus
CN112561028A (en) Method for training neural network model, and method and device for data processing
WO2021227787A1 (en) Neural network predictor training method and apparatus, and image processing method and apparatus
WO2022088063A1 (en) Method and apparatus for quantizing neural network model, and method and apparatus for processing data
WO2021169366A1 (en) Data enhancement method and apparatus
WO2021057884A1 (en) Sentence paraphrasing method, and method and apparatus for training sentence paraphrasing model
CN113536970A (en) Training method of video classification model and related device
WO2022179588A1 (en) Data coding method and related device
CN116468114A (en) Federal learning method and related device
Yu et al. Hand gesture recognition based on attentive feature fusion
WO2021057690A1 (en) Neural network building method and device, and image processing method and device
WO2021103977A1 (en) Neural network searching method, apparatus, and device
CN114004265A (en) Model training method and node equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40022038

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination