0% found this document useful (0 votes)
27 views8 pages

Future Generation Computer Systems: Dehua Zhang Sha Lou

This study explores the application of neural networks and the BP algorithm for classifying and predicting stock price patterns, highlighting the importance of quantitative investment in the context of big data and Internet finance. The BP algorithm neural network demonstrated a prediction accuracy of 73.29%, outperforming other models, particularly when predicting stock prices over a 15-day range. The findings suggest that this approach can provide valuable insights for investors and enhance macroeconomic regulation efforts.

Uploaded by

Kangana W. M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views8 pages

Future Generation Computer Systems: Dehua Zhang Sha Lou

This study explores the application of neural networks and the BP algorithm for classifying and predicting stock price patterns, highlighting the importance of quantitative investment in the context of big data and Internet finance. The BP algorithm neural network demonstrated a prediction accuracy of 73.29%, outperforming other models, particularly when predicting stock prices over a 15-day range. The findings suggest that this approach can provide valuable insights for investors and enhance macroeconomic regulation efforts.

Uploaded by

Kangana W. M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Future Generation Computer Systems 115 (2021) 872–879

Contents lists available at ScienceDirect

Future Generation Computer Systems


journal homepage: www.elsevier.com/locate/fgcs

The application research of neural network and BP algorithm in stock


price pattern classification and prediction

Dehua Zhang, Sha Lou
Harbin University of Commerce, Harbin 150028, Heilongjiang, China

article info a b s t r a c t

Article history: Under the background of big data and Internet finance, quantitative investment is becoming more and
Received 15 July 2020 more critical, and the prediction of the stock price has become the focus of investors’ concern and
Received in revised form 3 October 2020 research. The purpose of this work is to apply neural network and BP algorithm onto the classification
Accepted 11 October 2020
and prediction of stock price patterns. The method is to use the BP algorithm neural network for the
Available online 13 October 2020
transaction data of 5 consecutive days as input samples, so there are 20 input layer nodes. The final
Keywords: value of the next day is used as the output sample, and the number of nodes in the output layer is 1.
Neural network The purpose of network training is to find 20 spline functions. After the training of the BP algorithm
BP algorithm neural network, the test data (stock price data for 5 consecutive days) independent of the training
Stock price prediction data is leveraged as the input of the neural network, and the closing price of the next day is used as
Stock price pattern classification
the target output of the network. Through the error between the actual output and the target output,
the stock price prediction performance of the network model is analyzed. The results have shown
that the prediction accuracy of the stock price is 62.12% under the prediction of deep learning fuzzy
algorithm and 73.29% under the prediction of the BP algorithm neural network. When the prediction
range is between 15 days, the error of 30 prediction values relative to the real value is within ± 10%,
accounting for 90% of the total days, and the prediction effect is the best. By analyzing the prediction
of the number of hidden layers on the stock price and different ranges, it can be concluded that the
prediction of the stock price trend prediction model of BP algorithm neural network is better than that
of the deep learning fuzzy algorithm prediction model. This algorithm provides investors with a certain
value for stock forecasting, which makes government gain a more active position in macroeconomic
regulation and control.
© 2020 Elsevier B.V. All rights reserved.

1. Introduction signal processing, and other fields, and has achieved amazing re-
sults. Therefore, the artificial neural network is used to predict the
With the development of research on stock market rules, most stock price. In the prediction of the nonlinear system of the stock
stock market prediction models are generated, which are suitable market, the rationality and applicability of the model construction
for the actual investment activities. These forecasting models and have its advantages, which can provide the nonlinear prediction
methods can clarify the operation rules of the stock market to a system for the stock market and theyrovide a wider space for
certain extent. However, due to the structural uncertainty of the development.
stock price system itself and the complexity of external economic For the prediction of the stock market, Kim et al. proposed a
environment factors, the forecasting work of the stock market new long-term and short-term mixed memory (LSTM) model to
will be challenging. Part of the results of the forecasting models predict the change of stock price. Using Kospi 200 index data, the
and applications currently used are not satisfactory to investors. authors found a hybrid model composed of LSTM and 1–3 GARCH
With the rapid development of artificial intelligence and com- models. The performance of each model was compared with the
puter technology, the stock market forecasting model is continu- existing methods. The performance was also compared with the
ously updated and integrated. The principle of the neural network proposed hybrid LSTM model. It was found that gew-slstm is a
is to model according to the internal mechanism of internal data, hybrid model composed of the LSTM model and three GARCH
which is widely used in pattern recognition, intelligent control, models, and its prediction error is the lowest in terms of mean
absolute error, mean square error, heterodispersity adjusted Mae
∗ Corresponding author. and Hetero dispersity adjusted MSE. By combining the neural
E-mail addresses: [email protected] (D. Zhang), [email protected] network model with a single econometric model and multiple
(S. Lou). econometric models, their model greatly improves the existing

