Stock characterization price prediction method based on multivariate heterogeneity characteristics
The method integrates text and market data to enhance stock price prediction by calculating sentiment and market correlation coefficients, improving prediction accuracy and portfolio management.
Patent Information
- Application Number
- CN202411341189.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-01-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Current methods for stock price prediction lack a comprehensive approach to harness the internal connections within financial markets by integrating multiple types of data, particularly text and market data, to enhance representation and prediction abilities.
A price prediction method that utilizes a review data mining module to extract sentiment correlation coefficients from stock text evaluations, constructs a market correlation matrix, and integrates these with a stock price prediction model to predict stock trends, incorporating an investment portfolio management module for stock selection and risk representation.
This method effectively utilizes multiple data types to represent stocks, enhancing prediction accuracy and providing a framework for stock portfolio selection, addressing the lack of comprehensive market connection analysis in existing technologies.
Smart Images

Figure CN119250971A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cleaning equipment, and in particular to a price prediction method for stock representation based on multivariate heterogeneity characteristics. Background Art
[0002] With the popularization and development of deep neural networks, more and more quantitative models are combined with deep neural networks in the field of financial science and technology to study single stocks, indexes composed of many stocks, etc. Among them, building relationships between different stocks and between stocks and indexes has become a research direction to improve the prediction performance of the model. However, current research is often limited to using a single relationship data, or using multiple relationship data from a single type of data.
[0003] Therefore, existing technologies and methods lack a forecasting method that can fully tap the internal connections of financial markets. Summary of the invention
[0004] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a price prediction method for stock representation based on multivariate heterogeneity features, which deeply explores the relationship between text evaluation, market price and stock trend, and fully considers the correlation between sectors, and has stronger representation ability and better prediction ability. In order to achieve the above-mentioned purpose and other advantages according to the present invention, a price prediction method for stock representation based on multivariate heterogeneity features is provided, comprising:
[0005] A review data mining module, wherein the market data mining module is used to obtain stock text evaluation data;
[0006] A market data mining module, wherein the market data mining module is used to obtain market data;
[0007] Calculate the sentiment correlation coefficient between sectors through the verbs in the stock text evaluation data;
[0008] Calculate the market correlation matrix from market data;
[0009] The stock price prediction model is constructed by using the comment data mining module, market data mining module and stock trend classifier module;
[0010] The pre-processed stock text evaluation data and the pre-trained stock price prediction model in the market data input are used to obtain the sector sharing model;
[0011] Obtain the latest stock text evaluation data and market data and input them into the stock price prediction model to predict the stock price trend of the next trading cycle.
[0012] Preferably, it also includes an investment portfolio management module, and the specific operations of the investment portfolio management module are:
[0013] The stock price prediction model is used to select stocks with a predicted increase in the next trading day, the stock representation of the corresponding stocks is saved, and the trading weight of the stocks is calculated;
[0014] The investment risk is represented by the dot product sum of the stock representations in the portfolio, and the total return of the portfolio is calculated.
[0015] Preferably, the stock text evaluation data is divided according to the stocks and time, and the stocks are screened according to the start and end time of the data set, and the stocks that meet the requirements are screened from all the stocks to form a stock pool, the stocks in the stock pool are preprocessed, and the text information is extracted as comment representation data through bidirectional vector embedding coding.
[0016] Preferably, the comment data mining module includes an encoder module, a first vector, a second vector, and concatenating the first vector and the second vector in a width dimension to obtain a third vector;
[0017] The encoder module processes and converts the fundamental historical information and technical historical information of the stock to obtain a first vector;
[0018] The bidirectional vector embedding result of the preprocessed stock text evaluation data is input into the distiller module to obtain the second vector.
[0019] Preferably, the market correlation matrix is calculated by market data, specifically:
[0020] Sector data is described by the average value of individual stock data within the sector;
[0021] Combine individual stock information with information from many sectors to generate a market price matrix;
[0022] For the market price matrix, calculate its covariance matrix as the market correlation matrix of the stock.
[0023] Compared with the prior art, the present invention has the following beneficial effects: by integrating the stock representation of multiple types of data, multiple types of fused data can be effectively used to represent stocks and the relationship between different stocks can be incorporated into the stock representation, thereby effectively solving the problem that the internal connection of the financial market has been ignored in the past. While predicting the rise and fall trend of stock prices, it also provides a method for stock portfolio selection, which provides new ideas for the subsequent study and research of stock price prediction models and stock selection models and engineering applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1A schematic diagram of a stock trend classification structure of a price prediction method based on stock representation of multivariate heterogeneity characteristics according to the present invention;
[0025] Figure 2 A detailed diagram of partially acquired data for the price prediction method based on multivariate heterogeneity characteristics of stocks according to the present invention;
[0026] Figure 3 A schematic diagram of a data set division method for a price prediction method of stock representation based on multivariate heterogeneity characteristics according to the present invention;
[0027] Figure 4 A structural diagram of a stock representation and a stock price prediction model of multiple types of fusion data according to a price prediction method of stock representation based on multivariate heterogeneity features of the present invention;
[0028] Figure 5 A structural diagram of a review data mining module of a price prediction method of stock representation based on multivariate heterogeneity features according to the present invention;
[0029] Figure 6 A structural diagram of a market data mining module of a price prediction method of stock representation based on multivariate heterogeneity characteristics according to the present invention;
[0030] Figure 7 A schematic diagram of an enhanced classifier module of the price prediction method based on multivariate heterogeneity feature stock representation according to the present invention;
[0031] Figure 8 The figure is a schematic diagram of the data training process of the price prediction method of stock representation based on multivariate heterogeneity features according to the present invention. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0033] Reference Figure 1-8 , a price prediction method for stock representation based on multivariate heterogeneous features, comprising:
[0034] A review data mining module, wherein the market data mining module is used to obtain stock text evaluation data;
[0035] A market data mining module, wherein the market data mining module is used to obtain market data;
[0036] Calculate the sentiment correlation coefficient between sectors through the verbs in the stock text evaluation data;
[0037] Calculate the market correlation matrix from market data;
[0038] The stock price prediction model is constructed by using the comment data mining module, market data mining module and stock trend classifier module;
[0039] The pre-processed stock text evaluation data and the pre-trained stock price prediction model in the market data input are used to obtain the sector sharing model;
[0040] The latest stock text evaluation data and market data are obtained and input into the stock price prediction model to predict the stock price trend of the next trading cycle.
[0041] In this embodiment, the stock text evaluation data uses a text information crawler program to collect stock comment information from the stock information platform, and downloads the stock's historical data from the stock data service provider. The downloaded data includes two types of data, one is the stock's fundamental historical information, including the company's price-earnings ratio and return on net assets. The other is the stock's technical historical information, including the stock's opening price, closing price, highest price, lowest price, trading volume, and transaction amount.
[0042] The acquired text information is divided into training set data and test set data according to the stocks and time, and the stocks are screened according to the start and end time of the data set, and the stocks that meet the requirements are screened from all stocks to form a stock pool.
[0043] The data set is divided into Figure 2 As shown, the ordinate shows different data sets, and the abscissa is a fixed-length time period, such as day, month, year. In the invention, the time period is year. In addition, except for the first data set that uses a training set data of one time period length and a test set data of one time length, the remaining data sets use training set data of two time period lengths and one time length test set data.
[0044] Then, the stocks within the time period between the start time of the first training set and the end time period of the last test set are screened, and the stocks that meet the requirements of not having any abnormal conditions such as delisting or ST during the time period and have always been in the stock pool of the CSI 300 Index are screened out to form the stock pool.
[0045] The stocks in the stock pool are processed and the text information is extracted as comment representations. First, the trading day test and missing value filling are performed on the stocks in the target stock set. By comparing the stock price date with the trading day, it is checked whether there is any missing trading day data. For the missing stock historical information data on some trading days, the price data of the previous trading day is used to fill the missing values.
[0046] Then, the natural language processing technology is used to segment the published content of the stock reviews. Specifically, a trained semantic analysis model such as hnlp is used to perform semantic analysis on each word in the review information text, and the words are classified according to nouns, verbs, adjectives, adverbs, and prepositions. The words with the same part of speech and adjacent positions are merged, and the sentences are segmented according to the words. For example, the sentence: "It seems that it is a rebound again, and it is in place again. It seems that there is no hope. This stock is too weak and needs to be measured." After segmentation, it becomes: "It seems that / v is / c a / v rebound / v, / w it is / d in place / v / u it seems that / v there is no hope / v, / w this / r / q stock / n is / d weak / a / u it needs to be / v measured / v." This article mainly focuses on verbs (v), adverbs (vd), gerunds (vn), and nouns (n) in the sentences, so only these four types of words are extracted for analysis.
[0047] Then, bidirectional vector embedding coding is used to extract text information into comment representations, and the evaluation text is segmented at two levels using window-level segmentation methods and sentence-level segmentation methods. The verb core words in each segmented window are converted into word embedding vectors using the word2vc method as key embedding vectors, and the words in the sentence to which the window belongs, excluding the verb core words used in the window, are converted into word embedding vectors using the word2vc method as value embedding vectors. The window-level segmentation method and the sentence-level segmentation method are two text segmentation methods: the segmentation object is a sequence of words composed of a fixed window size and a complete sentence. That is, for the evaluation S=s1s2…s k , using the sentence-level segmentation method to split into s1, s2, …, s k , where s n is a sentence in the evaluation; for evaluation S = w1w2…w s , using the window-level segmentation method to split into w1w2…w p ,w p+1 w p+2 …w 2p ,…,w 1p+1 w 1p+2 ..w s , where w n is a word in the evaluation. c =w a …w b Window W m …w n , whose keys are embedded in the vector in is the word vector of wi and w i ∈w m …w n , wi is the core verb; its value is embedded in the vector in w i The word vector of W i ∈w a …w b .
[0048] In this embodiment, the sentiment correlation coefficient between the sections is calculated by the verbs in the stock text evaluation data:
[0049] The sentiment correlation coefficient between the sections is calculated by the verbs in the evaluation. The sentiment correlation coefficient is expressed as SR v,p , which indicates the correlation between verb v and stock bar p, and the calculation expression is:
[0050] SR v,p =STTF v,p ×STISF p,q ×SETF v,q ×SEIDF q
[0051] Where, STTF p,v The frequency of verb v in stock forum p is expressed as:
[0052]
[0053] Where n p,v Indicates the number of times the verb v appears in the stock forum p, m p Indicates the number of all verbs in the stock bar p.
[0054] Where, STISF q,p It represents the inverse sector frequency of stock p for sector q, and the expression is:
[0055]
[0056] Where M q represents the number of all stocks in sector q, N q,v represents the number of stocks in sector q that contain verb v. q,v The frequency of verb v in section q is expressed as:
[0057]
[0058] In the formula, en q,v Indicates the number of times verb v appears in section q, em q Represents the number of all verbs in section q.
[0059] Where, SEIMFq It represents the reverse market frequency of sector q, and the expression is:
[0060]
[0061] In the formula, MM represents the number of sectors in the market, MN q,v Represents the number of all sectors in the market that contain verb v.
[0062] The classification of stock sectors adopts the classification standards of Oriental Fortune.
[0063] In this embodiment, the market correlation matrix is calculated through market data, specifically:
[0064] First, for the historical price of a single stock s over the past t days, use P s =[p1 p2 … p t ] is used to represent the sector data. For sector data, the average value of the individual stock data within the sector is used to describe it:
[0065] B1=average(P)
[0066] Where l represents the sector with sector number l. Finally, this paper combines the information of individual stocks with the information of many sectors to generate a market price matrix. For stock s, its market price matrix is constructed as follows:
[0067]
[0068] Where t represents the time span, x_n represents the information of the nth sector, the first row in the market price matrix shows the price data of the corresponding stock, and the 2nd to n+1th rows show the corresponding sector data.
[0069] Then, for the market price matrix, calculate its covariance matrix as the market correlation matrix of the stock, which is calculated as follows:
[0070] M=E[(X-EX) T (X-EX)]
[0071] Where E represents mathematical expectation. The market correlation matrix is expressed as follows:
[0072]
[0073] where c n,s Represents the correlation between the nth sector and stock s.
[0074] In this embodiment, the stock price prediction model includes a comment data mining module, a market data mining module and a stock trend classifier module. The framework structure is as follows: Figure 4 shown.
[0075] Among them, the comment data mining module is as follows Figure 5 As shown, the encoder module layer of Transformer is used to process and transform the fundamental historical information and technical historical information of the stock to obtain the first vector P = [p1, p2, ..., p k The bidirectional vector embedding result of the evaluation preprocessed in step 3 is input into the distiller module to obtain the second vector Q = [q1, q2, ..., q k ], and its calculation formula is as follows:
[0076]
[0077] In the formula, v s,i represents the value embedding vector of the i-th evaluation of stock s, i∈N, N is the set of all evaluations on the t-th day, Score s,i is the attention score of the i-th sentence evaluation of stock s, calculated as follows:
[0078]
[0079] In the formula, represents the key embedding vector of the jth verb core word in the i-th review of stock s, represents the sentiment correlation coefficient between the jth verb core word in the i-th evaluation of stock s and the current sector, s s Represents the stock representation used to represent stock s, initialized with random values.
[0080] Finally, the first vector and the second vector are concatenated in the width dimension to obtain the third vector X = [x1, x2, ..., x k ], as the fusion data input enhanced classifier model, the splicing method is as follows:
[0081] X=P||Q
[0082] X=[p1||q1, p2||q2,…,p k ||q k ].
[0083] Market data mining modules such as Figure 6 As shown in the figure, firstly, according to the correlation between the target stock and each sector in the market correlation matrix, all sectors are divided into two categories, X pos is a collection of positively correlated sectors, X neg is a set of negatively correlated sectors. Then the Transformer layer is used to encode the market price data of sectors that are positively correlated with the target stock and sectors that are negatively correlated with the target stock respectively:
[0084] (β pos, β s , β neg )=Transformer(X pos , X s , X neg )
[0085] Then, the graph neural network is used to learn the attention weights between the positively correlated sectors and the negatively correlated sectors and the target stock, and use this to update the feature information of the positively correlated sectors and the negatively correlated sectors. i and the target stock node β s The weight between is calculated as:
[0086]
[0087] Where r∈{pos,neg} are the learnable weights of positive correlation nodes and negative correlation nodes respectively.
[0088] From this, we can calculate that the characteristics of the weighted positive correlation sector and negative correlation sector are:
[0089]
[0090] Where d is a collection of positively correlated sectors or negatively correlated sectors.
[0091] For the target stock node feature β s , this paper uses a fully connected layer for feature extraction:
[0092] h s =fc(β s )
[0093] Finally, the extracted features h pos ,h s ,h neg , input classifier module.
[0094] Stock price trend classifier module such as Figure 7 As shown in Figure 1, it includes a Transformer decoder module layer, a long short-term memory model (LSTM) layer, a Transformer encoder module layer, and a multi-layer perceptron. The original feature data is encoded through the Transformer decoder module layer to obtain H t = decoder([X1, X2, ..., X t ]), where H t is a matrix with a length of t and a width of k. Next, the LSTM layer is used to extract continuous data [Y1, Y2, Y3] = LSTM (H t). Then use the encoder module layer of Transformer to decode and obtain E t = encoder([Y1, Y2, Y3]). Then use the multi-layer perceptron to extract and obtain M t =MLP(E t ). Finally, the probability of the stock price trend rising and falling is obtained.
[0095] Organize the stocks belonging to the same sector, use the data of these stocks for pre-training in the stock price prediction model, and obtain the sector-shared model.
[0096] In order to improve the generalization performance of data and enhance the prediction effect of the stock price prediction model, the present invention introduces a module sharing mechanism in the training. The training process is as follows: Figure 8 As shown. First, list the sectors to which all stocks in the stock pool belong and summarize them, and divide and organize the stocks according to the sectors to which they belong. Then, input the training set data of the stocks belonging to the same sector at a specified time into the model in order for a small number of trainings. Then, save the trained model parameters as the shared model for the sector at the training time, where the order of stock training is in ascending order of stock codes.
[0097] According to the order of training set and test set, the pre-processed comment representation data and market data are successively input into the plate sharing model for formal training, and the latest text information is obtained and input into the trained model to predict the stock price trend of the next trading cycle. The latest stock evaluation related information is obtained by using a crawler program, encoded into a bidirectional vector embedding, and input into the trained model together with the latest market data to predict the stock price trend of the next trading day.
[0098] In this embodiment, an investment portfolio management module is constructed, and the specific operations are as follows:
[0099] By screening out stocks whose prediction results for the next trading day are rising, the stock representations of the corresponding stocks are saved from the stock price prediction model, and the trading weights of the stocks are calculated in the following way. The calculation method is as follows:
[0100] min ω risk(r p )=ωMω T
[0101] Where M is the risk matrix, and the calculation method of each item in the matrix is as follows:
[0102]
[0103] In the formula, SE i , SE jRepresent the stock representation of the i-th stock and the j-th stock respectively, M i,j Represents the element in the i-th row and j-th column of the risk matrix.
[0104] In the formula, ω i Represents the weight of the i-th stock in the portfolio, which needs to be satisfied.
[0105] ∑ω i =1
[0106] 0≤ω i ≤1
[0107] In the formula, risk represents the investment risk, which is represented by the dot product sum of the stock representations in the portfolio, and E represents the portfolio return. Therefore, the total return of the portfolio can be expressed as:
[0108] E(r p )=∑ω i E(r i )
[0109] Finally ω=[ω1,ω2,...ω m ] is the weight coefficient of the stocks in the investment portfolio.
[0110] The number of devices and processing scales described here are used to simplify the description of the present invention, and the application, modification and variation of the present invention will be obvious to those skilled in the art.
[0111] Although the embodiments of the present invention have been disclosed as above, they are not limited to the applications listed in the specification and implementation modes. They can be fully applied to various fields suitable for the present invention. For those familiar with the art, additional modifications can be easily implemented. Therefore, without departing from the general concept defined by the claims and the scope of equivalents, the present invention is not limited to the specific details and the illustrations shown and described herein.
Claims
1. A price prediction method for stock representation based on multivariate heterogeneity features, characterized in that: include: A review data mining module, wherein the market data mining module is used to obtain stock text evaluation data; A market data mining module, wherein the market data mining module is used to obtain market data; Calculate the sentiment correlation coefficient between sectors through the verbs in the stock text evaluation data; Calculate the market correlation matrix from market data; The stock price prediction model is constructed by using the comment data mining module, market data mining module and stock trend classifier module; The pre-processed stock text evaluation data and the pre-trained stock price prediction model in the market data input are used to obtain the sector sharing model; Obtain the latest stock text evaluation data and market data and input them into the stock price prediction model to predict the stock price trend of the next trading cycle.
2. A price prediction method based on stock representation of multivariate heterogeneity characteristics as claimed in claim 1, characterized in that: It also includes an investment portfolio management module, and the specific operations of the investment portfolio management module are: The stock price prediction model is used to select stocks with a predicted increase in the next trading day, the stock representation of the corresponding stocks is saved, and the trading weight of the stocks is calculated; The investment risk is represented by the dot product sum of the stock representations in the portfolio, and the total return of the portfolio is calculated.
3. A price prediction method for stock representation based on multivariate heterogeneity characteristics as claimed in claim 1, characterized in that: The stock text evaluation data is divided according to the stocks and time, and the stocks are screened according to the start and end time of the data set. The stocks that meet the requirements are screened out from all the stocks to form a stock pool. The stocks in the stock pool are preprocessed, and the text information is extracted as comment representation data through bidirectional vector embedding coding.
4. A price prediction method based on stock representation based on multivariate heterogeneity characteristics as claimed in claim 3, characterized in that: The comment data mining module includes an encoder module, a first vector, a second vector, and concatenating the first vector and the second vector in a width dimension to obtain a third vector; The encoder module processes and converts the fundamental historical information and technical historical information of the stock to obtain a first vector; The bidirectional vector embedding result of the preprocessed stock text evaluation data is input into the distiller module to obtain the second vector.
5. A price prediction method for stock representation based on multivariate heterogeneity characteristics as claimed in claim 1, characterized in that: The market correlation matrix is calculated by market data, specifically: Sector data is described by the average value of individual stock data within the sector; Combine individual stock information with information from many sectors to generate a market price matrix; For the market price matrix, calculate its covariance matrix as the market correlation matrix of the stock.
6. A price prediction method based on stock representation based on multivariate heterogeneity characteristics as claimed in claim 1, characterized in that: The specific operations of the market data mining module are: According to the correlation between the target stock and each sector in the market correlation matrix, all sectors are divided into positive correlation sectors and negative correlation sectors; The market price data of the sectors that are positively correlated with the target stock and the sectors that are negatively correlated with the target stock are encoded through the Transformer layer respectively; Use graph neural networks to learn the attention weights between the positively correlated sectors and the negatively correlated sectors and the target stocks, and use this to update the feature information of the positively correlated sectors and the negatively correlated sectors; The extracted features are input into the classifier module.
7. A price prediction method for stock representation based on multivariate heterogeneity characteristics as claimed in claim 1, characterized in that: The stock price trend classifier module includes a Transformer decoder module layer, a long short-term memory model (LSTM) layer, a Transformer encoder module layer and a multi-layer perceptron.
8. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Stock closing price prediction method fusing news data
CN115660855A
Apparatus and Method for Detecting Violence, Smart Violence Monitoring System having the same
KR102648004B1
Cited By
Stock price collapse risk analysis reference system based on stock market interaction data identification
CN121052933A
