CN116415624A - Model training method and device, and content recommendation method and device - Google Patents

Model training method and device, and content recommendation method and device Download PDF

Info

Publication number
CN116415624A
CN116415624A CN202111625500.0A CN202111625500A CN116415624A CN 116415624 A CN116415624 A CN 116415624A CN 202111625500 A CN202111625500 A CN 202111625500A CN 116415624 A CN116415624 A CN 116415624A
Authority
CN
China
Prior art keywords
neural network
feature
content
information
matching result
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
CN202111625500.0A
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 CN202111625500.0A priority Critical patent/CN116415624A/en
Publication of CN116415624A publication Critical patent/CN116415624A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • 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

Abstract

The application discloses a model training method and device and a content recommending method and device. The method comprises the steps of obtaining training sample information; performing feature processing on the first object feature by using a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature by using the first neural network; performing feature processing on the first content features by adopting a second neural network to obtain second content features; performing feature matching on the second object features and the second content features to obtain a first matching result; updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises a first neural network and a second neural network. The method can effectively improve the robustness of the preset neural network model obtained through training, and further can improve the accuracy of content recommendation.

Description

Model training method and device, and content recommendation method and device
Technical Field
The application relates to the technical field of computers, in particular to a model training method and device, and a content recommendation method and device.
Background
With the continuous development of internet technology, people's life is already indistinct from the internet. In the internet age, with the rapid expansion of content, the pressure of content selection faced by people is increased, which reduces the use efficiency of content by people, thereby causing the problem of information overload.
The recommendation system is a personalized recommendation system for recommending information, products and the like of interest to the object according to the content requirements, interests and the like of the object. A good recommendation system not only can provide personalized content and service for objects, but also can establish close relation with the objects.
However, in some cases, the content recommendation model in the recommendation system does not recommend content for the object accurately enough.
Disclosure of Invention
The embodiment of the application provides a model training method and device, and a content recommending method and device, wherein the method can effectively improve the accuracy of content recommendation.
The first aspect of the application provides a model training method, which comprises the following steps:
acquiring training sample information, wherein the training sample information comprises a plurality of training samples, and the training samples comprise first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information and label information corresponding to each piece of content information;
Performing feature processing on the first object feature by using a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature by using the first neural network;
performing feature processing on the first content features by adopting a second neural network to obtain second content features;
performing feature matching on the second object features and the second content features to obtain a first matching result;
updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises the first neural network and the second neural network.
Accordingly, a second aspect of the present application provides a model training apparatus, the apparatus comprising:
the first acquisition unit is used for acquiring training sample information, wherein the training sample information comprises a plurality of training samples, and the training samples comprise first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information and label information corresponding to each piece of content information;
The first processing unit is used for carrying out feature processing on the first object feature by adopting a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of carrying out feature processing on the first object feature by adopting the first neural network;
the second processing unit is used for carrying out feature processing on the first content features by adopting a second neural network to obtain second content features;
the first matching unit is used for carrying out feature matching on the second object features and the second content features to obtain a first matching result;
and the updating unit is used for updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises the first neural network and the second neural network.
In some embodiments, the model training apparatus further comprises:
the third processing unit is used for carrying out feature processing on the first object feature again by adopting the first neural network to obtain a third object feature, wherein neurons in the first neural network are randomly hidden in the process of carrying out feature processing on the first object feature again by adopting the first neural network;
A first calculation unit configured to calculate first difference information of the second object feature and the third object feature;
the updating unit is further configured to:
and updating model parameters of a preset neural network model according to the first matching result, the label information and the first difference information.
In some embodiments, the model training apparatus further comprises:
the second matching unit is used for performing feature matching on the third object feature and the second content feature to obtain a second matching result;
a second calculation unit configured to calculate second difference information between the first matching result and the second matching result;
the updating unit is further configured to:
and updating model parameters of a preset neural network model according to the first matching result, the label information, the first difference information and the second difference information.
In some embodiments, the updating unit comprises:
a first determining subunit, configured to determine a first sub-loss function according to the first matching result and the tag information;
a second determining subunit, configured to determine a second sub-loss function according to the first difference information;
A third determining subunit, configured to determine a third sub-loss function according to the second difference information;
a constructing subunit, configured to construct a loss function of a preset neural network model based on the first sub-loss function, the second sub-loss function, and the third sub-loss function;
and the training subunit is used for carrying out iterative training on the preset neural network model based on the loss function.
In some embodiments, the second computing unit comprises:
a fourth determining subunit, configured to determine a first result sequence corresponding to the first matching result and a second result sequence corresponding to the second matching result;
and the calculating subunit is used for calculating the relative entropy between the first result sequence and the second result sequence and obtaining second difference information between the first matching result and the second matching result.
In some embodiments, the model training apparatus provided herein further includes:
a fourth processing unit, configured to perform feature processing on the first object feature again by using the first neural network to obtain a fourth object feature, where in a process of performing feature processing on the first object feature again by using the first neural network, neurons in the first neural network are randomly hidden;
The third matching unit is used for performing feature matching on the second content features and the fourth object features to obtain a third matching result;
a third calculation unit configured to calculate third difference information between the first matching result and the third matching result;
the updating unit is further configured to:
and updating model parameters of a preset neural network model according to the first matching result, the label information and the third difference information.
In some embodiments, the first matching unit includes:
an operation subunit, configured to perform dot product operation between the feature vector corresponding to the second object feature and the feature vector corresponding to the second content feature, to obtain an operation result;
and the processing subunit is used for carrying out normalization processing on the operation result to obtain a first matching result.
A third aspect of the present application provides a content recommendation method, the method comprising;
obtaining object information and candidate content information;
extracting the characteristics of the object information to obtain object characteristics;
extracting the characteristics of the candidate content information to obtain content characteristics;
inputting the object features and the content features into a preset neural network model, and outputting scores corresponding to each content feature, wherein the preset neural network model is a preset neural network model trained in the model training method provided by the first aspect;
And determining target candidate contents according to the scores corresponding to the characteristics of each content, and recommending the candidate contents to the object.
Accordingly, a fourth aspect of the present application provides a content recommendation apparatus, the apparatus comprising:
a second acquisition unit configured to acquire object information and candidate content information;
the first extraction unit is used for extracting the characteristics of the object information to obtain object characteristics;
the second extraction unit is used for extracting the characteristics of the candidate content information to obtain content characteristics;
the input unit is used for inputting the object features and the content features into a preset neural network model, outputting scores corresponding to each content feature, wherein the preset neural network model is a trained preset neural network model in the model training method of the first aspect;
and the determining unit is used for determining target candidate contents according to the scores corresponding to the characteristics of each content and recommending the candidate contents to the object.
In some embodiments, the first extraction unit comprises:
the word segmentation subunit is used for carrying out word segmentation processing on the object information to obtain a plurality of word segments corresponding to the object information;
and the embedding subunit is used for carrying out word embedding processing on the plurality of segmented words to obtain object features corresponding to the object information.
The fifth aspect of the present application also provides a computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps of the model training method provided in the first aspect of the present application or the content recommendation method provided in the third aspect.
A sixth aspect of the present application provides a computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps in the content recommendation method provided in the first aspect of the present application when the computer program is executed.
A seventh aspect of the present application provides a computer program product comprising computer programs/instructions which when executed by a processor implement the steps of the model training method provided in the first aspect or the content recommendation method provided in the third aspect.
According to the model training method provided by the embodiment of the application, training sample information is obtained, the training sample information comprises a plurality of training samples, and the training samples comprise first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information and label information corresponding to each piece of content information; performing feature processing on the first object feature by using a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature by using the first neural network; performing feature processing on the first content features by adopting a second neural network to obtain second content features; performing feature matching on the second object features and the second content features to obtain a first matching result; updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises a first neural network and a second neural network.
Therefore, according to the model training method provided by the application, the hidden layer can be added in the sub-model for processing the object characteristics in the double-tower model of the recommendation system, so that the neurons of the sub-model are randomly hidden, the situation that the model cannot be converged due to the long tail condition of the object characteristics is avoided, the robustness of the double-tower model of the recommendation system is improved, and the accuracy of content recommendation can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic illustration of one scenario of model training in the present application;
FIG. 2 is a flow chart of the model training method provided by the present application;
FIG. 3 is another flow diagram of the model training method provided herein;
FIG. 4 is a flow chart of a content recommendation method provided herein;
FIG. 5 is a schematic diagram of the model training apparatus provided herein;
FIG. 6 is a schematic diagram of a content recommendation device provided in the present application;
fig. 7 is a schematic structural diagram of a computer device provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It will be apparent that the described embodiments are only some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
The embodiment of the invention provides a model training method and device and a content recommending method and device. The model training method can be used in a model training device. The model training apparatus may be integrated in a computer device, which may be a terminal or a server. The terminal can be a mobile phone, a tablet computer, a notebook computer, an intelligent television, a wearable intelligent device, a personal computer (PC, personal Computer), a vehicle-mounted terminal and other devices. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligent platforms, and the like. Wherein the server may be a node in a blockchain.
Referring to fig. 1, a schematic view of a scenario of a model training method provided in the present application is shown. As shown in the figure, the server a receives training sample information sent by the terminal B, wherein the training sample information comprises a plurality of training samples, and the training samples comprise first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information and label information corresponding to each piece of content information; then, the server A adopts a first neural network to conduct feature processing on the first object feature to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of conducting feature processing on the first object feature by adopting the first neural network; performing feature processing on the first content features by adopting a second neural network to obtain second content features; performing feature matching on the second object features and the second content features to obtain a first matching result; updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises a first neural network and a second neural network.
It should be noted that the schematic diagram of the model training scenario shown in fig. 1 is only an example, and the model training scenario described in the embodiment of the present application is for more clearly describing the technical solution of the present application, and does not constitute a limitation of the technical solution provided in the present application. Those skilled in the art can know that, with the evolution of the model training scene and the appearance of the new service scene, the technical scheme provided by the application is also applicable to similar technical problems.
The following describes the above-described embodiments in detail.
In the related art, a double-tower deep structure semantic model (Deep Structured Semantic Models, DSSM) adopted in a recommendation system is used for modeling object features and content features respectively by adopting a deep neural network (Deep Neural Networks, DNN), then similarity of the object features and the content features is output through the model, and content recommendation is carried out on the object according to the similarity. However, the long tail phenomenon is remarkable due to the large variability of the objects. When long-tail object data are sparse, the models corresponding to the object features are difficult to converge, so that the generalization capability of the trained models is insufficient, and the recommendation accuracy of the models is low. In order to solve the problem that model generalization capability obtained by training is insufficient due to long-tail object data sparseness, and further the recommendation accuracy of the model is poor, the application provides a model training method which can pertinently improve the robustness of the model in a recommendation system, and therefore the accuracy of content recommendation is improved.
Embodiments of the present application will be described in terms of a model training apparatus that may be integrated in a computer device. The computer device may be a terminal or a server. The terminal can be a mobile phone, a tablet computer, a notebook computer, an intelligent television, a wearable intelligent device, a personal computer (PC, personal Computer), a vehicle-mounted terminal and other devices. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, network acceleration services (Content Delivery Network, CDN), basic cloud computing services such as big data and artificial intelligent platforms, and the like. As shown in fig. 2, a flow chart of a model training method provided in the present application includes:
Step 101, training sample information is obtained.
The training sample information may be information for training a double-tower DSSM model in a recommendation system. The training sample information may be a training sample set, and the training sample set may include a plurality of training samples. The training sample comprises a first object feature corresponding to the object information, a first content feature corresponding to the content information and label information corresponding to the content feature. In the present application, the object may be a specific user, or may be an object that is artificially and intelligently simulated or controlled, such as an intelligent robot.
The first object feature is a feature obtained by extracting a feature from object information, and the feature may be a feature vector. Specifically, feature extraction is performed on the object information, and the first object feature may be obtained by mapping text information corresponding to the object information into a vector space. When the text information corresponding to the object information is English, a word hash method can be adopted to obtain a first object feature corresponding to the object information; when the text information corresponding to the object information is Chinese, a word embedding method can be adopted to obtain a first object feature corresponding to the object information. Likewise, the first content feature corresponding to the content information may be obtained by the above method.
One training sample may include a plurality of content features corresponding to a plurality of content information and one object feature corresponding to one object information. In addition, the training sample further includes label information corresponding to each content information, and the label information may be 1 or 0. When the label information is 1, the object corresponding to the object information in the training sample is indicated to have clicking action on the content corresponding to the label information, and then the sample can be determined to be a positive sample; when the label information is 0, it is indicated that the object corresponding to the object information in the training sample has no click action on the content corresponding to the label information during sampling, and then the sample is determined to be a negative sample. In other words, in the present application, the preset neural network model may be trained by using the object feature corresponding to the object information and the content feature corresponding to the content information as input and the tag information corresponding to the content information as input, where the preset neural network model may be the aforementioned twin-tower DSSM model.
And 102, performing feature processing on the first object feature by using a first neural network to obtain a second object feature.
In this application, the trained preset neural network model may be the aforementioned dual-tower DSSM model, and since the dual-tower DSSM model includes DNNs for processing object features and DNNs for processing content features, the DNNs for processing object features are determined to be the first neural network, and the DNNs for processing content features are determined to be the second neural network.
In the present application, when the first neural network is used to perform feature processing on the first object feature, random concealment processing, that is, dropout processing, may be performed on neurons in the first neural network. Specifically, in the present application, the DNN corresponding to the first neural network may be a Multi-layer Perceptron (MLP), and performing random hiding processing on neurons in the DNN may be adding a dropout layer between every two layers in the MLP, so that the neurons in the MLP are randomly hidden. In the method, as the dropout layer is added in DNN, some neurons in the model can be randomly hidden (mask) in the training process of the model, so that different characteristic expressions of the same object are obtained, and the robustness of the model can be improved.
And step 103, performing feature processing on the first content features by adopting a second neural network to obtain second content features.
Wherein in the dual tower DSSM model, there is yet another DNN to be used for feature processing of the content features. The first content feature may also be referred to herein as a first content feature sequence, because the first content feature includes features corresponding to a plurality of pieces of content. The second content feature, which is obtained by processing the first content feature using the second neural network, may also be referred to as a second content feature sequence.
In some embodiments, when the second neural network processes the first content feature, random dropout processing may also be performed on neurons in the second neural network, so as to avoid a problem that a model for content feature processing cannot converge due to long tail of the content feature, and further enhance robustness of a preset neural network model obtained by training.
And 104, performing feature matching on the second object features and the second content features to obtain a first matching result.
In the dual-tower DSSM model, when the features corresponding to the object and the features corresponding to the content are determined, that is, the second object features and the second content features are determined, the object features and the content features may be further matched, so as to determine the semantic similarity between the object information and the content information. For example, the semantic similarity between object information and content information may be characterized by cosine similarity between vectors corresponding to object features and vectors corresponding to content features.
In some embodiments, feature matching the second object feature with the second content feature to obtain a first matching result includes:
1. performing dot product operation between the feature vector corresponding to the second object feature and the feature vector corresponding to the second content feature to obtain an operation result;
2. And normalizing the operation result to obtain a first matching result.
In the present application, dot product operation may be performed between the feature vector corresponding to the second object feature and the feature vector corresponding to the second content feature, to obtain an operation result. Wherein the result of the vector dot product operation is a scalar, e.g., a numerical value. As described above, the second content feature may be a second object feature sequence, and then the dot product operation may be performed between the feature vector corresponding to the second object feature and the vector corresponding to the second content feature, or the dot product operation may be performed between the feature vector corresponding to the second object feature and the vector corresponding to each feature in the second content feature sequence, and then the obtained operation result may be a number sequence, that is, the operation result includes a plurality of numbers.
Then, the operation result can be normalized, namely, a numerical sequence corresponding to the operation result can be processed by adopting a softmax function, so that a matching result is obtained. It will be appreciated that the matching result is also a sequence of values, each value in the sequence representing a semantic similarity between the content information and the object information.
And 105, updating model parameters of the preset neural network model according to the first matching result and the label information until the preset neural network model converges.
In this application, the preset neural network may be the aforementioned dual-tower DSSM model, which includes DNNs for processing object features and DNNs for processing content features, that is, the preset neural network model may include the aforementioned first neural network and second neural network. When the preset neural network model is processed, the input of the model is the first object characteristic and the first content characteristic, and the output of the model is the first matching result.
As previously described, the first matching result is a sequence of values. On the other hand, the training sample also comprises label information corresponding to each content information, namely the label information also forms a label sequence. Then according to the preset loss function calculation formula, and adopting the numerical sequence and the label sequence, the loss value corresponding to each content information can be calculated. And performing gradient back transmission on the preset neural network model based on the loss values, and adjusting model parameters of the preset neural network model, namely adjusting model parameters of the first neural network and the second neural network until the parameters of the preset neural network model are converged, so as to complete training of the preset neural network model.
In some embodiments, the model training method provided in the present application further includes:
1. performing feature processing on the first object feature again by using the first neural network to obtain a third object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature again by using the first neural network;
2. calculating first difference information of the second object feature and the third object feature;
3. and updating model parameters of a preset neural network model according to the first matching result, the label information and the first difference information.
In this embodiment of the present application, the first neural network may be used to perform feature processing on the first object feature again, to obtain a third object feature. When the first neural network is used for processing the first object feature, random hiding processing is still needed to be performed on neurons in the first neural network. I.e. it is still necessary to add a dropout layer in the first neural network DNN to randomly mask the neurons in the DNN. In the process of performing feature processing on the first object feature twice based on the first neural network by adopting the dropoff method, the proportion of neurons of the two dropoff may be the same.
Because the way of hiding the neurons in the first neural network is implemented randomly, the second object feature and the third object feature obtained by performing feature processing on the first object feature twice by adopting the first neural network are also different. However, since the first object features processed twice by the first neural network are identical, the second object features and the third object features obtained by processing the first object features multiple times by the ideal model should also tend to be similar, i.e. the smaller the difference between the second object features and the third object features should also be. In this regard, the network parameters of the first neural network may be adjusted in a contrast learning manner. Specifically, first difference information between the second object feature and the third object feature may be calculated, and then added to a loss function of a preset neural network model to constrain model parameters.
That is, in the present application, after the first difference information is obtained by calculation, the model parameters of the preset neural network model may be further updated according to the first matching result, the tag information and the first difference information. That is, the new loss function of the preset neural network model includes two parts, one part is the difference between the probability value and the label value corresponding to each content output by the model, and the other part is the first difference information between the second object feature and the third object feature. And then, carrying out iterative training on the preset neural network model based on the new loss function to obtain the trained preset neural network model.
In some embodiments, the model training method provided in the present application further includes:
4. performing feature matching on the third object feature and the second content feature to obtain a second matching result;
5. calculating second difference information between the first matching result and the second matching result;
6. and updating model parameters of a preset neural network model according to the first matching result, the label information, the first difference information and the second difference information.
In the application, after different sub-models for processing the object features are obtained by adopting a dropout method, and the first object features are processed by adopting different sub-models to obtain the second object features and the third object features, the output results of the different sub-models can be further constrained. The difference between the second object feature and the third object feature is ensured to be as small as possible, and the difference between the semantic similarity between the object feature and the content feature output by different sub-models is ensured to be as small as possible.
Therefore, in the present application, after the first neural network is adopted to perform feature processing on the first object feature again to obtain the third object feature, feature matching may be further performed on the third object feature and the second content feature, so as to obtain a second matching result. Wherein, as mentioned above, the matching result is a numerical sequence composed of a series of similarity values. I.e. the first matching result and the second matching result here are both a sequence of values.
Further, model parameters of the preset neural network model can be updated according to the first matching result, the label information, the first difference information and the second difference information.
In some embodiments, updating model parameters of the preset neural network model according to the first matching result, the tag information, the first difference information and the second difference information includes:
6.1, determining a first sub-loss function according to the first matching result and the label information;
6.2, determining a second sub-loss function according to the first difference information;
6.3, determining a third sub-loss function according to the second difference information;
6.4, constructing a loss function of the preset neural network model based on the first sub-loss function, the second sub-loss function and the third sub-loss function;
and 6.5, carrying out iterative training on a preset neural network model based on the loss function.
In this embodiment of the present application, the loss function of the preset neural network model may include three parts, where the first part is a difference between the second object feature and the third object feature, that is, first difference information, and the part may be referred to as a first sub-loss function; the second part is the difference between the matching result of the second object feature and the second content feature and the matching result of the third object feature and the second content feature, i.e. the difference between the first matching result and the second matching result, i.e. the second difference information, which part may be referred to as a second sub-loss function; the third part is the difference between the matching result and the tag information, where the matching result may be the first matching result or the second matching result, and this part may be referred to as a third sub-loss function.
Then, a total loss function of the preset neural network model is determined based on the first sub-loss function, the second sub-loss function and the third sub-loss function. Specifically, the three sub-loss functions may be accumulated to obtain a total loss function of the preset neural network model.
Thus, after the total loss function of the preset neural network model is determined, the preset neural network model can be iteratively trained based on the loss function and the training sample until model parameters are converged, and the trained preset neural network model is obtained.
In some embodiments, calculating second difference information between the first matching result and the second matching result includes:
5.1, determining a first result sequence corresponding to the first matching result and a second result sequence corresponding to the second matching result;
and 5.2, calculating the relative entropy between the first result sequence and the second result sequence, and obtaining second difference information between the first matching result and the second matching result.
In the present application, the difference information between the first matching result and the second matching result may be determined by calculating the KL divergence (Kullback-Leibler Divergence) between the sequences corresponding to the first matching result and the second matching result. Among these, KL divergence, also known as Relative Entropy (RE) or information divergence (Information Divergence, ID), is a measure of asymmetry of the difference between two probability distributions.
Specifically, a first result sequence corresponding to the first matching result and a second result sequence corresponding to the second matching result may be determined first, where a numerical value in the result sequence may be a dot product between the second content feature and the second object feature or the third object feature. Then, calculating the relative entropy between the first result sequence and the second result sequence, and obtaining second difference information between the first matching result and the second matching result.
In some embodiments, the model training method provided in the present application further includes:
A. performing feature processing on the first object feature again by using the first neural network to obtain a fourth object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature again by using the first neural network;
B. performing feature matching on the second content features and the fourth object features to obtain a third matching result;
C. calculating third difference information between the first matching result and the third matching result;
D. and updating model parameters of a preset neural network model according to the first matching result, the label information and the third difference information.
In the embodiment of the application, the first object feature is processed twice by adopting a dropout method based on the first neural network, so as to obtain the second object feature and the fourth object feature. However, in this embodiment, the comparison learning of the second object feature and the fourth object feature is not required, and only the output of the two sub-models obtained by adopting the dropout method is required to be constrained, that is, the matching result of the second content feature and the second object feature and the matching result of the second content feature and the fourth object feature are kept consistent as much as possible.
Therefore, in the embodiment of the present application, after the second object feature and the fourth object feature are determined, feature matching is performed on the second content feature and the fourth object feature, so as to obtain a third matching result. Third difference information between the first matching result and the third matching result is then calculated. And further updating model parameters of a preset neural network model according to the first matching result, the label information and the third difference information.
That is, in the embodiment of the present application, the loss function of the preset neural network model includes two parts, the first part is the difference between the first matching result and the tag information, the second part is the difference between the first matching result and the third matching result, and the two parts are added to obtain the loss function of the preset neural network model.
And then, carrying out iterative training on the preset neural network model based on the loss function and the training sample information until the model parameters are converged, and obtaining the trained preset neural network model.
According to the above description, according to the model training method provided by the embodiment of the application, training sample information is obtained, the training sample information includes a plurality of training samples, and the training samples include first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information, and tag information corresponding to each piece of content information; performing feature processing on the first object feature by using a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature by using the first neural network; performing feature processing on the first content features by adopting a second neural network to obtain second content features; performing feature matching on the second object features and the second content features to obtain a first matching result; updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises a first neural network and a second neural network.
Therefore, according to the model training method provided by the application, the hidden layer can be added in the sub-model for processing the object characteristics in the double-tower model of the recommendation system, so that the neurons of the sub-model are randomly hidden, the situation that the model cannot be converged due to the long tail condition of the object characteristics is avoided, the robustness of the double-tower model of the recommendation system is improved, and the accuracy of content recommendation can be improved.
The application also provides a model training method which can be used in computer equipment, wherein the computer equipment can be a terminal or a server. As shown in fig. 3, another flow chart of the content recommendation method provided in the present application includes:
in step 201, a computer device obtains training sample information.
The training sample information may include a plurality of training samples, and the training samples may include object information, a plurality of pieces of content information corresponding to the object information, and tag information corresponding to each piece of content information. The tag information may be 0 or 1, which represents a click condition of the object corresponding to the object information on the content information. A label information of 0 may be referred to as a negative sample and a label information of 1 may be referred to as a positive sample.
The content information may include a title of the content, a body of the content, a tag of the content, and the like.
Step 202, the computer device performs word embedding processing on the object information and the content information to obtain a first object feature and a first content feature.
After the training sample information is obtained, the computing equipment performs word segmentation on object information and content information in the training sample information, and performs word embedding on the word segmented information to obtain first object features corresponding to the object information and first content features corresponding to the content information.
The first object feature and the first content feature may both be feature vectors, where the first content feature may include feature vectors corresponding to a plurality of content information, that is, the first content feature may be a feature sequence.
In step 203, the computer device performs feature processing on the first content feature by using a first neural network in the preset neural network model, so as to obtain a second content feature.
The network model for training in the application is a preset neural network model, wherein the preset neural network model can be a double-tower DSSM model, and the model comprises a first neural network for processing content characteristics and a second neural network for processing object characteristics.
The first neural network is used for carrying out feature processing on the first content features to obtain second content features.
In step 204, the computer device performs feature processing on the first object feature twice by using a second neural network in the preset neural network model, to obtain a second object feature and a third object feature.
In the present application, a dropout method may be used to obtain more sub-models, and in particular, the dropout method may be used to perform feature processing on the first object feature based on the second neural network. When the first object feature is processed based on the second neural network by adopting the dropout method, the preset dropout probability can be adopted to randomly hide the neurons in the second neural network. The dropout method only conceals the neuron in the second neural network at the current processing time, and the neuron in the second neural network cannot be lost. Each neuron in the second neural network after training has its corresponding model parameter, and when the preset neural network model after training is used, the neurons in the second neural network still exist.
The computer equipment adopts a second neural network in a preset neural network model to perform feature processing on the first object feature twice, so that the second object feature and the third object feature can be obtained. The dropout method is to randomly hide neurons in the second neural network, so that the obtained second object features are different from the third object features.
In step 205, the computer device calculates first difference information between the second object feature and the third object feature.
In the application, a method based on simple comparison learning sentence embedding (Simple Constructive Learning, simCSE) is used for obtaining a submodel by using a dropout method, and different object features of one object, namely the second object feature and the third object feature, are obtained through randomness of dropout. And then comparing and learning the two features, namely calculating first difference information of the second object feature and the third object feature. It will be appreciated that since the two features are different object features corresponding to the same object, the two features should remain as similar as possible. I.e. the smaller the difference information between the two should be, the better the second object feature should tend to be the same as the third object feature during model training.
In step 206, the computer device performs feature matching on the second content feature and the second object feature to obtain a first matching result.
After determining the second content feature corresponding to the content information and the second object feature corresponding to the object information, the dual-tower DSSM model needs to further perform feature matching on the second content feature and the second object feature to obtain the semantic similarity between the object information and the content information. Thus, the computer device may perform feature matching on the second content feature and the second object feature, resulting in a first matching result. The matching of the second content feature and the second object feature may specifically determine a content feature vector corresponding to the second content feature and an object feature vector corresponding to the second object feature, and then calculate cosine similarity between the content feature vector and the object feature vector to obtain semantic similarity between the content information and the object information. Since the second content feature includes features corresponding to the plurality of content information, cosine similarity between the plurality of content feature vectors and the object feature vector can be calculated to obtain a plurality of semantic similarity, or a semantic similarity sequence. And then, further inputting the semantic similarity sequence into a softmax layer for normalization processing to obtain a first matching result. I.e. the first matching result is a sequence of values.
In step 207, the computer device performs feature matching on the second content feature and the third object feature, to obtain a second matching result.
In this case, since the dropout method is adopted in the present application, two features of the object, that is, the aforementioned second object feature and third object feature, are obtained. After the second content feature and the second object feature are subjected to feature matching to obtain a first matching result, the second content feature and the third object feature are subjected to feature matching to obtain a second matching result. The matching manner is the same as the matching manner between the second content feature and the second object feature, and will not be described herein.
At step 208, the computer device calculates second difference information between the first matching result and the second matching result.
Wherein, as mentioned above, the first matching result is a sequence of values, wherein the values are semantic similarity values between the object information and different content information; likewise, the second matching result is also a semantic similarity value between the unified object and the aforementioned different content information. Since the semantic similarity of the same object to unified content information should be similar, second difference information between the first matching result and the second matching result can be calculated. The difference information should be continuously reduced during model training so that the first and second matching results tend to be the same.
In step 209, the computer device calculates third difference information between the first matching result and the tag information.
Further, the method for training the preset neural network model adopts supervised training, namely, the model output result is restrained by a certain label. I.e. the first matching result in this application should be close to the tag information.
Thus, the computer device may calculate third difference information between the first matching result and the tag information, which should gradually go to 0 during training of the model.
In step 210, the computer device constructs a loss function of the preset neural network model based on the first difference information, the second difference information, and the third difference information.
According to the above analysis, in the training process of the preset neural network model, there are three constraints, namely, the first difference information, the second difference information and the third difference information, so that a loss function for training the preset neural network model can be constructed according to the first difference information, the second difference information and the third difference information, and then the preset neural network model can be trained based on the loss function.
In step 211, the computer device performs iterative training on the preset neural network model based on the loss function, to obtain a trained preset neural network model.
After determining a loss function adopted when training a preset neural network model, carrying out iterative training on the preset neural network model based on the loss function and training sample information until the preset neural network model converges, and obtaining the trained preset neural network model.
According to the above description, according to the content recommendation method provided by the application, training sample information is obtained, the training sample information comprises a plurality of training samples, and the training samples comprise first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information and label information corresponding to each piece of content information; performing feature processing on the first object feature by using a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature by using the first neural network; performing feature processing on the first content features by adopting a second neural network to obtain second content features; performing feature matching on the second object features and the second content features to obtain a first matching result; updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises a first neural network and a second neural network.
Therefore, according to the model training method provided by the application, the hidden layer can be added in the sub-model for processing the object characteristics in the double-tower model of the recommendation system, so that the neurons of the sub-model are randomly hidden, the situation that the model cannot be converged due to the long tail condition of the object characteristics is avoided, the robustness of the double-tower model of the recommendation system is improved, and the accuracy of content recommendation can be improved.
In another aspect, the present application also provides a content recommendation method, which may be applied to a content recommendation device, where the content recommendation device may be integrated in a computer apparatus. Fig. 4 is a schematic flow chart of a content recommendation method provided in the present application. The method comprises the following steps:
in step 301, object information and candidate content information are acquired.
The candidate content information may include a title of a content corresponding to the candidate content, a body of the content, a tag of the content, and the like.
And step 302, extracting the characteristics of the object information to obtain the characteristics of the object.
After the object information is obtained, feature extraction can be performed on the object information to obtain object features.
In some embodiments, feature extraction is performed on object information to obtain object features, including:
1. Performing word segmentation processing on the object information to obtain a plurality of word segments corresponding to the object information;
2. and carrying out word embedding processing on the plurality of segmented words to obtain object features corresponding to the object information.
In this embodiment, a word embedding method may be used to extract features of the object information, specifically, word segmentation may be performed on the object information to obtain a plurality of words corresponding to the object information, and then word embedding may be performed on each word segment to obtain object features corresponding to the object information.
And step 303, extracting the characteristics of the candidate content information to obtain the content characteristics.
The candidate content information may be further extracted to obtain content features. Wherein the content features include features corresponding to a plurality of candidate content information. And extracting the characteristics of the candidate content information, or processing the candidate content information by adopting a word embedding method to obtain the content characteristics corresponding to the candidate content information.
And step 304, inputting the object characteristics and the content characteristics into the trained preset neural network model to obtain the score corresponding to each content characteristic.
The trained preset neural network can be a trained preset neural network model obtained by training by the model training method.
And step 305, determining target candidate contents according to the scores corresponding to the characteristics of each content, and recommending the candidate contents to the object.
After the score corresponding to each content feature is obtained, the score corresponding to each candidate content can be determined, then a preset number of candidate contents with the highest score can be selected as target candidate contents, and the target candidate contents are recommended to the object.
According to the above description, the content recommendation method provided by the present application obtains the object information and the candidate content information; extracting features of the object information to obtain object features; extracting the characteristics of the candidate content information to obtain content characteristics; inputting object features and content features into a preset neural network model, and outputting scores corresponding to each content feature, wherein the preset neural network model is a preset neural network model trained according to the model training method provided by the application; and determining target candidate contents according to the scores corresponding to the characteristics of each content, and recommending the candidate contents to the object. According to the content recommendation method, the candidate content is scored by adopting a more accurate candidate content evaluation model, and then target candidate content is recommended to the object according to the score of the candidate content. The method can effectively improve the accuracy of content recommendation.
In order to better implement the above model training method, the embodiment of the application also provides a model training device, which can be integrated in a terminal or a server.
For example, as shown in fig. 5, a schematic structural diagram of a model training apparatus provided in an embodiment of the present application, the model training apparatus may include a first obtaining unit 401, a first processing unit 402, a second processing unit 403, a first matching unit 404, and an updating unit 405, as follows:
a first obtaining unit 401, configured to obtain training sample information, where the training sample information includes a plurality of training samples, and the training samples include first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information, and tag information corresponding to each piece of content information;
a first processing unit 402, configured to perform feature processing on the first object feature by using a first neural network to obtain a second object feature, where neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature by using the first neural network;
a second processing unit 403, configured to perform feature processing on the first content feature by using a second neural network, so as to obtain a second content feature;
A first matching unit 404, configured to perform feature matching on the second object feature and the second content feature, so as to obtain a first matching result;
the updating unit 405 is configured to update model parameters of a preset neural network model according to the first matching result and the tag information until the preset neural network model converges, where the preset neural network model includes a first neural network and a second neural network.
In some embodiments, the model training apparatus further comprises:
the third processing unit is used for carrying out feature processing on the first object feature again by adopting the first neural network to obtain a third object feature, wherein neurons in the first neural network are randomly hidden in the process of carrying out feature processing on the first object feature again by adopting the first neural network;
a first calculation unit configured to calculate first difference information of the second object feature and the third object feature;
an updating unit, further configured to:
and updating model parameters of a preset neural network model according to the first matching result, the label information and the first difference information.
In some embodiments, the model training apparatus further comprises:
the second matching unit is used for carrying out feature matching on the third object feature and the second content feature to obtain a second matching result;
A second calculation unit for calculating second difference information between the first matching result and the second matching result;
an updating unit, further configured to:
and updating model parameters of a preset neural network model according to the first matching result, the label information, the first difference information and the second difference information.
In some embodiments, the updating unit comprises:
a first determining subunit, configured to determine a first sub-loss function according to the first matching result and the tag information;
a second determining subunit configured to determine a second sub-loss function according to the first difference information;
a third determining subunit configured to determine a third sub-loss function according to the second difference information;
the construction subunit is used for constructing a loss function of the preset neural network model based on the first sub-loss function, the second sub-loss function and the third sub-loss function;
and the training subunit is used for carrying out iterative training on the preset neural network model based on the loss function.
In some embodiments, the second computing unit comprises:
a fourth determining subunit, configured to determine a first result sequence corresponding to the first matching result and a second result sequence corresponding to the second matching result;
And the calculating subunit is used for calculating the relative entropy between the first result sequence and the second result sequence to obtain second difference information between the first matching result and the second matching result.
In some embodiments, the model training apparatus provided herein further includes:
the fourth processing unit is used for carrying out feature processing on the first object feature again by adopting the first neural network to obtain a fourth object feature, wherein neurons in the first neural network are randomly hidden in the process of carrying out feature processing on the first object feature again by adopting the first neural network;
the third matching unit is used for carrying out feature matching on the second content features and the fourth object features to obtain a third matching result;
a third calculation unit configured to calculate third difference information between the first matching result and a third matching result;
an updating unit, further configured to:
and updating model parameters of a preset neural network model according to the first matching result, the label information and the third difference information.
In some embodiments, the first matching unit comprises:
the operation subunit is used for carrying out dot product operation between the feature vector corresponding to the second object feature and the feature vector corresponding to the second content feature to obtain an operation result;
And the processing subunit is used for carrying out normalization processing on the operation result to obtain a first matching result.
In the implementation, each unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiment, which is not described herein again.
As can be seen from the foregoing description, in the model training device provided in the embodiment of the present application, training sample information is obtained by the first obtaining unit 401, the training sample information includes a plurality of training samples, and the training samples include first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information, and tag information corresponding to each piece of content information; the first processing unit 402 performs feature processing on the first object feature by using a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature by using the first neural network; the second processing unit 403 performs feature processing on the first content feature by using a second neural network to obtain a second content feature; the first matching unit 404 performs feature matching on the second object feature and the second content feature to obtain a first matching result; the updating unit 405 updates model parameters of the preset neural network model according to the first matching result and the tag information until the preset neural network model converges, where the preset neural network model includes a first neural network and a second neural network.
Therefore, according to the model training method provided by the application, the hidden layer can be added in the sub-model for processing the object characteristics in the double-tower model of the recommendation system, so that the neurons of the sub-model are randomly hidden, the situation that the model cannot be converged due to the long tail condition of the object characteristics is avoided, the robustness of the double-tower model of the recommendation system is improved, and the accuracy of content recommendation can be improved.
In order to better implement the content recommendation method, the embodiment of the application also provides a content recommendation device, which can be integrated in a terminal or a server.
For example, as shown in fig. 6, a schematic structural diagram of a content recommendation device provided in an embodiment of the present application, the content recommendation device may include a second obtaining unit 501, a first extracting unit 502, a second extracting unit 503, an input unit 504, and a determining unit 505, as follows:
a second acquisition unit 501 for acquiring object information and candidate content information;
a first extracting unit 502, configured to perform feature extraction on object information to obtain object features;
a second extracting unit 503, configured to perform feature extraction on the candidate content information to obtain content features;
An input unit 504, configured to input the object features and the content features into a preset neural network model, and output a score corresponding to each content feature, where the preset neural network model is a preset neural network model trained in the model training method of the first aspect;
a determining unit 505, configured to determine target candidate content according to the score corresponding to each content feature, and recommend the candidate content to the object.
In some embodiments, the first extraction unit comprises:
the word segmentation subunit is used for carrying out word segmentation processing on the object information to obtain a plurality of word segments corresponding to the object information;
and the embedding subunit is used for carrying out word embedding processing on the plurality of segmented words to obtain object characteristics corresponding to the object information.
In the implementation, each unit may be implemented as an independent entity, or may be implemented as the same entity or several entities in any combination, and the implementation of each unit may be referred to the foregoing method embodiment, which is not described herein again.
As can be seen from the above description, the content recommendation device provided in the embodiment of the present application acquires the object information and the candidate content information through the second acquisition unit 501; the first extraction unit 502 performs feature extraction on the object information to obtain object features; the second extraction unit 503 performs feature extraction on the candidate content information to obtain content features; the input unit 504 inputs the object features and the content features to a preset neural network model, outputs scores corresponding to each content feature, and the preset neural network model is a preset neural network model trained according to the model training method provided in the application; the determining unit 505 determines target candidate contents according to the score corresponding to each content feature, and recommends the candidate contents to the subject. According to the content recommendation method, the candidate content is scored by adopting a more accurate candidate content evaluation model, and then target candidate content is recommended to the object according to the score of the candidate content. The method can effectively improve the accuracy of content recommendation.
The embodiment of the application also provides a computer device, which may be a terminal or a server, as shown in fig. 7, which is a schematic structural diagram of the computer device provided in the application. Specifically, the present invention relates to a method for manufacturing a semiconductor device.
The computer device may include one or more processing cores 'processing units 601, one or more storage media's storage units 602, power modules 603, and input modules 604, among other components. Those skilled in the art will appreciate that the computer device structure shown in FIG. 7 is not limiting of the computer device and may include more or fewer components than shown, or may be combined with certain components, or a different arrangement of components. Wherein:
the processing unit 601 is a control center of the computer device, connects respective parts of the entire computer device using various interfaces and lines, and performs various functions of the computer device and processes data by running or executing software programs and/or modules stored in the storage unit 602, and calling data stored in the storage unit 602. Optionally, processing unit 601 may include one or more processing cores; preferably, the processing unit 601 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, an object interface, an application program, etc., and the modem processor mainly processes wireless communication. It will be appreciated that the modem processor described above may not be integrated into the processing unit 601.
The storage unit 602 may be used to store software programs and modules, and the processing unit 601 performs various functional applications and data processing by running the software programs and modules stored in the storage unit 602. The storage unit 602 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, application programs required for at least one function (such as a sound playing function, an image playing function, and web page access), etc.; the storage data area may store data created according to the use of the computer device, etc. In addition, the storage unit 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory unit 602 may also include a memory controller to provide access to the memory unit 602 by the processing unit 601.
The computer device further comprises a power module 603 for supplying power to the respective components, and preferably, the power module 603 may be logically connected to the processing unit 601 through a power management system, so that functions of managing charging, discharging, power consumption management and the like are achieved through the power management system. The power module 603 may also include one or more of any components, such as a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
The computer device may also include an input module 604, which input module 604 may be used to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to object settings and function control.
Although not shown, the computer device may further include a display unit or the like, which is not described herein. In particular, in this embodiment, the processing unit 601 in the computer device loads executable files corresponding to the processes of one or more application programs into the storage unit 602 according to the following instructions, and the processing unit 601 executes the application programs stored in the storage unit 602, so as to implement various functions as follows:
acquiring training sample information, wherein the training sample information comprises a plurality of training samples, and the training samples comprise first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information and label information corresponding to each piece of content information; performing feature processing on the first object feature by using a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature by using the first neural network; performing feature processing on the first content features by adopting a second neural network to obtain second content features; performing feature matching on the second object features and the second content features to obtain a first matching result; updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises a first neural network and a second neural network.
Or, acquiring object information and candidate content information; extracting features of the object information to obtain object features; extracting the characteristics of the candidate content information to obtain content characteristics; inputting object features and content features into a preset neural network model, and outputting scores corresponding to each content feature, wherein the preset neural network model is a preset neural network model trained according to the model training method provided by the application; and determining target candidate contents according to the scores corresponding to the characteristics of each content, and recommending the candidate contents to the object.
It should be noted that, the computer device provided in the embodiment of the present application and the method in the foregoing embodiment belong to the same concept, and the specific implementation of each operation above may refer to the foregoing embodiment, which is not described herein.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present invention provide a computer readable storage medium having stored therein a plurality of instructions capable of being loaded by a processor to perform the steps of any of the methods provided by the embodiments of the present invention. For example, the instructions may perform the steps of:
Acquiring training sample information, wherein the training sample information comprises a plurality of training samples, and the training samples comprise first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information and label information corresponding to each piece of content information; performing feature processing on the first object feature by using a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature by using the first neural network; performing feature processing on the first content features by adopting a second neural network to obtain second content features; performing feature matching on the second object features and the second content features to obtain a first matching result; updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises a first neural network and a second neural network.
Or, acquiring object information and candidate content information; extracting features of the object information to obtain object features; extracting the characteristics of the candidate content information to obtain content characteristics; inputting object features and content features into a preset neural network model, and outputting scores corresponding to each content feature, wherein the preset neural network model is a preset neural network model trained according to the model training method provided by the application; and determining target candidate contents according to the scores corresponding to the characteristics of each content, and recommending the candidate contents to the object.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Wherein the computer-readable storage medium may comprise: read Only Memory (ROM), random access Memory (RAM, random Access Memory), magnetic or optical disk, and the like.
Since the instructions stored in the computer readable storage medium may perform the steps in any of the methods provided in the embodiments of the present invention, the beneficial effects that any of the methods provided in the embodiments of the present invention can be achieved are detailed in the previous embodiments, and are not described herein.
Among other things, according to one aspect of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a storage medium. The computer instructions are read from the storage medium by a processor of the computer device, and executed by the processor, cause the computer device to perform the method provided in various alternative implementations of the model training method or the content recommendation method described above.
The model training method and device, the content recommendation method and device provided by the embodiment of the invention are described in detail, and specific examples are applied to illustrate the principle and implementation of the invention, and the description of the above embodiments is only used for helping to understand the method and core ideas of the invention; meanwhile, as those skilled in the art will vary in the specific embodiments and application scope according to the ideas of the present invention, the present description should not be construed as limiting the present invention in summary.

