Stock prediction system and method based on CEEMDAN-CNN-BiLSTM-Attention hybrid algorithm

The CEEMDAN-CNN-BiLSTM-Attention hybrid algorithm solves the problem of nonlinearity and nonstationarity of stock price series, achieving high-precision stock prediction. Combining signal processing and deep learning models improves prediction accuracy and computational efficiency.

CN121437154APending Publication Date: 2026-01-30NANJING VOCATIONAL UNIV OF IND TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511617811.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2026-01-30

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively handle the nonlinearity, nonstationarity, and multi-scale noise interference of stock price series, causing traditional models to fail in financial time series forecasting. Furthermore, deep learning models cannot simultaneously capture long-term dependencies and high-frequency noise.

Method used

A hybrid algorithm of CEEMDAN-CNN-BiLSTM-Attention is adopted. CEEMDAN is used for signal decomposition, CNN is used for feature extraction, BiLSTM is used to capture time dependence, and attention mechanism is used to dynamically allocate weights to achieve high-precision prediction.

Benefits of technology

It significantly improves the accuracy and computational efficiency of stock prediction, effectively isolates high-frequency noise and low-frequency trend components, dynamically adjusts attention levels, and enhances sensitivity to key historical information and prediction accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121437154A_ABST
    Figure CN121437154A_ABST
Patent Text Reader

Abstract

The invention discloses a stock prediction system and method based on a CEEMDAN-CNN-BiLSTM-Attention hybrid algorithm, in the system, a data acquisition module is used for acquiring stock data to be predicted; the data preprocessing module preprocesses the acquired stock data; the model building module is used for building a CEEMDAN-CNN-BiLSTM-Attention model, and training and adjusting the built CEEMDAN-CNN-BiLSTM-Attention model by using the stock data, so as to learn the characteristics and rules of the change of the stock price; the trained CEEMDAN-CNN-BiLSTM-Attention model is used for stock prediction, and the model is used for stock prediction; and the prediction output module is used for outputting a prediction result of the CEEMDAN-CNN-BiLSTM-Attention model. Through signal decomposition and recombination and deep learning model collaborative optimization, the problems of nonlinearity, non-stationarity and multi-scale noise interference of the stock price sequence are solved, and high-precision end-to-end prediction is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the field of financial technology and artificial intelligence, and relates to a stock prediction system and method based on a CEEMDAN, CNN, BiLSTM and Attention hybrid algorithm, which solves the problems of nonlinearity, non-stationarity and multi-scale noise interference of stock price sequences through signal decomposition and recombination and deep learning model collaborative optimization, and realizes high-precision end-to-end prediction. BACKGROUND

[0002] As a core indicator of the financial market, stock index is a typical high-noise, nonlinear and non-stationary time series data. Its price fluctuation is not only affected by complex factors such as macro economy, policy regulation and investor sentiment, but also presents significant time dependence and dynamic change characteristics. Traditional econometric models (such as Markov model, ARMA-GARCH model) are based on strict statistical assumptions (such as zero mean, sequence independence, homoscedasticity, etc.), but in the actual financial market, stock index data often cannot meet these assumptions due to market fluctuations, unexpected events and other factors, resulting in model failure.

[0003] To overcome the limitations of traditional methods, machine learning models have gradually become the mainstream tool for financial time series prediction. Although shallow models such as support vector machine (SVM), multilayer perceptron (MLP) and decision tree can handle nonlinear problems, they have the risk of overfitting and cannot effectively capture the long-term dependence of time series. The rise of deep learning models provides a new solution to this problem. Among them, convolutional neural network (CNN) is good at extracting local features of data and has been widely used in time series prediction and computer vision. However, CNN cannot capture the long-term dependence characteristics of time series. Recurrent neural network (RNN) and its derivative models (such as LSTM) can describe time dependence, but they are not ideal in extracting long-term sequence features and have shown significant advantages in stock prediction, but they are sensitive to high-frequency noise. To further improve the prediction accuracy, combined model prediction methods have gradually emerged. For example, the CNN-BiLSTM combined model extracts local features through CNN and then uses bidirectional LSTM (BiLSTM) to capture forward and backward time dependence, significantly improving the prediction performance. In addition, the introduction of attention mechanism enables the model to dynamically allocate weights and focus on key historical information, further optimizing the prediction results. However, traditional models do not fully combine signal processing techniques to deal with the complexity of financial data.

