Stock prediction method and system based on dynamic integrated heterogeneous deep learning model

By dynamically integrating heterogeneous deep learning models and combining historical stock data with company knowledge graphs, the model is dynamically selected and screened, solving the problem of insufficient model diversity in traditional methods and achieving higher stock prediction accuracy.

CN118898515APending Publication Date: 2024-11-05SHANGHAI JIAOTONG UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202310498605.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-05
Publication Date
2024-11-05

AI Technical Summary

Technical Problem

Most existing stock sequence prediction methods are based on the assumption of independent and identically distributed (i.i.d.), which cannot accurately capture various trading strategies and patterns. The prediction accuracy of traditional single models is affected, and the model differentiation in traditional ensemble methods is insufficient, which cannot fully capture the complex relationship of stock prices.

Method used

We employ a dynamic ensemble heterogeneous deep learning model. By training multiple deep learning models with different structures and combining historical stock time series data and company knowledge graphs, we dynamically select high-performing models and perform similarity screening to build a secondary learner for prediction.

Benefits of technology

It improves the accuracy and variability of stock forecasts, ensuring the dynamic selection of the most suitable model combination on different trading days, thus enhancing forecast precision.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118898515A_ABST
    Figure CN118898515A_ABST
Patent Text Reader

Abstract

The invention provides a stock prediction method and system based on a dynamic integrated heterogeneous deep learning model. The method comprises the following steps: obtaining stock data to be tested; according to the to-be-tested stock data, multiple deep learning models of different structures are trained, a heterogeneous deep learning model pool is obtained, and the heterogeneous deep learning model pool comprises multiple primary models; in the heterogeneous deep learning model pool, performing model selection based on the dynamic performance of the primary model and the similarity between the models to obtain a to-be-selected model pool; the model prediction result in the to-be-selected model pool is used as input for training, and a secondary learner is obtained; and obtaining a final stock prediction result through the secondary learner. According to the stock sequence prediction method, the accuracy of stock sequence prediction is improved by training deep learning models which have different structures and use other knowledge such as a knowledge graph as input, and by evaluating the effect of each deep learning model close to the trading day, selecting the most suitable model pool and training a secondary learner for integration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of stock prediction, and in particular to a stock prediction method and system based on a dynamically integrated heterogeneous deep learning model. Background Art

[0002] Stock sequence prediction is of great significance for maintaining financial market stability and early warning of high-risk market fluctuations. Most existing stock sequence prediction methods use features such as stock time series, related text information, and manually extracted company knowledge graphs to build machine learning and deep learning models, such as LSTM, GRU, etc. to predict stock sequences in future trading days.

[0003] However, these methods are based on the assumption that all stock time series data follow independent and identical distribution. In reality, there are many trading strategies and trading patterns in the stock market, which makes it difficult for a single model to accurately capture and detect all stock change patterns. At the same time, the bias and variance of the model affect the prediction accuracy of the single model. According to the efficient market hypothesis, a single model cannot perform well in all feature spaces. Models with different types of data as input will capture different features during model training. The fluctuation of stock prices is not only related to its own historical price, but also closely related to the price of stocks in its industry or with which it has business dealings. Traditional machine learning models that use a single stock price as input cannot capture the impact of other stock prices on the target stock price. At the same time, the model differences in the homogeneous integration method used in the traditional integration method are not enough. Since there are many trading patterns and price fluctuation patterns in the stock market, a single model cannot accurately capture all potential stock patterns.

[0004] In addition, the stock series prediction itself is a time series. The prediction accuracy of each model within the trading day T is closely related to the prediction performance in the past period of time. It is necessary to dynamically select the model to be used according to different trading days in order to obtain the best prediction results.

[0005] Therefore, dynamically integrating heterogeneous deep learning models with different inputs to predict stock series can effectively overcome the impact of problems such as large prediction variance of a single model, differences in capturing features of different structural models, and large fluctuations in the model's prediction performance with changes in trading days, which affect the prediction accuracy.

[0006] In summary, the market is in urgent need of a stock prediction method and system based on a dynamically integrated heterogeneous deep learning model that can overcome the problem of large prediction variance of a single model and improve the prediction progress. Summary of the invention

[0007] In view of the defects in the prior art, the purpose of the present invention is to provide a stock prediction method and system based on dynamically integrated heterogeneous deep learning models.

