A clatt stock correlation prediction method based on bayesian optimization

By using the Bayesian-optimized CLATT method, combined with neural networks of CNN, BiLSTM, and attention mechanisms, the problem of insufficient accuracy in stock correlation prediction in existing technologies is solved, achieving higher accuracy and robustness in prediction.

CN119048229BActive Publication Date: 2025-11-18ANHUI UNIV OF TECH SCI & TECH PARK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410455903.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-16
Publication Date
2025-11-18
Estimated Expiration
2044-04-16

AI Technical Summary

Technical Problem

Existing technologies struggle to accurately predict stock correlations in non-stationary time series. Traditional statistical and machine learning methods are insufficient for fitting complex data and cannot meet the needs of financial transactions.

Method used

We employ the CLATT stock correlation prediction method based on Bayesian optimization. This method involves constructing a database, preprocessing the data, calculating the correlation matrix, decomposing the return data using a multi-factor model, and combining neural networks with CNN, BiLSTM, and attention mechanisms for prediction.

Benefits of technology

It improves the accuracy and robustness of stock correlation prediction, is applicable to various stock portfolio conditions, reduces the impact of noise and missing data, and improves algorithm efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119048229B_ABST
    Figure CN119048229B_ABST
Patent Text Reader

Abstract

The application discloses a CLATT stock correlation prediction method based on Bayesian optimization, comprising the following steps: constructing a database, including stock data and corresponding factor data in at least a period of time; preprocessing the data in the database, calculating the correlation matrix between different factors, and eliminating strongly correlated factors; decomposing the stock yield data based on a multi-factor model, calculating the corresponding factor values, and calculating the correlation data between stocks by using a Pearson correlation coefficient; fusing and splicing the stock yield data and the correlation data to obtain an input vector, so as to enhance the multi-source nature of the input data, improve the prediction accuracy, input the input vector into a prediction model, and output a prediction result, which has higher accuracy and robustness and is suitable for various stock combination conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of data processing technology and time series data prediction technology, specifically to a CLATT stock correlation prediction method based on Bayesian optimization. Background Technology

[0002] Market conditions, economic environment, and other factors can all cause changes in the relationships between assets. These different factors can lead to assets with certain similar characteristics exhibiting similar market trends. Accurate pre-assessment of correlations among portfolio assets has become an important area of ​​research and development. Stock correlation prediction can further promote optimal asset allocation, price discovery, provide liquidity, diversify and transfer risk, and reduce search and information costs in financial transactions.

[0003] Different methods and techniques exist to improve short-term stock correlation prediction. Traditional statistical methods are only suitable for predicting stationary stochastic processes, but not for non-stationary time series. Machine learning and other methods are limited by their ability to model historical and current data, and their fitting to complex data is somewhat insufficient. Therefore, there is an urgent need for a Bayesian optimization-based CLATT stock correlation prediction method to address these issues. Summary of the Invention

[0004] The purpose of this invention is to provide a Bayesian optimization-based CLATT stock correlation prediction method that can effectively solve the problems existing in the prior art.

[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: a CLATT stock correlation prediction method based on Bayesian optimization, comprising the following steps:

[0006] S1. Construct a database, including stock data and corresponding factor data for at least a certain period of time;

[0007] S2. Preprocess the data in the database and calculate the correlation matrix between different factors, and remove strongly correlated factors.

[0008] S3. Decompose the stock return data based on the multi-factor model, calculate the corresponding factor values, and use the Pearson correlation coefficient to calculate the correlation data between stocks.

[0009] S4. Merge and concatenate the stock return data and correlation data to obtain the input vector, and input it into the prediction model to output the prediction result.

[0010] Preferably, in step S1, the stock data includes the stock code, opening price, closing price, and trading date.

[0011] Preferably, in step S2, the preprocessing is as follows: outliers in stock data and factor data are processed to bring them back to a reasonable level, and the original data is divided and standardized using the zero-mean standardization method, and the standardized data is neutralized.

[0012] Preferably, outlier handling is specifically as follows:

[0013] Calculate the median of the input sequence: Mid = Median(X) i );

[0014] Calculate X i sequential The value of M in the quantile 1 / 4 ,and The value of M in the quantile 3 / 4 ;

[0015] gap1 = M 3 / 4 -M 1 / 4 gap2 = M 1 / 2 -M 1 / 4 ;

[0016] The sequence after extreme value processing is as follows:

[0017] When X i <M 1 / 4 -1.5*gap2, then X i =M 1 / 4 -1.5*gap2;

