Emotion index construction method and device, computer equipment and storage medium

By applying text classification models to conduct comment sentiment analysis in the financial market, the emotional index is constructed, and the problem of emotional index construction in massive comment data is solved, and the accuracy of credit approval and risk control capabilities are improved.

CN119474492APending Publication Date: 2025-02-18PING AN BANK CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411466610.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the financial market, when faced with massive comment data, it is difficult for existing technology to accurately construct emotional indexes, resulting in inaccurate credit approval results and irreparable losses.

Method used

By obtaining multiple comment information within the preset time range and their corresponding tag information, the text classification model is used for sentiment analysis, including word embedding layer, convolutional layer and fully connected layer, the sentiment prediction model is constructed, and the prediction results are constructed. Emotional index.

Benefits of technology

It improves the accuracy of credit approval, enhances risk control capabilities, improves customer experience, and improves the intelligence level and reliability of the model through deep learning technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474492A_ABST
    Figure CN119474492A_ABST
Patent Text Reader

Abstract

The invention provides an emotion index construction method and device, computer equipment and a storage medium. The method comprises the steps of obtaining multiple pieces of first comment information in a preset duration range and label information corresponding to each piece of first comment information; the label information comprises a positive label, a neutral label and a negative label; inputting the first comment information into a word embedding layer of a to-be-trained text classification model, and outputting a word vector matrix; inputting the word vector matrix into a convolutional layer, and outputting a first feature vector; inputting each first feature vector into a full connection layer, and outputting an emotion prediction result corresponding to the first comment information; completing the construction of a text classification model according to the emotion prediction result and the label information; and obtaining to-be-constructed second comment information, inputting multiple pieces of second comment information into the constructed text classification model, outputting an emotion classification result, and completing construction of emotion indexes corresponding to the multiple pieces of second comment information according to the emotion classification result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine learning technology, which is applied in the financial field, and in particular to a method, device, computer equipment and storage medium for constructing a sentiment index. Background Art

[0002] As the application of the Internet in the financial field becomes more mature, in today's financial market, investors can use various social media or online platforms to express their views on the market, and more and more investors tend to obtain investment information through comments on the Internet.

[0003] However, how to mine the massive amount of comment data provided by the Internet has become the focus of investors. If the sentiment index is constructed in a statistical way, it is generally necessary to sample and manually analyze the corresponding comments on social media. However, in the face of today's massive data, this process requires a lot of manpower and material resources, and the number of samples is really insignificant compared to the total amount of data, making it difficult to accurately calculate the true sentiment index corresponding to each comment.

[0004] Therefore, there is an urgent need for a sentiment index construction method for massive comment information in financial systems, so that users can quickly confirm the specific emotions corresponding to multiple comments of interested investors in a specific time period. Summary of the invention

[0005] This application provides a sentiment index construction method, device, computer equipment and storage medium, which aims to solve the problem that some customers in pure online loans fill in false address information in order to bypass system rules, etc., which causes the system to misjudge the customer's loan qualifications, and then leads to inaccurate credit approval results, causing irreparable losses.

[0006] In a first aspect, the present application provides a method for constructing a sentiment index, comprising:

[0007] Acquire multiple first comment information within a preset time range and label information corresponding to each first comment information; wherein the label information includes positive labels, neutral labels and negative labels;

[0008] Input each first comment information into the word embedding layer of the text classification model to be trained, and output the word vector matrix corresponding to each first comment information;

[0009] Input each word vector matrix into the convolutional layer of the text classification model, and output the first eigenvector corresponding to each word vector matrix;

[0010] Input each first feature vector into the fully connected layer of the text classification model, and output the sentiment prediction result corresponding to each first comment information;

[0011] The text classification model is constructed based on the sentiment prediction results and label information corresponding to each first comment information;

[0012] Acquire multiple pieces of second comment information to be constructed, input the multiple pieces of second comment information into the constructed text classification model, output sentiment classification results corresponding to the multiple pieces of second comment information, and complete the construction of sentiment indexes corresponding to the multiple pieces of second comment information according to the sentiment classification results.

[0013] In some embodiments, before inputting each first comment information into the word embedding layer of the text classification model to be trained, it also includes: determining a target word at the center position of multiple words corresponding to each first comment information; calculating the context probability of the remaining multiple words and the target word; generating a high-dimensional vector matrix corresponding to the first comment information according to each word and the context probability corresponding to the word; obtaining the one-hot encoded vector corresponding to the high-dimensional vector matrix, so as to input the one-hot encoded vector into the word embedding layer, and outputting the word vector matrix; wherein the dimension of the word vector matrix is ​​lower than the high-dimensional vector matrix.

[0014] Exemplarily, calculating the context probability of the remaining multiple words and the target word includes: obtaining the window word corresponding to the target word among the multiple words according to a preset window range; inputting each window word and the target word into a preset continuous bag of words model, and the continuous bag of words model calculates the context probability corresponding to the target word; the context probability includes the context probability value corresponding to each window word.

[0015] In some embodiments, the text classification model also includes a pooling layer, and each first feature vector is input into the fully connected layer of the text classification model, including: inputting each first feature vector into the pooling layer of the text classification model, and outputting a second feature vector corresponding to each feature vector; wherein the second feature vector includes an average pooling vector and a maximum pooling vector corresponding to the first feature vector; and inputting the second feature vector into the fully connected layer of the text classification model.