https://doi.org/10.1016/j.future.2020.10.009
0167-739X/© 2020 Elsevier B.V. All rights reserved.
D. Zhang and S. Lou Future Generation Computer Systems 115 (2021) 872–879

prediction performance. Finally, his method can be used as a (5) Transaction amount: from the formula, it is equal to the
comprehensive model including time series model and neural transaction price multiplied by the corresponding quantity. An-
network model to expand to various fields, or as a comprehensive other form of currency, representing the total sales of shares
model to predict the volatility of the stock market. The accuracy [6,7].
of this method is low and shown in Ref. [1]. Putrier believed that (6) Trading volume: the total number of shares traded on that
in securities investment, the management of investor funds can day. The minimum unit is 1 batch (100 shares).
be regarded as a dynamic optimal control problem. To optimize (7) Up and down: through the closing price of the stock price
the capital structure of investors, investors must predict the stock for two consecutive days, to judge whether the stock price is
price dynamics of the portfolio. Author used the ARIMA Kalman significantly up or down, the latest closing price will rise when it
filter to predict the daily share price of the portfolio. Next, the is higher than the previous closing price, otherwise it will fall [8].
return value of the stock price was calculated according to the
(8) Pressure point: this means that the stock price stops rising
stock price forecast. Authors tried to use model predictive control
after reaching a certain point in the rising process, which is called
(MPC) to solve combinatorial optimization problems. If we use
pressure point.
the MPC algorithm to get the best controller, we can get the best
(9) Support point: this means that the stock price continues to
combination management strategy [2]. Kuang Y, Singh R, Singh S,
fall, reaches a specific position, and stops falling, then rises, which
et al. A novel macroeconomic et al. proposed a new macroeco-
is called the support point [9].
nomic prediction model based on improved multimedia support
BP neural network model and Ariko algorithm. The choice of fault (10) K line: it is an analysis chart of specific changes in stock
prediction technology is limited and the prediction technology price during the unit period. This is an essential reference for
is uncertain, so the model mainly focused on the following two short-term investors to analyze stocks, with specific technical
aspects. The uncertainty of the selection error of the prediction requirements.
method is more prominent. The possibility of a wrong predic-
tion method leading to a correct prediction result is minimal. 2.2. Stock market
Limitations of prediction methods. It does not depend on which
prediction method has applicable conditions It is neither robust
nor static. Thus, to improve the previous methods, it is needed to The stock market is the issuing and trading market, which
study the updated technology. He used Ant Colony Algorithm to includes the issuing market and the circulation market. The circu-
change the BP model and continues to predict points appropri- lation market is the so-called issuing market, and the circulation
ately, which refers to fixed value prediction. The practicability of market refers to the circulation market. A company limited by
this method is not reliable [3]. shares can raise a lot of capital quickly by issuing shares to the
This study first introduces the stock market and its basic terms society. This is used to expand the scale of the business. People
in detail, then classified the methods and difficulties of stock who invest in stocks are reluctant to share the risk of enterprise
forecasting, lists three kinds of stock price forecasting methods, development and expansion, because they want the value of the
i.e. time series method, securities investment analysis method invested capital [10,11].
and artificial intelligence forecasting method. Three forecasting Introduction to primary and secondary markets:
difficulties influencing factors, i.e. internal factors, fundamental The primary stock market is also known as the issuing market.
factors, and policy factors. Then, the BP neural network and Enterprises that need funds can issue a limited number of shares,
its mathematical model are described, including the formula of so that investors can choose to buy necessary funds. Companies
weight adjustment, algorithm derivation, and so on. At the same that issue stocks usually sell stocks not directly to ordinary in-
time, experimental modeling is carried out in this study. After vestors, but through intermediaries, i.e., securities brokers, so the
the completion, the data are simulated and analyzed, and the primary stock market is also known as the brokerage market. The
results have been obtained. Through the analysis of the number public offering method of listed companies is called a graveyard,
of hidden layer to the stock price prediction, the analysis of BP
which is the public offering of the market. The method of issuing
algorithm and fuzzy algorithm to the stock price prediction, the
shares to specific objects is called a private offering, that is, a
comparative analysis of the errors of different algorithms and the
non-public offer [12].
analysis of the prediction effect of different ranges. This study
The secondary market circulation market provides a trading
demonstrates the validity and superiority of the prediction model
place for issuing stocks, which is a stock trading place. Because
of the BP algorithm neural network in this study.
the secondary market provides liquidity for stocks, investors can
cash at any time, so stockholders can cash at any time. Hence,
2. Prediction of stock price model and BP algorithm
the secondary market has the function of price setting. The main
functions of the secondary market include: absorbing idle private
2.1. Basic terms of stock
funds for the development of enterprises and effectively guiding
the flow of funds. It is also the primary function of the market
(1) Opening price: also known as the opening price of the
economy. The secondary market reflects the social and economic
market, it is the price at which one shares is traded as a unit after
the centralized bidding process before the market [4]. situation and provides the basis for the formulation of national
(2) Closing price: originally refers to the last trading price of policies. The secondary market and primary market promote and
the stock. At present, the closing prices of Shanghai and Shenzhen restrict each other. According to type, quantity, and method of
stock markets are weighted average prices. This refers in partic- the stocks issued in the circulation market, the structure of the
ular to the weighted average price of all transaction prices one securities circulating in the secondary market is determined. As
minute before the last transaction [5]. a stock exchange, the secondary market promotes and promotes
(3) Lowest price: refers to the lowest value of all trading prices the development of the primary market. Through reasonable
of stocks on that day. organization and high-quality service, the stocks in the circulation
(4) Maximum price: refers to the highest value of all trading market can be effectively distributed and transferred, making
prices of shares on the day. investors more suitable for circulation [13,14].
873
D. Zhang and S. Lou Future Generation Computer Systems 115 (2021) 872–879