[0008] A stock prediction method based on a dynamically integrated heterogeneous deep learning model provided by the present invention includes:

[0009] Step S1: Obtain the stock data to be tested;

[0010] Step S2: training a plurality of deep learning models with different structures according to the stock data to be tested to obtain a heterogeneous deep learning model pool, wherein the heterogeneous deep learning model pool includes a plurality of primary models;

[0011] Step S3: In the heterogeneous deep learning model pool, model selection is performed based on the dynamic performance of the primary model and the similarity between models to obtain a pool of candidate models;

[0012] Step S4: using the model prediction results in the candidate model pool as input for training to obtain a secondary learner;

[0013] Step S5: obtaining the final stock prediction result through the secondary learner.

[0014] Preferably, the stock data includes historical time series data of the stocks to be tested and a company knowledge graph corresponding to the stocks to be tested;

[0015] The training of multiple deep learning models with different structures includes taking the adjacency matrix extracted from the company knowledge graph corresponding to the tested stock and the historical time series data of the tested stock as input for model training, taking the relationship matrix between the company corresponding to the tested stock and the industry corresponding to the company and the historical time series data of the tested stock as input for model training, and taking only the historical time series data of the tested stock as input for model training;

[0016] Each deep learning model with different structures does not affect each other during training.

[0017] Preferably, the model selection based on the dynamic performance of the primary model and the similarity between models includes the following sub-steps:

[0018] Step S3.1: Determine a trading day and obtain historical time series data of all stocks within a preset time from the trading day;

[0019] Step S3.2: Obtaining the prediction scores of all primary models on each historical trading day within a preset time from the trading day according to the historical time series data;

[0020] Step S3.3: Calculate the actual stock recommendation score;

[0021] Step S3.4: According to the prediction score of the primary model and the actual stock recommendation score, the performance of the corresponding primary model is evaluated to obtain a plurality of candidate models and the best model within a preset time from the trading date;

[0022] Step S3.5: By calculating the Tanimoto similarity between the prediction time series of each candidate model and the prediction time series of the best model, the models are screened to obtain the final candidate model pool, where the Tanimoto similarity calculation formula is as follows:

[0023]

[0024] In the formula, sim Tanimoto (a, b) represents the Tanimoto similarity between vector a and vector b, dot represents the vector dot multiplication operation, and in the present invention, a and b respectively represent the time series vectors of the prediction results of different primary learners.

[0025] Preferably, the evaluation criterion for evaluating the performance of the corresponding primary model is the sum of the IC and RankIC values ​​between the prediction score of the primary model and the actual stock recommendation score, and the formula is as follows:

[0026]

[0027] IC T =corr(y T ,s T )

[0028] RankIC T =corr(rank(y T ),rank(s T ))

[0029] Where corr() represents the correlation coefficient, x and y represent the historical truth value and the primary learner output respectively, the subscript i represents the i-th historical truth value or the primary model prediction output in the time series, IC T and RankIC T Respectively represent the IC coefficient and RankIC coefficient of the stock prediction score and the historical true value on trading day T, y T and rank(y T ) represent the real recommendation scores of all stocks on trading day T and the stock rankings obtained based on the real recommendation scores, s T and rank(s T ) are the recommendation scores predicted by the T model on the trading day and the stock rankings obtained based on the predicted values.

[0030] Preferably, the screening includes eliminating models whose Tanimoto similarity to the best model is less than 0.75.

[0031] Preferably, the formula of the secondary learner in step S4 is as follows:

[0032] X level0 ∈R N×M

[0033] Among them, y level1 represents the output of the secondary learner, W and b represent learnable parameters, and X level0 represents the input of the secondary learner, N is the number of stocks on the trading day, and M is the number of primary learners dynamically selected on the day;

[0034] By training on the prediction results of each primary model on the trading day and the preset time before the trading day, W,b is updated for the next prediction.

[0035] A stock prediction system based on a dynamically integrated heterogeneous deep learning model provided by the present invention includes:

[0036] Module M1: Get the stock data to be tested;

[0037] Module M2: training a plurality of deep learning models with different structures according to the stock data to be tested, and obtaining a heterogeneous deep learning model pool, wherein the heterogeneous deep learning model pool includes a plurality of primary models;

[0038] Module M3: In the heterogeneous deep learning model pool, model selection is performed based on the dynamic performance of the primary model and the similarity between models to obtain a pool of candidate models;