[0016] In some embodiments, the text classification model is constructed according to the sentiment prediction result and label information corresponding to each first comment information, including: calculating the cross entropy loss function corresponding to the sentiment prediction result and the label information; and constructing the text classification model according to the value of the cross entropy loss function; wherein the expression of the cross entropy loss function includes:

[0017]

[0018] Among them, and H(,) represent the value of the cross entropy loss function, Q represents the label information, P represents the sentiment prediction result, q i represents the true classification probability corresponding to the first comment information of the i-th article, p iRepresents the true classification probability corresponding to the i-th first comment information.

[0019] In some embodiments, the sentiment classification results include attested sentiment, neutral sentiment and negative sentiment; based on the sentiment classification results, the sentiment index corresponding to the multiple second comment information is constructed, including: obtaining time distribution information, user distribution information and word count information corresponding to the multiple second comment information; based on the sentiment classification results corresponding to each second comment information, obtaining the number of positive comments, the number of negative comments and the number of neutral comments corresponding to the multiple second comment information; obtaining the sentiment index based on the time distribution information, user distribution information and word count information, the number of positive comments, the number of negative comments and the number of neutral comments.

[0020] Exemplarily, obtaining a sentiment index according to time distribution information, user distribution information and word count information, the number of positive comments, the number of negative comments and the number of neutral comments includes: obtaining positive weights corresponding to positive comments and negative weights corresponding to negative comments; normalizing the time distribution information, user distribution information and word count information respectively, obtaining a time threshold corresponding to the time distribution information, a user threshold corresponding to the user distribution information and a word count threshold corresponding to the word count information; calculating the sentiment index according to the positive weight, the negative weight, the time threshold, the user threshold, the word count threshold, the number of positive comments, the number of negative comments and the number of neutral comments; the expression of the sentiment index includes:

[0021]

[0022] Among them, EI is the emotional index, W positive is the positive weight, W negative is the negative weight, N positive is the number of positive comments, N negative is the number of negative comments, N neutral is the number of neutral comments, T is the time threshold, U is the user threshold, and S is the word count threshold.

[0023] In a second aspect, the present application provides a device for constructing an emotion index, comprising:

[0024] A label acquisition unit, used to acquire a plurality of first comment information within a preset time range and label information corresponding to each first comment information; wherein the label information includes positive labels, neutral labels and negative labels;

[0025] A matrix output unit, used to input each first comment information into a word embedding layer of the text classification model to be trained, and output a word vector matrix corresponding to each first comment information;

[0026] A vector output unit, used to input each word vector matrix into the convolution layer of the text classification model, and output the first eigenvector corresponding to each word vector matrix;

[0027] A sentiment prediction unit, used to input each first feature vector into a fully connected layer of a text classification model, and output a sentiment prediction result corresponding to each first comment information;

[0028] A model building unit, used to complete the construction of a text classification model according to the sentiment prediction result and label information corresponding to each first comment information;

[0029] An index construction unit is used to obtain multiple second comment information to be constructed, input the multiple second comment information into the constructed text classification model, output the sentiment classification results corresponding to the multiple second comment information, and complete the construction of the sentiment index corresponding to the multiple second comment information according to the sentiment classification results.

[0030] In a third aspect, the present application further provides a computer device, including:

[0031] Memory and processor;

[0032] The memory is used to store computer programs;

[0033] The processor is used to execute the computer program and implement the steps of the emotion index construction method described in the first aspect when executing the computer program.

[0034] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the steps of the emotion index construction method as described in the first aspect above.

[0035] A method for constructing an emotional index provided in an embodiment of the present application is intended to help financial institutions judge the integrity and qualification assessment of loan applicants by analyzing the emotional tendencies of customer online comments, especially for customers who attempt to bypass system rules by filling in false address information. The method collects multiple first comment information (such as customer online comments, messages, etc.) within a preset time range. Each first comment information is marked with an emotional label, which is divided into three categories: positive labels, neutral labels, and negative labels. Each first comment information is input into the word embedding layer of the text classification model to be trained to generate a corresponding word vector matrix. This step uses word embedding technology (such as Word2Vec, GloVe or BERT) to convert text data into numerical vectors that can be processed by machine learning algorithms. The generated word vector matrix is ​​input into the convolution layer, and the features of each word vector matrix are extracted through a convolutional neural network (CNN) to generate a first feature vector. The first feature vector is input into the fully connected layer, and the emotional prediction result corresponding to each first comment information is output. The fully connected layer processes the feature vector through a multi-layer perceptron (MLP) and finally outputs the emotional classification result. The text classification model is optimized and tuned based on the sentiment prediction results and pre-marked label information to gradually improve the accuracy and effectiveness of the model. Multiple second comment information for which sentiment index is to be constructed is obtained, and these comment information is input into the constructed text classification model. The text classification model performs sentiment classification on multiple second comment information and outputs the sentiment classification result corresponding to each comment information. Based on the sentiment classification results of multiple second comment information, the corresponding sentiment index is constructed to comprehensively reflect the overall sentiment tendency of the comments.

[0036] The provided method has the following beneficial effects:

[0037] 1. Enhance risk control capabilities: Through the construction of sentiment index, financial institutions can conduct detailed analysis of customer sentiment tendencies and further determine the authenticity of customer information. This helps to detect and prevent potential fraud and reduce the risk of inaccurate credit approval caused by false address information.

[0038] 2. Improve the accuracy of credit approval: Sentiment analysis based on customer review information can provide a reference for credit approval and convert unstructured text data into a useful sentiment index as an auxiliary basis for credit decision-making. It can provide an additional dimension to conduct a comprehensive assessment of customers, thereby improving the accuracy of loan qualification judgment.