[0018] When X i >M 1 / 4 +1.5*gap1, then X i =M 3 / 4 +1.5*gap1.

[0019] Preferably, in step S2, the relevant factor calculation formula is as follows:

[0020]

[0021] Where ρ is the correlation coefficient, E is the expected value, N is the number of factors, i represents the i-th factor, X and Y are the values ​​of the two variables, and μ X and μ Y It is the mean of X and Y.

[0022] Preferably, in step S3, the multi-factor model decomposes the stock return data using the following formula:

[0023]

[0024] Among them, R j X represents the return rate of the j-th stock;jk f represents the exposure of the j-th stock to the k-th factor; k The factor return of the k-th factor; u j This represents the pricing error between the actual expected return of the j-th stock and the expected return implied by the multi-factor model.

[0025] Preferably, in step S3, the formula for calculating the correlation between stocks is:

[0026]

[0027] Where R i and R j For daily stock returns, two sets of sample points (R) i ,R j The formulas for calculating the covariance and standard deviation of a given variable are:

[0028]

[0029]

[0030]

[0031] Among them, Cov(R) i ,R j ) represents the covariance coefficient, n represents the number of returns, and R0 is the coefficient of variation. i and R j For daily stock returns, X i For daily stock returns, Let σ be the average stock return over the interval. i The standard deviation is denoted as .

[0032] Preferably, in step S4, the input vector includes:

[0033] Time series X with multivariate factors t :

[0034] in, Represents the relevance feature column. This represents the stock return characteristic column, where c represents the correlation data and r represents the corresponding return data. The sum of c and r is the same as i.

[0035] Preferably, in step S4, the prediction model is composed of a combination of CNN and several BiLSTM layers and an attention mechanism, and is optimized using a Bayesian algorithm until the optimal hyperparameters are determined.

[0036] Preferably, the prediction model includes:

[0037] The input layer is used to receive the input vector;

[0038] The CNN layer extracts feature information from the input vector and retains the time series features of the input stock correlation data;

[0039] The BiLSTM layer processes time series information and captures the time series features in the input stock data and correlation data.

[0040] The attention mechanism layer receives the stock correlation data processed by the BiLSTM layer and captures the inherent relationship between the input stock data and the correlation data.

[0041] The output layer outputs the prediction results of the correlation.

[0042] Beneficial effects: In this invention, the input vector is obtained by fusing and concatenating stock return data with correlation data, thereby enhancing the multi-source nature of the input data and improving prediction accuracy. The prediction model employs a combination of CNN and several BiLSTM layers, along with an attention mechanism. The attention mechanism focuses on the most relevant features in the output data, thus improving the model's robustness to noise and missing data. This model can capture complex relationships and patterns in the data, making it suitable for various stock portfolio conditions. The Bayesian optimization algorithm can be used to train with historical results to obtain the optimal hyperparameter values, improving algorithm efficiency. Attached Figure Description

[0043] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.

[0044] In the attached diagram:

[0045] Figure 1 This is a schematic diagram of the stock prediction model based on multi-source data fusion of the present invention;

[0046] Figure 2 This is a schematic diagram of the encoding prediction network structure for predicting inter-stock correlation according to an embodiment of the present invention.

[0047] Figure 3 This is a schematic diagram of the steps of the multi-factor model in an embodiment of the present invention. Detailed Implementation

[0048] The embodiments of the present invention will now be described with reference to the accompanying drawings. The terminology used in the embodiments section is for illustrative purposes only and is not intended to limit the scope of the invention. The embodiments of this application will now be described with reference to the accompanying drawings.

[0049] refer to Figure 1This is a schematic diagram illustrating the method and process for predicting the correlation between stocks according to an embodiment of the present invention. It describes a Bayesian optimization-based CLATT stock correlation prediction method, which includes the following steps:

[0050] Build a database that includes stock data and corresponding factor data for at least a certain period of time;

[0051] The data in the database is preprocessed, and the correlation matrix between different factors is calculated, and strongly correlated factors are removed.

[0052] The stock return data (the return calculated from the closing price) is decomposed based on a multi-factor model to calculate the corresponding factor values, and the correlation data between stocks is calculated using the Pearson correlation coefficient.

[0053] The input vector is obtained by fusing and concatenating stock return data and correlation data, and then input into the prediction model to output the prediction result.

[0054] Based on the above method, taking a certain financial quantitative firm as an example, the specifics are as follows:

[0055] A database is constructed by selecting stock codes, opening prices, closing prices, trading dates, and corresponding factor data within a certain period.

