Stock market abnormity early warning method based on multilevel encoder-decoder architecture

Through the multi-level encoder-decoder architecture and Informer model combined with logistic regression and ridge regression algorithm, multi-source information is processed, and the problems of insufficient consideration of diversification factors and poor prediction effect in the existing technology are solved, and the stock market is realized Accurate early warning and evaluation of abnormalities improves the comprehensiveness and accuracy of predictions.

CN118917941APending Publication Date: 2024-11-08EAST CHINA NORMAL UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410883358.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

The existing stock market forecasting methods lack consideration of diversification factors, are difficult to deal with unstructured information, and a single model such as LSTM has insufficient prediction accuracy and interpretability, resulting in complex market anomaly prediction and evaluation.

Method used

Using a multi-level encoder-decoder architecture combined with the Informer model, the logistic regression and ridge regression algorithm are integrated to build an abnormality evaluation model, process multi-source information through a global attention mechanism, consider historical stock prices, public opinion and economic indicators, and establish specific stock anomalies. Evaluate the model to improve the comprehensiveness and accuracy of the prediction.

Benefits of technology

It realizes a quantitative warning of stock market abnormalities, enhances the model's perception of market dynamics, solves the problem of poor prediction effect of a single model, improves the accuracy and credibility of prediction, and has good commercial development value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118917941A_ABST
    Figure CN118917941A_ABST
Patent Text Reader

Abstract

The invention discloses a stock market abnormity early warning method based on a multi-level encoder-decoder architecture, and the method is characterized in that the method comprises the steps: constructing a multi-scale stock information prediction model, a stock abnormity evaluation model, and a market abnormity evaluation model, and the like: employing an Informer model to organize financial index data, the method comprises the following steps: weighting public opinions and various financial indexes by utilizing an attention mechanism, evaluating and predicting stock data, constructing an anomaly evaluation model through logistic regression and ridge regression algorithms, evaluating by utilizing factors such as volatility and sales amount, and evaluating the stock anomaly through a relation model of credibility and prediction sequence length in combination with the stock anomaly evaluation model. And constructing a stock market anomaly evaluation model. Compared with the prior art, the method has the advantages that financial background, public opinions and stock trend factors are comprehensively predicted and analyzed, the problem that a single model such as LSTM is poor in stock prediction effect is solved, the final anomaly analysis accuracy is guaranteed from the priori knowledge perspective of prediction accuracy, and the method has good application prospects and commercial value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of financial data analysis and processing, and in particular to a stock market abnormality early warning method based on a multi-level encoder-decoder architecture that integrates financial data collection, data processing and data analysis. Background Art

[0002] With the continuous development of information technology and data analysis methods, the current stock market investors have an increasing demand for abnormal warnings. However, traditional stock prediction methods have a series of limitations, mainly manifested in insufficient consideration of diversified factors and low adaptability to market dynamics. The current mainstream stock market prediction methods mainly rely on a single model, such as LSTM and other deep learning models. These models often only focus on historical stock price data and cannot fully consider the impact of external factors on the market. At the same time, traditional models have difficulties in processing unstructured information (such as public opinion data), making it difficult to achieve comprehensive market anomaly analysis. Therefore, improving the accuracy and comprehensiveness of predictions has become one of the research difficulties in the development of current stock market prediction technology.

[0003] In the current stock market investment field, time series prediction is a crucial task. Mainstream time series prediction models include traditional statistical models such as ARIMA (autoregressive integrated moving average model) and deep learning models such as LSTM (long short-term memory network). These models have improved the accuracy of historical stock price prediction to a certain extent, but there are still some problems. Traditional statistical models perform poorly when dealing with nonlinear and non-stationary data, while deep learning models often have large data requirements and lack the interpretability of the model prediction process. At the same time, in terms of market anomaly judgment, common methods mainly include machine learning methods such as logistic regression and ridge regression, as well as attempts to construct market health indicators. Algorithms such as logistic regression and ridge regression predict anomalies by building models, but they have certain limitations when dealing with large amounts of unstructured data. The construction of market health indicators aims to evaluate the overall state of the market by integrating various market information, but the establishment of these indicators lacks unified standards and is subjective and uncertain.