[0039] 3. Improve customer experience: Through accurate sentiment analysis, financial institutions can better understand customer needs and emotional states, thereby providing more considerate and effective services. This helps to establish more honest and trusting customer relationships, which is conducive to the long-term development of the business.

[0040] 4. Improve the intelligence level of the model: Using advanced deep learning technologies such as convolutional neural networks and multi-layer perceptrons can effectively improve the intelligence level and reliability of text classification models. During the model optimization process, continuous tuning is performed based on target feedback (label information) to ensure the accuracy and robustness of the model in practical applications.

[0041] Through this detailed sentiment index construction method, financial institutions can more comprehensively understand customer behavior and emotional trends, effectively prevent risks, improve operational efficiency, and ultimately achieve a more scientific and accurate loan approval process.

[0042] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0044] Figure 1 This is a schematic flow chart of the steps of a method for constructing an emotion index provided by an embodiment of the present application;

[0045] Figure 2 This is a schematic diagram of word vector conversion calculation provided by an embodiment of the present application;

[0046] Figure 3 is a schematic diagram of a convolution operation provided by an embodiment of the present application;

[0047] Figure 4 is a structural schematic diagram of an emotion index construction device provided in an embodiment of the present application;

[0048] Figure 5 It is a schematic block diagram of the structure of a computer device provided in one embodiment of the present application.

[0049] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. DETAILED DESCRIPTION

[0050] 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 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.

[0051] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0052] It should be understood that, in order to facilitate the clear description of the technical solutions of the embodiments of the present invention, in the embodiments of the present invention, the words "first", "second", etc. are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art can understand that the words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not necessarily limit the difference.

[0053] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0054] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0055] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0056] As the application of the Internet in the financial field becomes more mature, in today's financial market, investors can use various social media or online platforms to express their views on the market, and more and more investors tend to obtain investment information through comments on the Internet.

[0057] However, how to mine the massive amount of comment data provided by the Internet has become the focus of investors. If the sentiment index is constructed in a statistical way, it is generally necessary to sample and manually analyze the corresponding comments on social media. However, in the face of today's massive data, this process requires a lot of manpower and material resources, and the number of samples is really insignificant compared to the total amount of data, making it difficult to accurately calculate the true sentiment index corresponding to each comment.

[0058] Therefore, there is an urgent need for a sentiment index construction method for massive comment information in financial systems, so that users can quickly confirm the specific emotions corresponding to multiple comments of interested investors in a specific time period.

[0059] To solve the above problems, please refer to Figure 1 , Figure 1 1 is a schematic flow chart of a method for constructing an emotion index provided in an embodiment of the present application. The method for constructing an emotion index can be implemented by a computer device, which can be deployed on a single server or a server cluster. It can also be deployed on a handheld terminal, a laptop computer, a wearable device, or a robot.

[0060] It should be noted that the acquisition of any information mentioned in the provided method is in compliance with relevant regulations and is carried out with the user's consent, and will not infringe on the user's privacy or violate relevant laws and regulations.

[0061] To solve the above problems, please refer to Figure 1 Specifically, Figure 1 As shown, the provided emotion index construction method includes steps S101 to S106. The details are as follows:

[0062] Step S101. Acquire multiple first comment information within a preset time range and label information corresponding to each first comment information; wherein the label information includes positive labels, neutral labels and negative labels.

[0063] Specifically, collect text information such as online comments and feedback from customers within a preset time frame. Label each comment with a sentiment tag, including positive, neutral, and negative. This can be done through manual annotation by experts or an existing data annotation library. Ensure the adequacy of data preparation: obtain a sufficient amount of comment information and accurate sentiment tags to provide a strong data foundation for subsequent model training. By including three sentiment tags, the model can learn to distinguish different sentiment tendencies and improve the accuracy of sentiment classification.

[0064] For example, by writing a PySpider crawler (the crawler method is not limited), 20 million user posting data from preset social media (can be one or more) for a total of ten years from 2014 to 2024 (the preset time range can be arbitrarily selected according to needs) are collected, including: post text, author, title, content, posting time, last comment time, number of views and number of comments, and the data is denoised and cleaned. 18,000 samples are sampled and sentimentally classified and labeled to obtain a sample data set containing positive labels, neutral labels and negative labels. The criteria for the three types of sentiment division are: posts containing optimism or bullish sentiment and feeling that the stock market is profitable are regarded as positive; posts containing pessimism or bearish sentiment and feeling that further investment will lose money are regarded as negative; posts without any emotional bias, but only simple statements or expressing objective opinions are regarded as neutral.

[0065] Step S102. Input each first comment information into the word embedding layer of the text classification model to be trained, and output the word vector matrix corresponding to each first comment information.

[0066] Specifically, the word vector matrix is ​​feature extracted through sentence vectors to obtain the first feature vector as the word vector representation of the text sentence. The text information of each comment is converted into a word vector matrix using word embedding technology (such as Word2Vec, GloVe, BERT, etc.). This step converts discrete text data into continuous numerical data for subsequent model processing. Word embedding can capture the semantics of words and their meaning in a specific context, allowing the model to better understand semantic information when processing text. Converting high-dimensional text data into low-dimensional vectors reduces computational complexity and improves the processing efficiency of the model.