[0039] Module M4: using the model prediction results in the candidate model pool as input for training to obtain a secondary learner;

[0040] Module M5: Obtain the final stock prediction result through the secondary learner.

[0041] Preferably, the stock data includes historical time series data of the stocks to be tested and a company knowledge graph corresponding to the stocks to be tested;

[0042] The training of multiple deep learning models with different structures includes taking the adjacency matrix extracted from the company knowledge graph corresponding to the tested stock and the historical time series data of the tested stock as input for model training, taking the relationship matrix between the company corresponding to the tested stock and the industry corresponding to the company and the historical time series data of the tested stock as input for model training, and taking only the historical time series data of the tested stock as input for model training;

[0043] Each deep learning model with different structures does not affect each other during training.

[0044] Preferably, the model selection based on the dynamic performance of the primary model and the similarity between models includes the following sub-steps:

[0045] Module M3.1: Determine the trading day and obtain the historical time series data of all stocks within a preset time from the trading day;

[0046] Module M3.2: Obtaining the prediction scores of all primary models on each historical trading day within a preset time from the trading day according to the historical time series data;

[0047] Module M3.3: Calculate the actual stock recommendation score;

[0048] Module M3.4: Evaluate the performance of the corresponding primary model based on the prediction score of the primary model and the actual stock recommendation score, and obtain multiple candidate models and the best model within a preset time from the trading date;

[0049] Module M3.5: By calculating the Tanimoto similarity between the prediction time series of each candidate model and the prediction time series of the best model, the models are screened to obtain the final candidate model pool. The Tanimoto similarity calculation formula is as follows:

[0050]

[0051] In the formula, sim Tanimoto (a, b) represents the Tanimoto similarity between vector a and vector b, dot represents vector dot product, and a and b represent the time series vectors of the prediction results of different primary learners.

[0052] Preferably, the evaluation criterion for evaluating the performance of the corresponding primary model is the sum of the IC and RankIC values ​​between the prediction score of the primary model and the actual stock recommendation score, and the formula is as follows:

[0053]

[0054] IC T =corr(y T ,s T )

[0055] RankIC T =orr(rank(y T ),rank( T ))

[0056] Where corr() represents the correlation coefficient, x and y represent the historical truth value and the primary learner output respectively, the subscript i represents the i-th historical truth value or the primary model prediction output in the time series, IC T and RankIC T Respectively represent the IC coefficient and RankIC coefficient of the stock prediction score and the historical true value on trading day T, y T and rank(y T ) represent the real recommendation scores of all stocks on trading day T and the stock rankings obtained based on the real recommendation scores, s T and rank(s T ) are the recommendation scores predicted by the T model on the trading day and the stock rankings obtained based on the predicted values;

[0057] The screening includes eliminating models whose Tanimoto similarity to the best model is less than 0.75.

[0058] Compared with the prior art, the present invention has the following beneficial effects:

[0059] 1. The present invention trains heterogeneous deep learning models using different data, so that each model in the model pool can capture the characteristics of the stock historical data itself and the relationship characteristics between stocks and stocks, and between stocks and different industries, solving the problem that a single model cannot capture the above characteristics at the same time and the problem that isomorphic models are not differentiated enough.

[0060] 2. The present invention evaluates the performance of all stocks over a period of time to obtain the most effective prediction model pool during this period. Then, through similarity calculation, highly differentiated prediction models are screened out as model selection during integration. This ensures that the model is dynamically selected on different trading days, thereby improving the accuracy and differentiation of the primary model.

[0061] 3. The present invention improves the accuracy of stock sequence prediction by evaluating the effects of various deep learning models near the trading day, selecting the most suitable model pool and training secondary learners for integration. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] 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:

[0063] Figure 1 It is a schematic diagram of the workflow of the present invention.

[0064] Figure 2 This is a model architecture diagram of the present invention. DETAILED DESCRIPTION

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

[0066] The present invention improves the stock sequence prediction effect by training deep learning models with different structures and different inputs, dynamically screening models according to trading days and training secondary learners.

[0067] The present invention provides historical time series data of all stocks within a given period of time. Specifically, for a given stock X, starting from trading day T, the previous 60 trading days include the opening price, closing price, highest price, lowest price, volume weighted average price, and trading volume of each trading day within trading day T. Use the above-mentioned vector of length 360 as input to predict the recommendation score of each stock on trading day T+1, and sort all stocks from high to low according to the recommendation score. Among them, 360 is the length of the historical data vector of a single stock on a single trading day. In the present invention, the recommendation score of stock i on trading day T+1 is calculated as follows:

