Financial Crisis Prediction Based on Long-Term and Short-Term Memory Neural Network

Enterprise ﬁ nancial crisis prediction analysis can predict the business process of enterprises, so that enterprises can take corresponding strategies in time. The ﬁ nancial crisis prediction of listed companies can e ﬀ ectively re ﬂ ect the business situation, so as to give investors reasonable investment advice. In order to supervise the sustainable management ability of enterprises e ﬃ ciently and accurately, this paper proposed a ﬁ nancial crisis prediction method based on long-term and short-term memory neural network, so as to provide valuable information for decision-makers. Firstly, the data in the enterprise ﬁ nancial system is analyzed and extracted, and the original data is cleaned and dimensionalized by normalization and feature selection. Then, the long-term and short-term memory neural network is used to build the ﬁ nancial early warning model, and the wolf pack algorithm is used to optimize the initial weight and bias parameters, so as to improve the e ﬃ ciency of parameter optimization. Finally, the ﬁ nancial data of 20 large- and medium-sized enterprises from 2019 to 2021 are veri ﬁ ed and analyzed. The experimental results show that compared with other common machine learning methods, the constructed wolf pack-optimized long-term and short-term memory neural network has the highest prediction performance in terms of root mean square error and goodness of ﬁ t, with the goodness of ﬁ t reaching 94.2%.


Introduction
In an expanding global market, enterprises have more opportunities for growth but at the same time face more serious challenges and crises. At present, there are many cases of enterprises falling into difficulties due to financial crises. On the other hand, with the rapid development of information technology, databases, networks, data mining, and other technologies are becoming increasingly mature, making it possible to build an efficient financial forecasting system. In today's era of big data, it has become an inevitable trend to maintain the survival of enterprises and social stability by accurately and objectively digging out the financial situation of enterprises from the vast amount of enterprise data.
However, the amount of enterprise financial data is huge, and it will change rapidly with time, which makes the analysis of enterprise financial data very difficult. In recent years, due to the wide use of big data platform, the method of solving complex problems through big data analysis technology has been deeply applied in enterprise financial analysis [1][2][3][4][5]. Financial analysis based on big data learning can complete the training and analysis of high-dimensional financial data and obtain effective training results. More importantly, the big data learning algorithm can not only solve the problem of timeliness of forecasting but also keep the relationship between historical time series (financial data) and current financial indicators, so as to obtain more accurate financial crisis forecasting results. In order to get a more accurate financial crisis prediction model, many researchers have done in-depth research on crisis prediction by using machine learning technology [6,7]. However, up to now, there is still no general model that can predict the financial crisis well. However, in order to avoid huge economic losses and market shocks caused by frequent financial crises, the demand for reliable financial crisis prediction is increasingly urgent.
With the rise of deep learning technology, some scholars apply deep learning technology to financial crisis prediction and get better performance on test data sets than traditional neural networks. However, the advantages of this technology have not been fully explored by previous methods and models. Among the current depth models, the recurrent neural network (RNN) model based on long short-term memory (LSTM) [8,9] is more suitable for the processing of financialrelated data because it can effectively utilize the long-distance dependent information in serial data. Therefore, this paper tries to apply LSTM model to the field of financial crisis prediction and adopts swarm intelligence algorithm to optimize the bias parameters, so as to improve the efficiency of parameter optimization.