[0056] Factor data and stock return data were screened, and then the factor data underwent preprocessing, including extreme value handling, null value handling, factor data normalization, and neutralization. Outlier handling used the quartile method, which is calculated as follows:

[0057] Calculate the median of the input sequence: Mid = Median(X) i );

[0058] Calculate X i sequential The value of M in the quantile 14 ,and The value of M in the quantile 34 ;

[0059] gap1 = M 3 / 4 -M 1 / 4 gap2 = M 1 / 2 -M 1 / 4 ;

[0060] Here, gap1 represents the distance between the upper half of the dataset (i.e., between the upper quartile and the median of the upper quartile); it is the distance between the upper quartile (Q3) and the lower quartile (Q1);

[0061] gap2 represents the distance between the lower quartile (Q1) and the median (Q2);

[0062] The sequence after extreme value processing is as follows:

[0063] When X i <M 1 / 4 -1.5*gap2, then X i =M 1 / 4 -1.5*gap2;

[0064] When X i >M 1 / 4 +1.5*gap1, then X i =M 3 / 4 +1.5*gap1;

[0065] The two thresholds mentioned above are calculated based on the data distribution and quartiles, and are used to identify and handle possible outliers.

[0066] The first threshold is M 1 / 4 -1.5*gap2, this value represents the distance between the lower quartile (Q1) minus 1.5 times the lower quartile and the median (Q2); this threshold is used to identify possible outliers located in the lower half of the dataset.

[0067] The second threshold is M 3 / 4 +1.5*gap1. This value represents the upper quartile (Q3) plus 1.5 times the distance between the upper quartile and the median (Q2). This threshold is used to identify potential outliers located in the upper half of the dataset.

[0068] By using these two thresholds, we can reasonably identify and process outliers that may exist in the dataset, thereby ensuring the accuracy and robustness of the data.

[0069] The formula for calculating the relevant factors is as follows:

[0070]

[0071] Where ρ is the correlation coefficient, E is the expected value, N is the number of factors, i represents the i-th factor, X and Y are the values ​​of the two variables, and μ X and μ Y It is the mean of X and Y; the closer the correlation between the two, that is, the quantified value, is to 1 or -1, the stronger the correlation, while the closer it is to 0, the weaker the correlation.

[0072] Many factors influence stock returns, and stock correlation data includes numerous attributes. Based on a multi-factor model, the Barra model is used to quantify fundamental factors. The multi-factor model decomposes daily stock returns into the following formula:

[0073]

[0074] Among them, R j X represents the return rate of the j-th stock; jk f represents the exposure of the j-th stock to the k-th factor; k The factor return of the k-th factor; u j This represents the pricing error between the actual expected return of the j-th stock and the expected return implied by the multi-factor model.

[0075] Specific quantitative indicators include key factors and variables highly correlated with stocks, such as market capitalization, Beta, momentum, volatility, non-linear market capitalization, price-to-book ratio, liquidity, profitability, growth rate, and leverage, used to measure stock returns. The table below shows the characteristic factors used in this paper and their definitions:

[0076]

[0077] The factor exposure of an asset on each factor is quantified; factor exposure measures the deviation of an asset's return from the market benchmark and is used to characterize the asset's multi-factor nature. These indicators are then used to calculate the asset's correlation; the formula for calculating stock correlation is as follows:

[0078]

[0079] Where R i and R j To quantify daily stock returns, a multi-factor model is used, with two sets of sample points (R0). i ,R j The formulas for calculating the covariance and standard deviation of a given variable are:

[0080]

[0081]

[0082]

[0083] Among them, Cov(R) i ,R j ) represents the covariance coefficient, n represents the number of returns, and R0 is the coefficient of variation. i and R j For daily stock returns, X i For daily stock returns, Let σ be the average stock return over the interval. i The standard deviation determines the input data for the model. The specific description of multi-source data fusion is as follows: Formally, using multivariate data for time t prediction, the input multivariate time series representing the observations at time t can be expressed as:

[0084]

[0085] Where i represents a certain column feature, and w represents the length of the observation sequence. Then the input matrix at time t can be represented as:

[0086]

[0087] in Represents the relevance feature column. Let represent the characteristic column of stock returns, where the sum of c and r is the same as i. At time step t, y t For correlation data, X t As a typical multivariate factor vector, the corresponding correlation prediction... The problem of predicting correlation uses time series X of multivariate factors. t And the true correlation data y t As input, the final model is used to measure the future time step.

[0088] For the above, the prediction model is composed of CNN and several BiLSTM layers stacked together with an attention mechanism, and is optimized using a Bayesian algorithm until the optimal hyperparameters are determined, that is, the weight values ​​that minimize the loss function MSE of the model.