[0004] In the field of signal processing, wavelet analysis, empirical mode decomposition (EMD) and its improved methods (such as EEMD, CEEMD) are widely introduced into financial time series prediction to decompose complex signals. However, traditional decomposition methods (such as EMD / EEMD) have the problems of mode mixing and residual noise.

[0005] Therefore, there is an urgent need for a stock prediction method that can overcome the shortcomings of the prior art. SUMMARY

[0006] To overcome the shortcomings of the prior art, the present application provides a stock prediction system and method based on a CEEMDAN-CNN-BiLSTM-Attention hybrid algorithm, which improves prediction accuracy and computational efficiency.

[0007] The technical solutions adopted by the present application are as follows: A stock prediction system based on a CEEMDAN-CNN-BiLSTM-Attention hybrid algorithm, the system comprising a data acquisition module, a data preprocessing module, a model establishment module, and a prediction output module, wherein: The data acquisition module is used to acquire stock data to be predicted; The data preprocessing module preprocesses the collected stock data; The model establishment module is used to establish a CEEMDAN-CNN-BiLSTM-Attention model, and the established CEEMDAN-CNN-BiLSTM-Attention model is trained and adjusted using stock data to learn the characteristics and rules of stock price changes; the trained CEEMDAN-CNN-BiLSTM-Attention model is used for stock prediction; The prediction output module is used to output the prediction results of the CEEMDAN-CNN-BiLSTM-Attention model.

[0008] Further, the data acquisition module comprises at least a data crawling submodule and a data storage submodule, wherein: The data crawling submodule is used to collect stock data; The data storage submodule stores the collected stock data for subsequent calling.

[0009] Further, the data crawling submodule first crawls stock market center section data, and then crawls k-line data corresponding to the stock code according to the user input stock code or name.

[0010] Further, the data preprocessing module comprises at least a data cleaning submodule, a data normalization submodule, a data noise reduction submodule, and a data segmentation submodule, wherein: The data cleaning submodule converts data to meet data analysis requirements; The data normalization submodule normalizes the data; The data denoising submodule denoises the data collected by the data collection module to eliminate noise and irrelevant information in the data.

[0011] Further, the data denoising submodule uses a Kalman filter to eliminate noise and irrelevant information in the data.

[0012] Further, the CEEMDAN-CNN-BiLSTM-Attention model includes a CEEMDAN data decomposition and reconstruction module, a feature extraction module, a time series analysis processing module, an attention allocation module, a trend prediction module, a performance evaluation module, and a set prediction module. The CEEMDAN data decomposition and reconstruction module uses the characteristic values predicted by CEEMDAN decomposition and performs minimum-maximum normalization on the reconstructed data to create a training set and a prediction set. The feature extraction module is composed of a CNN convolutional neural network and is used to identify and extract key features in stock data. The time series analysis processing module is composed of a BiLSTM neural network, which converts the feature vectors extracted from the CNN to a dimension that can be fully utilized by the BiLSTM to learn long dependencies in stock data. The attention allocation module uses an attention mechanism to calculate the influence of data at different time points in the sequence on the prediction result, and then determines the importance of each time point data. This allows the model to focus on the information that contributes most to the prediction. The trend prediction module inputs the feature data weighted by attention into a fully connected layer to generate the final stock trend prediction result. The performance evaluation module evaluates the CEEMDAN-CNN-BiLSTM-Attention model constructed, adjusts the model parameters according to the evaluation, and optimizes the model. The set prediction module superimposes the prediction results of each component to obtain the final prediction result, and then uses inverse normalization to obtain the final prediction result.