[0004] In summary, although existing technologies have made some progress, market anomaly prediction and assessment is still a complex problem that requires a more comprehensive and in-depth approach. Summary of the invention

[0005] The purpose of the present invention is to provide a stock market anomaly warning method based on a multi-level encoder-decoder architecture for the deficiencies of the prior art. The method adopts mainstream time series prediction methods such as a multi-level Encoder-Decoder architecture and an Informer model, and uses a constructed accurate anomaly assessment model and a stock market anomaly assessment model. The anomaly is predicted by algorithms such as logistic regression and ridge regression, and a relationship model between credibility and prediction sequence length, as well as a specific stock anomaly assessment model constructed by volatility and sell-off amount. The method comprehensively considers multiple factors, guarantees the accuracy of the final anomaly analysis from the perspective of prior knowledge of prediction accuracy, and takes into account linear and nonlinear, stable and non-stationary situations when processing historical stock price data to improve the comprehensiveness and accuracy of the prediction. At the same time, by introducing a global attention mechanism, the influence of multi-source information is weighted, and the model's perception of market dynamics is enhanced. The method is simple, and the financial background, public opinion and stock trend factors are comprehensively predicted and analyzed, which better solves the problem of poor stock prediction effect of a single model such as LSTM, and has good application prospects and commercial development value.

[0006] The specific technical solution to achieve the purpose of the present invention is: a stock market abnormality early warning method based on a multi-level encoder-decoder architecture, which is characterized in that the method combines the advantages of multiple models and incorporates most of the stock market influencing factors into the model for analysis, and specifically includes the following steps:

[0007] Step a: Construct a multi-scale stock information prediction model;

[0008] Step b: Construct a stock valuation model;

[0009] Step c: Construct a market evaluation model;

[0010] Step d: Input the structured data into the consumption prediction model for prediction, use the stock evaluation model to evaluate the prediction results, and use the market evaluation model to evaluate the market.

[0011] The method involves a new model that can be divided into multiple levels. These sub-levels are used to process information including public opinion, economic indicators such as CPI, company fundamentals, and investor sentiment.

[0012] The step a of constructing a multi-scale stock information prediction model includes the following sub-steps:

[0013] a1: Organize historical stock data, divide the data into training set and test set, and clean the data.

[0014] a2: Use the Informer model and set parameters, including data name, prediction type, data resampling, input, prior and prediction sequence length, number of heads of the multi-head attention mechanism, early stopping strategy, and use GPU to accelerate training. The loss function uses the mean absolute error (MAE). The output value is calculated using the forward propagation method, and the parameters of the Informer model are optimized using the gradient descent algorithm.

[0015] a3: Organize the financial indicator data and divide the data into training set and test set. Use the maximum-minimum scaling algorithm to normalize the data set. Use the principal component analysis method (PCA) to reduce the dimension of the data. Call the integrated moving average autoregressive model (ARIMA model) to predict the financial indicator data.

[0016] a4: Collect public opinions related to stocks, organize public opinion data using large language models, quantify public opinions through text sentiment analysis technology, and evaluate their impact on specific stocks.

[0017] a5: Use the global attention mechanism to process public opinion and multiple financial indicator data to quantify the impact on stock prices and trading volumes.

[0018] The data required for step a1 uses appropriate indicators inside and outside the financial system. The data include but are not limited to historical stock price data, news text data, relevant corporate financial statements, GDP, CPI, PMI, PPI and other economic data. The data can be preliminarily processed, including but not limited to: processing missing values, removing outliers and standardizing data.

[0019] The step b of constructing the stock valuation model includes the following sub-steps:

[0020] b1: Input financial data into the multi-scale stock information prediction model to predict future stock market data, macroeconomic indicators, and microeconomic indicators.

[0021] b2: Construct the loss function of the logistic regression algorithm and process the prediction index data generated by the prediction module through L2 regularization;