[0089] Among them, such as Figure 2 As shown, the prediction model mainly consists of five parts: input layer, CNN layer, BiLSTM layer, attention mechanism layer and output layer.

[0090] The input layer receives normalized stock correlation data. The CNN module extracts various features from the input data, preserving the time-series features of the stock correlation data. Wide convolutional kernels can be used in the convolutional network to obtain a larger receptive field, extracting more features and effectively suppressing noise interference. Subsequently, the time-series information of the stock data processed in the CNN module, capturing the time-series features of the input stock data and correlation data, is fed into the next layer. The BiLSTM layer then processes the stock correlation data, which is then input into the attention layer. The self-attention layer captures the inherent correlation between the input stock data and correlation data, helping to improve the prediction accuracy of stock correlation. The attention layer transmits the processed data to the output layer. Finally, the output layer outputs the predicted correlation results.

[0091] Furthermore, the following experiments were conducted to further verify its effectiveness:

[0092] The dataset randomly selected eight stocks from the fund's holdings as candidate assets. The codes for these eight stocks are 300015, 300274, 300347, 603799, 300014, 300122, 300207, and 300450. To ensure data consistency, null values ​​were removed, and trading day periods containing common numerical values ​​were selected. Finally, 1227 days of data, from January 4, 2017 to January 28, 2022, were selected for calculating stock correlation. The corresponding stock returns are one trading day earlier than the correlation data dates, totaling 1127 trading days.

[0093] The optimal values ​​of hyperparameters for the proposed model were determined using a Bayesian optimization algorithm. Based on extensive experiments, the hyperparameter combination corresponding to the minimum MAE value was selected as the final hyperparameter combination applied to stock correlation prediction. The results are shown in the table below:

[0094]

[0095] The mean squared error (MSE) model, the optimal model for measuring relevance, was used to examine the accuracy of the correlation predictions. For further evaluation, mean absolute error (MAE), root mean square error (RMSE), and the regression performance correlation index R² model were also used; MSE gives the error generated in the regression. The formula for calculating MSE is given below:

[0096]

[0097] Where m is the number of instances in the dataset on which MSE is measured, and x (i) y is a vector containing all features (excluding labels) of the i-th instance in the dataset, while y (i) This is its label (the expected output value of this instance). The root mean square error model is as follows:

[0098]

[0099] The mean absolute error is calculated for the given model, and its formula is defined as follows:

[0100]

[0101] R² measures the fit of time series values.

[0102]

[0103] The numerator of the formula is the sum of squared errors, used to directly assess the model's fit; the denominator is the sum of squared standard deviations of the samples, used for comparison of the sum of squared errors. Where y i The true value representing the actual stock correlation. The predicted stock correlation value, where i represents the i-th data point. This is the average of the true values.

[0104] To verify the predictive performance of the attention-based CNN-BiLSTM hybrid neural network on stock correlation, an experiment comparing the regression performance of different models with the same input dataset was conducted. By comparing the data values ​​and trends of various evaluation indicators in the experiment, the effectiveness of the proposed improved model was analyzed and verified. The out-of-sample loss functions of different models are compared in the table below:

[0105]

[0106] Experimental results show that the CLATT model achieves a 36.89% improvement in MAE (Mean Effect). More specifically, it demonstrates a 30.30% improvement over CNN-LSTM and a 27.62% improvement over CNN-BiLSTM. Based on MSE (Mean Effect), CLATT achieves a 45.76% improvement over CNN-BiLSTM across both datasets. Therefore, the CLATT model exhibits higher prediction accuracy and stronger robustness.

[0107] To verify the effectiveness of multivariate data input, that is, to simultaneously integrate data sources directly related to stock correlation data as sample inputs to the model to verify the model's improvement effect, the same deep learning model was set up with the same parameters as above, the sample data variable inputs were changed, and the experimental results were observed and compared.

[0108] Specifically, the entire experiment employed a CNN-BiLSTM hybrid deep learning model with an attention mechanism. Based on this, return data directly related to stock correlation were individually added and subtracted to verify the effectiveness of the multivariate data. The performance of each evaluation indicator attribute value in the model's experimental results was compared across different stock data sample sets, and the overall average value of different indicators across each group of different stock datasets was calculated. The specific experimental results are shown in the table below, where "+" indicates multivariate data input and "-" indicates single stock correlation time-series data input:

[0109]