2.3. Prediction method of stock market

(1) Time series method


The time series method is a statistical relation model that
combines stock price index with time-series framework. The clas-
sical models include the RW model (complete random model),
and ARIMA model (autoregressive moving average model). In
the time series method (uniform instability model), according to
the variables contained in the model, it is used to distinguish
the single variable and the multivariable of the measurement
method. For the decision of the multivariable model and the
selection of parameters, a lot of complex data analysis is needed.
Empirical evidence shows that the time series method may have
a good impact on short-term stock price prediction. However, if
Fig. 1. Topology of a typical three-layer BP neural network.
the prediction period is very long, the prediction accuracy of the
time series model will continue to decrease [15].
(2) Analysis method of securities investment
The methods of securities investment analysis are usually stocks issued and the capital expected to invest in the stock
divided into two types: basic analysis and technical analysis. market. If the stock system is expanded indefinitely, the value
The technical analysis method mainly refers to deciding whether of the issued stock will be correspondingly reduced. Therefore,
to buy or sell stocks according to the short-term trend of the the government spent a lot of time to investigate the impact of
stock investment market, and the basic analysis method mainly the number of shares issued on the whole stock market and the
determines the stock investment based on the overall exter- national economy, and mastered the pace of IPO [20].
nal environment [16]. Fundamental analysis is mainly to study (2) Fundamentals
various factors of supply and demand in the stock investment Fundamentals are part of the analysis that are being paid
market and comprehensively judge the stock price. The technical attention by investors. If it is not clearly understood the industry,
analysis mainly investigates the influence of the past and present major businesses, interests, and other important information of
changes of the stock market on the future price trend of the the investee companies; it is not easy to judge the value of the
stock market, and uses various economic mathematical models company. The so-called fundamentals mainly refer to the macroe-
to predict the future of the stock market by taking the past and conomic factors and internal factors of the company. Macroe-
present data of the stock market as the survey samples, which conomic factors mainly include interest rate, fiscal revenue and
is a kind of price change analysis. Technical analysis methods expenditure, money supply and demand, and residents’ income.
include moving average method, K-line chart analysis method, The company’s internal factors refer to the company’s interests,
point and number analysis method, histogram analysis method, liabilities, cash flow, and strategic policies [21,22].
trend analysis method, shape analysis method, angle analysis (3) Policy factors
method, golden section spiral calendar method, incredible series, The policy factor refers to the corresponding adjustment made
four-dimensional space method. The basic method to wait for the by the state in response to various economic conditions. These
above-mentioned technical analysis methods is chart informa- policies often directly or indirectly affect the operation of listed
tion. When choosing the influencing factors in the analysis chart, companies and the whole stock market. Although it is essential
user mainly deal with them through subjective judgment and rely for investors to study national policies, there are relatively few
too much on the subjective experience analysis method. In the investors with high research capacity [23].
complex stock price forecasting, the reliability of this method is The capital market is an absolute interest seeking place. In
questioned. the past 100 years, professional investors have summed up many
(3) Artificial intelligence prediction method advanced investment concepts and methods. The most striking
In recent years, with the rapid development of artificial intel-
one is the value investment school represented by Buffett. Among
ligence theory and algorithm, BP neural network is undoubtedly
the investment operators, the annual profit margin is more than
hot research in the application of neural networks to stock price
20%. In addition, there are also many colleges based on Taoist
prediction. In the field of finance, many scholars in Europe and
theory that mining historical data rules to predict the future trend
America have studied and applied neural networks [17].
of the stock market, and many investors who have obtained great
benefits. There are also institutional investors using mathematical
2.4. Difficulties in stock price prediction
methods for quantitative analysis of the stock market. Even if
Its price usually determines the price of a stock, but it is also there are a few people who can get rich returns in the market,
affected by many factors such as market sentiment and market they still cannot accurately predict the trend of long-term stock
trends. We can often see that there is a big deviation between prices. Therefore, it is difficult to predict the stock market [24].
the stock price and the price, which is mainly affected by the
relationship between supply and demand. In the bullish market, 2.5. Overview of BP neural network
investors tend to exaggerate blindly, resulting in the stock price
exceeding its value many times. Similarly, in the bearish market, BP (back propagation) network is a neural network learning
due to the pessimistic expectations of investors, the stock market algorithm. The neural network is composed of the input layer,
continues to be depressed, and the share price is lower than the output layer, and hidden layer. The hidden layer contains at least
net asset per share. The supply–demand relationship is the cause one layer, usually more than three network mechanisms. Show
of the stock price. It is influenced by many factors such as internal the basic 3-layer neural network model. As shown in Fig. 1, the
market factors, basic factors, policy factors [18,19]. topology of a typical three-layer BP neural network is shown.
(1) Market internal factors The learning process of the BP neural network has two parts:
The internal cause of the market is the supply and demand the forward propagation of the signal and the backpropagation of
of stocks, that is, the relationship between the total number of error. The input sampling signals are transmitted in the order of
874
D. Zhang and S. Lou Future Generation Computer Systems 115 (2021) 872–879