[0068]

[0069] According to a stock prediction method based on a dynamic integrated heterogeneous deep learning model provided by the present invention, Figure 1 to Figure 2 As shown, including:

[0070] Step S1: Acquire the stock data to be tested, which includes the historical time series data of the stock to be tested and the company knowledge graph corresponding to the stock to be tested.

[0071] Step S2: Based on the data of the stock to be tested, multiple deep learning models with different structures are trained to obtain a heterogeneous deep learning model pool, wherein the heterogeneous deep learning model pool contains multiple primary models. The training of multiple deep learning models with different structures includes taking the adjacency matrix extracted from the company knowledge graph corresponding to the stock to be tested and the historical time series data of the stock to be tested as input for model training, taking the relationship matrix between the company corresponding to the stock to be tested and the industry corresponding to the company and the historical time series data of the stock to be tested as input for model training, and taking only the historical time series data of the stock to be tested as input for model training. In other words,

[0072] Specifically, given stock time series data and a knowledge graph of listed companies, for example, 8 deep learning models with different structures are trained independently using the above data, and each model does not affect each other during training. One of the models uses the adjacency matrix f extracted from the knowledge graph and the stock time series data as input for training. The model name is RSR, where f∈R N ×N×K , N is the number of stocks, K is the number of different relationships, and the adjacency matrix f indicates whether K relationships exist between N stocks; another model in the model pool uses the relationship matrix g between listed companies and corresponding industries and stock time series data as input for training. The model name is HIST, where g∈R N×M , N is the number of stocks, M is the number of industries, and the relationship matrix can indicate whether there is a connection between N stocks and industries in M; the remaining 6 models are heterogeneous models that use only stock time series data as input for training, and the model names are: MLP, GAT, GRU, LSTM, ALSTM, SFM. By training heterogeneous deep learning models using different data, each model in the model pool can capture the characteristics of stock historical data itself and the relationship characteristics between stocks and stocks, and between stocks and different industries, so as to solve the problem that a single model cannot capture the above characteristics at the same time and the lack of differentiation of isomorphic models.

[0073] Step S3: In the heterogeneous deep learning model pool, model selection is performed based on the dynamic performance of the primary model and the similarity between models to obtain a pool of candidate models. That is to say, the dynamic integration scheme proposed in the present invention first evaluates the performance of all stocks within a period of time according to the time-sensitive characteristics of stock time series data, obtains the most effective prediction model pool during this period, and then screens out the prediction model with high difference through similarity calculation as the model selection during integration. Specifically, in the model selection for trading day T, the prediction results of each model in the model pool in the [TL, T) period are first obtained, where L represents the length of the look-back time, and then the IC value and RankIC value of the prediction results of each model compared with the historical real data are calculated, and the candidate model is determined according to the size of the two values, and then the Tanimoto similarity between each model is calculated, and the model with lower prediction sequence similarity is selected to ensure the difference of each model during the period of integration. Through the above operation, the present invention can ensure that the dynamic selection of models is realized in different trading days to ensure the accuracy and difference of the primary model.

[0074] Furthermore, the model selection based on the dynamic performance of the primary model and the similarity between models includes the following sub-steps:

[0075] Step S3.1: Determine the trading day, and obtain the historical time series data of all stocks within the preset time from the trading day. Specifically, for example, if the trading day is T and the preset time is 60 days before the trading day, then obtain the historical time series data of all stocks within the preset time from the trading day, that is, obtain the historical time series data of stocks within the 60 days before the trading day including the trading day T, recorded as historical data∈R 60×N×360 , where N is the number of stocks and 360 is the length of the historical data vector of a single stock on a single trading day.

[0076] Step S3.2: Based on the historical time series data, obtain the prediction scores of all primary models on each historical trading day within a preset time from the trading day, denoted as historical prediction∈R 60×N×8 , where N is the number of stocks and 8 is the number of primary models.

[0077] Step S3.3: Calculate the true stock recommendation score, true score∈R 60×N . Where 60 represents the number of look-back days, N represents the total number of stocks, and the recommendation score of stock i on day t is calculated as follows:

[0078]