[0067] At the same time, the Text-CNN model is a variant of the Convolutional Neural Network (CNN), which is specifically used for tasks that process text data, such as text classification and sentiment analysis. The Text-CNN model is an efficient and flexible text processing model that can achieve good results in a variety of natural language processing tasks through the characteristics of convolutional neural networks.

[0068] For example, the core of the word embedding layer is the word vector matrix, which is mainly used to complete the word vector conversion of the text sentence. Through the matrix multiplication operation, the high-dimensional one-hot encoding of the words in the input text is mapped to a low-dimensional vector space. The input of this layer is the one-hot encoding of each word corresponding to the vocabulary ID in the word order.<p1,p2,...,pi,...,pn> .like Figure 2 As shown, pi represents the V-dimensional one-hot vector of the i-th word. The word embedding layer is a V×m parameter matrix W V×m , where is equal to the vocabulary length of the words in the corpus plus 1, is the dimension of the word vector, and is usually used as a hyperparameter of the model and needs to be manually set before model training.

[0069] Assume that the one-hot vector corresponding to the i-th word xi in the input text of length n is P i 1×V , after mapping calculation, we get a new m-dimensional vector C i 1×m , the calculation formula is as follows:

[0070] C i 1×m =p i 1×m ·W V×M ;

[0071] By vertically concatenating all the word vectors calculated by the embedding layer mapping, the original natural language text sentence is transformed into an n×m dimensional tensor matrix C n×m . In general, the word vector matrix is ​​a lookup table for mapping words in high-dimensional space. Words are directly located in the corresponding vector in high-dimensional space through one-hot encoding. Usually, there are two ways to obtain the word vector matrix: 1. Model the corpus through algorithms such as word2vec before building the model; 2. Randomly initialize the word vector matrix parameters at the beginning of the model, and then update the parameters in the matrix during the model training and optimization process. After the model training is completed, the corresponding word vector matrix can be obtained.

[0072] In some embodiments, before inputting each first comment information into the word embedding layer of the text classification model to be trained, it also includes: determining a target word at the center position of multiple words corresponding to each first comment information; calculating the context probability of the remaining multiple words and the target word; generating a high-dimensional vector matrix corresponding to the first comment information according to each word and the context probability corresponding to the word; obtaining the one-hot encoded vector corresponding to the high-dimensional vector matrix, so as to input the one-hot encoded vector into the word embedding layer, and outputting the word vector matrix; wherein the dimension of the word vector matrix is ​​lower than the high-dimensional vector matrix.

[0073] In each first comment information, determine the central word of multiple words in each comment information as the target word. Calculate the context probabilities of the remaining words and the target word. Generate a high-dimensional vector matrix based on the words and their context probabilities, and obtain their corresponding one-hot encoding vectors. Convert the high-dimensional vector matrix into a low-dimensional word vector matrix and input it into the word embedding layer. Through the calculation of context probabilities, the model can capture more contextual information in word meaning understanding and more accurately represent the semantics of words. Convert the high-dimensional vector matrix into a low-dimensional word vector matrix to reduce the data dimension and improve the calculation efficiency.

[0074] Exemplarily, calculating the context probability of the remaining multiple words and the target word includes: obtaining the window word corresponding to the target word among the multiple words according to a preset window range; inputting each window word and the target word into a preset continuous bag of words model, and the continuous bag of words model calculates the context probability corresponding to the target word; the context probability includes the context probability value corresponding to each window word.

[0075] In the comment information, the context window word corresponding to the target word is obtained according to the preset window range. Use the Continuous Bag of Words (CBOW) model: input the window word and the target word into the CBOW model to calculate the context probability value of the target word. The CBOW model can efficiently capture the contextual relationship of words when calculating the context probability and improve the text representation ability. The context information expressed in the form of probability values ​​helps the model better understand and classify the text sentiment.

[0076] It should be noted that in some embodiments, under the condition that the context is known, by selecting the middle word as the target word, taking the target word as the center, n words in the context are selected as input, and the probability of each word in the corpus appearing in the position of the target word, i.e., the context probability value, is predicted. The calculation formula of the context probability value is as follows:

[0077] P(w i |w i-k , ..., w i-2 , w i-1 , w i+1 , w i+2 ..., w i+k )=P(w i |context)

[0078] Among them, w i It indicates the central word, and context indicates the context;

[0079] w i-k , ..., w i-2 , w i-1 , w i+1 , w i+2 ..., w i+k The n words in the context are selected with the target word as the center; P is the probability of the center word. The context is selected in a window manner, that is, only the words within the current word window are used as the context.

[0080] Since the CBOW model is based on the idea of ​​the Bag of Words model, the sequence information of the context words is not considered, and the average value of the context vector is used as the input of the model. For text with a window size of 1 / 2n, the calculation formula of the model input is:

[0081]

[0082] After obtaining the model input through the input layer, multiply it with the parameter matrix of the output layer to obtain u j :

[0083] u j =v j ×x;

[0084] where v j is the jth column of the output matrix W. Finally, the Softmax function is used to calculate the probability distribution of each word y j :

[0085]

[0086] During the training process, the model randomly initializes the parameters of the output weight W, and then optimizes the parameters through the BP algorithm, and finally obtains the word vector matrix.

[0087] Step S103. Input each word vector matrix into the convolutional layer of the text classification model, and output the first eigenvector corresponding to each word vector matrix.