the input layer, hidden layer and output layer. Finally, the actual weight should be in direct proportion to the decrease of the error
output is compared with the teacher signal. When the difference gradient, namely:
is large, the error will be backpropagation, and the error will be ∂E
distributed to each node of each layer to generate the error signal ∆wjk = −η , j = 0, 1, 2 . . . n; k = 1, 2, . . . , l (10)
of each node. The neural network will change the weight value
∂wjk
of each node on this basis. The weighted correction process will In the formula, the negative sign represents the gradient de-
continue to cycle, and the network learning and training process cline, and the constant η ∈ (0, 1) represents the scale coefficient,
will continue until the final error reaches an acceptable range or which is often called the learning rate of the neural network.
reaches a predetermined number of learning times [25]. (3) Derivation of BP algorithm
The formula of weight adjustment of the three-layer BP algo-
2.6. Mathematical model of BP neural network rithm is deduced.
∂E ∂ E ∂ netk
(1) Basic model ∆wjk = −η = −η (11)
∂wjk ∂ netk ∂wjk
For the three-layer BP neural network mathematical model,
the following assumptions are made: the input vector of the An error signal is defined for the output layer and the hidden
model is X = (x1 , x2 , . . . , xi , . . . , xn )T ; the output vector of the layer respectively, so that:
output layer is O = (o1 , o2 , . . . , ok , . . . , ol )T ; the output vec- ∂E ∂E
tor of the hidden layer is Y = (y1 , y2 , . . . , yj , . . . , yn )T ; the δko = − ; δy = − (12)
∂ netk j ∂ netj
expected output vector is d = (d1 , d2 , . . . , dk , . . . , dl )T ; V = y
(V1 , V2 , . . . , Vj , . . . , Vm ) is the weight matrix from the input layer ∆wjk = ηδko yj ; ∆vij = ηδj xi (13)
to the hidden layer, W = (W1 , W2 , . . . , Wk , . . . , Wl ) is the weight For the output layer, expand to:
matrix from the hidden layer to the output layer; Vj is the weight
vector corresponding to the jth neuron in the hidden layer; Wk is ∂E ∂ E ∂ ok ∂E ′
δko = − =− =− f (netk ) (14)
the weight vector corresponding to the kth Shenjing element in ∂ netk ∂ ok ∂ netk ∂ ok
the output layer. ∂E
For the output layer, the following equation exists: = −(dk − ok ) (15)
∂ ok
ok = f (netk ), k = 1, 2, . . . , l (1) Comprehensive:
m
∑ δ = (dk − ok )ok (1 − ok )
o
(16)
netk = wjk yj , k = 1, 2, l (2) k

j=0 Formula (16) is the final derivation formula of two error sig-
nals. Combining formula (13) and formula (16), the weight adjust-
For hidden layers, the following equation exists:
ment formula of BP learning algorithm of three-layer network is
yj = f (netj ), j = 1, 2, m (3) obtained as follows:

⎨∆wjk = ηδk yj = η((dkl − ok )ok)(1 − ok )yj


o

n
∑ ⎪
netj = vij xi , j = 1, 2, . . . , m (4)
y
∑ (17)
i=0 ⎪
⎩ ∆ vij = ηδ j x i = η δko wjk yj (1 − yj )xi
k=1
Set the transformation function f (x) as unipolar sigmoid func-
tion
3. Construction of stock price trend prediction model
1
f (x) = (5)
1 + e−x 3.1. Data set
By derivation, we can get:
The experimental data is collected from the stock market

