Lightweight share price prediction model construction method and system based on multi-dimensional feature mixing
By using factor mixer, timing mixer and stock market mixer in the stock price prediction model, the characteristics of factor, time and stock dimensions are solved, and the problem of poor extraction of stock timing dimension information in the prior art is solved, achieving more efficient information exchange and stronger prediction performance.
Patent Information
- Application Number
- CN202311314222.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-10
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art is difficult to effectively extract information on stock timing dimensions in stock price predictions, and relies on complex neural network architectures and external prior graphs, resulting in poor model performance.
A lightweight stock price prediction model based on multi-dimensional feature mixing is adopted. The factor mixer, time mixer and stock market mixer are used to process the characteristics of factor, time and stock dimensions respectively, and efficient timing information is extracted and the channels for information exchange between stocks are restricted.
It realizes efficient information extraction and information exchange in the stock market, reduces the complexity of the model parameters, and improves prediction performance and generalization capabilities.
Smart Images

Figure CN119809816A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of deep learning technology, and in particular to a method and system for constructing a lightweight stock price prediction model based on multi-dimensional feature mixing. Background Art
[0002] Stock price prediction. Stock price prediction is an important basic task in the field of quantitative investment. Since the rise and fall of different stock prices are not independent of each other, stock price prediction is actually expressed as a multivariate time series prediction problem. Unlike other relatively stable multivariate time series prediction problems (traffic forecasting, climate estimation, power statistics, etc.), the stock market is more fragile and volatile, and achieving accurate prediction is still an issue to be explored. Existing solutions mostly use a more complex design pattern, using a recurrent neural network to extract the representation of a single stock, and then send it to a graph neural network that requires a large amount of prior information for information exchange, calculate the market representation of a single stock, and finally combine the two representations to output the prediction result. However, this training mode requires high storage and time costs, and has strict requirements on the amount of original data and manually defined prior structures. Low-quality data sources will lead to a decline in model performance.
[0003] Multilayer Perceptron Mixer. Multilayer Perceptron is a basic feedforward artificial neural network model with powerful processing and expression capabilities. The neurons in each layer are connected to the neurons in the adjacent layers. By continuously adjusting the weights between neurons, the learning and prediction of complex problems can be achieved. Multilayer Perceptron extracts nonlinear features of the input to perform pattern recognition and classification tasks, and is widely used in many fields (such as image recognition, speech recognition, natural language processing, etc.). Among them, Multilayer Perceptron Mixer is a novel deep learning model architecture based on Multilayer Perceptron. It extracts features and represents learning on the basis of Multilayer Perceptron through deep learning operations such as normalization, skip connection, matrix transposition, etc., and has more excellent parameter efficiency, scalability and interpretability. In addition, Multilayer Perceptron Mixer does not use any complex prior assumptions and can learn the characteristics of data more flexibly. However, due to the high dynamic characteristics of the stock market and the low validity of data, the traditional Multilayer Perceptron Mixer is difficult to apply in the field of stock price prediction.
[0004] The stock market is a recognized non-steady-state environment, and its data is highly random and does not have strong periodicity. To achieve accurate prediction of stock prices, it is necessary to fully consider the financial factor information in the stock, the price fluctuations and trends in the past period of time, and the relationship between stocks in the market. On the one hand, the existing deep learning methods do not fully characterize the relationship between the connotation of stock data from the three characteristic dimensions of factors, time, and stocks. On the other hand, the existing methods use complex neural network architectures to model stock data, which leads to overfitting problems caused by insufficient training data scale. Both aspects lead to poor prediction performance. In view of this, the present invention proposes three lightweight mixers for modeling, which mainly solve the following two technical difficulties:
[0005] (1) Solve the problem of efficient information extraction from the stock time series dimension. The time series mixer uses the upper triangular mask to solve the problem of time series accessibility and transforms the original data with multi-scale pooling operations to provide the model with time series features of different spans.
[0006] (2) Solve the problem of information exchange in the stock dimension that does not rely on external prior graphs. The stock market mixer combines the current market characteristics and does not rely on the message passing mode of the graph neural network architecture and the operating principle of homogeneous node smoothing. While taking advantage of the low inductive bias of the multi-layer perceptron mixer structure, it reduces the dimension of the weight matrix of the intermediate layer of the mixer to obtain a more robust market representation and a more generalized prediction model.
[0007] Therefore, based on the idea of multi-dimensional feature mixing, the present invention realizes a lightweight, high-performance stock price prediction model by specifically designing feature mixers for factor, time, and stock dimensions.
[0008] Patent document CN107292430A discloses a method for screening key points of stock historical trends and a method for trend prediction. The screening method is based on sliding window technology, and the trend prediction method is based on technical indicator theory to form a feature set of key points of stock trends to be predicted, and classify and predict the feature set of key points of stock trends to be predicted. However, this patent cannot completely solve the existing technical problems. Summary of the invention
[0009] In view of the defects in the prior art, the object of the present invention is to provide a method and system for constructing a lightweight stock price prediction model based on multi-dimensional feature mixing.
[0010] The method for constructing a lightweight stock price prediction model based on multi-dimensional feature mixing provided by the present invention includes:
[0011] Step S1: Use the factor mixer to provide an interactive channel for the original data in the factor dimension;
[0012] Step S2: Use a time series mixer, select time step spans of different sizes, perform convolution or pooling operations on the features after passing through the factor mixer, and obtain time series fragments of different scales. Then send these fragments to a mixer containing an upper triangular mask matrix operation to obtain time series representations extracted at different scales, and finally concatenate them to output a single stock time series representation.
[0013] Step S3: Use a stock market mixer to collect all the single stock time series representations in step S2, decompose the weight matrix of the fully connected layer in the middle of the mixer, learn the market state in the form of hyperparameters, limit the channels for information exchange between stocks, and obtain a more robust stock market representation;
[0014] Step S4: Combine the representations learned in steps S2 and S3, send them to the final fully connected layer, and use the ranking loss function to optimize the overall model.
[0015] Preferably, the step S1 comprises:
[0016] The vector of each stock consisting of T time steps and F factors at each time step is recorded as The characteristics after mixing the factor dimensions are recorded as The factor mixer extracts the feature expression as follows:
[0017]
[0018] in, is the trainable transformation matrix of the factor mixer; σ is the rectified linear unit ReLU or hard self-gated activation function Hardswish used in the nonlinear activation function model; T represents the matrix transpose operation, which is used to exchange the order of time and factor dimensions to achieve the effect of information mixing in the corresponding dimensions; LayerNorm is the standard normalization operation; the dimension of the hidden layer is set to be equal to the dimension of the original factor.
[0019] Preferably, the step S2 comprises:
[0020] After obtaining the characteristics of the factor dimension mixture Finally, the timing mixer is replaced by an upper triangular matrix so that each time step can only see the elements before it, expressed as:
[0021]
[0022] in, It is the feature after the time series dimension is mixed; is the trainable upper triangular matrix of the mixer, setting the dimension of the hidden layer equal to the original time series dimension;
[0023] Based on the lack of periodicity and short-term validity of stock time series data, the time series mixer divides the data into pieces according to time steps of different sizes and calculates the time series features under different spans. The expression is:
[0024]
[0025] in, represents the representation after compression with a time step of k; Avgpool represents the average pooling operation, which uses 1D convolution compression; the final output of the timing mixer is obtained by concatenating and then connecting a fully connected layer, and the expression is:
[0026] h (k) =T-Mixing(I-Mixing(x (k) ))
[0027]
[0028] Among them, T-Mixing and I-Mixing represent timing mixer and factor mixer respectively; represents the result of feature interaction after compression with a span of time step k; h is the aggregation of all h (k) After the final characterization of a single stock, set
[0029] Preferably, step S3 comprises:
[0030] After the feature mixing of the first two stages, the model obtains a collection of representations of N stocks Based on the information bottleneck theory, the market hyperparameter m is set according to the characteristics of the data set d to interact with the data under certain restrictions. The expression is:
[0031]
[0032] in, is the market representation of N stocks; Summarize N stock representations into m market state representations; Set up to restore the compressed information and describe the impact of m market states on N stocks;
[0033] Finally, combined with market representation Use its own representation H to predict the closing price of the next day.
[0034] Preferably, step S4 comprises:
[0035] Using the 1-day return rate as the prediction value, the final loss function combines the minimum trivial loss and the ranking loss used for various ranking tasks, so that the model gives a higher ranking to stocks with higher backtest values when predicting. The expression is:
[0036]
[0037] in, and Represents the predicted ranking score and the actual ranking score; α is a hyperparameter that controls the ranking loss weight; after the model is trained using gradient descent, the stock price of the next trading day is predicted for each stock using its historical price and text features, and then the actual stock price is obtained by denormalization as the price prediction result for the next trading day.
[0038] The lightweight stock price prediction model construction system based on multi-dimensional feature mixing provided by the present invention includes:
[0039] Module M1: Use factor mixer to provide interaction channels for original data in factor dimension;
[0040] Module M2: Using a time series mixer, select different time step spans, perform convolution or pooling operations on the features after passing through the factor mixer to obtain time series fragments of different scales, and then send these fragments to a mixer containing upper triangular mask matrix operations to obtain time series representations extracted at different scales, and finally concatenate them to output a single stock time series representation;
[0041] Module M3: uses a stock market mixer to collect all the single stock time series representations in module M2, decomposes the weight matrix of the fully connected layer in the middle of the mixer, learns the market state in the form of hyperparameters, limits the channels for information exchange between stocks, and obtains a more robust stock market representation;
[0042] Module M4: Combine the representations learned in modules M2 and M3, send them to the final fully connected layer, and use the ranking loss function to optimize the overall model.
[0043] Preferably, the module M1 comprises:
[0044] The vector of each stock consisting of T time steps and F factors at each time step is recorded as The characteristics after mixing the factor dimensions are recorded as The factor mixer extracts the feature expression as follows:
[0045]
[0046] in, is the trainable transformation matrix of the factor mixer; σ is the rectified linear unit ReLU or hard self-gated activation function Hardswish used in the nonlinear activation function model; T represents the matrix transpose operation, which is used to exchange the order of time and factor dimensions to achieve the effect of information mixing in the corresponding dimensions; LayerNorm is the standard normalization operation; the dimension of the hidden layer is set to be equal to the dimension of the original factor.
[0047] Preferably, the module M2 comprises:
[0048] After obtaining the characteristics of the factor dimension mixture Finally, the timing mixer is replaced by an upper triangular matrix so that each time step can only see the elements before it, expressed as:
[0049]
[0050] in, It is the feature after the time series dimension is mixed; is the trainable upper triangular matrix of the mixer, setting the dimension of the hidden layer equal to the original time series dimension;
[0051] Based on the lack of periodicity and short-term validity of stock time series data, the time series mixer divides the data into pieces according to time steps of different sizes and calculates the time series features under different spans. The expression is:
[0052]
[0053] in, represents the representation after compression with a time step of k; Avgpool represents the average pooling operation, which uses 1D convolution compression; the final output of the timing mixer is obtained by concatenating and then connecting a fully connected layer, and the expression is:
[0054] h (k) =T-Mixing(I-Mixing(x (k) ))
[0055]
[0056] Among them, T-Mixing and I-Mixing represent timing mixer and factor mixer respectively; represents the result of feature interaction after compression with a span of time step k; h is the aggregation of all h (k) After the final characterization of a single stock, set
[0057] Preferably, the module M3 includes:
[0058] After the feature mixing of the first two stages, the model obtains a collection of representations of N stocks Based on the information bottleneck theory, the market hyperparameter m is set according to the characteristics of the data set d to interact with the data under certain restrictions. The expression is:
[0059]
[0060] in, is the market representation of N stocks; Summarize N stock representations into m market state representations; Set up to restore the compressed information and describe the impact of m market states on N stocks;
[0061] Finally, combined with market representation Use its own representation H to predict the closing price of the next day.
[0062] Preferably, the module M4 includes:
[0063] Using the 1-day return rate as the prediction value, the final loss function combines the minimum trivial loss and the ranking loss used for various ranking tasks, so that the model gives a higher ranking to stocks with higher backtest values when predicting. The expression is:
[0064]
[0065] in, and Represents the predicted ranking score and the actual ranking score; α is a hyperparameter that controls the ranking loss weight; after the model is trained using gradient descent, the stock price of the next trading day is predicted for each stock using its historical price and text features, and then the actual stock price is obtained by denormalization as the price prediction result for the next trading day.
[0066] Compared with the prior art, the present invention has the following beneficial effects:
[0067] (1) The present invention proposes a time series mixer based on an upper triangular mask matrix and multi-scale sampling, which operates a single stock representation with multiple steps to extract time series information. At the same time, the weight matrix of the mixer uses a mask in the shape of an upper triangular matrix to limit the accessibility of the time step;
[0068] (2) The present invention proposes a stock market mixer based on weight matrix decomposition, which is used to achieve feature mixing between stocks. It abandons the design of using graph as information interaction mode in the existing model. By decomposing the weight matrix of the fully connected layer in the middle of the mixer, the overall information of the stock market is first extracted from the time series representation of all stocks, and then the impact of the overall market information on a single stock is calculated, which not only reduces the parameter complexity of the model but also improves the prediction performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0070] Figure 1 is a diagram of the overall workflow of the model, N represents the number of stocks in the market, X i represents the original data of the i-th stock, h i It represents the characterization of the i-th stock after the factor mixer and the time series mixer. It represents the representation of the i-th stock after passing through the stock market mixer;
[0071] Figure 2 is the flow chart of the stock market mixer, N represents the number of stocks in the market, and m represents the number of stock market states;
[0072] Figure 3 It is the flowchart of the factor & time series mixer, where N represents the factor dimension, T represents the time series dimension, and d represents the dimension of the single stock after processing. DETAILED DESCRIPTION
[0073] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0074] Example 1
[0075] like Figure 1 The present invention provides a lightweight stock price prediction model construction method based on multi-dimensional feature mixing, using a factor mixer, a time series mixer and a stock market mixer, and performing the following steps:
[0076] Step S1, the factor mixer provides an interactive channel for the original data in the factor dimension, using the traditional multi-layer perceptron mixer design;
[0077] Step S2, the time series mixer selects time step spans of different sizes, performs convolution or pooling operations on the features after passing through the factor mixer to obtain time series fragments of different scales, and then sends these fragments to the mixer containing the upper triangular mask matrix operation to obtain the extracted time series representations at different scales, and finally splices them to output the time series representation of a single stock;
[0078] Step S3, the stock market mixer collects all the time series features of individual stocks in step S2, decomposes the weight matrix of the fully connected layer in the middle of the mixer, learns the market state in the form of hyperparameters, limits the channels for information exchange between stocks, and obtains a more robust stock market representation;
[0079] In step S4, the representations learned in steps S2 and S3 are combined and sent to the final fully connected layer to optimize the overall model using the ranking loss function.
[0080] Factor Mixer
[0081] The vector of each stock consisting of T time steps and F factors at each time step is recorded as The characteristics after mixing the factor dimensions are recorded as The present invention extracts features via the following factor mixer:
[0082]
[0083] in, is the trainable transformation matrix of the factor mixer, σ is the modified linear unit ReLU or hard self-gated activation function Hardswish used in the nonlinear activation function model. T represents the matrix transposition operation, which is used to exchange the order of time and factor dimensions to achieve the effect of information mixing in the corresponding dimensions. LayerNorm is the standard normalization operation. Here, the dimension of the hidden layer is set to be equal to the dimension of the original factor.
[0084] Timing Mixer
[0085] First, let’s introduce the masking mechanism. In the previous step, we obtain the features after the factor dimension is mixed. After that, the timing mixer does not choose the conventional matrix form, but uses the above triangular matrix (except that all elements above the diagonal are 0) instead, so that each time step can only "see" the elements before it. The implementation process is as follows:
[0086]
[0087] in, It is the feature after the time series dimension is mixed. It is the trainable upper triangular matrix of the mixer, where the dimension of the hidden layer is set equal to the original time series dimension.
[0088] Based on the lack of periodicity and short-term validity of stock time series data, the time series mixer divides the data into pieces according to time steps of different sizes and calculates the time series features under different spans. The process is as follows:
[0089]
[0090] here It represents the representation after compression with a time step span of k. Avgpool represents the average pooling operation. One-dimensional convolution compression can also be used here.
[0091] like Figure 3 , the final output of the timing mixer is obtained by concatenating and then connecting the fully connected layer:
[0092] h (k) =T-Mixing(I-Mixing(x (k) ))
[0093]
[0094] Here T-Mixing and I-Mixing represent timing mixer and factor mixer respectively. represents the result of feature interaction after compression with a span of time step k, and h is the aggregation of all h (k) The final representation of a single stock. For example, when the length of the input sequence is 16 and k∈4,2,...,1 is set, the dimension of h is For the convenience of expression, set
[0095] Stock Market Mixer
[0096] like Figure 2 After the first two stages of feature mixing, the model obtains a collection of representations of N stocks Based on the information bottleneck theory, the present invention abandons the setting that the hidden layer dimension is equal to the input dimension or positively correlated in the standard mixer, and sets the market hyperparameter m to interact with the data under certain restrictions according to the characteristics of the data set d:
[0097]
[0098] in, is the market representation of N stocks, The representations of N stocks are summarized into m market state representations, Set up to restore the compressed information and describe the impact of m market states on N stocks.
[0099] Finally, the present invention combines market characterization Use its own representation H to predict the closing price of the next day.
[0100] Sorting loss
[0101] The present invention uses the 1-day return rate as the prediction value, and the final loss function combines the common minimum trivial loss and the ranking loss used for various ranking tasks, so that the model can give a higher ranking to stocks with higher backtest values when predicting. The details are as follows:
[0102]
[0103] in, and Represents the predicted ranking score and the real ranking score, and α is a hyperparameter that controls the ranking loss weight. After the model is trained using gradient descent, the stock price of the next trading day is predicted for each stock using its historical price and text features, and then the real stock price is obtained by denormalization, which can be used as the price prediction result of the stock on the next trading day. Since the Adam optimizer is more suitable for unstable training targets and it can dynamically adjust the learning rate to converge faster, the present invention uses the Adam optimizer as a gradient descent training model.
[0104] After the model is trained using gradient descent, the historical price of each stock is used to predict the stock price of the next trading day, and then the real stock price is obtained by denormalization, which can be used as the price prediction result of the stock on the next trading day.
[0105] Example 2
[0106] The present invention also provides a lightweight stock price prediction model construction system based on multi-dimensional feature mixing. The lightweight stock price prediction model construction system based on multi-dimensional feature mixing can be realized by executing the process steps of the lightweight stock price prediction model construction method based on multi-dimensional feature mixing, that is, technical personnel in this field can understand the lightweight stock price prediction model construction method based on multi-dimensional feature mixing as a preferred implementation mode of the lightweight stock price prediction model construction system based on multi-dimensional feature mixing.
[0107] The lightweight stock price prediction model construction system based on multi-dimensional feature mixing provided by the present invention includes:
[0108] Module M1: Use factor mixer to provide interaction channels for original data in factor dimension;
[0109] Module M2: Using a time series mixer, select different time step spans, perform convolution or pooling operations on the features after passing through the factor mixer to obtain time series fragments of different scales, and then send these fragments to a mixer containing upper triangular mask matrix operations to obtain time series representations extracted at different scales, and finally concatenate them to output a single stock time series representation;
[0110] Module M3: uses a stock market mixer to collect all the single stock time series representations in module M2, decomposes the weight matrix of the fully connected layer in the middle of the mixer, learns the market state in the form of hyperparameters, limits the channels for information exchange between stocks, and obtains a more robust stock market representation;
[0111] Module M4: Combine the representations learned in modules M2 and M3, send them to the final fully connected layer, and use the ranking loss function to optimize the overall model.
[0112] The module M1 comprises:
[0113] The vector of each stock consisting of T time steps and F factors at each time step is recorded as The characteristics after mixing the factor dimensions are recorded as The factor mixer extracts the feature expression as follows:
[0114]
[0115] in, is the trainable transformation matrix of the factor mixer; σ is the rectified linear unit ReLU or hard self-gated activation function Hardswish used in the nonlinear activation function model; T represents the matrix transpose operation, which is used to exchange the order of time and factor dimensions to achieve the effect of information mixing in the corresponding dimensions; LayerNorm is the standard normalization operation; the dimension of the hidden layer is set to be equal to the dimension of the original factor.
[0116] The module M2 comprises:
[0117] After obtaining the characteristics of the factor dimension mixture Finally, the timing mixer is replaced by an upper triangular matrix so that each time step can only see the elements before it, expressed as:
[0118]
[0119] in, It is the feature after the time series dimension is mixed; is the trainable upper triangular matrix of the mixer, setting the dimension of the hidden layer equal to the original time series dimension;
[0120] Based on the lack of periodicity and short-term validity of stock time series data, the time series mixer divides the data into pieces according to time steps of different sizes and calculates the time series features under different spans. The expression is:
[0121]
[0122] in, represents the representation after compression with a time step of k; Avgpool represents the average pooling operation, which uses 1D convolution compression; the final output of the timing mixer is obtained by concatenating and then connecting a fully connected layer, and the expression is:
[0123] h (k) =T-Mixing(I-Mixing(x (k) ))
[0124]
[0125] Among them, T-Mixing and I-Mixing represent timing mixer and factor mixer respectively; represents the result of feature interaction after compression with a span of time step k; h is the aggregation of all h (k) After the final characterization of a single stock, set
[0126] The module M3 comprises:
[0127] After the feature mixing of the first two stages, the model obtains a collection of representations of N stocks Based on the information bottleneck theory, the market hyperparameter m is set according to the characteristics of the data set d to interact with the data under certain restrictions. The expression is:
[0128]
[0129] in, is the market representation of N stocks; Summarize N stock representations into m market state representations; Set up to restore the compressed information and describe the impact of m market states on N stocks;
[0130] Finally, combined with market representation Use its own representation H to predict the closing price of the next day.
[0131] The module M4 comprises:
[0132] Using the 1-day return rate as the prediction value, the final loss function combines the minimum trivial loss and the ranking loss used for various ranking tasks, so that the model gives a higher ranking to stocks with higher backtest values when predicting. The expression is:
[0133]
[0134] in, and Represents the predicted ranking score and the actual ranking score; α is a hyperparameter that controls the ranking loss weight; after the model is trained using gradient descent, the stock price of the next trading day is predicted for each stock using its historical price and text features, and then the actual stock price is obtained by denormalization as the price prediction result for the next trading day.
[0135] Those skilled in the art know that, in addition to implementing the system, device and its various modules provided by the present invention in a purely computer-readable program code, it is entirely possible to implement the same program in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, the system, device and its various modules provided by the present invention can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures within the hardware component; the modules for implementing various functions can also be considered as both software programs for implementing the method and structures within the hardware component.
[0136] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.
Claims
1. A lightweight stock price prediction model construction method based on multi-dimensional feature mixing, characterized in that: include: Step S1: Use the factor mixer to provide an interactive channel for the original data in the factor dimension; Step S2: Use a time series mixer, select time step spans of different sizes, perform convolution or pooling operations on the features after passing through the factor mixer, and obtain time series fragments of different scales. Then send these fragments to a mixer containing an upper triangular mask matrix operation to obtain time series representations extracted at different scales, and finally concatenate them to output a single stock time series representation. Step S3: Use a stock market mixer to collect all the single stock time series representations in step S2, decompose the weight matrix of the fully connected layer in the middle of the mixer, learn the market state in the form of hyperparameters, limit the channels for information exchange between stocks, and obtain a more robust stock market representation; Step S4: Combine the representations learned in steps S2 and S3, send them to the final fully connected layer, and use the ranking loss function to optimize the overall model.
2. The method for constructing a lightweight stock price prediction model based on multi-dimensional feature mixing according to claim 1, characterized in that: The step S1 comprises: The vector of each stock consisting of T time steps and F factors at each time step is recorded as The characteristics after mixing the factor dimensions are recorded as The feature expression extracted by the factor mixer is: in, is the trainable transformation matrix of the factor mixer; σ is the rectified linear unit ReLU or hard self-gated activation function Hardswish used in the nonlinear activation function model; T represents the matrix transpose operation, which is used to exchange the order of time and factor dimensions to achieve the effect of information mixing in the corresponding dimensions; LayerNorm is the standard normalization operation; the dimension of the hidden layer is set to be equal to the dimension of the original factor.
3. The method for constructing a lightweight stock price prediction model based on multi-dimensional feature mixing according to claim 2 is characterized in that: The step S2 comprises: After obtaining the characteristics of the factor dimension mixture Finally, the timing mixer is replaced by an upper triangular matrix so that each time step can only see the elements before it, expressed as: in, It is the feature after the time series dimension is mixed; is the trainable upper triangular matrix of the mixer, setting the dimension of the hidden layer equal to the original time series dimension; Based on the lack of periodicity and short-term validity of stock time series data, the time series mixer divides the data into pieces according to time steps of different sizes and calculates the time series features under different spans. The expression is: in, represents the representation after compression with a time step of k; Avgpool represents the average pooling operation, which uses 1D convolution compression; the final output of the timing mixer is obtained by concatenating and then connecting a fully connected layer, and the expression is: h (k) =T-Mixing(I-Mixing(x (k) )) Among them, T-Mixing and I-Mixing represent timing mixer and factor mixer respectively; represents the result of feature interaction after compression with a span of time step k; h is the aggregation of all h (k) After the final characterization of a single stock, set 4. The method for constructing a lightweight stock price prediction model based on multi-dimensional feature mixing according to claim 3 is characterized in that: The step S3 comprises: After the feature mixing of the first two stages, the model obtains a collection of representations of N stocks Based on the information bottleneck theory, the market hyperparameter m is set according to the characteristics of the data set d to interact with the data under certain restrictions. The expression is: in, is the market representation of N stocks; Summarize N stock representations into m market state representations; Set up to restore the compressed information and describe the impact of m market states on N stocks; Finally, combined with market representation Use its own representation H to predict the closing price of the next day.
5. The method for constructing a lightweight stock price prediction model based on multi-dimensional feature mixing according to claim 4 is characterized in that: The step S4 comprises: Using the 1-day return rate as the prediction value, the final loss function combines the minimum trivial loss and the ranking loss used for various ranking tasks, so that the model gives a higher ranking to stocks with higher backtest values when predicting. The expression is: in, and Represents the predicted ranking score and the actual ranking score; α is a hyperparameter that controls the ranking loss weight; after the model is trained using gradient descent, the stock price of the next trading day is predicted for each stock using its historical price and text features, and then the actual stock price is obtained by denormalization as the price prediction result for the next trading day.
6. A lightweight stock price prediction model construction system based on multi-dimensional feature mixing, characterized in that: include: Module M1: Use factor mixer to provide interaction channels for original data in factor dimension; Module M2: Using a time series mixer, select different time step spans, perform convolution or pooling operations on the features after passing through the factor mixer to obtain time series fragments of different scales, and then send these fragments to a mixer containing upper triangular mask matrix operations to obtain time series representations extracted at different scales, and finally concatenate them to output a single stock time series representation; Module M3: uses a stock market mixer to collect all the single stock time series representations in module M2, decomposes the weight matrix of the fully connected layer in the middle of the mixer, learns the market state in the form of hyperparameters, limits the channels for information exchange between stocks, and obtains a more robust stock market representation; Module M4: Combine the representations learned in modules M2 and M3, send them to the final fully connected layer, and use the ranking loss function to optimize the overall model.
7. The lightweight stock price prediction model construction system based on multi-dimensional feature mixing according to claim 6 is characterized in that: The module M1 comprises: The vector of each stock consisting of T time steps and F factors at each time step is recorded as The characteristics after mixing the factor dimensions are recorded as The factor mixer extracts the feature expression as follows: in, is the trainable transformation matrix of the factor mixer; σ is the rectified linear unit ReLU or hard self-gated activation function Hardswish used in the nonlinear activation function model; T represents the matrix transpose operation, which is used to exchange the order of time and factor dimensions to achieve the effect of information mixing in the corresponding dimensions; LayerNorm is the standard normalization operation; the dimension of the hidden layer is set to be equal to the dimension of the original factor.
8. The lightweight stock price prediction model construction system based on multi-dimensional feature mixing according to claim 7 is characterized in that: The module M2 comprises: After obtaining the characteristics of the factor dimension mixture Finally, the timing mixer is replaced by an upper triangular matrix so that each time step can only see the elements before it, expressed as: in, It is the feature after the time series dimension is mixed; is the trainable upper triangular matrix of the mixer, setting the dimension of the hidden layer equal to the original time series dimension; Based on the lack of periodicity and short-term validity of stock time series data, the time series mixer divides the data into pieces according to time steps of different sizes and calculates the time series features under different spans. The expression is: in, represents the representation after compression with a time step of k; Avgpool represents the average pooling operation, which uses 1D convolution compression; the final output of the timing mixer is obtained by concatenating and then connecting a fully connected layer, and the expression is: h (k) =T-Mixing(I-Mixing(x (k) )) Among them, T-Mixing and I-Mixing represent timing mixer and factor mixer respectively; represents the result of feature interaction after compression with a span of time step k; h is the aggregation of all h (k) After the final characterization of a single stock, set 9. The lightweight stock price prediction model construction system based on multi-dimensional feature mixing according to claim 8 is characterized in that: The module M3 comprises: After the feature mixing of the first two stages, the model obtains a collection of representations of N stocks Based on the information bottleneck theory, the market hyperparameter m is set according to the characteristics of the data set d to interact with the data under certain restrictions. The expression is: in, is the market representation of N stocks; Summarize N stock representations into m market state representations; Set up to restore the compressed information and describe the impact of m market states on N stocks; Finally, combined with market representation Use its own representation H to predict the closing price of the next day.
10. The lightweight stock price prediction model construction system based on multi-dimensional feature mixing according to claim 9 is characterized in that: The module M4 comprises: Using the 1-day return rate as the prediction value, the final loss function combines the minimum trivial loss and the ranking loss used for various ranking tasks, so that the model gives a higher ranking to stocks with higher backtest values when predicting. The expression is: in, and Represents the predicted ranking score and the actual ranking score; α is a hyperparameter that controls the ranking loss weight; after the model is trained using gradient descent, the stock price of the next trading day is predicted for each stock using its historical price and text features, and then the actual stock price is obtained by denormalization as the price prediction result for the next trading day.
Citation Information
Patent Citations
Method for screening key points of historical trend of stock, and trench prediction method
CN107292430A
Stock price trend prediction method and system, terminal and storage medium
CN112365075A
Stock prediction method fusing generative adversarial network and two-dimensional attention mechanism
CN113129148A
Stock income sorting system based on time sequence convolution and graph neural network
CN115239498A
Stock trading platform server that provides a binary-based prediction stock price using an artificial neural network and the operating method thereof
KR102453562B1
Cited By
Machine learning-based multi-output regression incremental learning dynamic adaptation stock price prediction model construction method
CN121413805A