Claims (15)

1. A method of model training, the method comprising:
acquiring training sample information, wherein the training sample information comprises a plurality of training samples, and the training samples comprise first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information and label information corresponding to each piece of content information;
performing feature processing on the first object feature by using a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature by using the first neural network;
performing feature processing on the first content features by adopting a second neural network to obtain second content features;
performing feature matching on the second object features and the second content features to obtain a first matching result;
updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises the first neural network and the second neural network.
2. The method according to claim 1, wherein the method further comprises:
Performing feature processing on the first object feature again by adopting the first neural network to obtain a third object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature again by adopting the first neural network;
calculating first difference information of the second object feature and the third object feature;
the updating the model parameters of the preset neural network model according to the first matching result and the label information comprises the following steps:
and updating model parameters of a preset neural network model according to the first matching result, the label information and the first difference information.
3. The method according to claim 2, wherein the method further comprises:
performing feature matching on the third object feature and the second content feature to obtain a second matching result;
calculating second difference information between the first matching result and the second matching result;
the updating the model parameters of the preset neural network model according to the first matching result, the tag information and the first difference information includes:
And updating model parameters of a preset neural network model according to the first matching result, the label information, the first difference information and the second difference information.
4. The method of claim 3, wherein updating model parameters of a predetermined neural network model according to the first matching result, the tag information, the first difference information, and the second difference information comprises:
determining a first sub-loss function according to the first matching result and the tag information;
determining a second sub-loss function according to the first difference information;
determining a third sub-loss function according to the second difference information;
constructing a loss function of a preset neural network model based on the first sub-loss function, the second sub-loss function and the third sub-loss function;
and carrying out iterative training on the preset neural network model based on the loss function.
5. A method according to claim 3, wherein said calculating second difference information between said first matching result and said second matching result comprises:
determining a first result sequence corresponding to the first matching result and a second result sequence corresponding to the second matching result;
And calculating the relative entropy between the first result sequence and the second result sequence to obtain second difference information between the first matching result and the second matching result.
6. The method according to claim 1, wherein the method further comprises:
performing feature processing on the first object feature again by using the first neural network to obtain a fourth object feature, wherein neurons in the first neural network are randomly hidden in the process of performing feature processing on the first object feature again by using the first neural network;
performing feature matching on the second content features and the fourth object features to obtain a third matching result;
calculating third difference information between the first matching result and the third matching result;
the updating the model parameters of the preset neural network model according to the first matching result and the label information comprises the following steps:
and updating model parameters of a preset neural network model according to the first matching result, the label information and the third difference information.
7. The method of claim 1, wherein performing feature matching on the second object feature and the second content feature to obtain a first matching result comprises:
Performing dot product operation between the feature vector corresponding to the second object feature and the feature vector corresponding to the second content feature to obtain an operation result;
and normalizing the operation result to obtain a first matching result.
8. A content recommendation method, the method comprising:
obtaining object information and candidate content information;
extracting the characteristics of the object information to obtain object characteristics;
extracting the characteristics of the candidate content information to obtain content characteristics;
inputting the object features and the content features into a preset neural network model, and outputting scores corresponding to each content feature, wherein the preset neural network model is a preset neural network model trained in the model training method according to any one of claims 1 to 7;
and determining target candidate contents according to the scores corresponding to the characteristics of each content, and recommending the candidate contents to the object.
9. The method according to claim 8, wherein the feature extraction of the object information to obtain object features includes:
performing word segmentation processing on the object information to obtain a plurality of word segments corresponding to the object information;
And carrying out word embedding processing on the plurality of segmented words to obtain object features corresponding to the object information.
10. A model training apparatus, the apparatus comprising:
the first acquisition unit is used for acquiring training sample information, wherein the training sample information comprises a plurality of training samples, and the training samples comprise first object features corresponding to object information, first content features corresponding to a plurality of pieces of content information and label information corresponding to each piece of content information;
the first processing unit is used for carrying out feature processing on the first object feature by adopting a first neural network to obtain a second object feature, wherein neurons in the first neural network are randomly hidden in the process of carrying out feature processing on the first object feature by adopting the first neural network;
the second processing unit is used for carrying out feature processing on the first content features by adopting a second neural network to obtain second content features;
the first matching unit is used for carrying out feature matching on the second object features and the second content features to obtain a first matching result;
and the updating unit is used for updating model parameters of a preset neural network model according to the first matching result and the label information until the preset neural network model converges, wherein the preset neural network model comprises the first neural network and the second neural network.
11. The apparatus of claim 10, wherein the apparatus further comprises:
the third processing unit is used for carrying out feature processing on the first object feature again by adopting the first neural network to obtain a third object feature, wherein neurons in the first neural network are randomly hidden in the process of carrying out feature processing on the first object feature again by adopting the first neural network;
a first calculation unit configured to calculate first difference information of the second object feature and the third object feature;
the updating unit is further configured to:
and updating model parameters of a preset neural network model according to the first matching result, the label information and the first difference information.
12. A content recommendation device, the device comprising:
a second acquisition unit configured to acquire object information and candidate content information;
the first extraction unit is used for extracting the characteristics of the object information to obtain object characteristics;
the second extraction unit is used for extracting the characteristics of the candidate content information to obtain content characteristics;
an input unit, configured to input the object feature and the content feature into a preset neural network model, and output a score corresponding to each content feature, where the preset neural network model is a preset neural network model trained in the model training method according to any one of claims 1 to 7;
And the determining unit is used for determining target candidate contents according to the scores corresponding to the characteristics of each content and recommending the candidate contents to the object.
13. A computer readable storage medium storing a plurality of instructions adapted to be loaded by a processor to perform the steps of the model training method of any one of claims 1 to 7 or the content recommendation method of claim 8 or 9.
14. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the model training method of any one of claims 1 to 7 or the content recommendation method of claim 8 or 9 when the computer program is executed.
15. A computer program product comprising computer program/instructions which, when executed by a processor, implement the steps of the model training method of any one of claims 1 to 7 or the content recommendation method of claim 8 or 9.
CN202111625500.0A 2021-12-28 2021-12-28 Model training method and device, and content recommendation method and device Pending CN116415624A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111625500.0A CN116415624A (en) 2021-12-28 2021-12-28 Model training method and device, and content recommendation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111625500.0A CN116415624A (en) 2021-12-28 2021-12-28 Model training method and device, and content recommendation method and device