f (x) = f (x)[1 − f (x)] (6) database from August 12, 2019, to December 12, 2019, and col-
lected randomly the stock price information of more than 58 000
The above formulas constitute the basic model of three-layer
per minute by Gree Electric (Stock Code: 000651), Maotai (Stock
BP neural network.
Code: 600519) of Shanghai mainboard and BYD (Stock Code:
(2) Network error and weight adjustment
002594) of small and medium-sized boards, with the opening
The final output error is defined as follows:
price, closing price and maximum price of three stock prices High
l value, minimum value and trading volume are the main stock
1 1∑
E= (d − O)2 = (dk − ok )2 (7) price trends. Feature extraction these information functions can
2 2
k=1 be used to reflect the trend of the stock price. Therefore, five
If the error definition is expanded to the hidden layer, then: information are selected as the input of the prediction model in
this paper. Considering the amount of data, a prediction model
l
1∑ is set up to predict the stock price trend with five information
E= [dk − f (netk )]2 (8) amounts of the initial 10 points and 11 points. Fig. 2 shows the
2
k=1 stock price trend of a company.
Push back to the input layer, then:
l m
3.2. Data analysis
1∑ ∑
E= {dk − f [ wjk f (netj )]}2 (9)
2 The input variables used in the experiment are n-day profit
k=1 j=0
rate, price yield, price to book ratio, maximum price, minimum
The network error is a function of the weights wjk , vij of each price, opening value, closing value, K value, D value, J value of KDJ
layer, so the error can be reduced by modifying the weights. indicator, etc. The values of these indicators are described in the
To reduce the error continuously, the adjustment size of the selection of the first sample in this chapter. The forecast process
875
D. Zhang and S. Lou Future Generation Computer Systems 115 (2021) 872–879

Fig. 2. Stock price trend.

is the input index value of the past n trading days. After the Table 1
network model passes BP, the output value will be generated. This Price information data of Gree Electric.

output value is the forecast value in the following table. The input Time Starting Maximum Minimum Closing Volume
price price price price
variables of the second comparative experiment are the highest
09:40 25.95 26.06 25.95 26.05 1 950 753
value, the lowest value, the starting value, the ending value, the
09:45 25.91 25.92 25.79 25.8 3 098 312
K value, the D value, and the J value. That is to say, the value 09:50 25.96 25.96 25.93 25.93 803 555
index of Experiment 1 is deleted. The prediction process is the 09:55 26.11 26.11 26.07 26.08 1 133 100
same as the initial experiment, and a series of predicted values 10:00 26.01 26.03 26 26.01 664 900
will be obtained later. Finally, the results of the two experiments 10:05 26.1 26.13 26.1 26.12 826 510
10:10 25.95 25.96 25.9 25.92 1 364 700
are compared by error analysis.

3.3. Establish BP algorithm neural network prediction model


depth configuration network model, which contains only four
The BP algorithm neural network used has an input layer and hidden layers for training. Then the parameter training is com-
output layer. Next, five consecutive days of transaction data will pleted according to the modeling method. After in-depth training
be used as input samples, so there are 20 input layer nodes. The of the network model, finally, input the inspection sample data
final value of the next day is used as the output sample, and the of green to predict the stock data, and the prediction accuracy
number of nodes in the output layer is 1. The purpose of network of the model can be found. The experimental results show that
training is to find 20 spline functions (I = 1, 2, . . . , 20) set to 1/20 when four hidden layers are used, the prediction accuracy of the
of the average distribution. BP neural network model is 59.73%. The selected training sample
data is imported into the BP neural network model, including only
3.4. Simulation prediction five hidden layers for training representation. When using five
hidden layers, the prediction accuracy of the network model with
After the training of the BP algorithm neural network, the high reliability is 63.41%.
test data independent of the training data (stock price data for 5 If the model is built according to this research method, the
consecutive days, etc.) is used as the input of the neural network, experimental results of setting the number of hidden layers show
and the closing price of the next day is used as the target output that the prediction accuracy of the BP algorithm neural network
of the network. The prediction performance of the network model model with five hidden layers is excellent. So far, this research
is analyzed by the error between the actual output and the target is based on the trend prediction model of stock price prediction
output. Here the sum of squares of the errors is used as the based on neural network. Among them, the input layer inputs
analysis index. 50 (5 * 10) in total, in the order of time per minute. There are
three neurons in the output layer (not up, down, up, down). The
4. Prediction and analysis of stock price based on BP algo- number of hidden layers of the network model is 5. The number
rithm of neural network of neurons in each layer is 150, 100, 60, 40, 20.

4.1. Analysis of the number of hidden layers on the prediction of 4.2. Analysis of BP algorithm and fuzzy algorithm for stock price
stock price prediction