[0110] The experimental results show that, compared to the model without stock return data, the prediction error indices MAE, MSE, and RMSE of the proposed model all show a downward trend, while the model's fit is also improved. This indicates that the variables included in the invention are all effective inputs, and comprehensive data can significantly improve the prediction performance.

[0111] refer to Figure 3BARRA multifactor model; data processing: select common factors affecting stock risk based on the BARRA multifactor model, calculate stock correlation through risk factors, and define the format of model input data using a sliding window.

[0112] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. For those skilled in the art, after learning the contents described in the present invention, several equivalent changes and substitutions can be made without departing from the principle of the present invention. These equivalent changes and substitutions should also be considered to fall within the protection scope of the present invention.

Claims

1. A CLATT stock correlation prediction method based on Bayesian optimization, characterized in that, The method comprises the following steps: S1, constructing a database, including stock data and corresponding factor data in at least one period of time; S2, preprocessing the data in the database and calculating the correlation matrix between different factors, and eliminating strongly correlated factors; The preprocessing is: processing the abnormal values in the stock data and the factor data to make the regression reasonable, dividing and standardizing the original data using the zero-mean standardization method, and neutralizing the standardized data; The specific abnormal value processing is: Compute median of input sequence: Mid = Median(X i ); Compute X i Sequence of Value M of the quantile 14 , and Value M of the quantile 34 ; gap1 = M 3 / 4 - M 1 / 4 , gap2 = M 1 / 2 - M 1 / 4 ; Wherein, the extreme value processed sequence is: When X i <M 1 / 4 -1.5*gap2, then X i = M 1 / 4 -1.5*gap2; When X i > M 1 / 4 + 1.5*gap1, then X i = M 3 / 4 + 1.5*gap1; S3, decomposing the stock return rate data based on the multi-factor model, calculating the corresponding factor values, and calculating the correlation data between stocks using the Pearson correlation coefficient; S4, fusing and splicing the stock return rate data and the correlation data to obtain an input vector, and inputting the input vector into a prediction model to output a prediction result; The prediction model is composed of CNN and a plurality of BiLSTM layers and an attention mechanism, and is optimized using a Bayesian algorithm until the optimal hyperparameters are determined.

2. The CLATT stock correlation prediction method based on Bayesian optimization according to claim 1, characterized in that: In step S1, the stock data includes stock code, opening price, closing price and trading date.

3. The CLATT stock correlation prediction method based on Bayesian optimization according to claim 1, characterized in that: In step S2, the correlation factor calculation formula is: Wherein, ρ is the correlation coefficient, E is the expectation calculation method, N is the number of factors, i represents the ith factor, X and Y are the values of two variables, and μX and μY are the means of X and Y.

4. The CLATT stock correlation prediction method based on Bayesian optimization according to claim 1, characterized in that: In step S3, the multi-factor model decomposes the stock return rate data formula: where R j represents the return of the jth stock; X jk represents the exposure of the jth stock to the kth factor; f k is the factor return of the kth factor; u j represents the pricing error between the actual expected return of the jth stock and the expected return implied by the multi-factor model.

5. The CLATT stock correlation prediction method based on Bayesian optimization according to claim 1, characterized in that: In step S3, the correlation between stocks is calculated as: where R i and R j are the daily stock returns, and the covariance and standard deviation of the two sets of sample points (R i , R j ) are calculated as follows: where Cov(R i ,R j ) is the covariance coefficient, n is the number of returns, R i and R j are the daily stock returns, X i is the daily stock return, is the interval stock return mean, and σ i is the standard deviation.

6. The CLATT stock correlation prediction method based on Bayesian optimization according to claim 1, characterized in that: In step S4, the input vector includes: Time series of multivariate factors X t : wherein, represents the correlation feature column, represents the stock return rate feature column, c represents the correlation data, r represents the corresponding return rate data, and the total number of c and r is the same as i.

7. The CLATT stock correlation prediction method based on Bayesian optimization according to claim 1, characterized in that: The prediction model includes: An input layer for receiving an input vector; A CNN layer for extracting feature information in the input vector and retaining the time sequence characteristics of the input stock correlation data; A BiLSTM layer for processing time sequence information and capturing time sequence characteristics in the input stock data and correlation data; An attention mechanism layer for receiving stock correlation data processed by the BiLSTM layer and capturing the internal correlation between the input stock data and correlation data; An output layer for outputting a prediction result of the correlation.

Citation Information

Patent Citations

  • Method of Stock Yield Prediction Based on LSTM Mode

    AU2020102461A4

  • Stock factor revenue analysis method and device, computer equipment and storage medium

    CN109584076A