Related Works
The current mainstream approach to financial crisis forecasting is to improve financial management systems to automate data analysis of finances through server-side records, statistics, and calculations in order to quickly obtain value data from the vast amount of financial information and make forecasts.
Machine learning technology, as a hot direction in the computer field, has been closely integrated and applied with the financial field. Using reasonable machine learning technology can solve the problem of efficient and automatic data analysis in financial industry and provide valuable forecast information for managers, thus providing reliable forecast for healthy organization operation. For example, Zhu et al. [10] proposed to use Z-score index decision tree to build a financial crisis prediction model, and the accuracy rate of predicting financial crisis three years in advance reached 75.37%. Ismanto et al. [11] proposed C4.5 decision tree mining algorithm to forecast and analyze the flow of enterprise's operating capital, which is more accurate than the traditional ID3 decision tree algorithm. Yao et al. [12] proposed a financial crisis prediction model based on genetic algorithm and least squares support vector machine, which effectively verified the effectiveness of machine learning technology in financial prediction. However, using the traditional machine learning technology mentioned above to predict the financial situation still has unsatisfactory accuracy, especially for the long-term prediction of complex data samples [13][14][15].
Long-term memory (LSTM) network, as a deep learning model, can dig out the inherent laws in time series data by learning historical data and is more suitable for processing software failure time data. At present, LSTM is mainly used in image recognition, natural language processing, and other fields. For example, Marcella et al. [16] proposed a remarkable attention model based on LSTM network, which can be used to predict the gaze direction of human eyes. Alhagry et al. [17] proposed an EEG emotion recognition model based on LSTM recurrent neural network. Kim H et al. [18] combined LSTM-RNN with computational fluid dynamics simulation to realize rapid and automatic tracking of harmful substances. The above research has shown that LSTM networks are tem-porally recurrent neural networks suitable for processing and predicting the internal patterns of time series data, which fits well with the characteristics of financial data.
Therefore, this paper attempts to use LSTM neural network to predict the financial crisis of enterprises. The main innovations and contributions include the following: (1) try to apply LSTM recurrent neural network architecture, which is excellent in the field of deep learning, to the field of financial crisis prediction, so as to make full use of LSTM's advantages in dealing with historical time series. The time series data of enterprise financial history and the current input data samples are used as the input of activation operation to improve the prediction accuracy of enterprise financial crisis. (2) The wolf pack algorithm is used to optimize the initial weight and bias parameters of LSTM, so as to avoid falling into the local minimum, thus improving its crisis prediction performance.

Data Preprocessing and Sample Generation
In order to continue effective forecast analysis, it is necessary to analyze and extract all kinds of tables and report data in the financial system. The main method is to clean the data, so as to generate data in comma-separated values (CSV) format. This is because the use and format of data in the financial management system are quite different among departments. In addition, there are a lot of redundant data unrelated to financial forecast. Therefore, all the existing reports in the system must be cleaned before data analysis.

Data Cleaning.
Aiming at the problems of missing values, inconsistent formats and repeated contents in financial data, this study adopts four processes to realize data cleaning, as follows: Step 1: complete the missing values. According to the empirical analysis, the condition for judging whether there is a defect is set to 0.8, and the input financial data feature sequence is classified according to the condition of 0.8. And filter and keep the feature column with the condition less than 0.8. It should be noted that the missing value of the deletion sequence here needs to be filled with "0" value Step 2: standardize the format. Standardize the format of the input financial data; for example, the format of the input time of each piece of data is changed to "2020-11-08" Step 3: duplicate content deletion. After the end of step 2, the data is screened for the second time. The purpose of this screening is to eliminate the feature columns with duplicate contents [18][19][20]. It should be noted that one feature column must be kept when eliminating multiple duplicate feature columns in the process, so as to avoid excessive deletion Step 4: delete unnecessary data: Delete the data characteristic columns in the data sample that are not in the financial forecast cycle, thus greatly reducing the data scale to be processed Finally, comma is used to separate the processed data by a fixed length, so as to form text data. This method is beneficial to data dimensionality reduction. 2 Wireless Communications and Mobile Computing 3.2. Feature Selection. The features of each column in the data samples need to be reasonably selected, so as to reflect the required prediction mapping and avoid overfitting, thus strengthening the generalization ability of the model with multiple samples. As the financial forecasting task is a nonlinear application problem, this study tries to use L1 norm regularization which performs well in nonlinear problems to complete feature selection. Firstly, the L1 norm score value of the feature sequence after data cleaning is calculated. Then, the threshold of fitness is set to 0.6, that is to say, the features whose score value is less than 0.6 are filtered out, thus further promoting data dimensionality reduction. Finally, only the key information related to financial business is left in the filtered feature sequence.

Normalization Treatment.
After cleaning and feature selection, the financial data has been effectively dimensionreduced, but the data features still have different value ranges, so the subsequent model prediction cannot be carried out. Therefore, in this study, the samples after cleaning and feature selection are normalized by a simple and quick mean variance normalization method, and the specific calculation formula is as follows: where min represents the lower bound, max represents the upper bound, X represents the input eigenvalue, and X scale represents the normalized eigenvalue.

Sliding Sample Generation.
As financial forecasting is a time-periodic work, it is necessary to set the time span, which is similar to the window frame in graphic image processing mechanism. In this paper, one year is set as the time span to select the data samples by sliding. Too short or too long time span will have certain influence on the prediction performance. One year is the selected value from many experiments. The specific operation process is shown in Figure 1.