The data collection interval is expected to be 5 min, and the The selected training sample data is imported into the BP
30-min stock price information data of Gree Electric from Decem- algorithm neural network prediction model of this paper for
ber 10, 2019 to December 10, 2019 will be randomly intercepted. training, and compared with the deep learning fuzzy algorithm
Table 1 shows the share price information of Gree Electric. for training. According to the modeling method, the parameters
Table 1 and experimental results show that if three hidden are trained in turn. After configuring the network model in train-
layers are used, the prediction accuracy of the network model is ing depth, input the following content at last. Test the sample
56.17%. The selected training sample data is imported into the data of stock data prediction to find out the accuracy of model
876
D. Zhang and S. Lou Future Generation Computer Systems 115 (2021) 872–879

Table 2
Error comparison table.
Time ε mae mse
0 0.01 11.51 157.81
5 0.05 9.63 126.84
10 0.1 7.15 71.65
15 0.2 4.46 29.21
20 0.3 2.14 9.39
25 0.4 0.89 1.76
30 0.5 1.17 2.54
35 0.6 1.79 3.68
40 0.7 2.56 7.95

Fig. 3. Prediction results of two algorithms.

prediction, as shown in Fig. 3 is the prediction result chart of two


algorithms.
It can be seen from Fig. 3 that the actual price fluctuates
between 28 and 34. Although the prediction results of the BP
neural network algorithm will vary greatly, there will be specific
errors. The prediction result of deep learning fuzzy algorithm is
more significant, more prominent, and chances of error is high.
The results show that the prediction accuracy of the predic-
tion model based on deep learning is 62.12%, and that of the
prediction model based on the BP algorithm neural network is
Fig. 4. Error comparison analysis of the two algorithms.
73.29%. The training sample data of the selected deep learning
fuzzy algorithm is imported into the prediction model of the BP
algorithm neural network for training, and the parameter training
is completed in turn according to the modeling method. After From Fig. 4, it can be seen that the error variance of the BP
training the deep reliability network model, input the BYD test algorithm neural network prediction model is small minimal, and
sample data. it tends to become 0, the highest is only 10%, and most of them
Compared with the effect of the model, the accuracy of Gree are within 10%. The maximum error of the fuzzy algorithm based
Electric Appliance Based on the prediction model of deep learning on deep learning is 20%, and the fluctuation range and fluctuation
is 62.12%, and the accuracy of the prediction model based on BP range are not within 10%. The advantages and functions of the
neural network is 73.29%. Therefore, the prediction effect of the two algorithms can be easily found.
BP algorithm neural network model is better than that of deep
learning fuzzy algorithm model. 4.4. Analysis of prediction effect in different ranges

4.3. Error comparison and analysis of different algorithms When fitting the closing price with 7-day information, the
prediction error of 5% days is 43% of the total days, and the
When n is 5, the model uses each indicator value within 5 days prediction effect is much better than that of n = 5. Tian’s stock
to predict the closing price of the next day. There are currently
price information cannot fully represent the process of stock price
46 input variables. Five opening prices, five closing prices, the
change.
five highest prices, five lowest prices, 5K values, 5D values, 5J
In the case of n = 10, the number of 30 predicted values for
values, and five dynamic price returns-value, five dynamic prices
the true value is within ±10%, 25, accounting for 83% of the total
to book ratio and one profit margin value. The output variable is
days. There are 15 errors within ±5% of the total number of days,
the closing price of the next trading day. The number of hidden
the prediction effect is further improved, and the number of days
layer nodes is 7.
within 5% of the error range reaches 50%.
A problem was found in the training process: the smaller the
When n = 15, the number of 30 predicted true values is
given fitting error, the better the final prediction result. This is
because if the wrong setting is allowed to be too small, the model within ±10% of 27, accounting for 90% of the total days. There
will lead to overfitting, and the final prediction result is far from are 17 errors within ±5%, accounting for 56% of the total days.
the real value. With the increase of the given error, the final The predicted result is slightly better than that of n = 10.
prediction error will first decrease and then increase. That means When n = 20, the number of 30 predicted true values is within
there is the most suitable specified permissible error that can ±10% of 26, accounting for 86% of the total days. There are 15
minimize the prediction error without changing other conditions. errors within ±5%, accounting for 50% of the total days. The
To find the relative optimum value, some experiments have been prediction results show that the outcome of n = 15 is slightly
carried out to adjust the allowable error ε from 0.01 to 0.7. Table 2 worse, the greater n is, the higher the prediction effect is, and
is the error comparison table. N is also the best value. As shown in Fig. 5, the comparison of
MAE is the average absolute error of the final predicted price different n-value prediction results is shown.
and the actual price, MSE is the mean square error of the pre- When n increases from 5, the prediction accuracy will de-
dicted price and the actual price. It can be seen from the table crease after the initial increase. When n = 15, the maximum
that when the allowable error ε is 0.4, Mae and MSE are both the relative value will be reached. Then, through several experiments
minimum, and when n = 5, 0.4 is the best allowable error value. to confirm the prediction results of n = 14 and N = 16, it is
As shown in Fig. 4, the error comparison analysis diagram of the found that the result is slightly worse than that of n = 15. In this
two algorithms is shown. prediction model, n = 15 is the best value.
877
D. Zhang and S. Lou Future Generation Computer Systems 115 (2021) 872–879