[0022] b3: Use the ridge regression algorithm to train and fit the evaluation model of a certain stock, adjust the regularization strength, and use the test set to test and evaluate the model.

[0023] The market evaluation model is established in step c, including the following sub-steps:

[0024] c1: Build a relationship model between credibility and prediction sequence length (unit: day), fit the model through linear regression machine learning algorithm, and adjust the weight parameters.

[0025] c2: A valuation model for a certain stock is constructed through volatility and sell-off amount, the analysis parameters are simplified, and the degree of future market risk is quantified from only three perspectives: trading volume, downward market trend, and volatility.

[0026] c3: Construct a market valuation model through prediction credibility and stock valuation model.

[0027] Compared with the prior art, the present invention has the following beneficial technical effects and significant technical progress:

[0028] 1) Quantified stock market anomalies and created an anomaly warning system for specific stocks and markets;

[0029] 2) Comprehensively predict and analyze financial background, public opinion and stock trend factors, solving the problem of poor stock prediction effect of single models such as LSTM.

[0030] 3) A credibility analysis is proposed to ensure the accuracy of the final anomaly analysis from the perspective of prior knowledge of prediction accuracy.

[0031] 4) The method is simple and has good application prospects and commercial development value. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 It is a flow chart of the present invention;

[0033] Figure 2 A model diagram of multi-scale stock information market anomaly prediction based on the architecture of the present invention;

[0034] Figure 3 This is the flow chart of the multi-scale stock information prediction model;

[0035] Figure 4 Flowchart of gradient descent for forward propagation;

[0036] Figure 5 This is a graph showing how sentiment analysis of financial text changes over time in Example 1;

[0037] Figure 6 This is a comparison chart of the actual stock price and sentiment score in Example 1;

[0038] Figure 7 Flowchart of the model for stock valuation;

[0039] Figure 8 Flowchart of the market assessment model;

[0040] Fig. 9 This is a curve diagram of the danger level predicted in Example 1. DETAILED DESCRIPTION

[0041] The present invention is further described in detail with reference to the following specific examples and drawings. The process, conditions, experimental methods, etc. for implementing the present invention, except for the contents specifically mentioned below, are all common knowledge and common common sense in the art and are not particularly limited by the present invention.

[0042] Example 1

[0043] See also Figure 1 , follow the steps below to conduct abnormal warning of the stock market:

[0044] S1. Construct a multi-scale stock information prediction model;

[0045] S2. Construct a stock valuation model;

[0046] S3. Build a market evaluation model;

[0047] S4, inputting the structured data into the multi-scale stock information prediction model for prediction, using the stock evaluation model to evaluate the prediction results, and using the market evaluation model to evaluate the market;

[0048] See also Figure 2-3 The step S1 of constructing a multi-scale stock information prediction model specifically includes the following steps:

[0049] Step A1: Stock data collection

[0050] We sort out the basic data of each stock from 2010 to 2024, use the stock price data from 2010 to 2023 as the training set, and the data from 2023 to 2024 as the test set, and extract the trading characteristics of the stock on a trading day into the opening price. open 、Closing pricePrice close 、Highest Price high 、Lowest Price low , selling volume S and buying volume B. Among these data, the closing price is generally used to represent the stock price on that day. The set Price of the opening price, closing price, highest price and lowest price of a stock at the tth time node is expressed by the following formula (j):

[0051] Price t =(Price open , Price close , Price high , Price low ) (j).

[0052] Therefore, in a continuous period of time, a certain stock will generate a sequence of closing prices. This continuous price sequence is represented by the following formula (k):

[0053] p1, p2, ...p T (k).

[0054] Clean the stock data, including date verification and data inspection. First, load the stock data from a file or other data source. Take a CSV file as an example and use the pandas library in Python to load the data. Make sure the data type of each column is correct. Check that the date column should be a date type, and the opening price, closing price, highest price, lowest price, and trading volume should be numeric types.