[0079] The closing price refers to the closing price of the stock on that day.

[0080] Step S3.4: According to the prediction score of the primary model and the actual stock recommendation score, the performance of the corresponding primary model is evaluated to obtain multiple candidate models and the best model within the preset time from the trading date. The evaluation standard for evaluating the performance of the corresponding primary model is the sum of the IC and RankIC values ​​between the prediction score of the primary model and the actual stock recommendation score, and the formula is as follows:

[0081]

[0082] IC T =corr(y T ,s T )

[0083] RankIC T =corr(rank(y T ),rank(s T ))

[0084] Where corr() represents the correlation coefficient, x and y represent the historical truth value and the primary learner output respectively, the subscript i represents the i-th historical truth value or the primary model prediction output in the time series, ICT and RankIC T Respectively represent the IC coefficient and RankIC coefficient of the stock prediction score and the historical true value on trading day T, y T and rank(y T ) represent the real recommendation scores of all stocks on trading day T and the stock rankings obtained based on the real recommendation scores, s T and rank(s T ) are the recommended scores predicted by the model on trading day T and the stock rankings obtained based on the predicted values. According to the IC and RankIC values ​​of the primary models, the sum of the two is obtained, and the top 4 primary models are sorted from large to small. They are selected as candidate models to ensure the accuracy of the subsequent integrated model, and the model with the highest IC and RankIC values ​​is selected as the best model.

[0085] Step S3.5: By calculating the Tanimoto similarity between the prediction time series of each candidate model and the prediction time series of the best model, the models are screened to obtain the final candidate model pool, where the Tanimoto similarity calculation formula is as follows:

[0086]

[0087] In the formula, sim Tanimoto (a, b) represents the Tanimoto similarity between vector a and vector b, dot represents vector dot product, and a and b represent time series vectors of prediction results of different primary learners. The screening includes eliminating models with Tanimoto similarity less than 0.75 with the best model. That is to say, the final model pool only retains the best model and other candidate models with Tanimoto similarity less than 0.75 with the best model to ensure that other candidate models can have a certain difference with the best model to prevent the primary model from outputting a single model.

[0088] Step S4: The model prediction results in the candidate model pool are used as input for training to obtain a secondary learner. The formula of the secondary learner in step S4 is as follows:

[0089] X Level0 ∈R N×M , W∈R M ,y level1 ∈R N

[0090] Among them, y level1 represents the output of the secondary learner, W and b represent learnable parameters, and X level0represents the input of the secondary learner, N is the number of stocks on the trading day, and M is the number of primary learners dynamically selected on the day. By training on the prediction results of each primary model within the preset time before the trading day and the trading day, W is updated and b is used for the next prediction.

[0091] Step S5: The final stock prediction result is obtained through the secondary learner. Use the prediction sequence of the primary model within a period of time as training data, and the historical data within this period as labels to train a machine learning secondary prediction model. That is to say, the prediction results of the secondary learner and the candidate model on trading day T+1 are used as input to obtain the final prediction result of the integrated model on trading day T+1. Specifically, after S primary models are selected, when predicting the stock sequence of trading day T, the prediction results of the S models in the [TL, T) period and the real historical data during this period are first obtained. Through data processing, the outputs of the S models are constructed into a vector of length S as training data, and the machine learning algorithm is used to train the secondary learner to predict the historical data in the [TL, T) period. After the training is completed, the prediction sequence of the primary candidate model on trading day T is used as input, so that the secondary model can derive the integrated prediction sequence of day T.

[0092] The present invention aims to provide a heterogeneous deep learning model based on dynamic integration of different inputs, which can provide different model combinations and weights according to the prediction performance of each model on different trading days, and output the integrated stock prediction sequence to achieve better stock sequence prediction accuracy.

[0093] Further, the stock prediction method of the present invention is specifically described as follows by taking examples:

[0094] Assuming that the CSI 300 stocks of the Shanghai Stock Exchange and the Shenzhen Stock Exchange are used, and the current date is 6:00 p.m. on May 19, 2020, the recommendation score of the CSI 300 stocks on May 20, 2020 is to be predicted. The data from January 1, 2007 to December 31, 2014 is used as the training set of the primary model, and the data from January 1, 2015 to December 31, 2019 is used as the validation set of the primary model. The data from February 20, 2020 to May 19, 2020 is used as the data set for dynamically evaluating the performance of the primary model and the training set of the secondary model.