Financial Crisis Prediction Based on LSTM
4.1. Structure of LSTM Neural Network. The LSTM neural network structure is based on the recurrent neural network (RNN) structure [21][22][23], which is shown in Figure 2. U, V, and W in Figure 2 are the connection weights of neurons in each layer. As can be seen from Figure 2, the output at time t is related to the hidden layer output at time t − 1 and t − 2 and the input at current time t. The output at each time takes into account the influence of historical time series. The LSTM neural network is generated by improving the recurrent neural network. Compared with RNN, LSTM neural network is more complex in cyclic operation, and it introduces memory nodes and related operations of forgetting gate, as shown in Figure 3.
In Figure 3, σ represents sigmoid function. h t−1 and C t−1 represent hidden layer output and memory node values at time t − 1, respectively. h t and C t represent hidden layer output and memory node output values at time t, respectively.
The expression of forget gate is as follows: where W f and b f represent the forget gate weight matrix and bias, respectively. The expression of the input gate is as follows: where W i and b i , respectively, represent the weight and offset of the input gate. The candidate memory valueC t of the memory node is represented as follows [24]: where W C and b C are the weights and offsets of memory nodes, respectively.
Use the result C t−1 of the forgetting gate at the last moment and the sum of the candidate memory nodes to obtain a new memory node C t . The expression method is as follows: The expression o t of the output gate is as follows: where W o and b o are the weight and offset of output gate, respectively.
Then, the propagation method is optimized according to the wolf pack algorithm, and the weights and offsets are continuously optimized to obtain a stable LSTM neural network model.

Wolf Pack Optimization of Weight Parameters.
In order to reduce the output error of LSTM neural network model, the traditional method mainly uses gradient decreasing method to iterate the initial weight and offset parameters for many times, so as to find the best network architecture. However, the traditional method is easy to fall into the local minimum, which leads to the fact that the accuracy and work efficiency cannot meet the actual requirements.
In order to solve the above problems, this study proposes to adopt the wolf pack algorithm [25] in swarm intelligence algorithm to effectively improve the efficiency of bias parameter optimization. Assume that the average value of the estimation error of personal medical expenses is expressed as follows: where C i represents the prediction error of the i-th financial index.

Wireless Communications and Mobile Computing
For the financial forecasting model, the required fitness function should be the reciprocal of the mean of each financial index (1/ C). Let N represent the number of offset parameters in the prediction model, M represent the total number of wolves, and Q represent the coordinate set of other wolves except the head wolf.
T num wolves are randomly selected as leaders in set Q; then, the migration process of leaders is as follows: Step where h is the direction of migration and S is the weight value. i = 1, 2, ::, T num , and g = 1, 2, ::, h. According to the leader's direction, the migration process of other wolves is as follows: Step where d k is the distance between the k-th wolf and the head wolf and d k ∈ ð0, D k Þ. i = 1, 2, ::, N − T num − 1.
where ω is the distance weight. The distance D k is the basis for wolves to judge whether prey has entered the siege range. Finally, all wolves began to gather towards the target, and the migration process was as follows: Step  Figure 1: Sliding sample generation. Finally, if 1/ C meets the error threshold of the financial prediction model, and R max meet the constraint conditions, the wolf pack optimization process is stopped.

Process of Financial Crisis Prediction.
According to the enterprise financial index data, obtain the enterprise financial crisis forecast sample. Firstly, the sample of enterprise financial crisis prediction is initialized by noise reduction, and then, the enterprise financial crisis prediction model is obtained by training wolf pack-optimized LSTM neural network. The specific process is shown in Figure 4.

Experimental Setup.
In order to analyze and verify the financial crisis prediction method proposed in this paper, a concrete experiment was carried out. The experimental hardware environment is as follows: the processor is Intel Core i7 2.2GHz, the graphics and image processing equipment is GTX970@2G memory, and the memory is 8 G. The experimental software environment is Windows 7 operating system and Matlab7.0 simulation software.
The data set used in the experiment is the real operations of 20 companies for 3 years (2019-2021). The selected 20 enterprises are from manufacturing, financial, and service industries. The financial data of 2019 and 2020 are selected as training samples, and the data of 2021 is selected as testing samples. By comparing the predicted value with the actual financial value in 2021, the accuracy of the financial crisis prediction method is verified. The parameters of LSTM neural network are set as follows: the time step is 12, the latitude of each time cloth is 4, the weights and offsets of memory nodes are 0.3 and 0.1, respectively, and the weights and offsets of the three gate are all 0.2.