[0055] Perform outlier processing and delete the data during the time when the stock market is not open, that is, delete the data during the holiday period. Delete the rows with default values, but if only one data in a row is missing, fill it with the previous valid value. Check and delete duplicate rows to ensure the uniqueness and accuracy of the data. Check the logic of the data. The opening price should be between the highest price and the lowest price, and the closing price should be between the highest price and the lowest price.

[0056] Add the feature value and calculate the closing price percentage change and moving average using the following formulas (m) to (n):

[0057]

[0058] Among them, Close(t) represents the closing price of the tth day, Close(t-1) represents the closing price of the t-1th day, SMA N (t) represents the N-day simple moving average of the t-th day, N is the time window size of the moving average, such as 5 days or 10 days, and Close(ti) represents the closing price of the ti-th day.

[0059] The original data sample is shown in Table 1 below:

[0060] Table 1. Sample of original data

[0061]

[0062] The processed data samples are shown in Table 2 below:

[0063] Table 2 Processed data samples

[0064]

[0065]

[0066] Close_pct_change: Indicates the daily rate of change of the closing price.

[0067] MA_5: represents the 5-day simple moving average.

[0068] MA_10: represents the 10-day simple moving average.

[0069] Step A2: Call the Informer model

[0070] Set the main function to read parameters. The main parameters include data name, prediction type, data resampling, input sequence length, prior sequence length, prediction sequence length, number of heads of multi-head attention mechanism, early stopping strategy and loss function calculation method. Use GPU to accelerate the training model. Use mean absolute error (MAE) as the loss function. The mean absolute error MAE is calculated by the following formula (o):

[0071]

[0072] Where n is the sample size, which represents the number of observations in the data set; y i is the actual observed value, which represents the true output of the sample; Represents the model's predicted output for the sample.

[0073] See also Figure 4 , train and adjust the Informer model, calculate the output value in the forward propagation manner, and use the gradient descent algorithm to reduce the value of the loss function, so as to find the local minimum loss value.

[0074] Step A3: Obtain financial indexes related to the stock market

[0075] Use Python or other feasible languages ​​to obtain financial indicator data related to the stock market, including GDP, CPI, PMI, PPI, investor sentiment, urban fixed asset investment, housing price index, business prosperity and entrepreneur confidence index, industrial added value growth, enterprise commodity price index, and money supply. Use data from 2010 to 2023 as a training set and data from 2023 to 2024 as a test set.

[0076] Normalize the training set and test set data, and use the following formula (p) to map the numerical ranges of different features to a unified range through min-max scaling to eliminate the scale differences between different features:

[0077]

[0078] Among them, X scaled is the scaled eigenvalue and X scaled ∈[0,1]; X is the original eigenvalue; X min is the minimum value among the eigenvalues; X max is the maximum value among the eigenvalues.

[0079] Use principal component analysis (PCA) to reduce dimensionality and reduce prediction errors caused by multicollinearity of data. The following is a code example of using principal component analysis in the numpy module:

[0080] import numpy as np

[0081] from sklearn.decomposition import PCA

[0082] import pandas as pd

[0083] np.random.seed(42)

[0084] data = np.random.rand(100,12)

[0085] columns=['GDP','CPI','PMI','PPI','Investor_Sentiment',

[0086] 'Urban_Fixed_Asset_Investment','House_Price_Index',

[0087] 'Business_Confidence_Index','Industrial_Value_Added_Growth',

[0088] 'Enterprise_Commodity_Price_Index','Money_Supply']

[0089] df=pd.DataFrame(data,columns=columns)

[0090] num_components = num_c

[0091] pca=PCA(n_components=num_components)

[0092] pca_result=pca.fit_transform(df)

[0093] columns_pca=[f'PC{i+1}'for iin range(num_components)]

[0094] df_pca=pd.DataFrame(data=pca_result,columns=columns_pca)

[0095] explained_variance_ratio=pca.explained_variance_ratio_

[0096] print(explained_variance_ratio)

[0097] Call the difference integrated moving average autoregressive model (ARIMA model), set it to use second-order differences to get smoother data, and input the data obtained after principal component analysis into the model for prediction. The following is a code example of using python to call the AIRMA model:

[0098] order = (1,1,1)

[0099] model=ARIMA(train,order=order)

[0100] fit_model = model.fit()

[0101] forecast_steps = len(test)

[0102] predictions=fit_model.predict(start=len(train),end=len(train)+forecast_steps-1,typ='levels')

[0103] Step A4: Use the big model to collect news and public opinions related to the stock market on the Internet

[0104] Referring to the news feature extraction method proposed by Zeya Zhang et al. in the article Stock Prediction: a method based on extraction of news features and recurrent neural networks, the following sequence is used to represent a continuous period of news text:

[0105] d1, d2, ..., d T

[0106] The probability of word w appearing in the document set is denoted as p(w), and the point mutual information between two words w and v is denoted as pmi(w, v), which is expressed by the following (q) to (r):

[0107]

[0108] From a priori perspective, we obtain favorable keywords and unfavorable keywords, which are represented by the favorable set P shown in the following (s) to (t) formulas: seed and negative set N seed . :

[0109]

[0110]

[0111] Define the standard positive set P and the standard negative set N, as well as the positive polarity polar(w) of word w on P and N, where P std and N std As shown in the following formulas (b) to (c):

[0112] P std ={w p1 , w p2 ,...,w pK} (b);

[0113] N std ={w n1 , w n2 ,...,w nK} (c).

[0114] Among them, P std It is a standard positive collection; N std is a standard negative set; w p1 For favorable keywords; w n1 It is a negative keyword.

[0115] For the news on the i-th trading day Its characteristics f(doc i ) is expressed by the following formula (u):

[0116]

[0117] in, is the sentiment intensity of the news on the i-th trading day.

[0118] Use the average value to calculate the positive or negative news λ of the i-th trading day i , using the σ activation function to convert λ i Mapped to the interval [-1, 1]. The closer to 1, the more favorable the impact, and the closer to -1, the more unfavorable the impact.

[0119] Step A5: Calculate the impact of external data on stocks

[0120] The global attention mechanism is used to analyze GDP, CPI, PMI, PPI, investor sentiment, urban fixed asset investment, housing price index, business prosperity and entrepreneur confidence index, industrial added value growth, enterprise commodity price index, money supply and positive or negative λ. i All parameters are weighted to obtain the impact of external data on stocks as λ.

[0121] The stock prediction price of the hidden layer is expressed by the following formula (v):

[0122]

[0123] The final result is re-weighted according to the changes in the data in the hidden layer.

[0124] See also Figure 5 , shows the changes in the sentiment scores of financial texts over a period of time. The sentiment scores range from -1 to 1, and the red dotted line indicates the horizontal line with a sentiment score of 0.

[0125] See also Figure 6 , comparing the stock closing price and sentiment score, the green line represents the stock price, the blue line represents the sentiment score, the vertical axis on the right always shows the sentiment score, and is represented by the following (w) formula:

[0126] FC=f(h price ) (w).

[0127] See also Figure 7 The step S2 of constructing the stock evaluation model specifically includes the following steps:

[0128] S2-1: Use the multi-scale stock information prediction model to predict stock market data, macroeconomic indicators, and microeconomic indicators. The indicators that need to be calculated through the predicted data include:

[0129] 1) The market average price-to-earnings ratio is calculated as shown in the following (x-1) formula:

[0130]

[0131] 2) The year-on-year growth rate of broad money M2 is calculated as shown in the following formula (x-2):

[0132]

[0133] 3) The total volume of stock market transactions is calculated using the following formula (x-3):

[0134] Total stock market transaction volume = total purchase volume + total sale volume (x-3).

[0135] 4) The change rate of total market transaction volume is calculated by the following formula (x-4):

[0136]

[0137] 5) The rise and fall of individual stocks is calculated by the following formula (x-5):

[0138]

[0139] 6) The rate of change of trading volume of individual stocks is calculated by the following formula (x-6):

[0140]

[0141] 7) The change rate of individual stock turnover rate is calculated by the following formula (x-7):