[0095] Step 1: Perform data preprocessing and calculate the recommendation score of each stock based on the daily closing price and the next day's closing price. Divide the data set into a training set and a validation set, and select the data within 60 days before the required prediction date as the data set for dynamic evaluation of the primary model based on the set dynamic range.

[0096] Step 2: Training of the primary model, initializing model parameters, and using random numbers to initialize the weights in the learnable parameter matrix. Process the training set into time slices, input the daily CSI 300 stock data into the model as a batch, and use the root mean square error as the loss function to train the primary model. The primary model involving graph input needs to input the relationship matrix or adjacency matrix for training at the same time. Set the upper limit of the number of iterations to 200 times. When the loss function no longer decreases in 30 iterations, the model is considered to have basically converged and training is stopped. Then, repeat the above training steps 10 times, and use the trained model to test on the validation set, and select the model with the smallest validation error.

[0097] Step 3: Dynamically select primary models. Including step 3.1: Evaluate the performance of primary models on dynamic data. Specifically, use all primary models to make predictions on the data set from 20200220 to 20200519, use IC and RankIC methods to evaluate the performance of all primary models on this data set, and select the top four models with the best performance as candidate models. Step 3.2: Calculate the Tanimoto similarity between the output sequence of the optimal candidate model obtained in step 3.1 and the output sequence of other candidate models, and screen out the models required for integration.

[0098] Step 4: Training of the secondary learner: Use the output of the integrated model obtained in step 3.2 on the dynamic data set as training data to train the secondary learner.

[0099] Step 5: Predict the stock recommendation score. First, use the model required for the integration obtained in step 3.2 to predict the stock recommendation score on May 20, 2020. Then use the secondary learner and take the output of the selected primary model as input to obtain the integrated prediction result of the secondary learner.

[0100] The present invention also provides a stock prediction system based on a dynamically integrated heterogeneous deep learning model. A person skilled in the art can implement the stock prediction system based on a dynamically integrated heterogeneous deep learning model by executing the step flow of the stock prediction method based on a dynamically integrated heterogeneous deep learning model. That is, the stock prediction method based on a dynamically integrated heterogeneous deep learning model can be understood as a preferred implementation of the stock prediction system based on a dynamically integrated heterogeneous deep learning model.

[0101] A stock prediction system based on a dynamically integrated heterogeneous deep learning model provided by the present invention includes:

[0102] Module M1: Obtain the stock data to be tested. The stock data includes the historical time series data of the stock to be tested and the company knowledge graph corresponding to the stock to be tested.

[0103] Module M2: Based on the data of the stocks to be tested, multiple deep learning models with different structures are trained to obtain a heterogeneous deep learning model pool, which contains multiple primary models. Training multiple deep learning models with different structures includes taking the adjacency matrix extracted from the company knowledge graph corresponding to the stocks to be tested and the historical time series data of the stocks to be tested as input for model training, taking the relationship matrix between the companies corresponding to the stocks to be tested and the industries corresponding to the companies and the historical time series data of the stocks to be tested as input for model training, and taking only the historical time series data of the stocks to be tested as input for model training.

[0104] Module M3: In the heterogeneous deep learning model pool, model selection is performed based on the dynamic performance of the primary model and the similarity between models to obtain a pool of candidate models. Model selection based on the dynamic performance of the primary model and the similarity between models includes the following sub-steps:

[0105] Module M3.1: Determine the trading day and obtain the historical time series data of all stocks within a preset time from the trading day.

[0106] Module M3.2: Based on historical time series data, obtain the prediction scores of all primary models on each historical trading day within a preset time from the trading day.

[0107] Module M3.3: Compute true stock recommendation scores.

[0108] Module M3.4: Based on the prediction score of the primary model and the actual stock recommendation score, evaluate the performance of the corresponding primary model and obtain the best model within the preset time from the trading date. The evaluation standard for evaluating the performance of the corresponding primary model is the sum of the IC and RankIC values ​​between the prediction score of the primary model and the actual stock recommendation score. The formula is as follows:

[0109]

[0110] IC T =corr(y T ,s T )

[0111] RankIC T =corr(rank(y T ),rank(s T ))