[0013] Further, the prediction output module is used to visually display the stock price prediction results.

[0014] Further, the performance evaluation module uses mean squared error (MSE), root mean squared error (RMSE), mean absolute error (MAE), and R-square as the evaluation criteria for the model.

[0015] Further, the processing process in the CEEMDAN data decomposition and reconstruction module includes: S1, decomposition: the original nonlinear and non-stationary time series data is decomposed into six IMF components and a residual term R by the CEEMDAN algorithm; S2, reconstruction: the IMF components are reconstructed into high-frequency components, low-frequency components and trend components using the run decision method; S3, normalization processing: the reconstructed data is normalized; S4, data segmentation: the training set and the test set are segmented according to a certain proportion.

[0016] A stock prediction method, which uses the stock prediction system of the above CEEMDAN-CNN-BiLSTM-Attention hybrid algorithm to predict stocks.

[0017] The beneficial effects of the application are: 1. The application performs adaptive signal decomposition on the nonlinear and non-stationary stock index sequence by CEEMDAN, that is, the original stock index sequence is decomposed into high-frequency terms (IMF1-IMF3), medium-frequency terms (IMF4-IMF6) and low-frequency terms (IMF7-Res) by CEEMDAN, realizing the decoupling of multi-scale features and providing purer input for subsequent models; this processing can effectively strip the high-frequency noise and low-frequency trend components, reducing the difficulty of directly processing complex time series data by a single model.

[0018] 2. The application extracts features and models time series by CNN, that is, CNN is used to extract local price pattern features and accurately capture intraday price fluctuation patterns, and BiLSTM is used to capture historical and future context information, simultaneously analyze historical trends and potential reversal points, and significantly improve the sensitivity to trend reversal points.

[0019] 3. The application introduces a channel attention mechanism to dynamically allocate weights to the features extracted by CNN, that is, the attention mechanism dynamically adjusts the attention degree to high-frequency noise and low-frequency trends according to market conditions, avoiding the "one-size-fits-all" processing of multi-scale features by a single model. The attention degree to high-frequency noise and low-frequency trends is adaptively adjusted to avoid the "one-size-fits-all" processing of multi-scale features by traditional models, so as to more accurately highlight key historical information, strengthen the learning of stock feature rules, and significantly improve the prediction accuracy.

[0020] 4. This invention utilizes a hybrid architecture of CEEMDAN-CNN-BiLSTM-Attention, leveraging a complete chain of "decomposition-feature extraction-temporal modeling-dynamic weighting" to achieve dual optimization of prediction accuracy and computational efficiency. CEEMDAN decomposition reduces the non-stationarity of the original sequence, while CNN parallel computation accelerates feature extraction, resulting in a significant improvement in overall inference speed compared to traditional LSTM. The system supports a complete solution from data acquisition and model deployment to visualization of prediction results.

[0021] Figure 1 This is a system architecture diagram of the present invention.

[0022] Figure 2 This is a structural diagram of the CEEMDAN-CNN-BiLSTM-Attention model of the present invention.

[0023] Figure 3 This is a comparison chart of the model prediction results of the present invention.

[0024] Figure 4 This is the front-end visualization interface for the stock prediction results of this invention. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the invention.

[0026] A stock prediction system based on a hybrid algorithm of CEEMDAN-CNN-BiLSTM-Attention, such as... Figure 1 As shown, The system includes a data acquisition module, a data preprocessing module, a model building module, and a prediction output module, wherein: More specifically, the data acquisition module includes a data crawling submodule and a data storage submodule, wherein: The data crawling submodule is used to collect stock data. The specific process is as follows: First, use a Python crawler to crawl the stock market data. Second, based on the stock code or name entered by the user, use a Python crawler to crawl the K-line data of the corresponding stock code.

