Design of Accounting Earnings Forecasting Model Based on Artificial Intelligence

e increasing complexity of the international situation intensies the changes of the economic environment. People’s demand for information represented by accounting earnings, such as judging the protability and risk coecient of the company, is becoming more and more urgent. is study puts forward the theory of predicting accounting earnings through accounting earnings factors in a nonlinear way and designs an accounting earnings forecasting model based on articial intelligence. Integrating LSTM, seq2seq, and reinforcement learning and combining with self-attention like mechanism, a complex multifactor time series forecasting model is established, and reinforcement learning is used to stabilize the model to prevent overtting, which puts forward a new solution to the multifactor time series forecasting problem of complex relationship. e experimental results and comparative analysis show the eectiveness of the enhanced recurrent neural network accounting earnings prediction model designed in this study.


Introduction
As a discipline that provides economic information re ecting the nancial status and operating results of enterprises, accounting re ects the performance of the entrusted responsibilities of the enterprise management by providing the users of nancial accounting reports with accounting information centered on the operation of enterprises, which is helpful for the users of nancial accounting reports to make economic decisions [1][2][3][4][5]. Accounting surplus is the most important concept and index in accounting information. Its decision usefulness is the foundation of nancial accounting and the main means to judge the value of the company [6].
In the information view of accounting, it is considered that the market is incomplete and full of uncertain factors [7]. No accounting method can get the real income of an enterprise, but accounting earnings information is a signal to investors that is helpful to judge and estimate economic income, which can improve the accuracy of investors' prediction of the future situation of the company. e valuation view of accounting further complements the role of accounting earnings information. It is believed that investors will take the corresponding accounting data (with pro t as the core) as the model change when valuing the company, so that the accounting earnings information and stock price a ect each other. In other words, through the value of accounting earnings, we can infer a lot of information related to accounting earnings and use the earnings information to analyze the company's operation, risk, future pro tability, stock price change trend, etc. erefore, the prediction of accounting earnings and the analysis of earnings information have always played a very important role in corporate management, investment, and other economic behaviors. e research of earnings information system can be traced back to the relationship between the intensity of expected income change and stock price adjustment. From the beginning of being concerned to today's research, many scholars have been exploring the correlation between accounting earnings and earnings information based on the company's stock price. In these studies [1,[8][9][10][11], a large number of theoretical and empirical studies show that the relationship between accounting earnings and stock returns (usually expressed by earnings response coefficient) changes alternately. Many studies also found that the stock price will fluctuate in the window period of accounting earnings information announcement such as annual report. In other words, earnings information will have an impact on the expected stock price in the future. At the same time, the stock price will also affect the future surplus.
In the current research, considering the weakness of the linear correlation between accounting earnings and stock return and the limitations of relevant assumptions, scholars have been seeking to establish a nonlinear correlation to uncover the secrets between accounting earnings, stock price, earnings announcement, annual report, and other factors, so as to judge the value of the company and help investors analyze and make decisions. e characteristics of this nonlinear system coincide with the nonlinear properties of neural networks [12,13]. Moreover, accounting earnings and related data are time series data. As a neural network that can display dynamic time series and use its internal memory to process the input sequence of any time series, recurrent neural network (RNN) [14][15][16][17][18][19][20] can predict earnings fluctuation and reflect the stock price behavior at this stage in combination with the influence of different time series data. Reinforcement learning can intelligently solve complex problems, get rid of the constraints of the current theoretical analysis of accounting earnings value, and bring more possibilities for the research and development of earnings information. erefore, driven by artificial intelligence [12][13][14][15][16][17][18][19][20], this paper constructs an overall model of various accounting earnings value related factors, such as earnings (here refers to the specific number of earnings, which can be equivalent to profits), earnings announcement, stock price, assets and liabilities, and company cash flow, based on the neural network for time series and combined with parameter selftuning means such as reinforcement learning. Based on earnings forecasting, an enhanced RNN earnings forecasting model is proposed, which can be nonlinear and can automatically adjust the importance of factors related to earnings value through model learning.

e Basic Idea.
e current two types of models (time series analysis model [21,22] and multiple cross-sectional regression model [23,24]) have their advantages and disadvantages. e time series analysis model can have a more stable output because it considers the dependencies that pass over time. Still, it is also difficult to obtain its data, and the model is too ideal. e multiple regression model based on cross-sectional data starts from reality, considers the correlation between earnings factors, and can achieve a more accurate output than the time series analysis model. However, the limitation of the linear model makes it impossible to include the time-dependent relationship at the same time, and the effect on multiple factors is also limited, so it is limited to instability and further development.
Due to the superiority of RNN in processing time-series data and the excellent ability of the neural network in fitting complex models, we hope to combine the advantages of the time series analysis model and multivariate cross-section regression model. e mainstream research factors of the accounting earnings system are unified into a nonlinear earnings forecasting model. e purpose is to realize an earnings forecast model that can reflect the relationship between accounting earnings factors and output more accurate accounting earnings forecast results by improving and enhancing the RNN infrastructure.
As a model that can transmit data time relationships and input multiple influencing factors simultaneously, RNN has many points to pay attention to when used as the basis of the whole model. e simplest RNN is prone to failure to converge when the factors are too complex; therefore, in the impact of multiple accounting earnings factors, next, this paper forms a preliminary model framework inspired by the multistep prediction based on seq2seq. Here, we use the seq2seq structure to improve LSTM. Because the seq2seq structure is a structure of encoder-decoder, after using seq2seq to improve LSTM, our earnings forecasting model can implement variable-length inputs. In this way, even if the value of each factor related to the value of accounting earnings that we choose is not null, it will not affect the model's output. Another feature of this improved seq2seq structure is that it can use the joint probability of previous values to predict the next value, making the entire prediction model more stable and reflecting the relationship between earnings-related factors.
With the improvement of seq2seq [25,26], we can incorporate many factors related to earnings value into the earnings forecast model. However, many parameters still need to be manually adjusted in the entire forecast model. From this point of view, the model will have similar problems as the multisection regression model: too many parameters, challenging to adjust, and then affect the effect of the model. To address this shortcoming, we use reinforcement learning to improve the whole prediction model. rough reinforcement learning, we can make the whole prediction model adjust through prediction, receiving feedback and feedback. is idea realizes the self-tuning of the prediction model and avoids the problem that the prediction model is difficult to complete the training caused by too many parameter adjustments. Under the guidance of the above improvement ideas, the accounting earnings forecast model is designed as shown in Figure 1, which can represent our earnings forecast's primary process and key steps.

Accounting Earnings Forecast Algorithm Model.
In the above, we have proved the basic idea of the overall model and the main architecture and algorithms used. In this part, we will explain the structure and improvement of each module in detail and introduce the basic model used, the way of improvement, the flow of data in it, process functions etc. We start with the seq2seq structure in the model, first explain the most basic data processing framework, then 2 Scientific Programming introduce the reinforcement learning algorithm based on seq2seq, and further explain the key functions in the model and the improved weighting method.

Improved Seq2seq
Model. In the above, we summarized the types of accounting earnings factors and analyzed the relationship between di erent accounting earnings factors. We explained in Section 2.2 that seq2seq could use the joint probability of prior values to predict the characteristics of the following value. e commonly used seq2seq has two structures. Here, we use the second structure of seq2seq to simulate the characteristics that accounting earnings factors a ect each other and act on the nal forecast value of earnings. Combined with our rst three-level relationship of the surplus factors analyzed in the chapter, we explained the reason for using LSTM in the seq2seq structure before, so we use Figure 2 to represent our nal seq2seq structure. e LSTM cell starts from reading the input data and the two states c t and h t of the previous cycle. z f , z i , and z o are all formed by the input data x t and the previous cycle h t−1 after splicing according to di erent weights through the activation function σ θ ( ). Calculated, these three variables are gated states, the LSTM cell starts from reading the input data x t and the two states c t and h t of the previous cycle. z f , z i , and z o are all formed by the input data x t and the previous cycle h t−1 after splicing according to di erent weights through the activation function σ θ . Calculated, these three variables are gated states, but in fact, the actual input is z calculated by the activation function φ θ . e rst step of LSTM is controlling the input information by the forget gate. We discard the relatively unimportant part of the input data through this step. In this process, the LSTM cell controls the previous cell state c t by calculating z f as the gate of the forget gate removal and retention of information in c t−1 . en, the LSTM cell processes the input, where the input gate z i will control the selective input of x t . In this process, the previously calculated z is performed together with z i , which we express with (2)-(1). e symbol ⊙ represents the multiplication of corresponding elements in the operation matrix.
e output stage will determine all the outputs regarded as the current cycle. Here, z o is used as the output gate. e calculation methods of h t and y t are listed in (2) and (3). In general, y t is obtained by h t transformation.
After processing the encoding part, the encoding vector enters the decoder for actual prediction, and the value of the decoder part is calculated according to the process in Figure 2. Assuming that the encoder part obtains the nal hidden layer state value is h te , the decoder at the time of t+1. e state value of the part is calculated by (4), and the predicted value y t+1 at this moment is calculated by (5).
If we make the actual value to be predicted y, then the loss function at this time can be expressed by (6), and X represents the input data sequence.
Considering that the surplus data is negative or positive and the characteristics of LSTM itself, we choose the sigmoid function as the σ activation function (7), the tanh function as the φ θ function (8), and the SoftMax function as the π θ function (9).
If the accounting earnings factor is put into the model, we use Figure 3 to represent the input and relationship composition of the earnings factor in seq2seq. e encoding vector is composed of the three output vectors of the encoder part. e importance of these three types of accounting factors is di erent, and the three types of accounting factors can be roughly determined through existing model research. erefore, in order not to further complicate the model, we only draw on the idea of attention mechanism (10), directly weight these three vectors, and then obtain the input of the decoder part.
Attention score(query, source) However, under the seq2seq model at this time, the optimization problem of the loss function is still not solved. Under such conditions, it is di cult to make the model have the best optimization strategy, making the instability produced by the model indistinguishable from the multiple regression cross section models. erefore, we use reinforcement learning to improve this problem of the seq2seq model, hoping to make the prediction results more accurate.

Reinforcement Learning Algorithm Integrating Seq2seq.
e earnings forecast model to be established in this study is based on a long time series. During this process, the relevant data are constantly changing, and according to the Introduction section, we know that there is also a correlation between the accounting earnings data of the same year, that is, the model we need is not a mapping of inputs to outputs, but a pattern between earnings-related information. However, pure LSTM not only has independent and identically distributed input but also cannot learn this "pattern." We have constructed the relationship dependence between surplus factors through the seq2seq structure, so we continue to use reinforcement learning to make seq2seq balance; then, after exploration and development, choose the most rewarding and most e ective behavioral mode. Because the nal model is a value prediction model, we need to choose a type of reinforcement learning algorithm suitable for value analysis. We mentioned in Section 1 that the most typical reinforcement learning algorithm for value prediction is Q-learning. erefore, we integrate the algorithm idea of Q-learning with the seq2seq model constructed in Section 2.2.1 to form the overall reinforcement learning algorithm model shown in Figure 4.
In this process, our purpose is to maximize the expectation of reward through the interaction between the agent and the environment and action. We use (11) to solve the reinforcement learning that integrates seq2seq, which is the same as Q-learning; Q π represents the utility function under policy. maxE y 1 ,..., y T ∼ π θ y 1 ,..., y T ( ) r y 1 , . . . , y T , L θ −E y 1 , . . . , y T ∼ π θ y 1 , . . . , y T r y 1 , . . . , y T . (12) At this time, the loss function can be calculated by (12); then by (13), we can obtain the value of the corresponding maximum partial derivative, we make the output of the decoder part before SoftMax is O t , and then the partial derivative can be rewritten as (14) and solved by (15). R b is a baseline reward value that does not depend on the seq2seq part.   Scienti c Programming zL θ z0 t π θ y t | y t−1 , s t , c t−1 − y t r y 1 , . . . , y T − r b .

Model Implementation and Experimental Analysis
Due to the large number of companies involved in the forecast results and the vast di erence between the forecast results, in Figure 5, the horizontal axis is the company code, the vertical axis is the unit length, and the green polyline represents the 2018 earnings of Shanghai A shares predicted by the enhanced recurrent neural network earnings forecast model. e red polyline is the actual earnings of these companies in 2018. Figure 5 includes 1512 forecast values, and the vertical axis value of other nonexistent company codes is 0. It is impossible to judge the quality of the speci c forecast situation only by the particular forecast value. erefore, according to the calculation method in Section 2, we calculate the metric value of the forecasted earnings in 2018 by the designed model. Table 1 also shows the same index values calculated from the prediction results of the basic LSTM model on the same data set (because no accounting analysis is involved here, the R2, ERC, and ICC indicators of the designed model are not compared with LSTM). Due to the large amount of data involved in the experiment and carried out on a personal host, the running time of LSTM and the designed model is more than one day, but considering that the accounting earnings forecast itself is in units of years, the time required for the experiment has little impact, far less than the accuracy and other evaluation criteria, so the evaluation of the results by the time of the experiment is not considered here.
From Table 1, only through the comparison of AE, can we nd that the designed model signi cantly improves prediction accuracy compared to the LSTM base model. At the same time, it is not di cult to nd that the results predicted by the designed model are still optimistic in general (i.e., the overall forecast of earnings will be larger than the actual value). Compared with the LSTM model, the di erence between AE and AAE is more signi cant. To a certain extent, it re ects that the designed model has a higher sensitivity when the company generates negative earnings. But at the same time, the stability (DS) of the model is not as good as that of the LSTM model, but the DS value of the designed model is still within an acceptable range.

Scienti c Programming
At the same time, we compare the DE values of the prediction results of the designed model and LSTM, and it is easy to find that the designed model fits the curve of the actual value more than LSTM. e comparison between DE and ADE further shows that the overall prediction trend of the LSTM model is far more optimistic than the designed model. It also makes the accuracy of the designed model higher than that of LSTM in the case of a downward trend in earnings.
In addition to comparing the prediction accuracy with the LSTM model, this experiment further compared with the HVZ model [27] and further analyzed the prediction results of the designed model in the accounting sense. e HVZ model needs long-term data to be computationally meaningful. In the data collected in this experiment, the amount of data that meets the requirements of the HVZ model is insufficient. erefore, we use the empirical data of Li and Mohanram [28] to compare with the designed model (Table 2), and we mainly compare the accuracy of the forecast results and whether they have accounting significance.
From Table 2, we can find that the prediction result of the designed model is more accurate than that of HVZ. When using data with a period of up to 40 years, the DS value of the prediction result of the HVZ model can even be reduced to less than 10%. But overall, the designed model is more accurate than HVZ in more general cases. e fit of the HVZ model is slightly better than the designed model, but considering the limited regression parameters used by the HVZ model, this does not mean that the designed model has a worse fit. In addition, the ERC value of the designed model is slightly higher than that of HVZ. e designed model is relatively more representative of market expectations, which may be because the designed model uses the basic structure of LSTM to transmit the time relationship in the accounting earnings correlation system or because the input data includes the impact of the announcement on the market. However, the ICC value of HVZ is higher than that of the designed model, indicating that the HVZ model has a higher correlation with actual returns. It also shows that there is room for further optimization of the input data of the designed model, which needs to be further adjusted according to accounting factors.

Conclusions
An accounting earnings forecasting model is designed based on artificial intelligence. From the perspective of financial accounting, more accurate judgment of the designed model on the company's profit trend itself is helpful for investment analysis and company decision-making. At the same time, it is difficult for traditional models to judge the sudden negative turn of company profits under volatile market conditions. e designed model can find out whether the company has profitability faster than the general model. It is easy to find out through the two common indicators of ICC and ERC. e designed model has a more sensitive response to the market and is more consistent with the company's actual income. e forecast results are more conducive to analyzing the company's problems in the face of adversity and can even further infer industry risks.
In general, the designed model has higher accuracy in a broader sense when forecasting earnings. It relaxes the data requirements for forecasting and the high standards for the company's accounting years. On this premise, it can further improve the accuracy of earnings forecasts and maintain high stability. is also shows that different companies have similar accounting earnings correlation systems, and this accounting earnings correlation system can be used to build earnings forecast models for various companies. At the same time, the earnings predicted by the designed model have accounting significance, and the forecast results can reflect the market's expectations and reflect the correlation between the forecast results and actual earnings. e experimental results also show that the selection of accounting earningsrelated factors has a particular impact on the results of earnings forecasting.
Data Availability e data can be made available from the corresponding author upon request.

Conflicts of Interest
e authors declare that they have no conflicts of interest.