[0112] Where corr() represents the correlation coefficient, x and y represent the historical truth value and the primary learner output respectively, the subscript i represents the i-th historical truth value or the primary model prediction output in the time series, IC T and RankIC TRespectively represent the IC coefficient and RankIC coefficient of the stock prediction score and the historical true value on trading day T, y T and rank(y T ) represent the real recommendation scores of all stocks on trading day T and the stock rankings obtained based on the real recommendation scores, s T and rank(s T ) are the recommendation scores predicted by the T model on the trading day and the stock rankings obtained based on the predicted values;

[0113] Module M3.5: By calculating the Tanimoto similarity between the prediction time series of each candidate model and the prediction time series of the best model, the models are screened to obtain the final candidate model pool. The Tanimoto similarity calculation formula is as follows:

[0114]

[0115] In the formula, sim Tanimoto (a, b) represents the Tanimoto similarity between vector a and vector b, dot represents vector dot product, and a and b represent the time series vectors of the prediction results of different primary learners. The screening includes eliminating models with a Tanimoto similarity of less than 0.75 with the best model.

[0116] Module M4: Take the model prediction results in the candidate model pool as input for training to obtain a secondary learner;

[0117] Module M5: Obtain the final stock prediction results through the secondary learner.

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

[0119] 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 stock prediction method based on dynamic integration of heterogeneous deep learning models, characterized in that: include: Step S1: Obtain the stock data to be tested; Step S2: training a plurality of deep learning models with different structures according to the stock data to be tested to obtain a heterogeneous deep learning model pool, wherein the heterogeneous deep learning model pool includes a plurality of primary models; Step S3: In the heterogeneous deep learning model pool, model selection is performed based on the dynamic performance of the primary model and the similarity between models to obtain a pool of candidate models; Step S4: using the model prediction results in the candidate model pool as input for training to obtain a secondary learner; Step S5: obtaining the final stock prediction result through the secondary learner.

2. The stock prediction method based on dynamic integrated heterogeneous deep learning model according to claim 1 is characterized in that: The stock data includes historical time series data of the stocks to be tested and the company knowledge graph corresponding to the stocks to be tested; The training of multiple deep learning models with different structures includes taking the adjacency matrix extracted from the company knowledge graph corresponding to the tested stock and the historical time series data of the tested stock as input for model training, taking the relationship matrix between the company corresponding to the tested stock and the industry corresponding to the company and the historical time series data of the tested stock as input for model training, and taking only the historical time series data of the tested stock as input for model training; Each deep learning model with different structures does not affect each other during training.

3. The stock prediction method based on dynamic integrated heterogeneous deep learning model according to claim 1 is characterized in that: The model selection based on the dynamic performance of the primary model and the similarity between models includes the following sub-steps: Step S3.1: Determine a trading day and obtain historical time series data of all stocks within a preset time from the trading day; Step S3.2: Obtaining the prediction scores of all primary models on each historical trading day within a preset time from the trading day according to the historical time series data; Step S3.3: Calculate the actual stock recommendation score; Step S3.4: According to the prediction score of the primary model and the actual stock recommendation score, the performance of the corresponding primary model is evaluated to obtain a plurality of candidate models and the best model within a preset time from the trading date; Step S3.5: By calculating the Tanimoto similarity between the prediction time series of each candidate model and the prediction time series of the best model, the models are screened to obtain the final candidate model pool, where the Tanimoto similarity calculation formula is as follows: In the formula, sim Tanimoto (a, b) represents the Tanimoto similarity between vector a and vector b, dot represents vector dot product, and a and b represent the time series vectors of the prediction results of different primary learners.

4. The stock prediction method based on dynamic integrated heterogeneous deep learning model according to claim 3 is characterized in that: The evaluation criteria for evaluating the performance of the corresponding primary model is the sum of the IC and RankIC values ​​between the prediction score of the primary model and the actual stock recommendation score, and the formula is as follows: IC T =corr(y T ,s T ) RankIC T =corr(rank(y T ), rank(s) T )) Where corr() represents the correlation coefficient, x and y represent the historical truth value and the primary learner output respectively, the subscript i represents the i-th historical truth value or the primary model prediction output in the time series, IC T and RankIC T Respectively represent the IC coefficient and RankIC coefficient of the stock prediction score and the historical true value on trading day T, y r and rank(y T ) represent the real recommendation scores of all stocks on trading day T and the stock rankings obtained based on the real recommendation scores, s T and rank(s T ) are the recommendation scores predicted by the T model on the trading day and the stock rankings obtained based on the predicted values.