[0088] Specifically, Figure 3 As shown in the figure, the convolution layer of the Text-CNN model is used. The main function of the convolution layer is to extract text features through one-dimensional convolution operations. The core of this layer is the convolution kernel. The convolution layer can extract text features of different levels and scales through different convolution kernels. The convolution operation can effectively capture local features and local dependencies in the text, and improve the model's ability to extract features for phrases and word groups. Through multi-layer convolution, richer text features can be extracted, improving the performance of the model in sentiment classification tasks.

[0089] For example, Figure 3 As shown, the convolution kernel is the basic unit of the convolution operation, and its essence is an h×m parameter matrix T h×m , where h is the size of the convolution window, indicating the range covered by the convolution kernel in one convolution operation, that is, each time the convolution is performed on h consecutive words, and m is the dimension of the word vector. The convolution operation is essentially a dot product operation of the matrix. The specific steps are: ① multiply the elements of the corresponding positions of two matrices of the same shape; ② sum the products of all elements; ③ add a bias to the summed result; ④ use the activation function to perform a nonlinear transformation on the result. The calculation formula is as follows:

[0090] t i =f(C h×v ·T h×v +b), where f is the nonlinear activation function C h×v The word vectors of h similar words form a matrix, T h×v represents the parameter matrix of the convolution kernel, and b is the bias parameter.

[0091] Step S104. Input each first feature vector into the fully connected layer of the text classification model, and output the sentiment prediction result corresponding to each first comment information.

[0092] Specifically, the first feature vector output from the convolutional layer is input to the fully connected layer to process and classify the feature data and output the sentiment prediction result of each comment. The fully connected layer performs nonlinear mapping on the feature data through a multi-layer neural network, which can better capture complex sentiment features and output accurate sentiment prediction results.

[0093] In some embodiments, the text classification model also includes a pooling layer, and each first feature vector is input into the fully connected layer of the text classification model, including: inputting each first feature vector into the pooling layer of the text classification model, and outputting a second feature vector corresponding to each feature vector; wherein the second feature vector includes an average pooling vector and a maximum pooling vector corresponding to the first feature vector; and inputting the second feature vector into the fully connected layer of the text classification model.

[0094] The first feature vector output from the convolutional layer is input to the pooling layer (including average pooling and maximum pooling). The second feature vector output from the pooling layer includes the average pooling vector and the maximum pooling vector. The second feature vector is input to the fully connected layer for sentiment classification. Through the pooling operation, feature information is further refined and concentrated, redundancy is eliminated, and important features are retained. The pooled vector is more representative and can improve the accuracy and robustness of sentiment classification.

[0095] Exemplarily, the pooling layer mainly performs pooling operations on the text feature maps extracted by the convolution layer. Pooling operation is a further extraction of features. Its main function is to extract important information and reduce the computational overhead of the model by significantly reducing the amount of data, while preventing the model from overfitting. Pooling operations can be divided into average pooling and maximum pooling. Average pooling takes the average value of all elements in the feature map output by the convolution layer, while maximum pooling takes the maximum value of all elements. In the Text-CNN model, for different convolution windows, there will be a pooling layer paired with one to perform pooling operations on all feature maps extracted from the window.

[0096] Step S105: Complete the construction of the text classification model according to the sentiment prediction result and label information corresponding to each first comment information.

[0097] Specifically, by comparing the sentiment prediction results with the actual label information, the model parameters are continuously adjusted through optimization algorithms such as back propagation and gradient descent to complete the training and optimization of the text classification model. The model parameters and structure are continuously adjusted through supervised learning methods to improve the performance and generalization ability of the model in sentiment classification tasks. The optimized model can better process future comment data and adapt to a variety of different application scenarios.

[0098] In some embodiments, the text classification model is constructed according to the sentiment prediction result and label information corresponding to each first comment information, including: calculating the cross entropy loss function corresponding to the sentiment prediction result and the label information; and constructing the text classification model according to the value of the cross entropy loss function; wherein the expression of the cross entropy loss function includes:

[0099]

[0100] Among them, and H(,) represent the value of the cross entropy loss function, Q represents the label information, P represents the sentiment prediction result, q i represents the true classification probability corresponding to the first comment information of the i-th article, p i Represents the true classification probability corresponding to the i-th first comment information.

[0101] The value of the cross entropy loss function is calculated for the sentiment prediction results and label information. The cross entropy loss is used to guide the parameter adjustment and optimization of the model. The cross entropy loss can effectively measure the difference between the prediction results and the true labels, and provide a clear optimization direction. Using the cross entropy loss function can ensure that the model converges quickly and effectively, making the training process more efficient.

[0102] It should be noted that the fully connected layer obtains the first / second eigenvector of the output of the convolutional layer / pooling layer through full connection, that is, each neuron receives all the values ​​of the previous layer output. Generally, there are several categories for the final classification, and the corresponding number of neurons will be set in the fully connected classification layer. The output value of each neuron is the probability value that the model believes that the sample belongs to the corresponding category. Since the probability pi∈[0,1], and ∑pi=1, the result of the neuron linear operation does not meet this condition, the Softmax function is required to perform the final conversion processing on the neuron data.

[0103]

[0104] If the samples are divided into three categories (because the labels are divided into three categories, corresponding settings), then for each sample, the model will output a probability distribution P = (p1, p2, p3). According to the output of the model and the actual classification of the sample, the loss value Loss is used to evaluate the accuracy of the model's classification of the sample.

[0105] For classification problems, the cross entropy function is generally used to calculate the loss value, as shown above. Since the true classification of the training set samples is known, it is usually sparsely distributed, that is, when the true classification is the first category, Q = (1, 0, 0), then:

[0106]

