Comment sorting model training method, comment sorting method and comment sorting device
By obtaining the first sorting position and real behavior information of the comments, training the comment sorting model, solving the problem that the comment sorting model in the existing technology is affected by the real sorting position, and achieving a more fair and accurate comment sorting result.
Patent Information
- Application Number
- CN202411664761.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-03-11
AI Technical Summary
The existing comment sorting model is affected by the true sorting position of multiple comments during the training process, resulting in reduced fairness and accuracy of the model.
By obtaining the first sorting position of multiple sample comments, the first descriptive features and weights of each sample comment are determined, and the real behavior information is used as supervision information to train the comment sorting model to obtain accurate weights that are not affected by the real sorting position.
The fairness and accuracy of the comment sorting model are improved, ensuring the accuracy and unbiasedness of the comment sorting results.
Smart Images

Figure CN119598018A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a review ranking model training method, a review ranking method and a review ranking device. Background Art
[0002] With the development of Internet technology, more and more users are sharing their own multimedia resources on media platforms. Accordingly, posting comments in the comment area of multimedia resources, or replying to and liking other users' comments, has gradually become a way of interaction between users. However, due to the excessive number of comments in the comment area, users usually only view the comments that are ranked higher in the comment area, while the comments that users may be interested in but are ranked lower are difficult to be seen by users. Therefore, how to personalize the sorting of comments to prioritize the comments that users are more interested in and enhance the user's enthusiasm for interaction in the comment area is a technical problem that needs to be solved.
[0003] In the related art, the comment ranking model is usually trained based on a large number of online users' behavioral feedback data on comments, so that the trained comment ranking model can output personalized comment ranking results. The sample training data used by the comment ranking model includes user information, multimedia resource information, and multiple comments on multimedia resources arranged according to the real ranking position, and the real ranking position is the display position of the comment in the comment area of the multimedia resource.
[0004] However, in the above scheme, when the sample training data is input into the model during the training process, the actual ranking positions of multiple comments are also input into the model, causing the ranking results of the comments by the trained model to be affected by the actual ranking positions of the comments, thereby reducing the fairness and accuracy of the model. Summary of the invention
[0005] The present disclosure provides a review ranking model training method, review ranking method and device, which can enable the review ranking model to obtain accurate weights that are not affected by the actual ranking positions of multiple reviews during online reasoning, thereby obtaining accurate and unbiased review ranking results based on the weights, thereby improving the fairness and accuracy of the model. The technical solutions of the present disclosure are as follows:
[0006] According to one aspect of an embodiment of the present disclosure, a method for training a review ranking model is provided, comprising:
[0007] Acquire sample data, the sample data including a plurality of sample comments of any multimedia resource and a first sorting position and a second sorting position of the plurality of sample comments, the first sorting position being obtained by sorting according to attribute information of the plurality of sample comments, and the second sorting position being a real sorting position of the plurality of sample comments in a comment display area of the multimedia resource;
[0008] Based on the multiple sample comments and the first ranking position, determine a first descriptive feature and a weight of each sample comment, wherein the first descriptive feature is used to represent a comment feature and a first position feature of the corresponding sample comment, and the weight is used to represent the importance of the corresponding sample comment among the multiple sample comments;
[0009] Determining predicted behavior information of a sample object in the comment display area based on the plurality of the first description features, the plurality of the weights, and the second ranking position, the sample object being an object displayed in the comment display area;
[0010] The actual behavior information of the sample object in the comment display area is used as supervision information, and a comment sorting model is trained based on the actual behavior information and the predicted behavior information. The comment sorting model is used to sort the weights of multiple comments on any multimedia resource.
[0011] According to another aspect of an embodiment of the present disclosure, a comment sorting method is provided, comprising:
[0012] For any multimedia resource to be recommended to the target object, a plurality of comments on the multimedia resource and a first ranking position of the plurality of comments are obtained, where the first ranking position is obtained by ranking the plurality of comments according to attribute information;
[0013] The plurality of comments, the first ranking position, and the object information of the target object are processed by a comment ranking model to obtain weights of the plurality of comments, wherein the weights are used to indicate the importance of the corresponding comments among the plurality of comments, and the comment ranking model is trained according to the comment ranking model training method according to any one of claims 1 to 13;
[0014] The plurality of comments are sorted from largest to smallest according to their weights.
[0015] According to another aspect of an embodiment of the present disclosure, a training device for a review ranking model is provided, comprising:
[0016] an acquisition unit, configured to acquire sample data, the sample data comprising a plurality of sample comments of any multimedia resource and a first sorting position and a second sorting position of the plurality of sample comments, the first sorting position being obtained by sorting the plurality of sample comments according to attribute information of the plurality of sample comments, and the second sorting position being a real sorting position of the plurality of sample comments in a comment display area of the multimedia resource;
[0017] A first determining unit is configured to determine a first descriptive feature and a weight of each sample comment based on the multiple sample comments and the first ranking position, wherein the first descriptive feature is used to represent a comment feature and a first position feature of the corresponding sample comment, and the weight is used to represent an importance of the corresponding sample comment among the multiple sample comments;
[0018] A second determining unit is configured to determine predicted behavior information of a sample object in the comment display area based on the plurality of the first description features, the plurality of the weights, and the second sorting position, the sample object being an object displayed in the comment display area;
[0019] The training unit is configured to use the actual behavior information of the sample object in the comment display area as supervision information, and based on the actual behavior information and the predicted behavior information, train a comment sorting model, wherein the comment sorting model is used to sort the weights of multiple comments on any multimedia resource.
[0020] In some embodiments, the acquisition unit is configured to sort the multiple sample comments from most to least according to the number of interactions of the multiple sample comments, where the number of interactions is the number of likes, the number of favorites, the number of replies or the number of shares; and sort the multiple sample comments from early to late according to the release time of the multiple sample comments.
[0021] In some embodiments, the first determination unit is configured to determine the first descriptive feature of each sample comment based on the multiple sample comments and the first sorting position; based on the self-attention mechanism, process the first descriptive feature of each sample comment to obtain the processed first descriptive feature of each sample comment; based on the processed first descriptive feature of each sample comment, determine the weight of each sample comment, and the weight is positively correlated with the first descriptive feature of the corresponding sample comment.
[0022] In some embodiments, the acquisition unit is configured to acquire a plurality of sample data corresponding to the multimedia resource;
[0023] Wherein, different sample data are targeted at different sample objects, and each piece of sample data also includes object information of the targeted sample object;
[0024] The first determining unit is configured to determine a first descriptive feature and a weight of each sample comment based on the multiple sample comments, the first ranking position, and object information of the sample object targeted by the sample data.
[0025] In some embodiments, the first determining unit includes:
[0026] A first determining subunit is configured to determine a first descriptive feature of each sample comment based on the plurality of sample comments and the first ranking position;
[0027] A first processing subunit is configured to process the first description feature of each sample comment based on a self-attention mechanism to obtain a processed first description feature of each sample comment;
[0028] The first determining subunit is further configured to determine an object feature of the sample object based on the object information of the sample object;
[0029] The second determining subunit is configured to determine the weight of each sample comment based on the processed first descriptive feature of each sample comment and the object feature, wherein the weight is positively correlated with the object feature and the first descriptive feature of the corresponding sample comment.
[0030] In some embodiments, the first determination subunit is configured to obtain a comment feature of each sample comment based on the multiple sample comments; encode the first sorting position of the multiple sample comments to obtain a first position feature of each sample comment; and for any sample comment, fuse the comment feature and the first position feature of the sample comment to obtain a first description feature of the sample comment.
[0031] In some embodiments, the second determination subunit is configured to perform dot product of the object feature with the first descriptive feature of each sample comment to obtain an intermediate weight of each sample comment; and normalize the intermediate weight of each sample comment to obtain the weight of each sample comment.
[0032] In some embodiments, the second determination unit is configured to determine the second descriptive feature of each comment based on multiple first descriptive features and the second sorting position, the second descriptive feature being used to represent the comment feature and the second position feature of the corresponding sample comment; and determine the predicted behavior information of the sample object in the comment display area based on multiple second descriptive features and multiple weights.
[0033] In some embodiments, the second determination unit is configured to encode the second sorting positions of the multiple sample comments to obtain a second position feature of each sample comment; for any sample comment, fuse the second position feature and the first description feature of the sample comment to obtain a second description feature of the sample comment; based on the self-attention mechanism, process the second description feature of each sample comment to obtain the processed second description feature of each comment.
[0034] In some embodiments, the second determination unit is configured to perform weighted summation of the multiple second descriptive features based on the multiple weights to obtain a duration feature of the sample object in the comment display area; and determine the predicted stay duration of the sample object in the comment display area based on the duration feature.
[0035] In some embodiments, the predicted behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area;
[0036] The second determination unit is further configured to determine, for any sample comment, based on a second descriptive feature of the sample comment, a predicted operation type of the sample object on the sample comment in the comment display area.
[0037] In some embodiments, the predicted behavior information includes the predicted length of time the sample object stays in the comment display area, and the actual behavior information includes the actual length of time the sample object stays in the comment display area;
[0038] The training unit comprises:
[0039] A third determining subunit is configured to determine a first loss based on the actual stay duration and the predicted stay duration, wherein the first loss is a mean square error loss between the actual stay duration and the predicted stay duration;
[0040] An updating subunit is configured to update the model parameters of the review ranking model based on the first loss.
[0041] In some embodiments, the predicted behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area, and the actual behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area.
[0042] The third determining subunit is further configured to determine, for any sample comment, a second loss of the sample comment based on the actual operation type and the predicted operation type of the sample object on the sample comment, wherein the second loss is a cross entropy loss between the actual operation type and the predicted operation type;
[0043] The updating subunit is configured to update the model parameters of the comment ranking model based on the first loss and the second losses of the multiple sample comments.
[0044] According to another aspect of an embodiment of the present disclosure, a comment sorting device is provided, comprising:
[0045] an acquisition unit configured to acquire, for any multimedia resource to be recommended to a target object, a plurality of comments on the multimedia resource and a first ranking position of the plurality of comments, wherein the first ranking position is obtained by ranking the plurality of comments according to attribute information;
[0046] a prediction unit configured to process the plurality of comments, the first ranking position, and the object information of the target object through a comment ranking model to obtain weights of the plurality of comments, wherein the weights are used to indicate the importance of the corresponding comments among the plurality of comments, and the comment ranking model is trained according to the training method of the comment ranking model;
[0047] The sorting unit is configured to sort the multiple comments from large to small according to the weights of the multiple comments.
[0048] According to another aspect of an embodiment of the present disclosure, an electronic device is provided, the electronic device comprising:
[0049] one or more processors;
[0050] A memory for storing program codes executable by the processor;
[0051] Among them, the processor is configured to execute the program code to implement the above-mentioned comment sorting model training method, or the above-mentioned comment sorting method.
[0052] According to another aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When the program code in the computer-readable storage medium is executed by a processor of an electronic device, the electronic device can execute the above-mentioned comment ranking model training method, or the above-mentioned comment ranking method.
[0053] According to another aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements the above-mentioned review ranking model training method or the above-mentioned review ranking method.
[0054] The disclosed embodiment provides a method for training a comment ranking model. By obtaining the first ranking position of multiple sample comments, the comment ranking model can determine the weight of each sample comment based on the first ranking position and multiple sample comments during the training process. The comment ranking model is trained using the real behavior information of the sample object in the comment display area for displaying multiple sample comments as supervision information, so that the comment ranking model can gradually acquire the ability to obtain accurate weights during the training process. Since the first ranking position is obtained by sorting the comments according to their own attributes, and the weight represents the importance of the comment among multiple comments, the comment ranking model can also obtain the first ranking position of the multiple comments to be sorted during online reasoning, and then can obtain accurate weights that are not affected by the real ranking positions of the multiple comments, so that accurate and unbiased comment ranking results can be output based on the weights, thereby improving the fairness and accuracy of the model.
[0055] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0057] Figure 1 The figure is a schematic diagram of an implementation environment according to an exemplary embodiment.
[0058] Figure 2 The figure is a flowchart of a method for training a review ranking model according to an exemplary embodiment.
[0059] Figure 3 The figure is a flowchart of another method for training a review ranking model according to an exemplary embodiment.
[0060] Figure 4 is a schematic diagram showing sample data according to an exemplary embodiment.
[0061] Figure 5 It is a structural diagram of a comment ranking model according to an exemplary embodiment.
[0062] Figure 6 The figure is a flow chart of a comment sorting method according to an exemplary embodiment.
[0063] Figure 7 It is a block diagram of a training device for a comment ranking model according to an exemplary embodiment.
[0064] Figure 8The figure is a block diagram of a comment sorting device according to an exemplary embodiment.
[0065] Fig. 9 It is a block diagram of a terminal according to an exemplary embodiment.
[0066] Fig.10 It is a block diagram of a server according to an exemplary embodiment. DETAILED DESCRIPTION
[0067] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0068] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0069] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions. For example, the multimedia resources, sample comments, object information, etc. involved in this disclosure are obtained with full authorization.
[0070] Figure 1 FIG. 1 is a schematic diagram of an implementation environment according to an exemplary embodiment. Taking the electronic device as a server as an example, see Figure 1 The implementation environment specifically includes: a terminal 101 and a server 102. The terminal 101 and the server 102 can be directly or indirectly connected via wired or wireless communication, which is not limited in the present disclosure.
[0071] The terminal 101 may be at least one of a smart phone, a smart watch, a desktop computer, a laptop computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), and a laptop computer. An application for comment display may be installed and run on the terminal 101, and a user may log in to the application through the terminal 101 to obtain the service provided by the application. The application is associated with the server 102, and the server 102 provides background services.
[0072] The terminal 101 may generally refer to one of a plurality of terminals. This embodiment is described by taking the terminal 101 as an example. Those skilled in the art may know that the number of the above terminals may be more or less. For example, the above terminals may be several, or the above terminals may be dozens or hundreds, or a greater number. The embodiment of the present disclosure does not limit the number and device type of the terminals.
[0073] The server 102 is at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. The server 102 can sort multiple comments on multimedia resources to be pushed to the terminal 101 through a comment sorting model, and push the sorting results of multiple comments on multimedia resources to the terminal 101, so that the terminal 101 can display the sorting results to the user in the comment display area of the multimedia resources. In some embodiments, the number of the above servers can be more or less, and the embodiments of the present disclosure are not limited to this. Of course, the server 102 also includes other functional servers to provide more comprehensive and diversified services.
[0074] Figure 2 is a flowchart of a method for training a review ranking model according to an exemplary embodiment. Figure 2 As shown, the method is performed by an electronic device, and the method includes the following steps:
[0075] In step 201, sample data is obtained, and the sample data includes multiple sample comments of any multimedia resource and a first sorting position and a second sorting position of the multiple sample comments. The first sorting position is obtained by sorting according to the attribute information of the multiple sample comments, and the second sorting position is the actual sorting position of the multiple sample comments in the comment display area of the multimedia resource.
[0076] In the embodiment of the present disclosure, the training data set of the comment ranking model includes multiple sample data, and one sample data includes multiple sample comments of any multimedia resource and the first ranking position and the second ranking position of the multiple sample comments. Among them, the first ranking position is the ranking position obtained by sorting according to the attribute information of the multiple sample comments, and the second ranking position is the actual ranking position of the multiple sample comments in the comment display area of the multimedia resource. The electronic device can obtain the sample data from the local database, and can also obtain the sample data from other electronic devices, which is not limited by the embodiment of the present disclosure.
[0077] In some embodiments, the attribute information of the sample comment includes the number of interactions and the release time of the sample comment. Accordingly, the implementation method of the electronic device obtaining the first ranking position of multiple sample comments in the sample data includes any of the following:
[0078] Implementation method 1: The electronic device sorts the multiple sample comments from most to least according to the number of interactions of the multiple sample comments. The number of interactions of the sample comments is the number of likes, the number of favorites, the number of replies, or the number of shares. Taking the number of interactions as the number of likes as an example, the first sorting position of the multiple sample comments is the sorting position obtained by inverting the number of likes of the multiple sample comments, that is, the more likes a sample comment has, the higher the sorting position of the sample comment.
[0079] Implementation method 2: The electronic device sorts multiple sample comments from early to late according to the release time of the multiple sample comments. The release time of the sample comment is the time when the corresponding user releases the sample comment in the comment display area of the multimedia resource. The earlier the release time, the higher the ranking position of the sample comment. By obtaining the first ranking position obtained by sorting according to the attribute information of multiple sample comments, the comment sorting model can learn the weight of the sample comments in the first ranking position during the training process, so that the weight output by the comment sorting model during online reasoning is not affected by the actual ranking position of the comment, thereby improving the accuracy of the model.
[0080] In step 202, based on multiple sample comments and the first ranking position, the first descriptive feature and weight of each sample comment are determined, the first descriptive feature is used to represent the comment feature and the first position feature of the corresponding sample comment, and the weight is used to represent the importance of the corresponding sample comment among the multiple sample comments.
[0081] In the disclosed embodiment, the electronic device extracts features from multiple sample comments and the first ranking positions of the multiple sample comments, and can obtain the comment features and first position features corresponding to each of the multiple sample comments. Accordingly, for any sample comment, the electronic device can obtain the first descriptive feature of the sample comment by fusing the comment features and the first position features of the sample comment. The first descriptive feature is used to represent the comment features and the first position features of the sample comment. After obtaining the first descriptive feature of each sample comment, the electronic device can fully connect the multiple first descriptive features to convert the multiple first descriptive features from vectors to scalar values, and obtain the weights corresponding to each of the multiple sample comments. Among them, the weight of the sample comment is used to represent the importance of the sample comment among the multiple sample comments, that is, to represent the contribution of the sample comment to the total length of stay of the sample object in the comment display area. The higher the contribution of the sample comment, the higher the degree of attraction of the sample comment to the sample object among the multiple sample comments.
[0082] In some embodiments, the electronic device processes multiple sample comments and the first ranking positions of the multiple sample comments through a comment ranking model to obtain a first descriptive feature and weight of each sample comment. The comment ranking model includes an input layer, an n-1 layer encoding block, and an activation function layer, where n is a positive integer greater than 1. The input layer is used to extract features from the input content to obtain multiple feature vectors to describe the various features of the input content in a high-dimensional space. The n-1 layer encoding block is used to use a self-attention mechanism to capture the relationship and influence between multiple input feature vectors. The activation function layer is used to fully connect and numerically normalize multiple input feature vectors to normalize multiple scalar values obtained by fully connecting multiple feature vectors to the interval [0,1], and the sum is 1. Accordingly, after inputting multiple sample comments and the first ranking position into the comment ranking model, the electronic device can extract features from the multiple sample comments and the first ranking position through the input layer to obtain the first description feature of each sample comment; then, through the n-1 layer encoding block, based on the self-attention mechanism, the first description feature of each sample comment is processed to obtain the first description feature of each sample comment after processing; finally, through the activation function layer, based on the first description feature of each sample comment after processing, the weight of each sample comment is determined, and the weight is positively correlated with the first description feature of the corresponding sample comment. By performing feature extraction, self-attention, full connection, and normalization on multiple sample comments and the first ranking positions of multiple sample comments, the weights of multiple sample comments are calculated, so that the comment ranking model can learn the ability to obtain weights that are not affected by the actual ranking position during the training process, thereby improving the accuracy of the comment ranking results obtained by subsequent sorting based on the weights of the comments.
[0083] In step 203, based on the plurality of first description features, the plurality of weights and the second ranking position, the predicted behavior information of the sample object in the comment display area is determined, the sample object being the object displayed in the comment display area.
[0084] In the embodiment of the present disclosure, the predicted behavior information is used to indicate the predicted behavior of the sample object in the comment display area. The predicted behavior can be a stay behavior in the comment display area. Accordingly, the predicted behavior information includes the total stay time of the sample object in the comment display area. The predicted behavior can also be a like behavior, a reply behavior, an expansion behavior, a forwarding behavior, etc. of the sample comment in the comment display area. Accordingly, the predicted behavior information can also include the predicted operation type of the sample object on multiple sample comments in the comment display area. The predicted operation type is an operation type such as a like, a forward, a reply, and an expansion, which is not limited in the embodiment of the present disclosure. Since the real behavior information of the sample object in the comment display area is related to the real ranking position of the multiple sample comments in the comment display area, the electronic device can determine the predicted behavior information of the sample object in the comment display area under the real ranking position based on the first descriptive feature, the weight, and the second ranking position of the multiple sample comments.
[0085] In step 204, the real behavior information of the sample object in the comment display area is used as supervision information, and a comment sorting model is trained based on the real behavior information and the predicted behavior information. The comment sorting model is used to sort the weights of multiple comments on any multimedia resource.
[0086] In the disclosed embodiment, whether the predicted behavior information is the same as the actual behavior information can reflect the accuracy of the comment ranking model. Accordingly, the electronic device can use the actual behavior information of the sample object in the comment display area as the supervision information, and train the comment ranking model based on the actual behavior information and the predicted behavior information, so that the comment ranking model can gradually acquire the ability to obtain accurate weights during the training process. The smaller the difference between the predicted behavior information and the actual behavior information, the higher the accuracy of the comment ranking model, and the more accurate the weight determined based on multiple comments and the first ranking positions of multiple comments.
[0087] The disclosed embodiment provides a method for training a comment ranking model. By obtaining the first ranking position of multiple sample comments, the comment ranking model can determine the weight of each sample comment based on the first ranking position and multiple sample comments during the training process. The comment ranking model is trained using the real behavior information of the sample object in the comment display area for displaying multiple sample comments as supervision information, so that the comment ranking model can gradually acquire the ability to obtain accurate weights during the training process. Since the first ranking position is obtained by sorting the comments according to their own attributes, and the weight represents the importance of the comment among multiple comments, the comment ranking model can also obtain the first ranking position of the multiple comments to be sorted during online reasoning, and then can obtain accurate weights that are not affected by the real ranking positions of the multiple comments, so that accurate and unbiased comment ranking results can be output based on the weights, thereby improving the fairness and accuracy of the model.
[0088] In some embodiments, the process of obtaining the first ranking position of the plurality of sample comments includes any of the following:
[0089] Sort the sample comments from most to least according to their interaction counts, where the interaction counts include the number of likes, the number of favorites, the number of replies, or the number of shares;
[0090] The multiple sample comments are sorted from early to late according to their release time.
[0091] In the disclosed embodiment, by obtaining the first ranking position obtained by sorting according to the attribute information of multiple sample comments, the comment ranking model can learn the weight of the sample comments in the first ranking position during the training process, so that the weight output by the comment ranking model during online reasoning is not affected by the actual ranking position of the comment, thereby improving the accuracy of the model.
[0092] In some embodiments, based on the plurality of sample reviews and the first ranking position, determining a first descriptive feature and a weight of each sample review includes:
[0093] Based on the plurality of sample reviews and the first ranking position, determining a first descriptive feature of each sample review;
[0094] Based on the self-attention mechanism, the first description feature of each sample comment is processed to obtain the processed first description feature of each sample comment;
[0095] Based on the processed first descriptive feature of each sample comment, the weight of each sample comment is determined, and the weight is positively correlated with the first descriptive feature of the corresponding sample comment.
[0096] In the disclosed embodiments, the weights of the multiple sample comments are calculated by performing feature extraction, self-attention, full connection, and normalization on the multiple sample comments and the first ranking positions of the multiple sample comments. This allows the comment ranking model to learn the ability to obtain weights that are not affected by the actual ranking positions during the training process, thereby improving the accuracy of the comment ranking results obtained by subsequent sorting based on the comment weights.
[0097] In some embodiments, obtaining sample data includes:
[0098] Obtain multiple pieces of sample data corresponding to multimedia resources;
[0099] Wherein, different sample data are targeted at different sample objects, and each piece of sample data also includes object information of the targeted sample object;
[0100] Based on the multiple sample comments and the first ranking position, determine the first descriptive feature and weight of each sample comment, including:
[0101] Based on the plurality of sample comments, the first ranking position, and the object information of the sample object targeted by the sample data, a first descriptive feature and a weight of each sample comment are determined.
[0102] In the disclosed embodiment, by acquiring the object information of the sample object, the personalized characteristics of the object can be introduced in the process of determining the comment weight, so that the comment ranking model can output personalized comment weights, and thus personalized ranking results of the comments can be obtained based on the personalized comment weights, thereby improving user satisfaction.
[0103] In some embodiments, based on the plurality of sample comments, the first ranking position, and the object information of the sample object targeted by the sample object, determining the first descriptive feature and the weight of each sample comment includes:
[0104] Based on the plurality of sample reviews and the first ranking position, determining a first descriptive feature of each sample review;
[0105] Based on the self-attention mechanism, the first description feature of each sample comment is processed to obtain the processed first description feature of each sample comment;
[0106] Determining object features of the sample object based on the object information of the sample object;
[0107] Based on the processed first descriptive feature and object feature of each sample comment, the weight of each sample comment is determined, and the weight is positively correlated with the object feature and the first descriptive feature of the corresponding sample comment.
[0108] In some embodiments, based on the plurality of sample reviews and the first ranking position, determining a first descriptive feature of each sample review includes:
[0109] Based on multiple sample comments, obtain the comment features of each sample comment;
[0110] Encode the first ranking positions of multiple sample comments to obtain the first position feature of each sample comment;
[0111] For any sample comment, the comment feature and the first position feature of the sample comment are fused to obtain the first description feature of the sample comment.
[0112] In the disclosed embodiment, by introducing the position features corresponding to the sample comments after being sorted according to the attribute information into the comment features of the sample comments, in the subsequent process of determining the comment weight based on the first descriptive feature, it is possible to obtain a weight that is not affected by the actual sorting position of the comment, thereby improving the accuracy of the subsequent comment sorting results obtained by sorting based on the comment weight.
[0113] In some embodiments, determining the weight of each sample comment based on the first description feature and the object feature of each sample comment includes:
[0114] Perform dot product between the object feature and the first descriptive feature of each sample comment to obtain the intermediate weight of each sample comment;
[0115] The intermediate weight of each sample comment is normalized to obtain the weight of each sample comment.
[0116] In the disclosed embodiment, by performing a dot product between the object feature and the first descriptive feature of the sample comment, the comment ranking model can jointly determine the weight of the sample comment based on the comment feature and the object feature, that is, the comment ranking model can output personalized comment weights, so that personalized ranking results of the comments can be obtained based on the personalized comment weights, thereby improving user satisfaction.
[0117] In some embodiments, based on the plurality of first description features, the plurality of weights, and the second ranking position, determining the predicted behavior information of the sample object in the comment display area includes:
[0118] Based on the plurality of first descriptive features and the second ranking positions, determining a second descriptive feature of each comment, the second descriptive feature being used to represent a comment feature and a second position feature of the corresponding sample comment;
[0119] Based on the plurality of second description features and the plurality of weights, predicted behavior information of the sample object in the comment display area is determined.
[0120] In the disclosed embodiment, by introducing the actual ranking positions of multiple sample comments in the comment display area to determine the predicted behavior information of the sample object in the comment display area, it can help the comment ranking model to more accurately predict the behavior of the sample object in the comment display area, thereby improving the accuracy of the comment ranking model.
[0121] In some embodiments, based on the plurality of first descriptive features and the second ranking position, determining the second descriptive feature of each review includes:
[0122] Encode the second ranking positions of multiple sample comments to obtain the second position feature of each sample comment;
[0123] For any sample comment, the second position feature and the first description feature of the sample comment are fused to obtain the second description feature of the sample comment;
[0124] Based on the self-attention mechanism, the second description feature of each sample comment is processed to obtain the processed second description feature of each comment.
[0125] In the disclosed embodiment, the second descriptive feature of the sample comment is obtained by fusing the first descriptive feature of the sample comment and the second position feature corresponding to the actual ranking position of the sample comment, so that the comment ranking model can subsequently determine the behavior prediction information of the sample object in the comment display area based on the second descriptive feature representing the actual ranking position of the sample comment, thereby improving the accuracy of the prediction results output by the comment ranking model.
[0126] In some embodiments, the predicted behavior information includes the predicted length of time the sample object stays in the review display area;
[0127] Based on the multiple second description features and the multiple weights, the predicted behavior information of the sample object in the comment display area is determined, including:
[0128] Based on multiple weights, multiple second description features are weighted summed to obtain a time feature of the sample object in the comment display area;
[0129] Based on the duration feature, the predicted duration of stay of the sample object in the comment display area is determined.
[0130] In the embodiment of the present disclosure, by performing weighted summation of multiple second descriptive features based on multiple weights, the review ranking model can determine the duration feature used to measure the predicted total duration of stay based on the contribution of multiple sample reviews to the total duration of stay of the sample object in the review display area, which helps the review ranking model to more accurately predict the total duration of stay of the sample object in the review display area, thereby improving the accuracy of the review ranking model.
[0131] In some embodiments, the predicted behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area;
[0132] After determining the predicted stay time of the sample object in the comment display area based on the duration feature, the method further includes:
[0133] For any sample comment, based on the second descriptive feature of the sample comment, the predicted operation type of the sample object on the sample comment in the comment display area is determined.
[0134] In the disclosed embodiment, by predicting the type of operation of the sample object on the sample comment based on the second descriptive feature of the sample comment, the comment ranking model can predict the type of operation of the sample object on the sample comment based on the actual ranking position of the sample comment in the sample display area, thereby improving the accuracy of the predicted operation type output by the comment ranking model.
[0135] In some embodiments, the predicted behavior information includes the predicted length of time the sample object stays in the comment display area, and the actual behavior information includes the actual length of time the sample object stays in the comment display area;
[0136] Based on real behavior information and predicted behavior information, the review ranking model is trained, including:
[0137] Based on the actual stay time and the predicted stay time, determine a first loss, where the first loss is a mean square error loss between the actual stay time and the predicted stay time;
[0138] Based on the first loss, update the model parameters of the review ranking model.
[0139] In the disclosed embodiment, by updating the model parameters of the comment ranking model based on the first loss, the accuracy of the comment ranking model can be improved, that is, the accuracy of the weights determined by the comment ranking model based on multiple comments, the first ranking positions of multiple comments, and the object information of the sample object is improved.
[0140] In some embodiments, the predicted behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area, and the real behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area;
[0141] The method also includes:
[0142] For any sample comment, based on the actual operation type and predicted operation type of the sample object on the sample comment, determine the second loss of the sample comment, where the second loss is the cross entropy loss between the actual operation type and the predicted operation type;
[0143] Based on the first loss, update the model parameters of the review ranking model, including:
[0144] Based on the first loss and the second loss of multiple sample reviews, the model parameters of the review ranking model are updated.
[0145] In the disclosed embodiment, by updating the model parameters of the comment ranking model based on the first loss and multiple second losses, not only the accuracy of the comment ranking model in predicting duration is improved, but also the accuracy of the comment ranking model in predicting operation type is improved, thereby further improving the accuracy of the weights determined by the comment ranking model based on multiple comments, the first ranking positions of multiple comments, and the object information of the sample object.
[0146] Above Figure 2 The basic process of the present disclosure is shown below. The training scheme of the review ranking model provided by the present disclosure is further described below. Figure 3 is a flowchart of another method for training a review ranking model according to an exemplary embodiment, the method being executed by an electronic device, see Figure 3 , the method comprises the following steps:
[0147] In step 301, multiple sample data corresponding to any multimedia resource are obtained, each sample data includes multiple sample comments of the multimedia resource, the first sorting position and the second sorting position of the multiple sample comments, and object information of the sample object targeted by the sample data, and different sample data target different sample objects.
[0148] In the embodiment of the present disclosure, the training data set of the comment sorting model includes multiple sample data corresponding to the same multimedia resource, and different sample data are targeted at different sample objects, that is, the viewing objects of the multimedia resources are different. For any multimedia resource, a sample data corresponding to the multimedia resource includes multiple sample comments of the multimedia resource, the first sorting position and the second sorting position of the multiple sample comments, and the object information of the sample object. Among them, the first sorting position is the sorting position obtained by sorting according to the attribute information of the multiple sample comments, and the second sorting position is the actual sorting position of the multiple sample comments in the comment display area of the multimedia resource. The attribute information of the sample comments includes the number of interactions and the release time of the sample comments. The number of interactions is the number of likes, the number of favorites, the number of replies or the number of shares. The object information of the sample object includes the object identifier and object attributes of the sample object. The object attributes include attributes such as age, gender, and region, which are not limited in the embodiment of the present disclosure.
[0149] Optionally, multiple sample comments of the sample data are stored in the form of a sequence. Accordingly, the multiple sample comments are arranged into a sequence in positive order according to the second sorting position. In the sequence, each sample comment includes, in addition to the text content of the sample comment, the comment identifier of the sample comment, the object identifier of the comment publishing object, the number of interactions of the sample comment, the posterior statistical probability of the interactive behavior of the sample comment, and the real behavior information of the sample object in the comment display area of the multiple sample comments. Among them, the posterior statistical probability is equal to the number of interactions corresponding to the interactive behavior of the sample comment divided by the number of exposures of the sample comment. For example, for the like behavior, the number of likes for a sample comment is 1 and the number of exposures is 10, then the posterior statistical probability of the like behavior of the sample comment is 0.1.
[0150] Optionally, a piece of sample data also includes resource information of multimedia resources, and the resource information includes the resource identifier of the multimedia resource, the object identifier of the resource publishing object, the duration of the multimedia resource, the browsing duration of the multimedia resource by the sample object, etc.
[0151] For example, Figure 4 FIG. 1 is a schematic diagram showing sample data according to an exemplary embodiment. Figure 4 As shown, a sample data includes the object information of the sample object, the resource information of the multimedia resource and the sample comment list of the multimedia resource. Among them, the object information includes the object identifier, the device identifier used by the object, the age, the gender, and the region (province, city, county). The resource information includes the resource identifier, the resource publishing object identifier, the resource type, the resource duration, and the browsing duration. In the sample comment list, each sample comment includes the comment identifier, the comment publishing object identifier, the text content, the display location, whether the comment has a picture, the number of xx (like, reply, expand, etc.) behaviors, the posterior statistical probability of xx behavior, and the predicted probability of xx behavior. The predicted probability is obtained by predicting the sample comments through other prediction models.
[0152] In step 302, based on multiple sample comments, the first sorting position, and the object information of the sample object targeted by the sample data, the first descriptive feature and the weight of each sample comment are determined, the first descriptive feature is used to represent the comment feature and the first position feature of the corresponding sample comment, and the weight is used to represent the importance of the corresponding sample comment among the multiple sample comments.
[0153] In the disclosed embodiment, the electronic device can extract features from multiple sample comments, the first ranking positions of multiple sample comments, and the object information of the sample object, and obtain the comment features and first position features corresponding to each of the multiple sample comments and the object features corresponding to the sample object. Then, the electronic device can first fuse the comment features and the first position features of each comment to obtain the first description features of each comment, and then, based on the object features of the sample object, fully connect the multiple first description features to convert each first description feature from an embedding vector composed of multiple feature values to a scalar value, and obtain the weights corresponding to the multiple sample comments. Among them, the weight of the sample comment is used to indicate the importance of the sample comment in the multiple sample comments, that is, to indicate the contribution of the sample comment to the total length of stay of the sample object indicated by the object feature in the comment display area. The higher the contribution of the sample comment, the higher the degree of attraction of the sample comment to the sample object in the multiple sample comments. By obtaining the object information of the sample object, the personalized features of the object can be introduced in the process of determining the comment weight, so that the comment ranking model can output personalized comment weights, so that the personalized ranking results of the comments can be obtained based on the personalized comment weights, thereby improving user satisfaction.
[0154] In some embodiments, the electronic device processes multiple sample comments, the first ranking positions of the multiple sample comments, and the object information of the sample object through a comment ranking model to obtain the first descriptive feature and weight of each sample comment. The comment ranking model includes an input layer, an n-1 layer encoding block, and an activation function layer, where n is a positive integer greater than 1. The input layer is used to extract features from the input content to obtain multiple feature vectors to describe various features of the input content in a high-dimensional space. The n-1 layer encoding block is used to use a self-attention mechanism to capture the relationship and influence between the multiple input feature vectors. The activation function layer is used to fully connect and numerically normalize the multiple input feature vectors to normalize the multiple scalar values obtained by fully connecting the multiple feature vectors to the interval [0,1], and the sum is 1. Accordingly, the process of determining the first descriptive feature and weight of each sample comment based on the multiple sample comments, the first ranking position, and the object information of the sample object by the electronic device includes the following steps (1)-(4).
[0155] (1) The electronic device determines the first descriptive feature of each sample comment based on the multiple sample comments and the first ranking position. The electronic device can extract features from the multiple sample comments and the first ranking position through the input layer to obtain the comment features and the first position features of each sample comment, and then process the comment features and the first position features of the sample comments through the input layer to obtain the first descriptive feature of the sample comments.
[0156] In some embodiments, the electronic device processes the plurality of sample comments and the first sorting position through the input layer, including: obtaining the comment feature of each sample comment based on the plurality of sample comments; encoding the first sorting position of the plurality of sample comments to obtain the first position feature of each sample comment; for any sample comment, fusing the comment feature of the sample comment and the first position feature to obtain the first description feature of the sample comment. The comment feature of the sample comment is represented by an embedded vector, that is, the comment features of the plurality of sample comments are represented in the form of a vector list. The first sorting position includes the comment identifiers of the plurality of sample comments and the sorting number corresponding to each comment identifier. By encoding the first sorting position, the electronic device can obtain a position encoding vector having the same dimension as the vector list, and the value of the position encoding vector at each position is used to represent the first position feature of the corresponding sample comment, that is, to represent the position of the sample comment in the plurality of sample comments sorted according to the attribute information. Accordingly, by processing the embedding vector of the comment feature and the value corresponding to the sample comment in the position encoding vector, the fusion of the comment feature of the sample comment and the first position feature can be achieved, that is, the first description feature of the sample comment can be obtained. By introducing the position features corresponding to the sample comments after they are sorted according to the attribute information into the comment features of the sample comments, in the subsequent process of determining the comment weight based on the first descriptive feature, it is possible to obtain a weight that is not affected by the actual sorting position of the comment, thereby improving the accuracy of the subsequent comment sorting results obtained by sorting based on the comment weight.
[0157] (2) The electronic device processes the first descriptive feature of each sample comment based on the self-attention mechanism to obtain the processed first descriptive feature of each sample comment. The comment ranking model includes n layers of encoding blocks. The electronic device can process the first descriptive features of multiple sample comments output by the input layer based on the self-attention mechanism through the first n-1 layers of encoding blocks in the n layers of encoding blocks to capture the relationship and influence between the multiple sample comments.
[0158] (3) The electronic device determines the object features of the sample object based on the object information of the sample object. Similar to step (1), the electronic device extracts features of the input object information through the input layer to obtain the object features of the sample object, and the object features are also represented by embedded vectors.
[0159] (4) The electronic device determines the weight of each sample comment based on the first descriptive feature and the object feature of each sample comment after processing, and the weight is positively correlated with the object feature and the first descriptive feature of the corresponding sample comment. The electronic device can fully connect multiple first descriptive features based on the object feature of the sample object through an activation function layer to convert each first descriptive feature from an embedded vector composed of multiple feature values to a scalar value. Then, the multiple scalar values are normalized through the activation function layer to obtain the weights corresponding to each of the multiple sample comments.
[0160] In some embodiments, the electronic device processes the first descriptive feature and the object feature of each sample comment after processing through the activation function layer, including: performing dot product of the object feature with the first descriptive feature of each sample comment to obtain the intermediate weight of each sample comment; normalizing the intermediate weight of each sample comment to obtain the weight of each sample comment. Among them, the object feature is represented by an embedding vector composed of multiple feature values, and the first descriptive feature is represented by an embedding vector composed of multiple feature values. The electronic device can obtain a scalar value by performing dot product of the embedding vector of the object feature and the embedding vector of the first descriptive feature, and the scalar value is the intermediate weight of the sample comment. By performing dot product of the object feature and the first descriptive feature of the sample comment, the comment ranking model can jointly determine the weight of the sample comment based on the comment feature and the object feature, that is, the comment ranking model can output personalized comment weights, so that personalized ranking results of comments can be obtained based on personalized comment weights, thereby improving user satisfaction.
[0161] In step 303, based on the plurality of first descriptive features and the second ranking positions, a second descriptive feature of each comment is determined, where the second descriptive feature is used to represent the comment feature and the second position feature of the corresponding sample comment.
[0162] In the disclosed embodiment, the electronic device extracts features from the second sorting positions of the multiple sample comments, and can obtain second position features corresponding to each of the multiple sample comments. The second position feature is used to indicate the display position of the sample comment in the comment display area. Accordingly, for any sample comment, the electronic device can obtain the second description feature of the sample comment by fusing the second position feature corresponding to the sample comment with the first description feature.
[0163] In some embodiments, the review ranking model includes not only an input layer, an n-1 layer coding block, and an activation function layer, but also an nth layer coding block, where n is a positive integer greater than 1. Accordingly, the process of the electronic device processing a plurality of first description features and a second ranking position to obtain a second description feature through the review ranking model includes the following steps (1)-(3).
[0164] (1) The electronic device encodes the second sorting position of the multiple sample comments to obtain the second position feature of each sample comment. The first descriptive feature of the sample comment is represented by an embedded vector, that is, the first descriptive feature of the multiple sample comments is represented in the form of a vector list. The second sorting position includes the comment identifiers of the multiple sample comments and the sorting number corresponding to each comment identifier. The electronic device can encode the second sorting position through the input layer to obtain a position encoding vector with the same dimension as the vector list. The value of the position encoding vector at each position is used to represent the second position feature of the corresponding sample comment, that is, to represent the display position of the sample comment in the comment display area.
[0165] (2) For any sample comment, the electronic device fuses the second position feature and the first description feature of the sample comment to obtain the second description feature of the sample comment. The electronic device processes the embedding vector of the first description feature and the value corresponding to the sample comment in the position encoding vector to achieve the fusion of the first description feature and the second position feature of the sample comment, that is, to obtain the second description feature of the sample comment.
[0166] (3) The electronic device processes the second description feature of each sample comment based on the self-attention mechanism to obtain the second description feature of each processed comment. The comment sorting model includes n layers of coding blocks. The electronic device can process the second description features of multiple sample comments based on the self-attention mechanism through the nth layer of coding blocks in the n layers of coding blocks to further capture the relationship and influence between the multiple sample comments. The second description feature of the sample comment is obtained by fusing the first description feature of the sample comment and the second position feature corresponding to the actual ranking position of the sample comment, so that the comment sorting model can subsequently determine the behavior prediction information of the sample object in the comment display area based on the second description feature representing the actual ranking position of the sample comment, thereby improving the accuracy of the prediction results output by the comment sorting model.
[0167] In step 304, based on the plurality of second description features and the plurality of weights, the predicted behavior information of the sample object in the comment display area is determined, the sample object being the object that displays the comment display area.
[0168] In the embodiment of the present disclosure, the predicted behavior information is used to indicate the predicted behavior of the sample object in the comment display area. The predicted behavior can be a stay behavior in the comment display area. Accordingly, the predicted behavior information includes the total stay time of the sample object in the comment display area. The predicted behavior can also be a like behavior, a reply behavior, an expansion behavior, a forwarding behavior, etc. of the sample comment in the comment display area. Accordingly, the predicted behavior information can also include the predicted operation type of the sample object on multiple sample comments in the comment display area. The predicted operation type is an operation type such as a like, a forward, a reply, and an expansion, which is not limited in the embodiment of the present disclosure. Since the real behavior information of the sample object in the comment display area is related to the real ranking position of the multiple sample comments in the comment display area, the second descriptive feature is used to represent the comment feature of the sample comment corresponding to the sample comment and the second position feature corresponding to the real ranking position. Therefore, the electronic device can determine the predicted behavior information of the sample object in the comment display area under the real ranking position based on the second descriptive feature and weight of the multiple sample comments. By introducing the actual ranking positions of multiple sample comments in the comment display area to determine the predicted behavior information of the sample object in the comment display area, it can help the comment ranking model to more accurately predict the behavior of the sample object in the comment display area, thereby improving the accuracy of the comment ranking model.
[0169] In some embodiments, the predicted behavior information includes the predicted stay time of the sample object in the comment display area. Accordingly, the above step 304 includes: the electronic device performs weighted summation on multiple second description features based on multiple weights to obtain the time feature of the sample object in the comment display area; the electronic device determines the predicted stay time of the sample object in the comment display area based on the time feature. Among them, since the weight of the sample comment is used to indicate the contribution of the sample comment to the total stay time of the sample object in the comment display area, for any sample comment, the electronic device can weight the second description feature of the sample comment based on the weight of the sample comment to obtain the weighted second description feature. Then, the multiple weighted second description features are summed to obtain the time feature of the sample object in the comment display area. The time feature is used to indicate the predicted stay time of the sample object in the comment display area. Accordingly, the electronic device performs time prediction on multiple sample comments based on the time feature to obtain the predicted stay time of the sample object in the comment display area. By performing weighted summation of multiple second descriptive features based on multiple weights, the review ranking model can determine the duration feature used to measure the predicted total duration of stay based on the contribution of multiple sample reviews to the total duration of stay of the sample object in the review display area, which helps the review ranking model to more accurately predict the total duration of stay of the sample object in the review display area, thereby improving the accuracy of the review ranking model.
[0170] In some embodiments, the predicted behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area. Accordingly, the above step 304 also includes: for any sample comment, the electronic device determines the predicted operation type of the sample object on the sample comment in the comment display area based on the second description feature of the sample comment. Among them, since the second description feature is used to represent the second position feature of the comment feature of the sample comment, the electronic device can predict the type of operation performed by the sample object on the sample comment based on the second description feature of the sample comment. The predicted operation type can be represented by a label. Taking the like operation as an example, the value of the label is 1, which means that the sample object likes the sample comment, and the value of the label is 0, which means that the sample object does not like the sample comment. The number of predicted operation types can be multiple or one, and the embodiment of the present disclosure does not limit this. By predicting the operation type of the sample object on the sample comment based on the second description feature of the sample comment, the comment sorting model can predict the operation type of the sample object on the sample comment based on the actual sorting position of the sample comment in the sample display area, thereby improving the accuracy of the predicted operation type output by the comment sorting model.
[0171] In step 305, the real behavior information of the sample object in the comment display area is used as supervision information, and a comment sorting model is trained based on the real behavior information and the predicted behavior information. The comment sorting model is used to sort the weights of multiple comments on any multimedia resource.
[0172] In the disclosed embodiment, whether the predicted behavior information is the same as the actual behavior information can reflect the accuracy of the comment sorting model. Accordingly, the electronic device can use the actual behavior information of the sample object in the comment display area as the supervision information, and train the comment sorting model based on the actual behavior information and the predicted behavior information, so that the comment sorting model can gradually acquire the ability to obtain accurate weights during the training process. The smaller the difference between the predicted behavior information and the actual behavior information, the higher the accuracy of the comment sorting model, and the more accurate the weight determined based on multiple comments, the first ranking position of multiple comments, and the object information of the sample object.
[0173] In some embodiments, the predicted behavior information includes the predicted stay time of the sample object in the comment display area, and the real behavior information includes the real stay time of the sample object in the comment display area. Accordingly, the above step 305 includes: the electronic device determines the first loss based on the real stay time and the predicted stay time, and the first loss is the mean square error loss between the real stay time and the predicted stay time; the electronic device updates the model parameters of the comment sorting model based on the first loss. Among them, the mean square error loss is used to indicate the difference between the real stay time and the predicted stay time. The smaller the mean square error loss, the smaller the difference between the real stay time and the predicted stay time, and the higher the accuracy of the comment sorting model. The electronic device updates the model parameters of the comment sorting model based on the first loss to reduce the first loss of the comment sorting model, and obtains the updated comment sorting model. If the updated comment sorting model meets the training end condition, such as the number of training times is the target number of times, or the first loss is within the target range, the updated comment sorting model is used as the comment sorting model that has completed training. If the updated comment ranking model does not meet the training end condition, the comment ranking model is updated again in accordance with steps 302 to 305 until the updated comment ranking model meets the training end condition, thereby obtaining a trained comment ranking model. By updating the model parameters of the comment ranking model based on the first loss, the accuracy of the comment ranking model can be improved, that is, the accuracy of the weights determined by the comment ranking model based on multiple comments, the first ranking positions of multiple comments, and the object information of the sample object can be improved.
[0174] In some embodiments, the predicted behavior information also includes the predicted operation type of the sample object in the comment display area for each sample comment, and the real behavior information also includes the predicted operation type of the sample object in the comment display area for each sample comment. Accordingly, the above step 305 also includes: for any sample comment, the electronic device determines the second loss of the sample comment based on the real operation type and the predicted operation type of the sample object on the sample comment, and the second loss is the cross entropy loss between the real operation type and the predicted operation type; the electronic device updates the model parameters of the comment sorting model based on the first loss and the second loss of the multiple sample comments. Among them, the cross entropy loss is used to indicate the difference between the real operation type and the predicted operation type. The smaller the cross entropy loss, the smaller the difference between the real operation type and the predicted operation type, and the higher the accuracy of the comment sorting model. The electronic device updates the model parameters of the comment sorting model based on the first loss and the second loss corresponding to each of the multiple sample comments, so as to reduce the first loss and the second loss, and obtain the updated comment sorting model. If the updated comment sorting model meets the training end condition, such as the number of training times is the target number of times, or the first loss and the second loss are both within the target range, the updated comment sorting model is used as the trained comment sorting model. If the updated comment ranking model does not meet the training end condition, the comment ranking model is updated again in accordance with steps 302 to 305 until the updated comment ranking model meets the training end condition, thereby obtaining a trained comment ranking model. By updating the model parameters of the comment ranking model based on the first loss and the plurality of second losses, not only the accuracy of the comment ranking model in predicting the duration is improved, but also the accuracy of the comment ranking model in predicting the operation type is improved, thereby further improving the accuracy of the weights determined by the comment ranking model based on the plurality of comments, the first ranking positions of the plurality of comments, and the object information of the sample object.
[0175] For example, Figure 5 FIG. 1 is a schematic diagram showing a structure of a comment ranking model according to an exemplary embodiment. Figure 5As shown, the comment ranking model adopts the encoder architecture of the Transformer model, including 6 layers of encoding blocks. X1,..Xi,..Xn represent the comment features of n sample comments. The first position encoding represents rotation encoding of the first ranking position of the n sample comments to obtain the first position features of the n sample comments. The first description features of the sample comments are obtained by adding the comment features and the first position features of the sample comments, and then the first description features corresponding to the n sample comments are input into the first 5 layers of encoding blocks. The first 5 layers of encoding blocks are used to capture the relationship and influence between the sample comments based on the self-attention mechanism to obtain multiple processed first description features. Then, the object feature Y of the sample object is dot-producted with the multiple processed first description features output by the 5th layer encoding block, and the multiple values obtained by the dot product are normalized to obtain the weights a1,..ai,..an of the n sample comments. The second position encoding represents rotation encoding of the second ranking position of the n sample comments to obtain the second position features of the n sample comments. Since the actual total duration of stay and the actual operation type in the supervision information are closely related to the second ranking position of the sample comments, the second description feature of the sample comments is obtained by adding the first description feature and the second position feature of the sample comments, and then the second description features corresponding to each of the n sample comments are input into the 6th layer encoding block. Finally, based on multiple weights, the processed multiple second description features output by the 6th layer encoding block are weighted and summed to obtain the duration feature r, and the predicted total duration of stay is obtained based on the duration feature. At the same time, the processed multiple second description features output by the 6th layer encoding block are respectively subjected to behavioral binary classification to obtain the behavioral binary classification results related to each sample comment.
[0176] The disclosed embodiment provides a method for training a comment sorting model, which can display interactive objects during the playback of multimedia resources so that users can play videos at multiple speeds by interacting with the interactive objects, thereby providing a solution for playing multimedia resources at multiple speeds through interactive operations. In the above manner, users can select the playback speed of multimedia resources according to actual needs, and can choose to watch multimedia resources at the default playback speed to obtain detailed information about the target object; they can also play multimedia resources at multiple speeds by interacting with the interactive objects, and can then quickly understand the target object while more conveniently obtaining virtual resources related to the target object, thereby improving information acquisition efficiency and human-computer interaction efficiency.
[0177] On the basis of the above embodiment, based on the above review ranking model training method, a trained review ranking model can be obtained, and then the reviews can be ranked based on the review ranking model. Figure 6 is a flowchart of a comment sorting method according to an exemplary embodiment. Figure 6As shown, the method is performed by an electronic device, and the method includes the following steps:
[0178] In step 601, for any multimedia resource to be recommended to a target object, multiple comments on the multimedia resource and first ranking positions of the multiple comments are obtained, and the first ranking positions are obtained by ranking the multiple comments according to attribute information.
[0179] In the disclosed embodiment, the target object is an object in the comment display area that displays multimedia resources. The electronic device can obtain a data stream that is pushed to the target object. The data stream includes multiple multimedia resources to be recommended to the target object and related information of the multimedia resources. Accordingly, the electronic device can obtain multiple comments and attribute information of multiple comments on any multimedia resource in the data stream based on the data stream, and then sort the multiple comments according to the attribute information to obtain the first sorting position of the multiple comments. Among them, the attribute information includes the number of interactions and the release time of the sample comments, and the number of interactions includes the number of likes, the number of favorites, the number of replies or the number of shares, etc.
[0180] In step 602, the comment ranking model is used to process multiple comments, the first ranking position, and the object information of the target object to obtain weights of the multiple comments. The weights are used to indicate the importance of the corresponding comments among the multiple comments. The comment ranking model is trained according to the training method of the comment ranking model in the above embodiment.
[0181] In the disclosed embodiment, in order to achieve personalized sorting of multiple comments, the electronic device can also obtain the object information of the target object, and the object information includes the object identification and object attributes of the sample object. The object attributes include attributes such as age, gender, and location, which are not limited in the disclosed embodiment. Since the comment sorting model is used to sort the weights of multiple comments based on any multimedia resource, the electronic device can obtain the weights of multiple comments based on the multiple comments of the multimedia resource, the first sorting position of the multiple comments, and the object information of the target object through the comment sorting model. Among them, the weight of the comment is used to indicate the importance of the comment among the multiple comments, that is, to indicate the contribution of the comment to the total length of stay of the target object in the comment display area. The higher the contribution of the comment, the higher the attractiveness of the comment to the target object among the multiple comments.
[0182] In step 603, the multiple comments are sorted from large to small according to their weights.
[0183] In the disclosed embodiment, the electronic device sorts the comments according to multiple weights from large to small, so that comments with larger weights are displayed closer to the front in the comment display area. That is, the electronic device can sort the comments that are more attractive to the target object in front, so that the target object can see the comments that he or she is more interested in first.
[0184] The disclosed embodiment provides a comment sorting method. Since the comment sorting model is used to sort based on the weights of multiple comments on any multimedia resource, the electronic device can obtain the weights of multiple comments on any multimedia resource to be recommended to the user through the comment sorting model, so that the comments can be sorted from large to small according to the multiple weights, so that the comments that are more attractive to the user among the multiple comments are displayed in a higher position, so that the user can see the comments that he is more interested in first, thereby improving the user's enthusiasm for interaction in the comment area.
[0185] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.
[0186] Figure 7 FIG. 1 is a block diagram of a training device for a review ranking model according to an exemplary embodiment. Figure 7 As shown, the device includes: an acquisition unit 701, a first determination unit 702, a second determination unit 703 and a training unit 704.
[0187] The acquisition unit 701 is configured to acquire sample data, where the sample data includes a plurality of sample comments of any multimedia resource and a first sorting position and a second sorting position of the plurality of sample comments, where the first sorting position is obtained by sorting the plurality of sample comments according to attribute information, and the second sorting position is a real sorting position of the plurality of sample comments in a comment display area of the multimedia resource;
[0188] A first determining unit 702 is configured to determine a first descriptive feature and a weight of each sample comment based on the multiple sample comments and the first ranking position, wherein the first descriptive feature is used to represent a comment feature and a first position feature of the corresponding sample comment, and the weight is used to represent an importance of the corresponding sample comment among the multiple sample comments;
[0189] A second determining unit 703 is configured to determine predicted behavior information of a sample object in a comment display area based on the plurality of first description features, the plurality of weights, and the second ranking position, the sample object being an object displayed in the comment display area;
[0190] The training unit 704 is configured to use the actual behavior information of the sample object in the comment display area as supervision information, and to train a comment sorting model based on the actual behavior information and the predicted behavior information. The comment sorting model is used to sort the weights of multiple comments on any multimedia resource.
[0191] In some embodiments, the acquisition unit 701 is configured to sort the multiple comments from most to least according to the number of interactions of the multiple comments, where the number of interactions is the number of likes, the number of favorites, the number of replies or the number of shares; and sort the multiple comments from early to late according to the release time of the multiple comments.
[0192] In some embodiments, the first determination unit 702 is configured to determine a first descriptive feature of each sample comment based on multiple sample comments and a first sorting position; based on a self-attention mechanism, process the first descriptive feature of each sample comment to obtain the processed first descriptive feature of each sample comment; based on the processed first descriptive feature of each sample comment, determine a weight of each sample comment, and the weight is positively correlated with the first descriptive feature of the corresponding sample comment.
[0193] In some embodiments, the acquisition unit 701 is configured to acquire multiple pieces of sample data corresponding to the multimedia resource;
[0194] Wherein, different sample data are targeted at different sample objects, and each piece of sample data also includes object information of the targeted sample object;
[0195] The first determining unit 702 is configured to determine a first descriptive feature and a weight of each sample comment based on the plurality of sample comments, the first ranking position, and the object information of the sample object targeted by the sample data.
[0196] In some embodiments, the first determining unit 702 includes:
[0197] A first determination subunit is configured to determine a first descriptive feature of each sample comment based on the plurality of sample comments and the first ranking position;
[0198] The first processing subunit is configured to process the first descriptive feature of each sample comment based on a self-attention mechanism to obtain the processed first descriptive feature of each sample comment;
[0199] The first determining subunit is further configured to determine an object feature of the sample object based on the object information of the sample object;
[0200] The second determination subunit is configured to determine the weight of each sample comment based on the processed first descriptive feature and the object feature of each sample comment, wherein the weight is positively correlated with the object feature and the first descriptive feature of the corresponding sample comment.
[0201] In some embodiments, the first determination subunit is configured to obtain comment features of each sample comment based on multiple sample comments; encode the first sorting positions of the multiple sample comments to obtain the first position features of each sample comment; for any sample comment, fuse the comment features and the first position features of the sample comment to obtain the first description features of the sample comment.
[0202] In some embodiments, the second determination subunit is configured to perform dot product of the object feature with the first descriptive feature of each sample comment to obtain the intermediate weight of each sample comment; and normalize the intermediate weight of each sample comment to obtain the weight of each sample comment.
[0203] In some embodiments, the second determination unit 703 is configured to determine the second descriptive feature of each comment based on multiple first descriptive features and second sorting positions, where the second descriptive feature is used to represent the comment feature and second position feature of the corresponding sample comment; and determine the predicted behavior information of the sample object in the comment display area based on multiple second descriptive features and multiple weights.
[0204] In some embodiments, the second determination unit 703 is configured to encode the second sorting positions of multiple sample comments to obtain a second position feature of each sample comment; for any sample comment, fuse the second position feature and the first description feature of the sample comment to obtain a second description feature of the sample comment; based on the self-attention mechanism, process the second description feature of each sample comment to obtain the processed second description feature of each comment.
[0205] In some embodiments, the second determination unit 703 is configured to perform weighted summation on multiple second description features based on multiple weights to obtain a duration feature of the sample object in the comment display area; based on the duration feature, determine the predicted stay duration of the sample object in the comment display area;
[0206] In some embodiments, the predicted behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area;
[0207] The second determination unit 703 is further configured to determine, for any sample comment, based on the second description feature of the sample comment, a predicted operation type of the sample object on the sample comment in the comment display area.
[0208] In some embodiments, the predicted behavior information includes the predicted length of time the sample object stays in the comment display area, and the actual behavior information includes the actual length of time the sample object stays in the comment display area;
[0209] The training unit 704 includes:
[0210] A third determining subunit is configured to determine a first loss based on the actual stay duration and the predicted stay duration, the first loss being a mean square error loss between the actual stay duration and the predicted stay duration;
[0211] The updating subunit is configured to update the model parameters of the review ranking model based on the first loss.
[0212] In some embodiments, the predicted behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area, and the actual behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area.
[0213] The third determination subunit is further configured to determine, for any sample comment, a second loss of the sample comment based on the actual operation type and the predicted operation type of the sample object on the sample comment, where the second loss is a cross entropy loss between the actual operation type and the predicted operation type;
[0214] The updating subunit is configured to update the model parameters of the comment ranking model based on the first loss and the second loss of the plurality of sample comments.
[0215] The disclosed embodiment provides a training device for a comment ranking model. By obtaining the first ranking position of multiple sample comments, the comment ranking model can determine the weight of each sample comment based on the first ranking position and multiple sample comments during the training process. The comment ranking model is trained using the real behavior information of the sample object in the comment display area for displaying multiple sample comments as supervision information, so that the comment ranking model can gradually acquire the ability to obtain accurate weights during the training process. Since the first ranking position is obtained by sorting the comments according to their own attributes, and the weight represents the importance of the comment among multiple comments, the comment ranking model can also obtain the first ranking position of the multiple comments to be sorted during online reasoning, and then can obtain accurate weights that are not affected by the real ranking positions of the multiple comments, so that accurate and unbiased comment ranking results can be output based on the weights, thereby improving the fairness and accuracy of the model.
[0216] It should be noted that the training device for the review ranking model provided in the above embodiment is only illustrated by the division of the above functional units. In actual applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the electronic device is divided into different functional units to complete all or part of the functions described above. In addition, the training device for the review ranking model provided in the above embodiment and the training method embodiment of the review ranking model belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0217] Regarding the training device for the comment ranking model in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0218] Figure 8 FIG. 1 is a block diagram of a comment sorting device according to an exemplary embodiment. Figure 8 As shown, the device includes: an acquisition unit 801, a prediction unit 802 and a sorting unit 803.
[0219] The acquisition unit 801 is configured to acquire, for any multimedia resource to be recommended to a target object, a plurality of comments on the multimedia resource and a first ranking position of the plurality of comments, wherein the first ranking position is obtained by ranking the plurality of comments according to attribute information;
[0220] The prediction unit 802 is configured to process the multiple comments, the first ranking position, and the object information of the target object through a comment ranking model to obtain weights of the multiple comments, where the weights are used to indicate the importance of the corresponding comments among the multiple comments, and the comment ranking model is trained according to the training method of the comment ranking model;
[0221] The sorting unit 803 is configured to sort the multiple comments from large to small according to the weights of the multiple comments.
[0222] The disclosed embodiment provides a comment sorting device. Since the comment sorting model is used to sort based on the weights of multiple comments on any multimedia resource, the electronic device can obtain the weights of multiple comments on any multimedia resource to be recommended to the user through the comment sorting model, so that the comments can be sorted from large to small according to the multiple weights, so that the comments that are more attractive to the user among the multiple comments are displayed in a higher position, so that the user can see the comments that he is more interested in first, thereby improving the user's enthusiasm for interaction in the comment area.
[0223] It should be noted that the comment sorting device provided in the above embodiment is only illustrated by the division of the above functional units. In actual applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the electronic device is divided into different functional units to complete all or part of the functions described above. In addition, the comment sorting device provided in the above embodiment and the comment sorting method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0224] Regarding the comment sorting device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0225] When an electronic device is provided as a terminal, Fig. 9 is a block diagram of a terminal according to an exemplary embodiment. Fig. 9 The structure block diagram of a terminal 900 provided by an exemplary embodiment of the present disclosure is shown. The terminal 900 may be: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The terminal 900 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0226] Typically, the terminal 900 includes a processor 901 and a memory 902 .
[0227] The processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0228] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 is used to store at least one program code, which is used to be executed by the processor 901 to implement the training method of the comment ranking model and the comment ranking method provided in the method embodiment of the present disclosure.
[0229] In some embodiments, the terminal 900 may further optionally include: a peripheral device interface 903 and at least one peripheral device. The processor 901, the memory 902 and the peripheral device interface 903 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 903 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907 and a power supply 908.
[0230] The peripheral device interface 903 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 901 and the memory 902. In some embodiments, the processor 901, the memory 902, and the peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902, and the peripheral device interface 903 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0231] The radio frequency circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 904 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 904 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 904 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 904 may also include circuits related to NFC (Near Field Communication), which is not limited in the present disclosure.
[0232] The display screen 905 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos and any combination thereof. When the display screen 905 is a touch display screen, the display screen 905 also has the ability to collect touch signals on the surface or above the surface of the display screen 905. The touch signal can be input to the processor 901 as a control signal for processing. At this time, the display screen 905 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 905 can be one, and the front panel of the terminal 900 is set; in other embodiments, the display screen 905 can be at least two, which are respectively set on different surfaces of the terminal 900 or are folded; in some other embodiments, the display screen 905 can be a flexible display screen, which is set on the curved surface or folded surface of the terminal 900. Even, the display screen 905 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 905 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).
[0233] The camera assembly 906 is used to capture images or videos. Optionally, the camera assembly 906 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 906 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0234] The audio circuit 907 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 901 for processing, or input them into the radio frequency circuit 904 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 900. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 907 may also include a headphone jack.
[0235] The power supply 908 is used to power various components in the terminal 900. The power supply 908 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 908 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0236] In some embodiments, the terminal 900 further includes one or more sensors 909 . The one or more sensors 909 include, but are not limited to: an acceleration sensor 910 , a gyroscope sensor 911 , a pressure sensor 912 , an optical sensor 913 , and a proximity sensor 914 .
[0237] The acceleration sensor 910 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal 900. For example, the acceleration sensor 910 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 901 can control the display screen 905 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 910. The acceleration sensor 910 can also be used to collect motion data of games or users.
[0238] The gyro sensor 911 can detect the body direction and rotation angle of the terminal 900, and the gyro sensor 911 can cooperate with the acceleration sensor 910 to collect the user's 3D actions on the terminal 900. The processor 901 can implement the following functions based on the data collected by the gyro sensor 911: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0239] The pressure sensor 912 can be set on the side frame of the terminal 900 and / or the lower layer of the display screen 905. When the pressure sensor 912 is set on the side frame of the terminal 900, it can detect the user's holding signal of the terminal 900, and the processor 901 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 912. When the pressure sensor 912 is set on the lower layer of the display screen 905, the processor 901 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 905. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0240] The optical sensor 913 is used to collect the ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the display screen 905 according to the ambient light intensity collected by the optical sensor 913. Optionally, when the ambient light intensity is high, the display brightness of the display screen 905 is increased; when the ambient light intensity is low, the display brightness of the display screen 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 according to the ambient light intensity collected by the optical sensor 913.
[0241] The proximity sensor 914, also called a distance sensor, is disposed on the front panel of the terminal 900. The proximity sensor 914 is used to collect the distance between the user and the front of the terminal 900. In one embodiment, when the proximity sensor 914 detects that the distance between the user and the front of the terminal 900 is gradually decreasing, the processor 901 controls the display screen 905 to switch from the screen-on state to the screen-off state; when the proximity sensor 914 detects that the distance between the user and the front of the terminal 900 is gradually increasing, the processor 901 controls the display screen 905 to switch from the screen-off state to the screen-on state.
[0242] Those skilled in the art will understand that Fig. 9 The structure shown in the figure does not constitute a limitation on the terminal 900, and the terminal 900 may include more or less components than those shown in the figure, or combine some components, or adopt a different component arrangement.
[0243] When the electronic device is provided as a server, Fig.10It is a block diagram of a server according to an exemplary embodiment. The server 1000 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1001 and one or more memories 1002, wherein the memory 1002 stores at least one program code, and the at least one program code is loaded and executed by the processor 1001 to implement the training method of the comment sorting model and the comment sorting method provided by the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 1000 may also include other components for implementing device functions, which will not be described in detail here.
[0244] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1002 including instructions, and the instructions can be executed by the processor 1001 of the electronic device 1000 to complete the above-mentioned review ranking model training method and review ranking method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0245] A computer program product includes a computer program, which, when executed by a processor, implements the above-mentioned review ranking model training method and review ranking method.
[0246] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0247] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for training a review ranking model, characterized in that: The method comprises: Acquire sample data, the sample data including a plurality of sample comments of any multimedia resource and a first sorting position and a second sorting position of the plurality of sample comments, the first sorting position being obtained by sorting according to attribute information of the plurality of sample comments, and the second sorting position being a real sorting position of the plurality of sample comments in a comment display area of the multimedia resource; Based on the multiple sample comments and the first ranking position, determine a first descriptive feature and a weight of each sample comment, wherein the first descriptive feature is used to represent a comment feature and a first position feature of the corresponding sample comment, and the weight is used to represent the importance of the corresponding sample comment among the multiple sample comments; Determining predicted behavior information of a sample object in the comment display area based on the plurality of the first description features, the plurality of the weights, and the second ranking position, the sample object being an object displayed in the comment display area; The actual behavior information of the sample object in the comment display area is used as supervision information, and a comment sorting model is trained based on the actual behavior information and the predicted behavior information. The comment sorting model is used to sort the weights of multiple comments on any multimedia resource.
2. The method for training a review ranking model according to claim 1, characterized in that: The process of obtaining the first ranking position of the plurality of sample comments includes any of the following: Sort the plurality of sample comments from most to least according to the number of interactions of the plurality of sample comments, where the number of interactions is the number of likes, the number of favorites, the number of replies or the number of shares; The plurality of sample comments are sorted from early to late according to the release time of the plurality of sample comments.
3. The method for training a review ranking model according to claim 1, characterized in that: The determining, based on the plurality of sample comments and the first ranking position, a first description feature and a weight of each sample comment comprises: Determining a first descriptive feature of each of the sample comments based on the plurality of sample comments and the first ranking position; Based on the self-attention mechanism, the first description feature of each sample comment is processed to obtain the processed first description feature of each sample comment; Based on the processed first descriptive feature of each sample comment, a weight of each sample comment is determined, and the weight is positively correlated with the first descriptive feature of the corresponding sample comment.
4. The method for training a review ranking model according to claim 1, characterized in that: The obtaining of sample data comprises: Acquire multiple pieces of sample data corresponding to the multimedia resource; Wherein, different sample data are targeted at different sample objects, and each piece of sample data also includes object information of the targeted sample object; The determining, based on the plurality of sample comments and the first ranking position, a first description feature and a weight of each sample comment comprises: Based on the multiple sample comments, the first ranking position, and the object information of the sample object targeted by the sample data, a first descriptive feature and a weight of each sample comment are determined.
5. The method for training a review ranking model according to claim 4, characterized in that: The determining, based on the plurality of sample comments, the first ranking position, and the object information of the sample object targeted by the sample object, a first description feature and a weight of each sample comment comprises: Determining a first descriptive feature of each of the sample comments based on the plurality of sample comments and the first ranking position; Based on the self-attention mechanism, the first description feature of each sample comment is processed to obtain the processed first description feature of each sample comment; Determining object features of the sample object based on the object information of the sample object; Based on the processed first descriptive feature of each sample comment and the object feature, a weight of each sample comment is determined, and the weight is positively correlated with the object feature and the first descriptive feature of the corresponding sample comment.
6. The method for training a review ranking model according to claim 3 or 5, characterized in that: The determining, based on the plurality of sample comments and the first ranking position, a first descriptive feature of each sample comment comprises: Based on the multiple sample comments, obtaining a comment feature of each sample comment; Encoding the first ranking positions of the plurality of sample comments to obtain a first position feature of each sample comment; For any sample comment, the comment feature and the first position feature of the sample comment are fused to obtain the first description feature of the sample comment.
7. The method for training a review ranking model according to claim 5, characterized in that: The determining the weight of each sample comment based on the first descriptive feature of each sample comment and the object feature includes: Performing dot products of the object feature and the first descriptive feature of each sample comment respectively to obtain an intermediate weight of each sample comment; The intermediate weight of each sample comment is normalized to obtain the weight of each sample comment.
8. The method for training a review ranking model according to claim 1, characterized in that: The determining, based on the plurality of the first description features, the plurality of the weights, and the second ranking positions, the predicted behavior information of the sample object in the comment display area includes: Based on the first description features and the second ranking positions, determining a second description feature of each comment, wherein the second description feature is used to represent a comment feature and a second position feature of the corresponding sample comment; Based on the plurality of the second description features and the plurality of the weights, predicted behavior information of the sample object in the comment display area is determined.
9. The method for training a review ranking model according to claim 8, characterized in that: The determining the second description feature of each comment based on the plurality of the first description features and the second ranking position includes: Encoding the second sorting positions of the plurality of sample comments to obtain a second position feature of each sample comment; For any sample comment, the second position feature and the first description feature of the sample comment are fused to obtain a second description feature of the sample comment; Based on the self-attention mechanism, the second description feature of each sample comment is processed to obtain the processed second description feature of each comment.
10. The method for training a review ranking model according to claim 8, characterized in that: The predicted behavior information includes the predicted stay time of the sample object in the comment display area; The determining, based on the plurality of the second description features and the plurality of the weights, predicted behavior information of the sample object in the comment display area includes: Based on the multiple weights, weighted summing is performed on the multiple second description features to obtain a duration feature of the sample object in the comment display area; Based on the duration feature, the predicted stay duration of the sample object in the comment display area is determined.
11. The method for training a review ranking model according to claim 10, characterized in that: The predicted behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area; After determining the predicted stay time of the sample object in the comment display area based on the duration feature, the method further includes: For any sample comment, based on the second descriptive feature of the sample comment, the predicted operation type of the sample object on the sample comment in the comment display area is determined.
12. The method for training a review ranking model according to claim 1, characterized in that: The predicted behavior information includes the predicted length of time the sample object stays in the comment display area, and the actual behavior information includes the actual length of time the sample object stays in the comment display area; The step of training a review ranking model based on the real behavior information and the predicted behavior information includes: Determine a first loss based on the actual stay duration and the predicted stay duration, where the first loss is a mean square error loss between the actual stay duration and the predicted stay duration; Based on the first loss, model parameters of the review ranking model are updated.
13. The method for training a review ranking model according to claim 12, characterized in that: The predicted behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area, and the real behavior information also includes the predicted operation type of the sample object on each sample comment in the comment display area; The method further comprises: For any sample comment, determining a second loss of the sample comment based on the actual operation type and the predicted operation type of the sample object on the sample comment, where the second loss is a cross entropy loss between the actual operation type and the predicted operation type; The updating of the model parameters of the review ranking model based on the first loss includes: Based on the first loss and the second losses of the plurality of sample reviews, model parameters of the review ranking model are updated.
14. A comment ranking method, characterized in that: The method comprises: For any multimedia resource to be recommended to the target object, a plurality of comments on the multimedia resource and a first ranking position of the plurality of comments are obtained, where the first ranking position is obtained by ranking the plurality of comments according to attribute information; The plurality of comments, the first ranking position, and the object information of the target object are processed by a comment ranking model to obtain weights of the plurality of comments, wherein the weights are used to indicate the importance of the corresponding comments among the plurality of comments, and the comment ranking model is trained according to the comment ranking model training method according to any one of claims 1 to 13; The plurality of comments are sorted from largest to smallest according to their weights.
15. A training device for a review ranking model, characterized in that: The device comprises: an acquisition unit, configured to acquire sample data, the sample data comprising a plurality of sample comments of any multimedia resource and a first sorting position and a second sorting position of the plurality of sample comments, the first sorting position being obtained by sorting the plurality of sample comments according to attribute information of the plurality of sample comments, and the second sorting position being a real sorting position of the plurality of sample comments in a comment display area of the multimedia resource; A first determining unit is configured to determine a first descriptive feature and a weight of each sample comment based on the multiple sample comments and the first ranking position, wherein the first descriptive feature is used to represent a comment feature and a first position feature of the corresponding sample comment, and the weight is used to represent an importance of the corresponding sample comment among the multiple sample comments; A second determining unit is configured to determine predicted behavior information of a sample object in the comment display area based on the plurality of the first description features, the plurality of the weights, and the second sorting position, the sample object being an object displayed in the comment display area; The training unit is configured to use the actual behavior information of the sample object in the comment display area as supervision information, and based on the actual behavior information and the predicted behavior information, train a comment sorting model, wherein the comment sorting model is used to sort the weights of multiple comments on any multimedia resource.
16. A comment sorting device, characterized in that: The device comprises: an acquisition unit configured to acquire, for any multimedia resource to be recommended to a target object, a plurality of comments on the multimedia resource and a first ranking position of the plurality of comments, wherein the first ranking position is obtained by ranking the plurality of comments according to attribute information; a prediction unit configured to process the plurality of comments, the first ranking position, and the object information of the target object through a comment ranking model to obtain weights of the plurality of comments, wherein the weights are used to indicate the importance of the corresponding comments among the plurality of comments, wherein the comment ranking model is trained according to the comment ranking model training method according to any one of claims 1 to 13; The sorting unit is configured to sort the multiple comments from large to small according to the weights of the multiple comments.
17. An electronic device, characterized in that: The electronic device comprises: one or more processors; a memory for storing program code executable by the processor; The processor is configured to execute the program code to implement the comment ranking model training method as described in any one of claims 1 to 13, or the comment ranking method as described in claim 14.
18. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the comment ranking model training method as described in any one of claims 1 to 13, or the comment ranking method as described in claim 14.
19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the training method of the comment ranking model as described in any one of claims 1 to 13, or the comment ranking method as described in claim 14 is implemented.