Evaluation Indicators.
In order to quantitatively evaluate the performance of financial forecast, this paper selects root mean square error (RMSE) and goodness of fit (R2) as evaluation indicators [26].
RMSE is calculated as follows: where it represents the predicted value and the actual value.

Wireless Communications and Mobile Computing
The calculation method of R2 is as follows: where the value range of R2 is [0,1]. A smaller RMSE and a larger R2 indicate better model prediction results.

Analysis of the Best
Layers of the Model. The comparison of predicted performance under different network layers is shown in Table 1.
As can be seen from Table 1, with the increase of layers, the prediction performance of test set gradually improves. When the number of layers is 3, it is the best, R2 is 98.57%, and RMSE is 1.012e-6. When the number of layers is 4, it begins to decrease again. Therefore, the optimal number of layers is set to 3, and the number of layers of LSTM neural network is set to 3 in subsequent experiments.

Forecast Performance of Asset-Liability Ratio and Gross
Profit Margin of Sales. The realization of financial forecast is mainly based on historical financial data. The financial operation of an enterprise can be judged by the prediction results of important financial indicators. This paper chooses to compare two important indicators of corporate finance in 2021: (1) asset-liability ratio and (2) gross profit margin of sales, and the forecast results are shown in Figures 5 and 6, respectively.
From Figures 5 and 6, it can be seen that the prediction performance of LSTM neural network optimized by wolf pack on the test data set is better for the asset-liability ratio and gross profit margin. It is found that the prediction effect of asset-liability ratio is better than that of sales gross profit margin. In the asset-liability ratio forecast of Figure 5, the deviations of asset-liability ratio forecast of enterprises No. 5,No. 10,and No. 11 are obvious, and the errors of other enterprises are small. On the other hand, in the gross profit margin forecast of Figure 6, the deviation between the forecast and the actual situation is very small. In the forecasting model, the asset-liability ratio and sales gross profit margin threshold can be set separately. In this paper, the asset-liability ratio threshold is set to 1.0, and the sales gross profit margin threshold is set to 0.2. According to the prediction results and threshold setting of LSTM neural network optimized by wolves, the warning tips of crisis are given. For example, enterprises with assetliability ratio greater than 1.0 should pay attention to debt crisis, while enterprises with gross profit margin lower than 0.2 should pay attention to market competition crisis and need to increase product R&D investment to improve product competitiveness.

Comparison of Prediction
Accuracy. Next, the wolf pack optimization LSTM neural network is used to test the financial samples of 20 listed enterprises in 2021. Ten indicators such as property right ratio, business growth rate, asset-liability ratio, and sales gross profit margin are selected as the prediction targets, and the corresponding thresholds are set for early warning. The predicted value exceeds or falls below a set threshold; i.e., a crisis is determined to exist. Enterprise financial crisis prediction results are shown in Table 2. Table 2 shows that the lowest and highest prediction accuracy rates of wolves optimizing LSTM neural network are 85.71% and 100%, respectively. Although the prediction performance of the 13-th enterprise was the worst, from the perspective of RMSE, the enterprise financial crisis prediction stability of wolf pack optimization LSTM neural network was high.  In order to further verify the performance of wolf pack optimization LSTM neural network in the financial crisis prediction of large-scale enterprises, SVM [27], convolutional neural network (CNN) [28], and LSTM neural network [29] were used to predict the financial crisis with 417 alarm data from 300 enterprises, and the results are shown in Figure 7. As shown in Figure 7, the wolf pack-optimized LSTM neural network had the highest prediction accuracy, LSTM neural network took second place, and SVM was the worst. Compared with other models, the wolf pack optimization LSTM neural network has the largest R2 (94.2%) result, which shows that it has obtained the best prediction result, which is completely consistent with the business development trend of the enterprise.

Conclusions
This paper presents a financial crisis prediction method based on wolf pack optimization LSTM neural network. The pretreated financial data were trained using LSTM neural network, and the historical financial data were forgotten and filtered using the forgetting gate and the memory node, so that part of the retained data was substituted into the next neural network training. The optimal initial weights and bias parameters were obtained by the wolf pack optimization algorithm. Taking the accuracy of enterprise financial risk early warning as the fitness function, a stable enterprise financial crisis prediction model is obtained. The proposed method has achieved good prediction results on various evaluation criteria and verified its feasibility. However, the number (dimension) of features in the training and test sample sets is still large, and more efficient dimension reduction using principal component analysis will be considered in the future to further improve the performance of the prediction model.

Data Availability
The experimental data used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
The authors declare that they have no conflicts of interest to report regarding the present study.