[0107] From this we can see that the loss function of the classification model is essentially equal to the amount of information output by the model prediction, that is, for each comment, its sentiment index is obtained.

[0108] Step S106. Obtain multiple second comment information to be constructed, input the multiple second comment information into the constructed text classification model, output the sentiment classification results corresponding to the multiple second comment information, and complete the construction of the emotion index corresponding to the multiple second comment information according to the sentiment classification results.

[0109] Specifically, new comment information is obtained, input into the trained text classification model, and the sentiment classification results of these comment information are output. According to the sentiment classification results, the sentiment index of multiple comments is comprehensively calculated to reflect the overall sentiment tendency. Through real-time sentiment analysis of new comment information, financial institutions can instantly understand the emotional state of customers and adjust credit decisions accordingly. The sentiment index can serve as an important reference indicator to help financial institutions more accurately evaluate customers' loan qualifications and reduce approval risks caused by false information. Through the detailed description of the above steps (S101 to S106), it can be seen that this sentiment index construction method has a rich technical processing flow and advanced algorithm application, which can not only effectively solve the problems caused by false information, but also improve the risk control and customer experience of financial institutions.

[0110] In some embodiments, the sentiment classification results include attested sentiment, neutral sentiment and negative sentiment; based on the sentiment classification results, the sentiment index corresponding to the multiple second comment information is constructed, including: obtaining time distribution information, user distribution information and word count information corresponding to the multiple second comment information; based on the sentiment classification results corresponding to each second comment information, obtaining the number of positive comments, the number of negative comments and the number of neutral comments corresponding to the multiple second comment information; obtaining the sentiment index based on the time distribution information, user distribution information and word count information, the number of positive comments, the number of negative comments and the number of neutral comments.

[0111] According to the sentiment classification results, the time distribution, user distribution and word count information of the comments are obtained. The number of positive, neutral and negative comments is calculated. Based on this information, the sentiment index is calculated to reflect the overall sentiment tendency. Through multi-dimensional information such as time, user and word count, a more comprehensive sentiment index analysis is provided. Comprehensively consider information of various dimensions to more accurately evaluate the emotional state and improve the reliability and effectiveness of the analysis.

[0112] Exemplarily, obtaining a sentiment index according to time distribution information, user distribution information and word count information, the number of positive comments, the number of negative comments and the number of neutral comments includes: obtaining positive weights corresponding to positive comments and negative weights corresponding to negative comments; normalizing the time distribution information, user distribution information and word count information respectively, obtaining a time threshold corresponding to the time distribution information, a user threshold corresponding to the user distribution information and a word count threshold corresponding to the word count information; calculating the sentiment index according to the positive weight, the negative weight, the time threshold, the user threshold, the word count threshold, the number of positive comments, the number of negative comments and the number of neutral comments; the expression of the sentiment index includes:

[0113]

[0114] Among them, EI is the emotional index, W positive is the positive weight, W negative is the negative weight, N positive is the number of positive comments, N negative is the number of negative comments, N neutral is the number of neutral comments, T is the time threshold, U is the user threshold, and S is the word count threshold.

[0115] By determining the weights of positive and negative comments, normalizing the time distribution, user distribution and word count information (e.g., taking values ​​in the range of 0-1), the corresponding threshold information is obtained. Based on the weights and thresholds, the sentiment index is calculated using a formula. By considering the different weights of positive and negative comments, the sentiment tendency can be more accurately reflected. Through the combination of normalization processing and multi-dimensional information, the calculation of the sentiment index is more comprehensive and representative.

[0116] For investors, the method provided can help professional investors analyze market conditions objectively and avoid risks. For the government, the investor sentiment index can help policymakers understand investors' emotional tendencies and reactions in a timely manner and formulate policies more reasonably. For enterprises, the investor sentiment index enables enterprises to better understand the information of market investors and take correct measures.

[0117] See also Figure 4 As shown, Figure 4 1 is a schematic diagram of the structure of the emotion index construction device 200 provided in an embodiment of the present application. The emotion index construction device 200 is used to execute the steps of the emotion index construction method shown in the above embodiments. The emotion index construction device 200 can be a single server or a server cluster, or the emotion index construction device 200 can be a terminal, which can be a handheld terminal, a laptop computer, a wearable device or a robot, etc.

[0118] like Figure 4 As shown, the emotion index constructing device 200 includes:

[0119] The label acquisition unit 201 is used to acquire a plurality of first comment information within a preset time range and label information corresponding to each first comment information; wherein the label information includes positive labels, neutral labels and negative labels;

[0120] A matrix output unit 202, used to input each first comment information into a word embedding layer of a text classification model to be trained, and output a word vector matrix corresponding to each first comment information;

[0121] A vector output unit 203, used to input each word vector matrix into the convolution layer of the text classification model, and output the first feature vector corresponding to each word vector matrix;

[0122] The sentiment prediction unit 204 is used to input each first feature vector into the fully connected layer of the text classification model, and output the sentiment prediction result corresponding to each first comment information;

[0123] A model building unit 205, used to complete the construction of a text classification model according to the sentiment prediction result and label information corresponding to each first comment information;

[0124] The index construction unit 206 is used to obtain multiple second comment information to be constructed, input the multiple second comment information into the constructed text classification model, output the sentiment classification results corresponding to the multiple second comment information, and complete the construction of the emotion index corresponding to the multiple second comment information according to the sentiment classification results.