Acknowledgments

This work was supported by Heilongjiang Province Philos-


ophy and Social Science Fund Project: Research on the Per-
formance and Influencing Factors of Grain Subsidy Policy in
the Agricultural Comprehensive Reform Experimental Area of
Liangjiang Plain in Heilongjiang Province (17JYC144). Youth In-
novative Talents Training Program in General Undergraduate Col-
leges and Universities in Heilongjiang Province: Research on the
Development of New Rural Cooperative Financial Organizations
in Major Grain Producing Areas Based on Farmers’ Perspective
(UNPYSCT2017203). Harbin University of Commerce School-level
Project: Research on the Development of New Rural Coopera-
Fig. 5. Comparison of different n-value prediction results. tive Financial Organizations in Heilongjiang Province Based on
Farmers’ Perspective (17XN050). Heilongjiang Province Philoso-
phy and Social Science Fund Project: Research on the coordi-
By comparing the training steps and errors, it can be judged nation of grain production and farmers’ income in Heilongjiang
that the number of nodes in the hidden layer is 4. After deter- Province Based on the perspective of targeted poverty alleviation
mining the parameters and structure of the model, we started the (18JYE669). Youth Innovative Talents Training Program in General
stock price training and prediction of Gree Electric and Guizhou Undergraduate Colleges and Universities in Heilongjiang Province
Moutai. If the index value in the past 15 days is used as the (UNPYSCT2018125). Harbin University of Commerce School-level
input variable of the model, and the closing price of the next Project (17XN049). Special support project for postdoctoral in
day is predicted, the effect will be the highest. In addition, the Heilongjiang Province (LBH-Z19073).
combination of value indicators and technical indicators as input
variables is better than only one type of indicator. References

[1] H.Y. Kim, C.H. Won, Forecasting the volatility of stock price index: A hybrid
5. Conclusion
model integrating LSTM with multiple GARCH-type models, Expert Syst.
Appl. 103 (aug.) (2018) 25–37.
In recent years, the application of artificial neural networks in [2] E.R.M. Putri, Investment management using portfolio optimization with
the field of finance has become a research hotspot. In particular, stock price forecasting I. Fitria, E. Apriliani, E.R.M. Putri - Applied
BP neural network, which is mature and widely used, has the Mathematical Sciences, 2016, Appl. Math. Sci. 10 (48) (2016) 2405–2413.
[3] Y. Kuang, R. Singh, S. Singh, et al., A novel macroeconomic forecasting
function of approximating complex continuous functions that model based on revised multimedia assisted BP neural network model and
many traditional methods cannot use. Compared with the predic- ant colony algorithm, Multimedia Tools Appl. 76 (18) (2017) 18749–18770.
tion accuracy of the fuzzy algorithm based on deep learning, the [4] E. Meric, M. Kamisli, F. Temizel, Interactions among stock price and
neural network prediction model of the BP algorithm in this study financial ratios: The case of Turkish banking sector, Appl. Econ. Finance
4 (6) (2017) 107.
has the experimental conclusion that the prediction accuracy of
[5] Victor R.R. Jose, Percentage and relative error measures in forecast
the fuzzy algorithm based on deep learning is lower than that of evaluation, Oper. Res. 65 (1) (2017) 200–211.
the neural network based on BP algorithm. [6] G.D. Martino, How do investors perceive long-term growth targets and
In the past technical analysis methods, if we predict such a forecast horizons in strategic plans? Evidence from Italian firms, Issues
nonlinear stock price, satisfactory results cannot be obtained in Stud. 07 (02) (2019) 3–43.
[7] Y.W. Him, L. Camillo, Stock price crash risk and unexpected earnings
most cases. The BP neural network model used in this study is thresholds, Manag. Finance 44 (8) (2018) 1012–1030.
based on the premise of fully using the BP algorithm to improve [8] G.S. Atsalakis, E.E. Protopapadakis, K.P. Valavanis, Stock trend forecasting
the training speed. A stock price index is an experimental object. in turbulent market periods using neuro-fuzzy systems, Oper. Res. 16 (2)
It forecasts the closing price of the next 30 days and achieves a (2016) 245–269.
[9] J.B. Kim, Accounting flexibility and managers’ forecast behavior prior to
satisfactory result. Therefore, the simulation experiment shows
seasoned equity offerings, Rev. Account. Stud. 21 (4) (2016) 1361–1400.
that the neural network stock price prediction method optimized [10] R.K. Loh, R.M. Stulz, Is sell-side research more valuable in bad times? J.
by the BP algorithm has a specific value. The trained BP neural Finance 73 (3) (2018) 959–1014.
network has a certain prediction effect and can provide investors [11] M. Khashei, Z. Hajirahimi, Performance evaluation of series and parallel
with the function of stock price prediction. strategies for financial time series forecasting, Financ. Innov. 3 (1) (2017)
24.
The prediction accuracy of this study is better than that of
[12] K. Chapman, G.S. Miller, H.D. White, Investor relations and information
other algorithms, but there is still room for improvement. In assimilation, Account. Rev. 94 (2) (2019) 105–131.
the next step, research of more stock technical indicators are [13] A. Sethi, Predictive modeling of CNX Nifty 200 from a valuation
improved and find out the relationship between indicators and perspective, Asian J. Manag. 10 (1) (2019) 14–18.
prediction accuracy. Further, improve the prediction accuracy [14] X. Tan, Z. Ji, Y. Zhang, Non-invasive continuous blood pressure measure-
ment based on mean impact value method, BP neural network, and genetic
of the law. In the process of forecasting the stock price with algorithm, Technol. Health Care 26 (6) (2018) 1–15.
the help of a neural network system, this study is only in an [15] S. Zhou, C.Y. Shen, L. Zhang, et al., Dual-optimized adaptive Kalman
ideal state. It does not consider other external factors such as filtering algorithm based on BP neural network and variance compensation
economic development momentum, government policy factors, for laser absorption spectroscopy, Opt. Express 27 (22) (2019) 31874.
[16] F.X. Li, Commutation failure detection algorithm based on stationary
other emergencies and so on. In fact, in a certain period, these
wavelet and BP neural network, Shenyang Gongye Daxue Xuebao/J.
external factors have a great impact on the stock price. Shenyang Univ. Technol. 40 (3) (2018) 248–252.
[17] M. Wang, Z. Yuan, X. Zhang, et al., Construction of air quality evaluation
Declaration of competing interest system based on FCM algorithm and BP neural network, Agric. Biotechnol.
7 (05) (2018) 279–281.
[18] H. Zhou, Y. Zhang, D. Zhang, et al., An anisotropic magnetostriction model
The authors declare that they have no known competing finan- based on BP neural network combining Levenberg–Marquardt algorithm
cial interests or personal relationships that could have appeared and particle swarm optimization, Int. J. Appl. Electromagn. Mech. 55 (3)
to influence the work reported in this paper. (2017) 1–9.

