Viewpoint sorting method and device, computer equipment and storage medium
By combining the views to be sorted and inputting them into pairs of views comparison models, combined with the global ranking model, the problem of poor generalization ability of traditional view sorting methods is solved, and better sorting effect and generalization ability are achieved.
Patent Information
- Application Number
- CN202411818745.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-10
AI Technical Summary
The traditional view sorting method has poor generalization ability, resulting in poor sorting effect.
By combining the target views in the set of opinions to be sorted, a multi-composition pair of views is formed, and these paired views are input into a paired view comparison model to obtain a relative ranking. Then, the relative ranking is input to the global ranking model to obtain the intensity parameters of each target viewpoint, and finally sort from high to low according to the intensity parameters. This method adopts a feature extraction module and a symmetric differential prediction module. The model parameters in the latter conform to the set probability distribution, which enhances the generalization ability of the model.
It improves the generalization ability and sorting performance of opinion sorting, can better adapt to data characteristics and different situations, and significantly improves the sorting effect.
Smart Images

Figure CN119760228A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, apparatus, computer device and storage medium for sorting viewpoints. Background Art
[0002] In technical scenarios such as content recommendation, information retrieval, data cleaning and screening, and opinion aggregation, how to find the best quality data from a large number of opinions, content, or information is a problem that often needs to be solved. Some traditional solutions determine the quality of the output data based on the reliability of the data publisher, while others instruct the neural network model to learn and evaluate the quality based on the annotation of historical data. However, the opinion ranking methods in traditional solutions often have the problem of poor generalization ability, resulting in poor ranking results. Summary of the invention
[0003] The purpose of this application is to solve at least one of the above-mentioned technical defects, especially the problem of poor sorting effect caused by weak generalization ability in traditional technologies.
[0004] In a first aspect, the present application provides a method for ranking viewpoints, comprising:
[0005] Combine the target opinions in the opinion set to be sorted in pairs to obtain multiple groups of paired opinions;
[0006] Input each pair of opinions into a pair of opinion comparison model to obtain the relative ranking of each pair of opinions; the opinion comparison model includes a feature extraction module and a symmetric difference prediction module, and the model parameters in the symmetric difference prediction module include variables that conform to a set probability distribution;
[0007] Input each relative ranking into the global ranking model to obtain the strength parameter of each target viewpoint;
[0008] Sort the target viewpoints according to the strength parameter from high to low.
[0009] In one embodiment, the feature extraction module includes an embedding layer, a multi-head attention unit, and a flattening layer; each pair of opinions is input into a pair of opinion comparison model to obtain a relative ranking of each group of pair of opinions, including:
[0010] The two target views in the paired views are respectively input into the feature extraction module to obtain their corresponding feature vectors; the embedding layer is used to convert the input target view into an embedded feature of the target dimension, the multi-head attention unit is used to convert the embedded feature into an attention score, and the flattening layer is used to convert the attention score into a feature vector;
[0011] A pair of feature vectors is input into the symmetric difference prediction module to obtain the relative ranking.
[0012] In one embodiment, the multi-head attention unit includes multiple multi-head attention layers. The multi-head attention layer directly connected to the embedding layer uses the multi-head attention mechanism to process the embedded features and outputs them to the next multi-head attention layer. Other multi-head attention layers use the multi-head attention mechanism to process the output of the previous multi-head attention layer and output it to the next multi-head attention layer.
[0013] In one embodiment, a residual connection is set between the input and output of each multi-head attention layer.
[0014] In one embodiment, the symmetric differential prediction module includes a differential construction unit, a prediction unit and a comparison unit. A pair of eigenvectors includes a first eigenvector and a second eigenvector. The differential construction unit is used to subtract the second eigenvector from the first eigenvector to obtain a first differential vector, and to subtract the first eigenvector from the second eigenvector to obtain a second differential vector, and input the first differential vector and the second differential vector into the prediction unit respectively. The prediction unit is used to obtain a corresponding prediction score according to the first differential vector or the second differential vector; the comparison unit is used to compare the sizes of the prediction scores to obtain a relative ranking; wherein the model parameters of the prediction unit include variables that conform to a set probability distribution.
[0015] In one embodiment, the prediction unit is a multi-layer perceptron structure, and the prediction unit obtains the prediction score according to the following expression:
[0016]
[0017] in, represents the prediction unit input, represents the first difference vector or the second difference vector, Represents the output of the lth hidden layer in the multi-layer perceptron structure, Represents the weight matrix of the lth hidden layer in the multilayer perceptron structure, represents the bias matrix of the lth hidden layer in the multilayer perceptron structure, L represents the total number of hidden layers in the multilayer perceptron structure, the diag(·) operator refers to the tanh activation function, and y represents the predicted score. Represents the transpose of the weight matrix of the output layer in the multilayer perceptron structure, Represents the bias matrix of the output layer in the multilayer perceptron structure.
[0018] In one embodiment, the probability distribution is set to Bernoulli distribution, and the weight matrix of the first layer in the multilayer perceptron structure satisfies the Bernoulli distribution. , for:
[0019]
[0020] in, represents the learnable parameters, The probability parameter is is a Bernoulli distributed random variable with i=1,...,L, j=1,...,h, h represents the total number of neurons in the hidden layer, and the diag(·) operator is used to convert the vector into a diagonal matrix.
[0021] In one embodiment, the comparison unit is used to subtract the prediction scores and process the subtraction result using a sigmoid activation function to obtain a relative ranking.
[0022] In one embodiment, the following loss function is used in the training process of the symmetric difference prediction module:
[0023]
[0024] Among them, Loss represents the value of the loss function, N is the number of samples in the training set, is the sample label, is the predicted score, is the adjustment factor, are the learnable model parameters in the symmetric difference prediction module.
[0025] In one embodiment, in a global ranking model, the probability that one target viewpoint outperforms another target viewpoint is determined using a Bradley-Terry-Luce model framework, and the Bradley-Terry-Luce model framework uses strength parameters of each target viewpoint as a reference, wherein each strength parameter satisfies a corresponding probability distribution. The global ranking model constructs a likelihood function based on the relative ranking, and calculates the maximum a posteriori probability estimate based on the likelihood function and the probability distribution to estimate the strength parameters of each target viewpoint.
[0026] In one of the embodiments, the global ranking model is further used to estimate each probability distribution using an expectation propagation algorithm.
[0027] In a second aspect, the present application provides a viewpoint ranking device, comprising:
[0028] A pairing module is used to combine the target opinions in the opinion set to be sorted in pairs to obtain multiple groups of paired opinions;
[0029] A relative ranking module inputs each pair of opinions into a pair of opinion comparison model to obtain a relative ranking of each pair of opinions; the opinion comparison model includes a feature extraction module and a symmetric difference prediction module, and the model parameters in the symmetric difference prediction module include variables that conform to a set probability distribution;
[0030] A strength prediction module is used to input each relative ranking into a global ranking model to obtain a strength parameter of each target viewpoint;
[0031] A global ranking module is used to sort the target opinions according to the strength parameter from high to low.
[0032] In a third aspect, the present application provides a computer device comprising one or more processors and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the opinion sorting method in any of the above embodiments are performed.
[0033] In a fourth aspect, the present application provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the opinion sorting method in any of the above embodiments.
[0034] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:
[0035] This opinion ranking method first combines the target opinions in the opinion set to be sorted into multiple groups of paired opinions, then inputs these paired opinions into the paired opinion comparison model to obtain relative rankings, and then inputs each relative ranking into the global ranking model to calculate the strength parameters of each target opinion, and finally sorts the target opinions according to the strength parameters. The feature extraction module of the paired opinion comparison model can extract deep features from the original data, and the symmetric difference prediction module uses parameters containing probability distribution variables, which makes the entire process better adapt to data characteristics and different situations, greatly improving generalization ability and sorting performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0037] Figure 1 A flowchart of a method for ranking viewpoints provided in one embodiment of the present application;
[0038] Figure 2 This is a workflow diagram of a paired viewpoint comparison model in one embodiment of the present application;
[0039] Figure 3 This is a workflow diagram of a method for ranking viewpoints in one embodiment of the present application;
[0040] Figure 4 An internal structure diagram of a computer device provided for one embodiment of the present application. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0042] This application provides a method for sorting opinions. Figure 1 , including steps S102 to S108.
[0043] S102, combining target viewpoints in the viewpoint set to be sorted in pairs to obtain multiple groups of paired viewpoints.
[0044] It can be understood that the set of opinions to be sorted refers to a collection of many different opinions that need to be sorted, and the opinions contained in the set of opinions to be sorted are the target opinions. The target opinion can be a text on a certain topic, such as financial analysis, medical decision-making, policy making, etc. It can also be content with the same or similar indexes in search engines, databases, and recommendation systems. This step requires these target opinions to be matched in groups of two to form multiple groups of different paired opinion combinations. For example, if there are opinions A, B, and C, then after combining them two by two, you will get paired opinions such as (A, B), (A, C), and (B, C).
[0045] S104, input each pair of opinions into a pair of opinion comparison model to obtain the relative ranking of each pair of opinions. The opinion comparison model includes a feature extraction module and a symmetric difference prediction module, and the model parameters in the symmetric difference prediction module include variables that conform to a set probability distribution.
[0046] It can be understood that the paired opinion comparison model is a model specially designed to compare the relative advantages and disadvantages between each pair of opinions. It contains a feature extraction module and a symmetric difference prediction module. The function of the feature extraction module is to extract key feature information that can represent the characteristics and differences of these opinions from the input paired opinions. These features can be category features, numerical features, or other types of descriptive features. The feature extraction module can mine the deep features of paired opinions. Because the original opinions may be diverse in form and complex in content, feature extraction can convert them into feature representations that the model can better understand and process, so that the subsequent symmetric difference prediction module can perform effective comparative analysis based on these features. It also helps to learn more compact and meaningful opinion representations, capture complex patterns and dependencies that may not be easy to discern in the original features, and thus improve generalization and prediction performance.
[0047] The symmetric difference prediction module is based on the extracted features and uses the model parameters contained therein to predict the relative ranking between each pair of opinions, that is, to determine which opinion has higher quality. Another key to improving the generalization ability of the model in this embodiment is that the model parameters of the symmetric difference prediction module are not fixed values, but the probability distribution is introduced to describe the uncertainty of the parameters, so that the paired opinion comparison model becomes a Bayesian neural network model. Fixed model parameters are prone to overfitting the specific patterns of training data during training, because the model can only learn and memorize these data features according to fixed parameters. Once data with slightly different features (such as new data in the test set or actual application) is encountered, the performance of the model may be greatly reduced. However, when the parameters conform to a certain probability distribution, the model will continuously explore different parameter values based on the probability distribution during the training process, which makes the model learn a more general feature representation that better reflects the inherent laws of the data, rather than being limited to the surface and local features of the training data, so that the model can better adapt to different data characteristics and various possible situations.
[0048] S106, inputting each relative ranking into a global ranking model to obtain a strength parameter of each target viewpoint.
[0049] It can be understood that the relative ranking is the comparison result of which opinion in each pair of opinions is better obtained through the paired opinion comparison model. It can be a simple binary judgment (such as 0 or 1 to indicate which is better or worse), or a continuous probability value and other forms that reflect the relative degree. The global ranking model is a model that can comprehensively consider the relative ranking information of all paired opinions, and then analyze and calculate the overall strength of each target opinion. This strength parameter is a quantitative representation of the quality of each target opinion in the entire set of opinions to be sorted, which allows different target opinions to be measured and compared on the same scale based on this strength parameter.
[0050] S108, sorting the target viewpoints in descending order according to the strength parameters.
[0051] It can be understood that this step can sort the quality of many target opinions by sorting them from high to low according to the intensity parameter, and can perform content recommendation, information retrieval or data screening according to user needs. It is also possible to select a certain number of top-ranked opinions for aggregation, such as collecting analysis reports on specific stocks from different financial analysts to generate a comprehensive forecast result. Another example is to provide patients with more accurate treatment plans by aggregating the diagnostic opinions of different doctors.
[0052] This opinion ranking method first combines the target opinions in the opinion set to be sorted into multiple groups of paired opinions, then inputs these paired opinions into the paired opinion comparison model to obtain relative rankings, and then inputs each relative ranking into the global ranking model to calculate the strength parameters of each target opinion, and finally sorts the target opinions according to the strength parameters. The feature extraction module of the paired opinion comparison model can extract deep features from the original data, and the symmetric difference prediction module uses parameters containing probability distribution variables, which makes the entire process better adapt to data characteristics and different situations, greatly improving generalization ability and sorting performance.
[0053] In one embodiment, the feature extraction module includes an embedding layer, a multi-head attention unit, and a flattening layer. It can be understood that the embedding layer is a structure in a deep learning model for converting discrete data into a continuous vector representation of a fixed dimension. The target view may include categorical features and numerical features. The categorical features can be mapped to the category feature embedding matrix E cat ∈ R |C|×d (d is the target dimension), each row in the matrix corresponds to a unique category, and any category feature o ij ∈C can be expressed as =E cat [o ij ]∈R d The numerical features can be mapped to a vector of target dimension by a learned linear layer. Any numerical feature o ij ∈R can be expressed as =E num [o ij ]∈R d After the embedding layer, the original n f The i-th view of the feature is transformed into n f ×d embedding feature matrix: E i = [e i1 , e i2 ,..., e inf ] ∈ R nf×d .
[0054] The multi-head attention unit is a deep learning module based on the attention mechanism, which aims to capture the dependencies and important feature information of different aspects of the input data (that is, the embedding feature matrix output by the embedding layer) from different representation subspaces at the same time. The attention mechanism essentially enables the model to focus on certain key parts of the input data. Multi-head means that it will use multiple such attention mechanisms in parallel, each of which learns different focuses, and finally integrates the information from different angles to obtain a more comprehensive and richer feature representation.
[0055] The flattening layer is a simple layer structure used to adjust the dimension of the input data in the deep learning model structure. Its main function is to convert the multi-dimensional input data (here it is the attention score output by the multi-head attention unit, which has a certain tensor structure dimension) into a one-dimensional vector form, which is convenient for subsequent model structures (such as the symmetric difference prediction module) to perform further processing and calculation.
[0056] Based on these three structures, each pair of opinions is input into the pair of opinion comparison model to obtain the relative ranking of each pair of opinions, including: the two target opinions in the pair of opinions are respectively input into the feature extraction module to obtain the corresponding feature vectors. Among them, the embedding layer is used to convert the input target opinion into the embedded features of the target dimension, the multi-head attention unit is used to convert the embedded features into attention scores, and the flattening layer is used to convert the attention scores into feature vectors. A pair of feature vectors is input into the symmetric difference prediction module to obtain the relative ranking.
[0057] In one embodiment, the multi-head attention unit includes multiple multi-head attention layers. The multi-head attention layer directly connected to the embedding layer uses the multi-head attention mechanism to process the embedded features and outputs them to the next multi-head attention layer. Other multi-head attention layers use the multi-head attention mechanism to process the output of the previous multi-head attention layer and output it to the next multi-head attention layer.
[0058] It can be understood that the working process of the feature extraction module can be found in Figure 2 , Figure 2 The “FeatureEmbedding” in the above code represents the embedding layer, which respectively embeds the pairs of viewpoints o i and j The processing is performed and the processing results are input into the multi-head attention unit. The multi-head attention unit includes multiple multi-head attention layers. Each multi-head attention layer corresponds to the "Multi-Head Self Attention" part in the figure. It contains multiple attention heads. Each attention head's Q (Query), K (Key), and V (Value) have corresponding weight matrices W Q , W K , W V ∈ R d×d Each weight matrix is multiplied with the embedded feature matrix through a linear layer to obtain the matrix corresponding to the attention head Q, K, and V. The attention score of an attention head needs to be obtained by combining the matrices corresponding to Q, K, and V. It can be expressed as:
[0059]
[0060] in, represents the attention score of the h-th attention head, Represents the input of this multi-head attention layer, represents the weight matrix corresponding to the h-th attention head Q, represents the weight matrix corresponding to the h-th attention head K, Represents the weight matrix corresponding to the hth attention head V. These three weight matrices are all learnable model parameters. Attention() represents the process of calculating the attention score based on the input (corresponding to Figure 2 The total attention score of the i-th view in the multi-head attention layer. It is necessary to combine the calculation results of all H attention heads (corresponding to Concat in the figure): In some embodiments, in order to maintain the integrity of the input data of each multi-head attention layer, optimize the gradient flow and alleviate the gradient explosion problem, a residual connection (corresponding to the Residual Connection in the figure) is set between the input and output of each multi-head attention layer, so its output can be expressed as: . In this embodiment, the embedded features of each opinion need to be processed continuously by a set number of multi-head attention layers before the final attention score is obtained and input into the flattening layer. This iterative processing can model increasingly complex and higher-order interactions between features, which often contain richer implicit patterns and are critical for accurately comparing pairwise opinions. In this embodiment, each subsequent multi-head attention layer builds on the output of the previous layer, iteratively refining the feature representation and capturing nonlinear dependencies that may be ignored in a one-pass scheme.
[0061] In one embodiment, the symmetric difference prediction module includes a difference construction unit, a prediction unit and a comparison unit. After the paired viewpoints are input into the feature extraction module, a one-to-one corresponding feature vector is obtained. The two feature vectors are respectively the first feature vector and the second feature vector (e.g. Figure 2 r oi and r oj ), the difference construction unit is used to obtain a first difference vector by subtracting the second eigenvector from the first eigenvector, and to obtain a second difference vector by subtracting the first eigenvector from the second eigenvector, and input the first difference vector and the second difference vector into the prediction unit respectively. The two difference vectors capture the difference between the two eigenvectors from different directions, laying the foundation for the subsequent analysis of the relative relationship between the two target viewpoints. The prediction unit is used to obtain the corresponding prediction score according to the first difference vector or the second difference vector. The comparison unit is used to compare the size of the prediction score to obtain a relative ranking. Among them, the model parameters of the prediction unit include variables that conform to the set probability distribution.
[0062] In one embodiment, the prediction unit is a multilayer perceptron structure, and the prediction unit obtains the prediction score according to the following expression:
[0063]
[0064] in, represents the prediction unit input, represents the first difference vector or the second difference vector. Figure 2 As shown, the first difference vector and the second difference vector are respectively input into the same multi-layer perceptron structure. The multi-layer perceptron structure includes L hidden layers. Represents the output of the lth hidden layer in the multi-layer perceptron structure, Represents the weight matrix of the lth hidden layer in the multilayer perceptron structure, represents the bias matrix of the lth hidden layer in the multilayer perceptron structure, L represents the total number of hidden layers in the multilayer perceptron structure, the diag(·) operator refers to the tanh activation function, and y represents the predicted score. Represents the transpose of the weight matrix of the output layer in the multilayer perceptron structure, Represents the bias matrix of the output layer in the multilayer perceptron structure.
[0065] In one embodiment, a traditional neural network has fixed parameter values, can only output point estimates of the predicted target, and is prone to overfitting. In order to achieve better generalization performance in the paired opinion comparison task, we redefine the multilayer perceptron structure as a Bayesian model, assigning a distribution to each parameter instead of a fixed value. The set probability distribution assigned to the multilayer perceptron structure is a Bernoulli distribution, and the weight matrix of the lth layer in the multilayer perceptron structure satisfies the Bernoulli distribution. , for:
[0066]
[0067] in, represents the learnable parameters, The probability parameter is is a Bernoulli distributed random variable, i=1,...,L, j=1,...,h, h represents the total number of neurons in the hidden layer, and the diag(·) operator is used to convert the vector into a diagonal matrix. The choice of probability parameters can be achieved through the Monte Carlo Dropout algorithm.
[0068] In one embodiment, the comparison unit is used to subtract the predicted scores and use the sigmoid activation function to process the subtraction result to obtain a relative ranking. The sigmoid activation function is a common nonlinear function that can map any real number input to a numerical range between 0 and 1. It is often used in fields such as deep learning to convert output results into probability form or perform normalization processing. In the current scenario, the result after processing by the sigmoid activation function represents a quantitative representation of the relative ranking of the two opinions. Being closer to 1 means that the opinion corresponding to the minuend in the predicted score is better.
[0069] A value closer to 0 means that the view corresponding to the subtraction in the predicted score is relatively better.
[0070] In one embodiment, the following loss function is used in the training process of the symmetric difference prediction module:
[0071]
[0072] Among them, Loss represents the value of the loss function, N is the number of samples in the training set, is the sample label, is the predicted score, is the adjustment factor, is the learnable model parameter in the symmetric difference prediction module. The training set contains the viewpoint set for the target field and scenario. The viewpoint set includes a large number of paired viewpoints for training. The sample annotations of each paired viewpoint are annotated with the pros and cons relationship between the two viewpoints. The learnable model parameters in the symmetric difference prediction module are trained by the above loss function, thereby completing the training of the symmetric difference prediction module. During training, the AdamW algorithm can be used for optimization, or weight decay can be used to prevent overfitting. Weight decay can specifically be to set a penalty coefficient for large weight values.
[0073] In one embodiment, in a global ranking model, the probability that one target viewpoint outperforms another target viewpoint is determined using a Bradley-Terry-Luce model framework, and the Bradley-Terry-Luce model framework uses strength parameters of each target viewpoint as a reference, wherein each strength parameter satisfies a corresponding probability distribution. The global ranking model constructs a likelihood function based on the relative ranking, and calculates the maximum a posteriori probability estimate based on the likelihood function and the probability distribution to estimate the strength parameters of each target viewpoint.
[0074] It can be understood that the Bradley-Terry-Luce model framework is a statistical model for modeling paired comparison data, and is often used in scenarios such as analyzing competition results and preference ranking. Express your opinioni Than point of view j Higher quality probability, Representing the views i and viewpoints j In the global ranking model, it is assumed that the strength parameter of the k-th opinion conforms to a certain probability distribution The maximum a posteriori probability estimation combines prior knowledge and observational data to estimate the parameters of the model. The relative ranking obtained from the pairwise opinion comparison model is the observational data for ranking the V target opinions. . Take the set of strength parameters of all target viewpoints as the parameters to be sought , which can be estimated using the maximum a posteriori probability estimation method ,Right now .in is the estimated intensity parameter set. is a hyperparameter related to the probability distribution of each intensity parameter. Taking the logarithm we get The constant term can be ignored, and the first term is the likelihood function, which means that given the parameters The data was observed under The second term is the logarithm of the probability of The logarithm of the probability distribution of . The likelihood function can be constructed based on the relative ranking. Specifically, each relative ranking corresponds to an item in the likelihood function, and each item is the probability of this relative ranking under the Bradley-Terry-Luce model framework. Multiplying these items together gives The likelihood function of the second term can be set to a fixed value. However, it can also be estimated using the expectation propagation algorithm.
[0075] In a specific embodiment, the global ranking model is also used to estimate each probability distribution using the expectation propagation algorithm. The complete workflow of this embodiment is as follows: Figure 3 As shown. It is often very difficult to directly calculate the probability distribution of the intensity parameter. The expectation propagation algorithm is a method for approximating the difficult probability distribution with the tractable probability distribution. It approximates the true probability distribution through iteration. Specifically, assuming Satisfies the isotropic Gaussian distribution, that is . For each intensity parameter an approximate probability distribution is set: . represents the set of various intensity parameters, represents the mean matrix of the approximate probability distribution, The covariance matrix represents the approximate probability distribution. In the process of the expectation propagation algorithm, it involves the construction of the hole distribution, moment matching, and the update of model parameters. In this process, each intensity parameter is traversed as a factor. The construction of the hole distribution is to convert the current traversed factor in the precision matrix P of the weight space and the natural parameter of the auxiliary vector x into Remove. Then recalculate the mean value matrix of the approximate probability distribution cav and the covariance matrix cav . After that, the standard normal cumulative distribution function is calculated respectively The first derivative under logarithm and the second-order derivative . Afterwards, use these two results to generate new natural parameters of the current factor:
[0076]
[0077] Add the new natural parameters of the current factor back into the weight space. Based on the latest weight space, The mean value matrix and covariance matrix of will also be updated. The convergence of the entire iterative process is determined by the difference between the natural parameters of the previous and next rounds. If the difference is lower than the set threshold, the current factor is updated, and the next factor is selected to continue updating until all factors are updated.
[0078] The present application provides a viewpoint ranking device, including a pairing module, a relative ranking module, a strength prediction module and a global ranking module.
[0079] The pairing module is used to combine the target viewpoints in the viewpoint set to be sorted in pairs to obtain multiple groups of paired viewpoints. The relative ranking module inputs each paired viewpoint into the paired viewpoint comparison model to obtain the relative ranking of each group of paired viewpoints. The viewpoint comparison model includes a feature extraction module and a symmetric difference prediction module. The model parameters in the symmetric difference prediction module include variables that conform to the set probability distribution. The strength prediction module is used to input each relative ranking into the global ranking model to obtain the strength parameter of each target viewpoint. The global ranking module is used to sort the target viewpoints according to the strength parameter in descending order.
[0080] For the specific limitations of the viewpoint sorting device, please refer to the limitations of the viewpoint sorting method above, which will not be repeated here. The various modules in the above-mentioned viewpoint sorting device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0081] The present application provides a computer device, including one or more processors and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the following are performed: combining target viewpoints in a set of viewpoints to be sorted in pairs to obtain multiple groups of paired viewpoints; inputting each paired viewpoint into a paired viewpoint comparison model to obtain a relative ranking of each group of paired viewpoints; the viewpoint comparison model includes a feature extraction module and a symmetric difference prediction module, and the model parameters in the symmetric difference prediction module include variables that conform to a set probability distribution; inputting each relative ranking into a global ranking model to obtain a strength parameter of each target viewpoint; and sorting the target viewpoints in descending order according to the strength parameter.
[0082] In one embodiment, the feature extraction module includes an embedding layer, a multi-head attention unit and a flattening layer; each pair of opinions is input into a paired opinion comparison model to obtain a relative ranking of each pair of opinions, including: the two target opinions in the paired opinions are respectively input into the feature extraction module to obtain their respective corresponding feature vectors; wherein the embedding layer is used to convert the input target opinion into an embedded feature of a target dimension, the multi-head attention unit is used to convert the embedded feature into an attention score, and the flattening layer is used to convert the attention score into a feature vector; a pair of feature vectors is input into a symmetric difference prediction module to obtain a relative ranking.
[0083] In one embodiment, the multi-head attention unit includes multiple multi-head attention layers. The multi-head attention layer directly connected to the embedding layer uses the multi-head attention mechanism to process the embedded features and outputs them to the next multi-head attention layer. Other multi-head attention layers use the multi-head attention mechanism to process the output of the previous multi-head attention layer and output it to the next multi-head attention layer.
[0084] In one embodiment, a residual connection is set between the input and output of each multi-head attention layer.
[0085] In one embodiment, the symmetric differential prediction module includes a differential construction unit, a prediction unit and a comparison unit. A pair of eigenvectors includes a first eigenvector and a second eigenvector. The differential construction unit is used to subtract the second eigenvector from the first eigenvector to obtain a first differential vector, and to subtract the first eigenvector from the second eigenvector to obtain a second differential vector, and input the first differential vector and the second differential vector into the prediction unit respectively. The prediction unit is used to obtain a corresponding prediction score according to the first differential vector or the second differential vector; the comparison unit is used to compare the sizes of the prediction scores to obtain a relative ranking; wherein the model parameters of the prediction unit include variables that conform to a set probability distribution.
[0086] In one embodiment, the prediction unit is a multi-layer perceptron structure, and the prediction unit obtains the prediction score according to the following expression:
[0087]
[0088] in, represents the prediction unit input, represents the first difference vector or the second difference vector, Represents the output of the lth hidden layer in the multi-layer perceptron structure, Represents the weight matrix of the lth hidden layer in the multilayer perceptron structure, represents the bias matrix of the lth hidden layer in the multilayer perceptron structure, L represents the total number of hidden layers in the multilayer perceptron structure, the diag(·) operator refers to the tanh activation function, and y represents the predicted score. Represents the transpose of the weight matrix of the output layer in the multilayer perceptron structure, Represents the bias matrix of the output layer in the multilayer perceptron structure.
[0089] In one embodiment, the probability distribution is set to Bernoulli distribution, and the weight matrix of the first layer in the multilayer perceptron structure satisfies the Bernoulli distribution. , for:
[0090]
[0091] in, represents the learnable parameters, The probability parameter is is a Bernoulli distributed random variable with i=1,...,L, j=1,...,h, h represents the total number of neurons in the hidden layer, and the diag(·) operator is used to convert the vector into a diagonal matrix.
[0092] In one embodiment, the comparison unit is used to subtract the prediction scores and process the subtraction result using a sigmoid activation function to obtain a relative ranking.
[0093] In one embodiment, the following loss function is used in the training process of the symmetric difference prediction module:
[0094]
[0095] Among them, Loss represents the value of the loss function, N is the number of samples in the training set, is the sample label, is the predicted score, is the adjustment factor, are the learnable model parameters in the symmetric difference prediction module.
[0096] In one embodiment, in a global ranking model, the probability that one target viewpoint outperforms another target viewpoint is determined using a Bradley-Terry-Luce model framework, and the Bradley-Terry-Luce model framework uses strength parameters of each target viewpoint as a reference, wherein each strength parameter satisfies a corresponding probability distribution. The global ranking model constructs a likelihood function based on the relative ranking, and calculates the maximum a posteriori probability estimate based on the likelihood function and the probability distribution to estimate the strength parameters of each target viewpoint.
[0097] In one of the embodiments, the global ranking model is further used to estimate each probability distribution using an expectation propagation algorithm.
[0098] Indicatively, Figure 4 As shown, Figure 4 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. Figure 4 The computer device 400 includes a processing component 402, which further includes one or more processors, and a memory resource represented by a memory 401 for storing instructions executable by the processing component 402, such as an application. The application stored in the memory 401 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 402 is configured to execute the instructions to perform the steps of the opinion ranking method of any of the above embodiments.
[0099] The computer device 400 may further include a power supply component 403 configured to perform power management of the computer device 400 , a wired or wireless model interface 404 configured to connect the computer device 400 to the model, and an input / output (I / O) interface 405 .
[0100] The present application provides a storage medium, in which computer-readable instructions are stored. When the computer-readable instructions are executed by one or more processors, the one or more processors execute: combining target viewpoints in a set of viewpoints to be sorted in pairs to obtain multiple groups of paired viewpoints; inputting each paired viewpoint into a paired viewpoint comparison model to obtain a relative ranking of each group of paired viewpoints; the viewpoint comparison model includes a feature extraction module and a symmetric difference prediction module, and the model parameters in the symmetric difference prediction module include variables that conform to a set probability distribution; inputting each relative ranking into a global ranking model to obtain a strength parameter of each target viewpoint; and sorting the target viewpoints in descending order according to the strength parameter.
[0101] In one embodiment, the feature extraction module includes an embedding layer, a multi-head attention unit and a flattening layer; each pair of opinions is input into a paired opinion comparison model to obtain a relative ranking of each pair of opinions, including: the two target opinions in the paired opinions are respectively input into the feature extraction module to obtain their respective corresponding feature vectors; wherein the embedding layer is used to convert the input target opinion into an embedded feature of a target dimension, the multi-head attention unit is used to convert the embedded feature into an attention score, and the flattening layer is used to convert the attention score into a feature vector; a pair of feature vectors is input into a symmetric difference prediction module to obtain a relative ranking.
[0102] In one embodiment, the multi-head attention unit includes multiple multi-head attention layers. The multi-head attention layer directly connected to the embedding layer uses the multi-head attention mechanism to process the embedded features and outputs them to the next multi-head attention layer. Other multi-head attention layers use the multi-head attention mechanism to process the output of the previous multi-head attention layer and output it to the next multi-head attention layer.
[0103] In one embodiment, a residual connection is set between the input and output of each multi-head attention layer.
[0104] In one embodiment, the symmetric differential prediction module includes a differential construction unit, a prediction unit and a comparison unit. A pair of eigenvectors includes a first eigenvector and a second eigenvector. The differential construction unit is used to subtract the second eigenvector from the first eigenvector to obtain a first differential vector, and to subtract the first eigenvector from the second eigenvector to obtain a second differential vector, and input the first differential vector and the second differential vector into the prediction unit respectively. The prediction unit is used to obtain a corresponding prediction score according to the first differential vector or the second differential vector; the comparison unit is used to compare the sizes of the prediction scores to obtain a relative ranking; wherein the model parameters of the prediction unit include variables that conform to a set probability distribution.
[0105] In one embodiment, the prediction unit is a multi-layer perceptron structure, and the prediction unit obtains the prediction score according to the following expression:
[0106]
[0107] in, represents the prediction unit input, represents the first difference vector or the second difference vector, Represents the output of the lth hidden layer in the multi-layer perceptron structure, Represents the weight matrix of the lth hidden layer in the multilayer perceptron structure, represents the bias matrix of the lth hidden layer in the multilayer perceptron structure, L represents the total number of hidden layers in the multilayer perceptron structure, the diag(·) operator refers to the tanh activation function, and y represents the predicted score. Represents the transpose of the weight matrix of the output layer in the multilayer perceptron structure, Represents the bias matrix of the output layer in the multilayer perceptron structure.
[0108] In one embodiment, the probability distribution is set to Bernoulli distribution, and the weight matrix of the first layer in the multilayer perceptron structure satisfies the Bernoulli distribution. , for:
[0109]
[0110] in, represents the learnable parameters, The probability parameter is is a Bernoulli distributed random variable with i=1,...,L, j=1,...,h, h represents the total number of neurons in the hidden layer, and the diag(·) operator is used to convert the vector into a diagonal matrix.
[0111] In one embodiment, the comparison unit is used to subtract the prediction scores and process the subtraction result using a sigmoid activation function to obtain a relative ranking.
[0112] In one embodiment, the following loss function is used in the training process of the symmetric difference prediction module:
[0113]
[0114] Among them, Loss represents the value of the loss function, N is the number of samples in the training set, is the sample label, is the predicted score, is the adjustment factor, are the learnable model parameters in the symmetric difference prediction module.
[0115] In one embodiment, in a global ranking model, the probability that one target viewpoint outperforms another target viewpoint is determined using a Bradley-Terry-Luce model framework, and the Bradley-Terry-Luce model framework uses strength parameters of each target viewpoint as a reference, wherein each strength parameter satisfies a corresponding probability distribution. The global ranking model constructs a likelihood function based on the relative ranking, and calculates the maximum a posteriori probability estimate based on the likelihood function and the probability distribution to estimate the strength parameters of each target viewpoint.
[0116] In one of the embodiments, the global ranking model is further used to estimate each probability distribution using an expectation propagation algorithm.
[0117] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0118] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can refer to each other.
[0119] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for ranking opinions, characterized in that: include: Combine the target opinions in the opinion set to be sorted in pairs to obtain multiple groups of paired opinions; Inputting each of the paired viewpoints into a paired viewpoint comparison model to obtain a relative ranking of each group of the paired viewpoints; the viewpoint comparison model includes a feature extraction module and a symmetric difference prediction module, and the model parameters in the symmetric difference prediction module include variables that conform to a set probability distribution; Inputting each of the relative rankings into a global ranking model to obtain a strength parameter of each of the target viewpoints; The target viewpoints are sorted in descending order according to the strength parameters.
2. The method for ranking opinions according to claim 1, characterized in that: The feature extraction module includes an embedding layer, a multi-head attention unit and a flattening layer; the inputting each pair of opinions into a pair of opinions comparison model to obtain a relative ranking of each group of the pair of opinions includes: The two target viewpoints in the paired viewpoints are respectively input into the feature extraction module to obtain the feature vectors corresponding to each other; wherein the embedding layer is used to convert the input target viewpoint into an embedded feature of the target dimension, the multi-head attention unit is used to convert the embedded feature into an attention score, and the flattening layer is used to convert the attention score into the feature vector; A pair of the feature vectors is input into the symmetric difference prediction module to obtain the relative ranking.
3. The method for ranking opinions according to claim 2, characterized in that: The multi-head attention unit includes multiple multi-head attention layers. The multi-head attention layer directly connected to the embedding layer uses a multi-head attention mechanism to process the embedded features and outputs them to the next multi-head attention layer. The other multi-head attention layers use a multi-head attention mechanism to process the output of the previous multi-head attention layer and output it to the next multi-head attention layer.
4. The method for ranking opinions according to claim 3, characterized in that: A residual connection is set between the input and output of each of the multi-head attention layers.
5. The method for ranking opinions according to claim 2, characterized in that: The symmetric differential prediction module includes a differential construction unit, a prediction unit and a comparison unit. The pair of eigenvectors includes a first eigenvector and a second eigenvector. The differential construction unit is used to subtract the second eigenvector from the first eigenvector to obtain a first differential vector, and to subtract the first eigenvector from the second eigenvector to obtain a second differential vector, and to input the first differential vector and the second differential vector into the prediction unit respectively. The prediction unit is used to obtain a corresponding prediction score according to the first differential vector or the second differential vector; the comparison unit is used to compare the sizes of the prediction scores to obtain the relative ranking; wherein the model parameters of the prediction unit include variables that conform to the set probability distribution.
6. The method for ranking opinions according to claim 5, characterized in that: The prediction unit is a multi-layer perceptron structure, and the prediction unit obtains the prediction score according to the following expression: Among them, h (0) represents the prediction unit input, Δ represents the first difference vector or the second difference vector, h (l) Represents the output of the lth hidden layer in the multilayer perceptron structure, W (l) Represents the weight matrix of the lth hidden layer in the multilayer perceptron structure, b (l) represents the bias matrix of the lth hidden layer in the multilayer perceptron structure, L represents the total number of hidden layers in the multilayer perceptron structure, the σ(·) operator refers to the tanh activation function, y represents the predicted score, Represents the transpose of the weight matrix of the output layer in the multilayer perceptron structure, b out Represents the bias matrix of the output layer in the multilayer perceptron structure.
7. The method for ranking opinions according to claim 6, characterized in that: The probability distribution is set to Bernoulli distribution, and the weight matrix of the first layer in the multilayer perceptron structure satisfies the Bernoulli distribution. , for: in, represents the learnable parameters, The probability parameter is is a Bernoulli distributed random variable with i=1,...,L, j=1,...,h, h represents the total number of neurons in the hidden layer, and the diag(·) operator is used to convert the vector into a diagonal matrix.
8. The method for ranking opinions according to claim 5, characterized in that: The comparison unit is used to subtract the predicted scores and process the subtraction result using a sigmoid activation function to obtain the relative ranking.
9. The method for ranking opinions according to claim 5, characterized in that: The following loss function is used in the training process of the symmetric difference prediction module: Among them, Loss represents the value of the loss function, N is the number of samples in the training set, is the sample label, is the prediction score, is the adjustment factor, are learnable model parameters in the symmetric difference prediction module.
10. The method for ranking opinions according to claim 1, characterized in that: In the global ranking model, the probability that one target viewpoint outperforms another target viewpoint is determined using the Bradley-Terry-Luce model framework. The Bradley-Terry-Luce model framework uses the intensity parameters of each target viewpoint as a reference, wherein each intensity parameter satisfies a corresponding probability distribution. The global ranking model constructs a likelihood function based on the relative ranking, and calculates a maximum a posteriori probability estimate based on the likelihood function and the probability distribution to estimate the intensity parameters of each target viewpoint.
11. The method for ranking opinions according to claim 10, characterized in that: The global ranking model is also used to estimate each of the probability distributions using an expectation propagation algorithm.
12. A viewpoint ranking device, characterized in that: include: A pairing module is used to combine the target opinions in the opinion set to be sorted in pairs to obtain multiple groups of paired opinions; A relative ranking module, inputting each of the paired viewpoints into a paired viewpoint comparison model to obtain a relative ranking of each group of the paired viewpoints; the viewpoint comparison model includes a feature extraction module and a symmetric difference prediction module, and the model parameters in the symmetric difference prediction module include variables that conform to a set probability distribution; A strength prediction module, used for inputting each of the relative rankings into a global ranking model to obtain a strength parameter of each of the target viewpoints; A global ranking module is used to sort the target viewpoints according to the order of the strength parameters from high to low.
13. A computer device, characterized in that: The method comprises one or more processors and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the opinion ranking method as described in any one of claims 1 to 11 are performed.
14. A storage medium, characterized in that: The storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the opinion ranking method as described in any one of claims 1-11.
Citation Information
Patent Citations
Text sorting method for mixing point-by-point strategy and pairwise strategy
CN108717434A
Video searching
WO2013021176A1