[0125] It should be noted that technical personnel in the relevant field can clearly understand that, for the convenience and conciseness of description, the specific working process of the emotion index construction device and each module described above can refer to the corresponding process in the emotion index construction method embodiment described in the above embodiments, and will not be repeated here.

[0126] The above-mentioned sentiment index construction method can be implemented in the form of a computer program. The computer program can be used in Figure 4 Run on the device shown.

[0127] See also Figure 5 , Figure 5 1 is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. The computer device includes a processor, a memory and a network interface connected via a device bus, wherein the memory may include a storage medium and an internal memory.

[0128] The storage medium can store an operating device and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any emotion index construction method.

[0129] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0130] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any emotion index construction method.

[0131] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present application, and does not constitute a limitation on the terminal to which the scheme of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0132] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0133] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:

[0134] Acquire multiple first comment information within a preset time range and label information corresponding to each first comment information; wherein the label information includes positive labels, neutral labels and negative labels;

[0135] Input each first comment information into the word embedding layer of the text classification model to be trained, and output the word vector matrix corresponding to each first comment information;

[0136] Input each word vector matrix into the convolutional layer of the text classification model, and output the first eigenvector corresponding to each word vector matrix;

[0137] Input each first feature vector into the fully connected layer of the text classification model, and output the sentiment prediction result corresponding to each first comment information;

[0138] The text classification model is constructed based on the sentiment prediction results and label information corresponding to each first comment information;

[0139] Acquire multiple pieces of second comment information to be constructed, input the multiple pieces of second comment information into the constructed text classification model, output sentiment classification results corresponding to the multiple pieces of second comment information, and complete the construction of sentiment indexes corresponding to the multiple pieces of second comment information according to the sentiment classification results.

[0140] In some embodiments, before inputting each first comment information into the word embedding layer of the text classification model to be trained, it also includes: determining a target word at the center position of multiple words corresponding to each first comment information; calculating the context probability of the remaining multiple words and the target word; generating a high-dimensional vector matrix corresponding to the first comment information according to each word and the context probability corresponding to the word; obtaining the one-hot encoded vector corresponding to the high-dimensional vector matrix, so as to input the one-hot encoded vector into the word embedding layer, and outputting the word vector matrix; wherein the dimension of the word vector matrix is ​​lower than the high-dimensional vector matrix.

[0141] Exemplarily, calculating the context probability of the remaining multiple words and the target word includes: obtaining the window word corresponding to the target word among the multiple words according to a preset window range; inputting each window word and the target word into a preset continuous bag of words model, and the continuous bag of words model calculates the context probability corresponding to the target word; the context probability includes the context probability value corresponding to each window word.

[0142] In some embodiments, the text classification model also includes a pooling layer, and each first feature vector is input into the fully connected layer of the text classification model, including: inputting each first feature vector into the pooling layer of the text classification model, and outputting a second feature vector corresponding to each feature vector; wherein the second feature vector includes an average pooling vector and a maximum pooling vector corresponding to the first feature vector; and inputting the second feature vector into the fully connected layer of the text classification model.

[0143] In some embodiments, the text classification model is constructed according to the sentiment prediction result and label information corresponding to each first comment information, including: calculating the cross entropy loss function corresponding to the sentiment prediction result and the label information; and constructing the text classification model according to the value of the cross entropy loss function; wherein the expression of the cross entropy loss function includes:

[0144]

[0145] Among them, and H(,) represent the value of the cross entropy loss function, Q represents the label information, P represents the sentiment prediction result, q i represents the true classification probability corresponding to the first comment information of the i-th article, p i Represents the true classification probability corresponding to the i-th first comment information.

[0146] In some embodiments, the sentiment classification results include attested sentiment, neutral sentiment and negative sentiment; based on the sentiment classification results, the sentiment index corresponding to the multiple second comment information is constructed, including: obtaining time distribution information, user distribution information and word count information corresponding to the multiple second comment information; based on the sentiment classification results corresponding to each second comment information, obtaining the number of positive comments, the number of negative comments and the number of neutral comments corresponding to the multiple second comment information; obtaining the sentiment index based on the time distribution information, user distribution information and word count information, the number of positive comments, the number of negative comments and the number of neutral comments.

[0147] Exemplarily, obtaining a sentiment index according to time distribution information, user distribution information and word count information, the number of positive comments, the number of negative comments and the number of neutral comments includes: obtaining positive weights corresponding to positive comments and negative weights corresponding to negative comments; normalizing the time distribution information, user distribution information and word count information respectively, obtaining a time threshold corresponding to the time distribution information, a user threshold corresponding to the user distribution information and a word count threshold corresponding to the word count information; calculating the sentiment index according to the positive weight, the negative weight, the time threshold, the user threshold, the word count threshold, the number of positive comments, the number of negative comments and the number of neutral comments; the expression of the sentiment index includes:

[0148]

[0149] Among them, EI is the emotional index, W positive is the positive weight, W negative is the negative weight, N positive is the number of positive comments, N negative is the number of negative comments, N neutral is the number of neutral comments, T is the time threshold, U is the user threshold, and S is the word count threshold.

[0150] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement the steps of the emotion index construction method provided in the above embodiments of the present application.

[0151] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.