[0142]

[0143] 8) The number of daily limit increases is calculated using the following formula (x-8):

[0144]

[0145] 9) The number of limit downs is calculated by the following formula (x-9):

[0146]

[0147] Step B2: Construct the loss function of the logistic regression model represented by the following formula (y):

[0148]

[0149] Among them, p is the probability that a certain stock is in a relatively dangerous state; x1, x2, ..., x n is the input feature, namely, the average price-earnings ratio of the market, the year-on-year growth rate of broad money M2, the total volume of stock market transactions, the change rate of the total volume of market transactions, the rise and fall of individual stocks, the change rate of individual stock transaction volume, the change rate of individual stock turnover rate, the number of daily limit increases, and the number of daily limit decreases; β0, β1,..., β n are model parameters.

[0150] The prediction indicator data generated by the prediction module is processed by L2 regularization. Regularization is used to reduce the multicollinearity between indicators. The historical data related to stocks in 2022 is used as the training set, and the historical data related to stocks in the first half of 2023 is used as the test set. The loss function plus the L2 regularization term is shown in the following formula (z):

[0151]

[0152] Among them, w i is the model parameter and λ is the regularization strength.

[0153] Step B3: Use the training set to train the ridge regression model and adjust the regularization strength λ

[0154] Select a series of possible λ values, denoted as α, starting from a small value and then gradually increasing. Use the training data set to fit the model under different α values, and evaluate the model performance through performance indicators such as mean squared error on the validation set. Select the α that obtains the minimum error on the validation set as λ. Use λ to fit the entire training data and evaluate the performance of the model on the test set.

[0155] See also Figure 8 ,Constructing the stock market evaluation model specifically includes the following steps.

[0156] c1: Assume that the credibility of stock market forecast is related to the number of forecast days, and quantify their relationship as shown in the following formula (I):

[0157]

[0158] Among them, C is the reliability of the prediction, l history is the time span of historical data used in training, l future is the time span from a future day to the present. The above formula is the credibility prediction model. λ1, λ2, b, and c are all weight parameters. According to the actual data obtained, the credibility is expressed by the ratio of the actual value to the deviation value as shown in the following formula (II):

[0159]

[0160] Select a reasonable linear regression machine learning algorithm and set the loss function from the following (III) to:

[0161]

[0162] Use machine learning algorithms to train and fit the prediction credibility model, and adjust the weight parameters λ1, λ2, b, and c in the formula to obtain more accurate prediction results.

[0163] Step C2: Construct a stock valuation model, which involves the calculation of the selling amount and volatility. The average of the opening price and the closing price is used to approximate the stock price at the time of selling, as shown in the following formula (IV):

[0164]

[0165] The selling amount is expressed by the following formula (IV):

[0166] S=Price sold ×Q (IV).

[0167] Among them, S is the selling amount, Price sold is the transaction price and Q is the total number of shares sold.

[0168] The daily rate of return on the future t day is expressed by the following formula (VI):

[0169]

[0170] Among them, Price close,t-1 Indicates the closing price of the previous day, Price close,t Indicates the closing price of the day.

[0171] The average daily rate of return from day t to day n in the future is expressed by the following formula (VII):

[0172]

[0173] The volatility is calculated by the following formula (VIII):

[0174]

[0175] Among them, σ t,n represents the volatility data from the tth to the nth day in the future, r t represents the rate of return on the tth day, and r represents the average rate of return from the tth day to the nth day in the future.

[0176] The stock valuation model is shown in the following formula (IX):

[0177]

[0178] Among them, D represents the risk level of a certain stock, S represents the recent selling amount of the stock, and d drop represents the duration of the stock price drop, and σ represents volatility. w1, w2, and w3 are respectively drop , and σ. This model quantifies the riskiness of stocks from three perspectives: trading volume, falling market trend, and volatility.

[0179] Select a reasonable linear regression machine learning algorithm and set the loss function as shown in the following (X) formula:

[0180]

[0181] Among them, L is the loss function, D predict The risk level obtained for the predicted data, D real The risk level is derived from actual data.