[0027] The data storage submodule stores the data filtered by the data filtering submodule in a local or cloud database for use by the data preprocessing module. The crawling module uses a step-by-step crawling approach, first storing the data in MySQL, then periodically importing it into HDFS using Sqoop. Based on backend requirements, Spark is used to filter and analyze the data, and the analysis results are stored in Hive. This avoids overload from a single operation. MySQL can serve as a backup of the original data, while HDFS provides distributed storage with high fault tolerance.

[0028] More specifically, the data preprocessing module includes a data cleaning submodule, a data normalization submodule, a data denoising submodule, and a data segmentation submodule, wherein: The data cleaning submodule is used to transform data into a format suitable for data analysis. Stock data is time-series data, and gaps in the data content may occur due to market influences. Other outliers are normal phenomena, making data cleaning essential. Data cleaning primarily involves checking for missing values, outliers, and duplicate values ​​for replacement and supplementation. Missing values ​​are mainly handled using mode imputation and forward imputation. Outliers are replaced using boundary values.

[0029] The data denoising submodule is used to denoise the data acquired by the data acquisition module, eliminating noise and irrelevant information. The data denoising uses a Kalman filter, a highly efficient recursive filter used to estimate the state of a dynamic system from noisy observation data. The formula is as follows:

[0030] in, Current state vector State transition matrix, Control input vector, Control input matrix, Process noise.

[0031]

[0032] in, Observation vector, Observation matrix Observational noise.

[0033] More specifically, the model building module is used to build the CEEMDAN-CNN-BiLSTM-Attention model, such as... Figure 2As shown, the CEEMDAN-CNN-BiLSTM-Attention model includes a CEEMDAN data decomposition and reconstruction module, a feature extraction module, a time series analysis and processing module, an attention allocation module, a trend prediction module, a performance evaluation module, and an ensemble prediction module, wherein: The CEEMDAN data decomposition and reconstruction module utilizes CEEMDAN to decompose the predicted feature values ​​and performs min-max normalization on the reconstructed data to create training and prediction sets. Specific operations include: (1) Decomposition: The original nonlinear and non-stationary time series data is decomposed into 7 components by the CEEMDAN algorithm, and the original nonlinear and non-stationary time series data is decomposed into 6 IMF components and a residual term R.

[0034] (2) Reconstruction: The IMF components are reconstructed into high-frequency components, low-frequency components and trend components using the run-length determination method.

[0035] (3) Normalization: Normalize the reconstructed data. Specifically, the data normalization submodule can use existing methods such as max-min normalization, standardization, and regularization for normalization.

[0036] (4) Data partitioning: The training set and the test set are partitioned according to a certain ratio. In this embodiment, the reconstructed data is divided into 80% training set and 20% test set.

[0037] The feature extraction module is composed of a Convolutional Neural Network (CNN) used to identify and extract key features from stock data. The CNN consists of convolutional layers and pooling layers. The convolutional layers perform convolution operations on the input sequences in the training set to extract local features and spatiotemporal correlations from the input sequences. The pooling layers perform pooling operations on the feature maps output by the convolutional layers, reducing the dimensionality and complexity of the feature maps and enhancing their robustness and generalization ability. The pooling layers downsample the input data, reducing the size of the feature maps.

[0038] The time series analysis processing module consists of a BiLSTM neural network, used to perform dimensionality transformation on the feature vectors extracted from the CNN. The aim is to enable the BiLSTM to fully utilize all data in the input sequence to learn long-term dependencies in stock data. Based on the BiLSTM structure, one module processes the input sequence in forward chronological order, while the other processes it in reverse chronological order, fully utilizing all data in the input sequence. Furthermore, the BiLSTM can effectively learn long-term dependencies in stock data, uncover feature patterns in the input sequence, and improve the accuracy of sequence modeling.

[0039] The attention allocation module uses an attention mechanism to calculate the degree of influence of data at different time points in the sequence on the prediction results, thereby determining the importance of data at each time point; this allows the model to focus on the information that contributes the most to the prediction.

[0040] The trend prediction module inputs attention-weighted feature data into the fully connected layer to generate the final stock trend prediction result.