[0152] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A method for constructing a sentiment index, characterized in that: include: Acquire multiple first comment information within a preset time range and label information corresponding to each first comment information; wherein the label information includes positive labels, neutral labels and negative labels; Input each of the first comment information into the word embedding layer of the text classification model to be trained, and output the word vector matrix corresponding to each of the first comment information; Input each of the word vector matrices into the convolutional layer of the text classification model, and output the first feature vector corresponding to each of the word vector matrices; Inputting each of the first feature vectors into the fully connected layer of the text classification model, and outputting the sentiment prediction result corresponding to each of the first comment information; The text classification model is constructed according to the sentiment prediction result and label information corresponding to each of the first comment information; Acquire multiple pieces of second comment information to be constructed, input the multiple pieces of second comment information into the constructed text classification model, output sentiment classification results corresponding to the multiple pieces of second comment information, and complete the construction of sentiment indexes corresponding to the multiple pieces of second comment information based on the sentiment classification results.

2. The method according to claim 1, characterized in that Before inputting each of the first comment information into the word embedding layer of the text classification model to be trained, the method further includes: Determine a target word at the center position of the plurality of words corresponding to each piece of the first comment information; Calculating the context probabilities of the remaining multiple words and the target word; Generate a high-dimensional vector matrix corresponding to the first comment information according to each of the words and the context probability corresponding to the words; Obtain a one-hot encoding vector corresponding to the high-dimensional vector matrix, input the one-hot encoding vector into the word embedding layer, and output the word vector matrix; wherein the dimension of the word vector matrix is ​​lower than that of the high-dimensional vector matrix.

3. The method according to claim 2, characterized in that The calculating of the context probabilities of the remaining plurality of words and the target word comprises: Acquire a window word corresponding to the target word from the plurality of words according to a preset window range; Each of the window words and the target word is input into a preset continuous bag-of-words model, and the continuous bag-of-words model calculates the context probability corresponding to the target word; the context probability includes the context probability value corresponding to each of the window words.

4. The method according to claim 1, characterized in that: The text classification model further includes a pooling layer, and the step of inputting each of the first feature vectors into a fully connected layer of the text classification model includes: Input each of the first feature vectors into the pooling layer of the text classification model, and output a second feature vector corresponding to each of the feature vectors; wherein the second feature vector includes an average pooling vector and a maximum pooling vector corresponding to the first feature vector; The second feature vector is input into a fully connected layer of the text classification model.

5. The method according to claim 1, characterized in that The step of completing the construction of the text classification model according to the sentiment prediction result and label information corresponding to each piece of the first comment information includes: Calculate the cross entropy loss function corresponding to the emotion prediction result and the label information; The text classification model is constructed according to the value of the cross entropy loss function; Among them, the expression of the cross entropy loss function includes: Wherein, the sum H(,) represents the value of the cross entropy loss function, Q represents the label information, P represents the emotion prediction result, q i represents the true classification probability corresponding to the first comment information of the i-th article, p i Represents the true classification probability corresponding to the i-th comment information.

6. The method according to claim 1, characterized in that The sentiment classification result includes affirmative sentiment, neutral sentiment and negative sentiment; and the step of constructing the sentiment index corresponding to the plurality of second comment information according to the sentiment classification result includes: Obtaining time distribution information, user distribution information, and word count information corresponding to a plurality of pieces of the second comment information; According to the sentiment classification result corresponding to each piece of the second comment information, the number of positive comments, the number of negative comments, and the number of neutral comments corresponding to the plurality of pieces of the second comment information are obtained; The sentiment index is obtained according to the time distribution information, the user distribution information and the word count information, the number of positive comments, the number of negative comments and the number of neutral comments.

7. The method according to claim 6, characterized in that The obtaining of the sentiment index according to the time distribution information, the user distribution information and the word count information, the number of positive comments, the number of negative comments and the number of neutral comments includes: Get the positive weights corresponding to positive comments and the negative weights corresponding to negative comments; Normalizing the time distribution information, user distribution information, and word count information respectively to obtain a time threshold corresponding to the time distribution information, a user threshold corresponding to the user distribution information, and a word count threshold corresponding to the word count information; The sentiment index is calculated according to the positive weight, negative weight, time threshold, user threshold, word count threshold, number of positive comments, number of negative comments and number of neutral comments; the expression of the sentiment index includes: Wherein, EI is the emotion index, W positive is the forward weight, W negative is the negative weight, N positive is the number of positive comments, N negative is the number of negative comments, N neutral is the number of neutral comments, T is the time threshold, U is the user threshold, and S is the word count threshold.

8. A device for constructing an emotion index, characterized in that: include: A label acquisition unit, used to acquire a plurality of first comment information within a preset time range and label information corresponding to each of the first comment information; wherein the label information includes a positive label, a neutral label and a negative label; A matrix output unit, used to input each of the first comment information into a word embedding layer of a text classification model to be trained, and output a word vector matrix corresponding to each of the first comment information; A vector output unit, used to input each of the word vector matrices into the convolutional layer of the text classification model, and output a first eigenvector corresponding to each of the word vector matrices; A sentiment prediction unit, used to input each of the first feature vectors into a fully connected layer of the text classification model, and output a sentiment prediction result corresponding to each of the first comment information; A model building unit, used to complete the construction of the text classification model according to the sentiment prediction result and label information corresponding to each of the first comment information; An index construction unit is used to obtain multiple second comment information to be constructed, input the multiple second comment information into the constructed text classification model, output the sentiment classification results corresponding to the multiple second comment information, and complete the construction of the sentiment index corresponding to the multiple second comment information according to the sentiment classification results.

9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and implement the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, causes the processor to implement the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Complaint event processing timeliness demand prediction method, device and medium

    CN119962766A

  • Implementation method and device of disaster information early warning and storage medium

    CN121121956A