[0182] Using machine learning algorithm to fit the model, adjusting the weight parameters w1, w2, w3 in the model, the risk assessment model of the stock market is expressed as the following formula (XI):

[0183]

[0184] in, represents the riskiness of the stock market, D represents the riskiness of a single stock, total represents the total number of stocks, f(F) is a function that measures the quality of macroeconomic indicators, η1 and η2 are the weighted riskiness of stocks and the weights of the quality of macroeconomic data.

[0185] Select a reasonable linear regression machine learning algorithm and set the loss function from the following formula (XII) as:

[0186]

[0187] Where L is the loss function, The risk level calculated for the predicted data is The risk level is derived from actual data.

[0188] Use machine learning algorithms to fit the model and adjust the η1 and η2 weight parameters in the model.

[0189] Step C3: Using the prior prediction accuracy model, the credible risk model is set to the following formula (XIII):

[0190]

[0191] Among them, TW is the credible risk, is the average prediction accuracy, The value of TW is used to indicate the future abnormal situation of the stock market.

[0192] Step C4: Setting the decision threshold

[0193] The abnormality level is divided according to the credibility risk. When the credibility risk is less than 1%, it is judged as low abnormality; when the credibility risk is between 1% and 15%, it is judged as medium abnormality; when the credibility risk is greater than or equal to 15%, it is judged as high abnormality. If it is judged as low abnormality, it means that the stock market is in a stable state; if it is judged as medium abnormality, it means that the stock market may be in a volatile state; if it is judged as high abnormality, it means that there is a large potential abnormality in the stock market.

[0194] See also Fig. 9,The figure shows the predicted and actually calculated danger levels, and the danger thresholds are marked with lines of different colors. The blue line represents the predicted danger level, the red line represents the actual danger level, the green line represents the low danger threshold (1%), and the orange line represents the medium and high danger threshold (15%).

[0195] The above is only a preferred implementation of the present invention and does not limit the present invention in any form. Therefore, any simple modification, equivalent change and modification made to the above implementation method based on the technical essence of the present invention without departing from the content of the technical solution of the present invention shall be included in the scope of the claims of this patent as long as it is an equivalent implementation of the present invention.

Claims

1. A stock market abnormality early warning method based on a multi-level encoder-decoder architecture, characterized in that: The method specifically comprises the following steps: Step a: Construct a multi-scale stock information prediction model a1: Divide the stock historical data into training set and test set, and clean the stock historical data; a2: Set the main function of the Informer model to read: data name, prediction type, data resampling, input, prior, prediction sequence length, number of heads of the multi-head attention mechanism, early stopping strategy, and use GPU accelerated training. The loss function of the GPU accelerated training uses the mean absolute error, uses the forward propagation method to calculate the output value, and uses the gradient descent algorithm to optimize the parameters of the Informer model; a3: Divide the financial indicator data into training set and test set, use the maximum-minimum scaling algorithm to normalize the data set, use the principal component analysis method to reduce the dimension of the data, and call the integrated moving average autoregressive model to predict the financial indicator data; a4: Use a large language model to organize public opinion data, quantify public opinion through text sentiment analysis, and evaluate its impact on specific stocks: a5: Use the global attention mechanism to process public opinion and multiple financial indicator data to quantify the impact on stock prices and trading volumes; a6: Use the global attention mechanism to process public opinion and multiple financial indicator data to quantify the impact on stock prices and trading volumes; Step b: Build a stock valuation model b1: Input financial data into the multi-scale stock information prediction model to predict future stock market data, macroeconomic indicators and microeconomic indicators; b2: Construct the loss function of the logistic regression algorithm and process the prediction index data generated by the multi-scale stock information prediction module through L2 regularization; b3: Use the ridge regression algorithm to train and fit the evaluation model of a certain stock, adjust the regularization strength, and use the test set to test and evaluate the multi-scale stock information prediction model; Step c: Build a market assessment model c1: Construct a relationship model between prediction credibility and prediction sequence length, fit the model through a linear regression machine learning algorithm, and adjust the weight parameters. The prediction sequence length unit is day; the quantitative stock market prediction credibility C is calculated by the following formula (e): Among them, C is the credibility of the prediction; l is the time span of historical data used in training; l is the time span from a certain day in the future to the present; c is the number of days for prediction; c2: Build a stock valuation model based on volatility and sell-offs, and use trading volume, downtrend, and volatility to quantify the risk of future stock markets c3: A market evaluation model is constructed by predicting credibility and a stock evaluation model, and a credible risk TW is used to represent abnormal situations in the future of the stock market. The credible risk TW is calculated by the following formula (h): in, is the average prediction accuracy, is the risk level of the stock market; Step d: Input the structured data into the multi-scale prediction model for prediction, use the stock evaluation model to evaluate the prediction results, and use the market evaluation model to evaluate the market.

