Stock prediction method and system based on multi-dimensional text emotion score
Through the multi-dimensional text emotion score method, combined with the convolutional neural network and Bert model, the comprehensive emotion score is calculated, which solves the problem of inaccurate emotional scores in the existing technology, and improves the accuracy and timeliness of stock predictions.
Patent Information
- Application Number
- CN202411968304.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-25
AI Technical Summary
The existing stock prediction methods are not accurate enough when calculating emotional scores, and ignore important factors such as comment popularity and user influence, resulting in insufficient prediction accuracy and timeliness.
The multi-dimensional text emotion score method is used to calculate word-level and sentence-level emotion through convolutional neural network and Bert model, and combine comment popularity and user influence to calculate the comprehensive emotion score as the input of the stock prediction model.
It improves the accuracy and timeliness of stock forecasts, and provides more accurate stock price forecasts by comprehensively considering a variety of factors.
Smart Images

Figure CN119887386A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of financial forecasting, and in particular to a stock forecasting method and system based on multi-dimensional text sentiment scores. Background Art
[0002] In the financial market, stock price fluctuations are affected by a combination of factors, among which the emotional factors of market participants are increasingly attracting attention. Traditional stock prediction methods mainly focus on fundamental analysis and technical analysis. Fundamental analysis focuses on studying factors such as the company's financial status and industry prospects, while technical analysis focuses on historical stock price trends and trading data. However, these methods often ignore the important impact of market participants' emotions and sentiments on stock price fluctuations.
[0003] With the continuous development of natural language processing technology and sentiment analysis technology, financial sentiment analysis has gradually become a hot research field. By performing sentiment analysis on financial texts, we can extract the investor sentiment information contained therein, and then provide new perspectives and methods for stock prediction. However, there are still some problems with the current stock prediction methods based on sentiment analysis. First, the calculation method of sentiment scores is not accurate and comprehensive enough, and often only considers the surface sentiment information of the text, while ignoring other important factors, such as comment popularity and user influence. Secondly, when dealing with complex sentiment sequences and stock price data, existing prediction models have problems such as poor adaptability and low prediction accuracy.
[0004] Therefore, how to comprehensively consider multiple factors, accurately calculate the sentiment score of financial texts, and build an effective prediction model to improve the accuracy and timeliness of stock predictions has become an urgent problem to be solved in the current financial field. Summary of the invention
[0005] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a stock prediction method and system based on multi-dimensional text sentiment scores, thereby improving the accuracy and timeliness of stock prediction.
[0006] The purpose of the present invention can be achieved by the following technical solutions:
[0007] A stock prediction method based on multi-dimensional text sentiment score includes the following steps:
[0008] Use the distributed crawler framework Scrapy-Redis to obtain stock bar comments, save the data in the MySQL database, and clean the comments to obtain the comment text;
[0009] Predicting the sentiment polarity of words in the comment text by using a convolutional neural network, and performing word-level sentiment calculation on the comment text to obtain a word-level sentiment score;
[0010] Obtaining sentence-level sentiment scores of the review text through the Bert model;
[0011] Calculating the comment heat of the comment text to obtain the comment heat;
[0012] Calculating the user influence of the comment text to obtain the user influence;
[0013] Obtaining a comprehensive sentiment score for each comment text according to the word-level sentiment score, sentence-level sentiment score, comment popularity, and user influence;
[0014] The comprehensive sentiment score is used as the input of the stock prediction model, and the stock rise and fall are predicted by the stock prediction model to obtain a prediction result.
[0015] Furthermore, the comment includes the comment title, comment content, number of readers, number of likes and user-related content.
[0016] Furthermore, the specific steps of data cleaning of the comments include:
[0017] Remove invalid information from the comments, including multiple types of HTML tags, other formatting marks, line breaks, spaces, useless punctuation marks, useless web links, dates, long numbers, long English, and advertising content;
[0018] The comment title and the comment content of the comment are merged in a duplicate-free manner. If there is only the comment title, the comment title is retained. If there are both, the duplicate parts are removed to obtain the comment text of the comment;
[0019] The expressions in the comments are processed by dictionary mapping, and user-related content that cannot reflect emotions is removed.
[0020] Furthermore, the step of word-level sentiment calculation includes:
[0021] Predicting the sentiment polarity of words in the review text by using a convolutional neural network, wherein the sentiment polarity includes positive words and negative words;
[0022] The word-level sentiment score of the comment text is calculated according to the sentiment polarity of the words in the comment text.
[0023] Furthermore, the word-level sentiment score calculation formula for each comment text is:
[0024]
[0025] In the formula, word_score iis the word-level sentiment score of the i-th comment text, Pos i is the number of positive words contained in the i-th comment text, Neg i is the number of negative words contained in the i-th comment text.
[0026] Furthermore, the calculation formula for the comment heat calculation is:
[0027] comment_heat i =0.5*(reading_volume i +comment_volume i )*α
[0028] Where comment_heat i is the comment popularity of the i-th comment text, reading_volume i is the reading volume of the i-th comment text, comment_volume i is the number of comments on the i-th comment text, and α is the weight of the time decay function.
[0029] Furthermore, the calculation formula of the user influence is:
[0030] user_influence i =0.5*user_appeal i +0.5*user_activity i
[0031] user_appeal i =(n i +c i +influence_level i +h i )*0.25
[0032] user_activity i =(r i +p i +post i +reply i )*0.25
[0033] Where user_influence i is the user influence of the i-th comment text, user_appeal i is the user appeal score of the i-th comment text, user_activity i is the user activity score of the i-th comment text, n iis the number of fans of the user who commented on the ith text, c i Whether the user of the i-th comment text is authenticated, influence_level i is the influence level of the user who commented on the ith text, h i is the historical access count of the i-th comment text, r i is the user age of the i-th comment text, p i The number of users followed by the user who commented on the i-th text, post i The number of posts by the user for the i-th comment text, reply i The number of user replies to the i-th comment text.
[0034] Furthermore, the calculation formula of the comprehensive sentiment score is:
[0035] comprehensive_score i =(sentence_score i +word_score i )*comment_heat i *user_influence i
[0036] Where comprehensive_score i is the comprehensive sentiment score of the i-th comment text, sentence_score i is the sentence-level sentiment score of the i-th comment text, word_score i is the word-level sentiment score of the i-th comment text, comment_heat i is the comment popularity of the i-th comment text, user_influence i is the user influence of the i-th comment text.
[0037] Furthermore, the stock prediction model is a hidden Markov model, and the training steps of the stock prediction model include:
[0038] Divide the daily stock dataset and minute-level stock dataset into training set and test set;
[0039] The sum of the comprehensive sentiment scores of all comments at each moment is taken as the hidden state sequence, and the rise and fall state of the corresponding real stock data is taken as the observable sequence. The determination rule of the observable sequence is: if the difference between the current closing price and the closing price at the previous moment is greater than 0, it is considered that the stock is rising, otherwise it is falling;
[0040] First, the parameters of the hidden Markov model are initialized, the number of hidden states is set to 2, the number of iterations is set to 10000, and the convergence threshold is set to 0.001. The model is trained using the training set. During the training process, the model parameters are iteratively updated using the Baum-Welch algorithm until the convergence condition is met or the preset number of iterations is reached, and the model parameters are estimated by maximizing the probability of the observable sequence;
[0041] The prediction results of the model are evaluated using the test set to complete the training.
[0042] According to another aspect of the present invention, a stock prediction system based on multi-dimensional text sentiment scores is provided, comprising:
[0043] The data cleaning module is used to obtain stock bar comments using the distributed crawler framework Scrapy-Redis, save the data to the MySQL database, and clean the comments to obtain the comment text;
[0044] A word-level sentiment score calculation module is used to predict the sentiment polarity of words in the comment text through a convolutional neural network, and perform word-level sentiment calculation on the comment text to obtain a word-level sentiment score;
[0045] A sentence-level sentiment score calculation module is used to obtain the sentence-level sentiment score of the comment text through the Bert model;
[0046] A comment heat calculation module is used to calculate the comment heat of the comment text to obtain the comment heat;
[0047] A user influence calculation module, used to calculate the user influence of the comment text to obtain the user influence;
[0048] A comprehensive sentiment score calculation module is used to obtain a comprehensive sentiment score for each comment text according to the word-level sentiment score, sentence-level sentiment score, comment popularity and user influence;
[0049] The stock prediction module is used to use the comprehensive sentiment score as the input of the stock prediction model, predict the rise and fall of the stock through the stock prediction model, and obtain the prediction result.
[0050] Compared with the prior art, the present invention has the following beneficial effects:
[0051] 1. The present invention performs word-level sentiment calculation on the comment text, obtains the sentence-level sentiment score of the comment text through the Bert model, calculates the comment heat and calculates the user influence on the comment text, obtains the comprehensive sentiment score of each comment text based on a comprehensive analysis of the word-level sentiment score, sentence-level sentiment score, comment heat and user influence, uses the comprehensive sentiment score as the input of the stock prediction model, predicts the stock rise and fall through the stock prediction model, and improves the accuracy of stock prediction.
[0052] 2. The present invention uses the comprehensive sentiment score as the input of the stock prediction model, the sum of the comprehensive sentiment scores of all comments at each moment as the hidden state sequence, and the rise and fall state of the corresponding real stock data as the observable sequence; the model is trained using a training set, and during the training process, the model parameters are iteratively updated using the Baum-Welch algorithm until the convergence condition is met or the preset number of iterations is reached. The model parameters are estimated by maximizing the probability of the observable sequence, thereby improving the timeliness of stock prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 A flow chart of a stock prediction method based on multi-dimensional text sentiment scores proposed by the present invention. DETAILED DESCRIPTION
[0054] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0055] Example 1
[0056] This embodiment provides a stock prediction method based on multi-dimensional text sentiment scores. Figure 1 As shown, the following steps are included:
[0057] S1. Use the distributed crawler framework Scrapy-Redis to obtain stock comments, save the data in the MySQL database, and clean the comments to obtain the comment text.
[0058] This embodiment uses the distributed crawler framework Scrapy-Redis to crawl stock comments. The framework combines the functions of Scrapy and Redis. By storing crawling requests and data in Redis, it realizes coordination and sharing between multiple crawler nodes. It has an efficient task distribution and deduplication mechanism, and supports dynamic expansion of crawler nodes. The crawled comments include comment titles, content, number of readers, number of likes, and user-related content. Since Redis is based on memory and does not have persistence, in order to ensure data security, the data is saved in the MySQL database at the same time to provide structured persistent storage, which is convenient for subsequent data processing and team collaboration.
[0059] The comment title and comment content are merged to remove duplicates. If there is only a title, the title is retained. If there are both, the duplicate parts are removed to generate the text of the comment.
[0060] Remove invalid information from text content, including HTML tags, other formatting tags, line breaks, spaces, useless punctuation marks, useless web links, dates, long numbers, long English, advertising content, etc.
[0061] Dictionary mapping was performed on 79 emojis in stock bar comments, such as replacing "smile" with happy, "rocket" with rising, and "sigh" with disappointed.
[0062] Further analyze the text content and delete content such as "additional content by the author", "forwarded", and "published on" that cannot reflect emotions but appear frequently.
[0063] S2. Predict the sentiment polarity of words in the comment text through convolutional neural network, and perform word-level sentiment calculation on the comment text to obtain word-level sentiment scores.
[0064] The convolutional neural network (CNN) is used to predict the sentiment polarity of the words in the prediction set. The specific operations include:
[0065] ①Convert the training set words into custom word vector representations;
[0066] ② Extract the local features of the word through the convolution layer, and then reduce the dimension through the pooling operation;
[0067] ③ Combine features of different sizes through feature fusion methods such as splicing and weighted averaging;
[0068] ④ Input the fused features into the fully connected layer for classification, and finally use softmax to output the probability of the sentiment polarity category.
[0069] Label the training set accordingly and import it into the custom word library of jieba word segmentation. Use the improved jieba word segmentation tool to remove stop words (such as useless punctuation, pronouns, numbers, etc.) from the cleaned stock review text and perform word segmentation. Then use SnowNLP to do part-of-speech tagging on the known custom data set and put it in the known part-of-speech list. Make part-of-speech tagging judgment on the words after jieba word segmentation. If the length of the word is greater than 1 and the part-of-speech exists in the known part-of-speech list, and the word does not exist in the training set, then add it to the prediction set. Finally, there are 9374 labeled words in the training set and 28299 unlabeled words in the prediction set.
[0070] To improve the accuracy of the model, the training set is divided into training set, validation set, and test set with a ratio of 8:1:1. The model parameters are updated through multiple trainings using the back propagation algorithm and the gradient descent optimization algorithm. The neural network parameters are set as follows: the number of softmax classifications is 2, the word embedding size is 128, the number of convolution kernels in the first group of convolution operations is 128, the number of convolution kernels in the second group of convolution operations is 98, the convolution kernel size is 3, the activation function is tanh, the pooling type is square root, the batch reading data size is 128, the iterative training rounds are 100, the optimizer uses the AdagradOptimizer algorithm, and the learning rate is 0.0001.
[0071] The prediction model proposed in this embodiment has an accuracy rate of up to 98% in the training set, 94% in the validation set, and 88% in the test set. The model is used to predict unlabeled words and is combined with the training set to build a more complete sentiment dictionary. The number of words in the new sentiment dictionary is 3767. Finally, the word-level sentiment score of each comment text is calculated using the new sentiment dictionary.
[0072] The word-level sentiment score calculation formula for each comment text is:
[0073]
[0074] In the formula, word_score i is the word-level sentiment score of the i-th comment text, Pos i is the number of positive words contained in the i-th comment text, Neg i is the number of negative words contained in the i-th comment text.
[0075] Using the word-level sentiment score calculation formula, we can obtain the word-level sentiment score corresponding to each comment text, as shown in Table 1.
[0076] Table 1 Word-level sentiment scores
[0077]
[0078]
[0079] S3. Get the sentence-level sentiment score of the comment text through the Bert model.
[0080] The BERT pre-trained model is used for sentence-level sentiment analysis. BERT is a pre-trained language model based on the Transformer architecture. It uses bidirectional encoding, can effectively capture the semantics of the word context, and includes two pre-training tasks: MLM and NSP.
[0081] Since the crawled SSE Index stock bar comment texts have no corresponding sentiment tags, and the original training of FinBert is not expected to include training texts in the stock field and has no classification function, the present invention uses the financial field pre-training model FinBert1.0 based on the BERT architecture and fine-tunes it.
[0082] The fine-tuning steps include:
[0083] ①Use the Bert model to create a tokenizer mapper to map the comment text content into corresponding word vectors;
[0084] ② Analyze the length of each sentence and find the length that can cover 95% of the length. If it exceeds, cut it off; if it is less, fill it in;
[0085] ③Create a data generator DataLoader to generate data in batches and dynamically;
[0086] ④ Load the model and train it using the data set. During the training process, use the back propagation and gradient descent optimization algorithms to update the model parameters, and evaluate the model using four evaluation indicators: Accuracy, Precision, Recall, and F1-score;
[0087] ⑤Evaluate the model. The evaluation results are shown in Table 2.
[0088] Table 2 Evaluation results
[0089]
[0090] The training parameters are set as follows: the maximum sentence length is 128, the number of classification results is 2, the batch size is 32, the number of training rounds is 10, the AdamW optimization algorithm is used, and the learning rate is 0.00001.
[0091] Finally, the trained model is used to predict the sentence-level sentiment scores of the cleaned stock bar comment texts. All the probabilities obtained in the results are classified into different scores using softmax. Different intervals represent different emotions of stockholders. [-1,-0.2] represents bearish sentiment, [-0.2,0.2] represents neutral sentiment, and [0.2,1] represents bullish sentiment. The sentence-level sentiment scores of the stock bar comment texts are shown in Table 3.
[0092] Table 3 Sentiment scores
[0093]
[0094] S4. Calculate the comment heat of the comment text to obtain the comment heat.
[0095] The popularity of comments is calculated using the number of comments read, the number of comments, and the time of comment release as influencing factors. Since the number of comments read and the number of comments have different dimensions, the number of comments read is first processed by log1000 and the number of comments is processed by log10.
[0096] Taking into account the significant impact of release time on comment popularity, weights are only allocated on working days and trading hours of the stock market (9:00-15:00, of which 9:15-9:25 is the call auction stage before the opening of the trading day, and noon is the transition period between the morning and afternoon sessions, which are all taken into account). Other time periods are excluded, and the time decay function weight allocation strategy is adopted. The specific weight parameters are shown in Table 4.
[0097] Table 4 Weight parameters
[0098]
[0099] The calculation formula for comment heat is:
[0100] comment_heat i =0.5*(reading_volume i +comment_volume i )*α
[0101] Where comment_heat i is the comment popularity of the i-th comment text, reading_volume i is the reading volume of the i-th comment text, comment_volume i is the number of comments on the i-th comment text, and α is the weight of the time decay function.
[0102] S5. Calculate the user influence on the comment text to obtain the user influence.
[0103] The user's appeal score is constructed based on the number of fans, whether the user is authenticated, the user's influence level, and the number of historical visits. The user's activity score is constructed based on the user's age, the number of other users the user follows, the number of posts the user makes, and the number of replies the user makes.
[0104] Taking into account the issues of dimension and data differences, these eight influencing factors are normalized and then weighted to generate user influence.
[0105] The calculation formula for user influence is:
[0106] user_influence i =0.5*user_appeal i +0.5*user_activity i
[0107] user_appeal i =(n i +c i +influence_level i +h i )*0.25
[0108] user_activity i =(r i +p i +post i +reply i )*0.25
[0109] Where user_influence i is the user influence of the i-th comment text, user_appeal i is the user appeal score of the i-th comment text, user_activity i is the user activity score of the i-th comment text, n i is the number of fans of the user who commented on the ith text, c i Whether the user of the i-th comment text is authenticated, influence_level i is the influence level of the user who commented on the ith text, h i is the historical access count of the i-th comment text, r i is the user age of the i-th comment text, p i The number of users followed by the user who commented on the i-th text, post i The number of posts by the user for the i-th comment text, reply i The number of user replies to the i-th comment text.
[0110] S6. Obtain a comprehensive sentiment score for each comment text based on word-level sentiment scores, sentence-level sentiment scores, comment popularity, and user influence.
[0111] The calculation formula for the comprehensive sentiment score is:
[0112] comprehensive_score i =(sentence_score i +word_score i )*comment_heat i *user_influence i
[0113] Where comprehensive_score i is the comprehensive sentiment score of the i-th comment text, sentence_score i is the sentence-level sentiment score of the i-th comment text, word_score i is the word-level sentiment score of the i-th comment text, comment_heat i is the comment popularity of the i-th comment text, user_influence i is the user influence of the i-th comment text.
[0114] S7. Use the comprehensive sentiment score as the input of the stock prediction model, predict the rise and fall of the stock through the stock prediction model, and obtain the prediction result.
[0115] By integrating the sentiment scores, sentiment sequences of different time granularities are constructed.
[0116] Daily data set construction:
[0117] Get daily stock data, filter out the closing price and the previous day's closing price for each daily stock data, and calculate the price difference between the previous and next days.
[0118] According to the comprehensive sentiment score calculation formula, the sum of the sentiment scores of stockholders' comments during the working hours of each tradable day is calculated and used as the hidden state sequence corresponding to the daily line data.
[0119] Minute-level dataset construction:
[0120] Get stock data with a frequency of 5 minutes, filter out the closing price of each 5-minute stock data and the closing price of the previous moment, calculate the difference between the closing price and the closing price of the previous moment, and determine the stock's rise and fall status.
[0121] According to the comprehensive sentiment score calculation formula, the sum of the sentiment scores of stockholders' comments in each 5-minute time period is calculated as the hidden state sequence corresponding to the 5-minute data.
[0122] The training steps of the stock prediction model include:
[0123] ① The daily data set and the minute-level data set are randomly divided into training set and prediction set in a ratio of 8:2 respectively.
[0124] ②Determine the parameters of the Hidden Markov Model (HMM):
[0125] The hidden state sequence is the sentiment score sequence, and the observable sequence is the rise and fall state of the corresponding real stock data. The rule for determining the observable sequence is: if the difference between the current closing price and the closing price at the previous moment is greater than 0, the stock is considered to be rising and marked as "up"; otherwise, it is a falling trend and marked as "down".
[0126] This embodiment uses the HMM model. First, the parameters of the HMM model are initialized, the number of hidden states is set to 2 (corresponding to "up" and "down"), the number of iterations is set to 10000, and the convergence threshold is set to 0.001. The model is trained using the training set data. During the training process, the model parameters are iteratively updated using the Baum-Welch algorithm until the convergence condition is met or the preset number of iterations is reached.
[0127] ③ Use the training set to train the HMM model and estimate the model parameters by maximizing the probability of the observation sequence.
[0128] The prediction accuracy of the stock prediction model is shown in Table 5.
[0129] Table 5 Prediction accuracy of stock prediction model
[0130]
[0131] By analyzing Table 5, it can be obtained that the use of the HMM model to predict the rise and fall of stocks on the daily line performs well in both the training set and the prediction set, which shows that the stock prediction method based on multi-dimensional text sentiment score proposed in this embodiment improves the accuracy and timeliness of stock prediction.
[0132] Example 2
[0133] This embodiment provides a stock prediction system based on multi-dimensional text sentiment scores, including:
[0134] The data cleaning module is used to obtain the stockholders' comments and clean the data of the stockholders' comments to obtain the comment text;
[0135] The word-level sentiment score calculation module is used to perform word-level sentiment calculation on the comment text to obtain the word-level sentiment score;
[0136] The sentence-level sentiment score calculation module is used to obtain the sentence-level sentiment score of the comment text through the Bert model;
[0137] The comment heat calculation module is used to calculate the comment heat of the comment text to obtain the comment heat;
[0138] User influence calculation module, used to calculate the user influence of the comment text to obtain the user influence;
[0139] The comprehensive sentiment score calculation module is used to obtain the comprehensive sentiment score of each comment text based on the word-level sentiment score, sentence-level sentiment score, comment popularity and user influence;
[0140] The stock prediction module is used to use the comprehensive sentiment score as the input of the stock prediction model, predict the rise and fall of the stock through the stock prediction model, and obtain the prediction result.
[0141] The rest is the same as in Example 1.
[0142] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A stock prediction method based on multi-dimensional text sentiment score, characterized in that: The following steps are involved: Use the distributed crawler framework Scrapy-Redis to obtain stock bar comments, save the data in the MySQL database, and clean the comments to obtain the comment text; Predicting the sentiment polarity of words in the comment text by using a convolutional neural network, and performing word-level sentiment calculation on the comment text to obtain a word-level sentiment score; Obtaining sentence-level sentiment scores of the review text through the Bert model; Calculating the comment heat of the comment text to obtain the comment heat; Calculating the user influence of the comment text to obtain the user influence; Obtaining a comprehensive sentiment score for each comment text according to the word-level sentiment score, sentence-level sentiment score, comment popularity, and user influence; The comprehensive sentiment score is used as the input of the stock prediction model, and the stock rise and fall are predicted by the stock prediction model to obtain a prediction result.
2. The stock prediction method based on multi-dimensional text sentiment score according to claim 1 is characterized in that: The comments include comment title, comment content, number of readers, number of likes and user-related content.
3. The stock prediction method based on multi-dimensional text sentiment score according to claim 1 is characterized in that: The specific steps for data cleaning of the comments include: Remove invalid information from the comments, including multiple types of HTML tags, other formatting marks, line breaks, spaces, useless punctuation marks, useless web links, dates, long numbers, long English, and advertising content; The comment title and the comment content of the comment are merged in a duplicate-free manner. If there is only the comment title, the comment title is retained. If there are both, the duplicate parts are removed to obtain the comment text of the comment; The expressions in the comments are processed by dictionary mapping, and user-related content that cannot reflect emotions is removed.
4. The stock prediction method based on multi-dimensional text sentiment score according to claim 1 is characterized in that: The steps of word-level sentiment calculation include: Predicting the sentiment polarity of words in the review text by using a convolutional neural network, wherein the sentiment polarity includes positive words and negative words; The word-level sentiment score of the comment text is calculated according to the sentiment polarity of the words in the comment text.
5. The method for stock prediction based on multi-dimensional text sentiment scores according to claim 4 is characterized in that: The word-level sentiment score calculation formula for each comment text is: In the formula, word_score i is the word-level sentiment score of the i-th comment text, Pos i is the number of positive words contained in the i-th comment text, Neg i is the number of negative words contained in the i-th comment text.
6. The method for stock prediction based on multi-dimensional text sentiment scores according to claim 1, characterized in that: The calculation formula for the comment heat calculation is: comment_heat i =0.5*(reading_volume i +comment_volume i )*α Where comment_heat i is the comment popularity of the i-th comment text, reading_volume i is the reading volume of the i-th comment text, comment_volume i is the number of comments on the i-th comment text, and α is the weight of the time decay function.
7. The method for stock prediction based on multi-dimensional text sentiment scores according to claim 1, characterized in that: The calculation formula of the user influence is: user_influence i =0.5*user_appeal i +0.5*user_activity i user_appeal i =(n i +c i +influence_level i +h i )*0.25 user_activity i =(r i +p i +post i +reply i )*0.25 Where user_influence i is the user influence of the i-th comment text, user_appeal i is the user appeal score of the i-th comment text, user_activity i is the user activity score of the i-th comment text, n i is the number of fans of the user who commented on the ith text, c i Whether the user of the i-th comment text is authenticated, influence_level i is the influence level of the user who commented on the ith text, h i is the historical access count of the i-th comment text, r i is the user age of the i-th comment text, p i The number of other users followed by the user who commented on the i-th text, post i The number of posts by the user for the i-th comment text, reply i The number of user replies to the i-th comment text.
8. The method for stock prediction based on multi-dimensional text sentiment scores according to claim 1, characterized in that: The calculation formula of the comprehensive sentiment score is: comprehensive_score i =(sentence_score i +word_score i )*comment_heat i *user_influence i Where comprehensive_score i is the comprehensive sentiment score of the i-th comment text, sentence_score i is the sentence-level sentiment score of the i-th comment text, word_score i is the word-level sentiment score of the i-th comment text, comment_heat i is the comment popularity of the i-th comment text, user_influence i is the user influence of the i-th comment text.
9. The method for stock prediction based on multi-dimensional text sentiment scores according to claim 1, characterized in that: The stock prediction model is a hidden Markov model, and the training steps of the stock prediction model include: Divide the daily stock dataset and minute-level stock dataset into training set and test set; The sum of the comprehensive sentiment scores of all comments at each moment is taken as the hidden state sequence, and the rise and fall state of the corresponding real stock data is taken as the observable sequence. The determination rule of the observable sequence is: if the difference between the current closing price and the closing price at the previous moment is greater than 0, it is considered that the stock is rising, otherwise it is falling; First, the parameters of the hidden Markov model are initialized, the number of hidden states is set to 2, the number of iterations is set to 10000, and the convergence threshold is set to 0.
001. The model is trained using the training set. During the training process, the model parameters are iteratively updated using the Baum-Welch algorithm until the convergence condition is met or the preset number of iterations is reached, and the model parameters are estimated by maximizing the probability of the observable sequence; The prediction results of the model are evaluated using the test set to complete the training.
10. A stock prediction system based on multi-dimensional text sentiment scores, characterized in that: include: The data cleaning module is used to obtain stock bar comments using the distributed crawler framework Scrapy-Redis, save the data to the MySQL database, and clean the comments to obtain the comment text; A word-level sentiment score calculation module is used to predict the sentiment polarity of words in the comment text through a convolutional neural network, and perform word-level sentiment calculation on the comment text to obtain a word-level sentiment score; A sentence-level sentiment score calculation module is used to obtain the sentence-level sentiment score of the comment text through the Bert model; A comment heat calculation module is used to calculate the comment heat of the comment text to obtain the comment heat; A user influence calculation module, used to calculate the user influence of the comment text to obtain the user influence; A comprehensive sentiment score calculation module is used to obtain a comprehensive sentiment score for each comment text according to the word-level sentiment score, sentence-level sentiment score, comment popularity and user influence; The stock prediction module is used to use the comprehensive sentiment score as the input of the stock prediction model, predict the rise and fall of the stock through the stock prediction model, and obtain the prediction result.