[0041] Performance evaluation module. Mean squared error (MSE), root mean squared error (RMSE), mean absolute error (MAE), and coefficient of determination (R-squared) are used as evaluation criteria for the model. These are then used to adjust model parameters and optimize the model.

[0042] The formula for calculating MSE is:

[0043] Where y represents the true value. This represents the predicted value. The smaller the MSE value, the better the model's prediction performance.

[0044] The RMSE calculation formula is as follows:

[0045] in, Let y be the predicted value and y be the actual value, respectively. The smaller the RMSE value, the better the model's prediction performance.

[0046] The MAE calculation formula is as follows:

[0047] in, y and y represent the predicted and actual values, respectively. The smaller the MAE value, the better the model's prediction performance.

[0048] The The calculation formula is:

[0049] in, y and y' are the predicted and actual values, respectively. The closer the value is to 1, the better the model fits.

[0050] The ensemble prediction module is used to obtain the final prediction. The prediction results of each component are re-superimposed to obtain the final prediction result, and then inverse normalization is used to obtain the final result.

[0051] The parameters required to initialize the model are shown in Table 1.

[0052]

[0053] Furthermore, the prediction output module is used to visualize the stock price prediction results. For example... Figure 3 As shown.

[0054] Combination Figure 1 The software architecture of this stock system includes a Web layer, a Django backend application layer, a data service layer, a data analysis layer, and a data persistence layer.

[0055] The Web layer is used to display the system interface.

[0056] The Django backend application layer is used for management using the Django framework.

[0057] The data service layer is used to process data, train models, and predict models.

[0058] The data analysis layer is used to analyze data requirements using Spark.

[0059] The data persistence layer is used to store data in HDFS and MySQL.

[0060] The following section evaluates and verifies the proposed stock prediction system based on a hybrid CEEMDAN-CNN-BiLSTM-Attention model using specific stock data. To ensure the randomness of the experiment, daily interactive data of a stock was randomly crawled from Eastmoney.com as the experimental dataset. The crawling script retrieved relevant stock data from January 1, 2021 to April 12, 2024 as the dataset. Five main trading indicators from this dataset were selected as input variables: opening price, closing price, highest price, lowest price, and trading volume, totaling 800 data points as training data. The closing price was used as the output for prediction. Taking the closing price as an example, 200 data points from daily interactive data from April 13, 2024 to January 17, 2025 were obtained as the prediction comparison data.

[0061] The comparison chart of model prediction results is shown below. Figure 3 As shown, CEEMDAN combined with the BiLSTM single model is more biased upwards compared to other models, with the midline closely matching the peak values ​​of the original data, indicating that the features acquired by this model are more easily influenced by the features of the input data. Besides the model proposed in this invention, other models exhibit a certain degree of upward bias in their data predictions compared to the true data values; however, this upward bias gradually decreases with the addition of network layers. The model of this invention is closer to the true values.

[0062] The experimental results are shown in Table 2: The CEEMDAN-CNN-BiLSTM-Attention hybrid model outperforms the BiLSTM model, BiLSTM-Attention, CNN-BiLSTM-Attention, CEEMDAN-BiLSTM, and CEEMDAN-BiLSTM-Attention in all evaluation metrics. This demonstrates that the improved hybrid model of this invention outperforms other models in prediction.

[0063]

[0064] The preferred embodiments of the present invention have been described in detail above. It should be understood that those skilled in the art can make numerous modifications and variations based on the concept of the present invention without creative effort. Therefore, all technical solutions that can be obtained by those skilled in the art based on the concept of the present invention through logical analysis, reasoning, or limited experimentation on the basis of existing technology should be within the scope of protection defined by the claims.

Claims