878
D. Zhang and S. Lou Future Generation Computer Systems 115 (2021) 872–879

[19] X. Tongle, W. Yingbo, C. Kang, Tailings saturation line prediction based on Dehua Zhang was born in Heilongjiang, Mudanjiang,
genetic algorithm and BP neural network, J. Intell. Fuzzy Systems 30 (4) P.R. China, in 1984. He received the Ph.D. in Manage-
(2016) 1947–1955. ment from Northeast Agricultural University, P.R. China.
[20] T. Liu, S. Yin, An improved particle swarm optimization algorithm used for Now, He works at the School of Finance, Harbin Uni-
BP neural network and multimedia course-ware evaluation, Multimedia versity of Commerce. At the same time, he conducted
Tools Appl. 76 (9) (2017) 11961–11974. postdoctoral research at the Northeast Asia Service
[21] Y. Liu, C. Hu, Y. Hong, Electric energy substitution potential prediction Outsourcing Research Center of Harbin University of
based on logistic curve fitting and improved BP neural network algorithm, Commerce. His research interest include rural finance,
Elektron. Elektrotech. 25 (3) (2019) 18–24. food economy and farmers’ income.
[22] F. Liu, H. Gong, L. Cai, et al., Prediction of ammunition storage relia- E-mail: [email protected].
bility based on improved ant colony algorithm and BP neural network,
Complexity 2019 (4) (2019) 1–13.
[23] Q.Y. Liu, Y.J. Ruan, X. Shi, et al., Hourly power load forecasting of office Sha Lou was born in Heilongjiang, Hegang, P.R. China,
building based on kmeans clustering and BP neural network algorithm, in 1983. She received the Ph.D. in Management from
Reneng Dongli Gongcheng/J. Eng. Thermal Energy Power 33 (3) (2018) Northeast Agricultural University, P.R. China. Now, she
138–144. works at the School of Finance, Harbin University of
[24] G. Zhou, Y. Sun, P. Jia, Application of genetic algorithm based BP neural Commerce. Her research interest include rural finance,
network to parameter inversion of surrounding rock and deformation agricultural insurance.
prediction, Modern Tunn. Technol. 55 (1) (2018) 107–113. E-mail: [email protected].
[25] Y.L. Song, C. Yu, D.G. Dai, et al., Parameter optimization of heat source
model for laser welding based on BP neural network and genetic algorithm,
Suxing Gongcheng Xuebao/J. Plasticity Eng. 24 (1) (2017) 218–222.

879

You might also like