5. The stock prediction method based on dynamic integrated heterogeneous deep learning model according to claim 3 is characterized in that: The screening includes eliminating models whose Tanimoto similarity to the best model is less than 0.

75.

6. The method for stock prediction based on dynamic integrated heterogeneous deep learning model according to claim 1, characterized in that: The formula of the secondary learner in step S4 is as follows: Among them, y level1 represents the output of the secondary learner, W and b represent learnable parameters, and X level0 represents the input of the secondary learner, N is the number of stocks on the trading day, and M is the number of primary learners dynamically selected on the day; By training on the prediction results of each primary model on the trading day and the preset time before the trading day, W,b is updated for the next prediction.

7. A stock prediction system based on dynamically integrated heterogeneous deep learning models, characterized in that: include: Module M1: Get the stock data to be tested; Module M2: training a plurality of deep learning models with different structures according to the stock data to be tested, and obtaining a heterogeneous deep learning model pool, wherein the heterogeneous deep learning model pool includes a plurality of primary models; Module M3: In the heterogeneous deep learning model pool, model selection is performed based on the dynamic performance of the primary model and the similarity between models to obtain a pool of candidate models; Module M4: using the model prediction results in the candidate model pool as input for training to obtain a secondary learner; Module M5: Obtain the final stock prediction result through the secondary learner.

8. The stock prediction system based on dynamically integrated heterogeneous deep learning models according to claim 7, characterized in that: The stock data includes historical time series data of the stocks to be tested and the company knowledge graph corresponding to the stocks to be tested; The training of multiple deep learning models with different structures includes taking the adjacency matrix extracted from the company knowledge graph corresponding to the tested stock and the historical time series data of the tested stock as input for model training, taking the relationship matrix between the company corresponding to the tested stock and the industry corresponding to the company and the historical time series data of the tested stock as input for model training, and taking only the historical time series data of the tested stock as input for model training; Each deep learning model with different structures does not affect each other during training.

9. The stock prediction system based on dynamically integrated heterogeneous deep learning models according to claim 7, characterized in that: The model selection based on the dynamic performance of the primary model and the similarity between models includes the following sub-steps: Module M3.1: Determine the trading day and obtain the historical time series data of all stocks within a preset time from the trading day; Module M3.2: Obtaining the prediction scores of all primary models on each historical trading day within a preset time from the trading day according to the historical time series data; Module M3.3: Calculate the actual stock recommendation score; Module M3.4: Evaluate the performance of the corresponding primary model based on the prediction score of the primary model and the actual stock recommendation score, and obtain multiple candidate models and the best model within a preset time from the trading date; Module M3.5: By calculating the Tanimoto similarity between the prediction time series of each candidate model and the prediction time series of the best model, the models are screened to obtain the final candidate model pool. The Tanimoto similarity calculation formula is as follows: In the formula, sim Tanimoto (a, b) represents the Tanimoto similarity between vector a and vector b, dot represents vector dot product, and a and b represent the time series vectors of the prediction results of different primary learners.

10. The stock prediction system based on dynamic integrated heterogeneous deep learning model according to claim 9, characterized in that: The evaluation criteria for evaluating the performance of the corresponding primary model is the sum of the IC and RankIC values ​​between the prediction score of the primary model and the actual stock recommendation score, and the formula is as follows: IC T =corr(y T ,s T ) RankIC T =corr(rank(y T ), rank(s) T )) Where corr() represents the correlation coefficient, x and y represent the historical truth value and the primary learner output respectively, the subscript i represents the i-th historical truth value or the primary model prediction output in the time series, IC T and RankIC T Respectively represent the IC coefficient and RankIC coefficient of the stock prediction score and the historical true value on trading day T, y T and rank(y T ) represent the real recommendation scores of all stocks on trading day T and the stock rankings obtained based on the real recommendation scores, s T and rank(s T ) are the recommendation scores predicted by the T model on the trading day and the stock rankings obtained based on the predicted values; The screening includes eliminating models whose Tanimoto similarity to the best model is less than 0.75.

Citation Information

Patent Citations

  • Method for predicting stock trends by applying deep learning technology

    CN106845681A

  • Stock price prediction method and system based on improved LSTM

    CN109272406A

  • Stock sorting method based on meta-learning

    CN114626949A

  • System and method for providing stock market recommendation

    WO2021060968A1