2. The method for stock market abnormality early warning based on a multi-level encoder-decoder architecture according to claim 1, characterized in that: The step a1 includes: loading the stock data, ensuring that the data type of each column is correct, and performing outlier processing including deleting data in holiday time periods, filling missing values, deleting duplicate rows, checking data logic, and adding the closing price change rate and moving average.

3. The method for stock market abnormality early warning based on a multi-level encoder-decoder architecture according to claim 1, characterized in that: The step b1 calculates the market average price-earnings ratio, the year-on-year growth rate of broad money M2, the total stock market transactions, the change rate of the total market transactions, the rise and fall of individual stocks, the change rate of individual stock transaction volume, the change rate of individual stock turnover rate, the number of daily limit increases and the number of daily limit decreases through the predicted data.

4. The method for stock market abnormality early warning based on a multi-level encoder-decoder architecture according to claim 1, characterized in that: The step c1 includes constructing a prediction credibility model, and based on the obtained real data, using the credibility represented by the ratio of the actual value to the deviation value, training and fitting the prediction credibility model through a machine learning algorithm, and adjusting the weights of the stock weighted risk and macroeconomic data.

5. The method for stock market abnormality early warning based on a multi-level encoder-decoder architecture according to claim 1, characterized in that: The step c2 includes: calculating the average of the opening price and the closing price to approximate the stock price at the time of selling, calculating the average daily return rate and volatility from t to n days in the future, constructing a stock risk model and performing linear regression fitting.

6. The method for stock market abnormality early warning based on a multi-level encoder-decoder architecture according to claim 1, characterized in that: The step c3 includes: using a priori prediction accuracy model, setting a credible risk model, adjusting the model weight parameters through a linear regression algorithm, dividing the abnormality levels, and determining the future abnormal situation of the stock market.

7. The method for stock market abnormality early warning based on a multi-level encoder-decoder architecture according to claim 1, characterized in that: The step a4 defines a standard positive set P and a standard negative set N, and the positive polarity polar(w) of word w on P and N is calculated by the following formula (a): Among them, P std Standard positive set; N std Standard bearish set; The P std It is expressed by the following formula (b): P std ={w p1 ,w p2 ,...,w pK } (b); The N std It is expressed by the following formula (c): N std ={w n1 ,w n2 ,...,w nK } (c); Among them, w p1 For favorable keywords; w n1 It is a negative keyword.

8. The method for stock market abnormality early warning based on a multi-level encoder-decoder architecture according to claim 1, characterized in that: The step b2 calculates the prediction index data by the following formula (d): Among them, Loss is the loss function; w i is the model parameter; λ is the regularization strength.

9. The method for stock market abnormality early warning based on a multi-level encoder-decoder architecture according to claim 1, characterized in that: The risk level in step c2 is calculated by the following formula (g): in, is the risk level of a single stock; total is the total number of stocks; f(F) is the function for measuring macroeconomic indicators; η1 and η2 are the weighted risk levels of stocks and the weights of macroeconomic data.

Citation Information

Cited By

  • Industrial multi-dimensional time sequence anomaly detection method based on multi-granularity overall period reconstruction

    CN121144699A