Publications (1)

Publication Number Publication Date
CN116415624A true CN116415624A (en) 2023-07-11

Family

ID=87058047

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111625500.0A Pending CN116415624A (en) 2021-12-28 2021-12-28 Model training method and device, and content recommendation method and device

Country Status (1)

Country Link
CN (1) CN116415624A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116562838A (en) * 2023-07-12 2023-08-08 深圳须弥云图空间科技有限公司 Person post matching degree determination method and device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116562838A (en) * 2023-07-12 2023-08-08 深圳须弥云图空间科技有限公司 Person post matching degree determination method and device, electronic equipment and storage medium
CN116562838B (en) * 2023-07-12 2024-03-15 深圳须弥云图空间科技有限公司 Person post matching degree determination method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110472002B (en) Text similarity obtaining method and device
CN111382190B (en) Object recommendation method and device based on intelligence and storage medium
CN113392209B (en) Text clustering method based on artificial intelligence, related equipment and storage medium
CN112052318A (en) Semantic recognition method and device, computer equipment and storage medium
CN111858898A (en) Text processing method and device based on artificial intelligence and electronic equipment
CN111026840A (en) Text processing method, device, server and storage medium
CN114328988A (en) Multimedia data feature extraction method, multimedia data retrieval method and device
CN113761220A (en) Information acquisition method, device, equipment and storage medium
CN114329029A (en) Object retrieval method, device, equipment and computer storage medium
CN113344184A (en) User portrait prediction method, device, terminal and computer readable storage medium
CN115879508A (en) Data processing method and related device
CN114328800A (en) Text processing method and device, electronic equipment and computer readable storage medium
CN116775497B (en) Database test case generation demand description coding method
CN116415624A (en) Model training method and device, and content recommendation method and device
CN113569017A (en) Model processing method and device, electronic equipment and storage medium
CN115129863A (en) Intention recognition method, device, equipment, storage medium and computer program product
CN116821781A (en) Classification model training method, text analysis method and related equipment
CN113822291A (en) Image processing method, device, equipment and storage medium
CN113821687A (en) Content retrieval method and device and computer readable storage medium
CN113413607A (en) Information recommendation method and device, computer equipment and storage medium
CN113392220A (en) Knowledge graph generation method and device, computer equipment and storage medium
CN110569331A (en) Context-based relevance prediction method and device and storage equipment
CN116992031B (en) Data processing method, device, electronic equipment, storage medium and program product
CN116778264B (en) Object classification method, image classification method and related equipment based on class reinforcement learning
CN113988214A (en) Similar user recommendation method and device based on voice recognition result

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40090783

Country of ref document: HK