1. A stock prediction system of a CEEMDAN-CNN-BiLSTM-Attention hybrid algorithm, characterized in that, The system comprises a data acquisition module, a data preprocessing module, a model establishment module and a prediction output module, wherein: The data acquisition module is used to acquire stock data to be predicted; The data preprocessing module preprocesses the acquired stock data; The model establishment module is used to establish a CEEMDAN-CNN-BiLSTM-Attention model, and train and adjust the established CEEMDAN-CNN-BiLSTM-Attention model by using stock data to learn the characteristics and rules of stock price changes; the trained CEEMDAN-CNN-BiLSTM-Attention model is used for stock prediction; The prediction output module is used to output the prediction result of the CEEMDAN-CNN-BiLSTM-Attention model.

2. The stock prediction system of claim 1, wherein, The data acquisition module at least comprises a data crawling submodule and a data storage submodule, wherein: The data crawling submodule is used to acquire stock data; The data storage submodule stores the acquired stock data for subsequent calling.

3. The stock prediction system of claim 2, wherein, The data crawling submodule first crawls the stock market center section data, and then crawls the K-line data corresponding to the stock code according to the stock code or name input by the user.

4. The stock prediction system of claim 1, wherein, The data preprocessing module at least comprises a data cleaning submodule, a data normalization submodule, a data denoising submodule and a data segmentation submodule, wherein: The data cleaning submodule converts the data to meet the requirements of data analysis; The data normalization submodule normalizes the data; The data denoising submodule denoises the data collected by the data acquisition module to eliminate noise and irrelevant information in the data.

5. The stock prediction system of claim 4, wherein, The data denoising submodule uses a Kalman filter to denoise and eliminate noise and irrelevant information in the data.

6. The stock prediction system of claim 1, wherein the CEEMDAN-CNN-BiLSTM-Attention hybrid algorithm is characterized by, The CEEMDAN-CNN-BiLSTM-Attention model comprises a CEEMDAN data decomposition and reconstruction module, a feature extraction module, a time series analysis processing module, an attention allocation module, a trend prediction module, a performance evaluation module and an ensemble prediction module, wherein: The CEEMDAN data decomposition and reconstruction module decomposes the predicted characteristic value by using CEEMDAN and performs minimum-maximum normalization on the reconstructed data to make a training set and a prediction set; The feature extraction module is composed of a CNN convolutional neural network and is used to identify and extract key features in the stock data; The time series analysis processing module is composed of a BiLSTM neural network, which converts the feature vector extracted from the CNN to a dimension, so that it can be fully utilized by the BiLSTM to learn the long dependence relationship in the stock data by using all the data in the input sequence; The attention allocation module uses an attention mechanism to calculate the influence degree of data at different time points in the sequence on the prediction result, and then determines the importance of the data at each time point; the model can focus on the information with the largest prediction contribution; The trend prediction module inputs the attention-weighted feature data into a full connection layer for generating a final stock trend prediction result; The performance evaluation module evaluates the constructed CEEMDAN-CNN-BiLSTM-Attention model, adjusts model parameters according to the evaluation, and optimizes the model; The ensemble prediction module superimposes the prediction results of each component to obtain a final prediction result, and then uses inverse normalization to obtain a final prediction result.

7. The stock prediction system of claim 6, wherein, The performance evaluation module uses mean square error (MSE), root mean square error (RMSE), mean absolute error (MAE), and determination coefficient (R-square) as the evaluation standard of the model.

8. The stock prediction system of claim 6, wherein the CEEMDAN-CNN-BiLSTM-Attention hybrid algorithm is characterized by, The processing process in the CEEMDAN data decomposition and reconstruction module includes: S1, decomposition: through the CEEMDAN algorithm, the original nonlinear and non-stationary time series data is decomposed into six IMF components and a residual term R; S2, reconstruction: using the run determination method, the IMF components are reconstructed into high-frequency components, low-frequency components and trend components; S3, normalization processing: the reconstructed data is normalized; S4, data segmentation: the training set and the test set are segmented according to a certain proportion.

9. The stock prediction system of claim 1, wherein the CEEMDAN-CNN-BiLSTM-Attention hybrid algorithm is characterized by, The prediction output module is used for visual display of the stock price prediction result.

10. A stock prediction method characterized by, The stock prediction system of claim 1 is used for stock prediction.