Stock Market Forecasting Based On Artificial Stock Market Forecasting Based On Artificial Intelligence Technology Intelligence Technology
Stock Market Forecasting Based On Artificial Stock Market Forecasting Based On Artificial Intelligence Technology Intelligence Technology
CSUSB ScholarWorks
8-2021
Part of the Business Analytics Commons, and the Finance and Financial Management Commons
Recommended Citation
LIANG, YUZHUN, "STOCK MARKET FORECASTING BASED ON ARTIFICIAL INTELLIGENCE TECHNOLOGY"
(2021). Electronic Theses, Projects, and Dissertations. 1324.
https://scholarworks.lib.csusb.edu/etd/1324
This Thesis is brought to you for free and open access by the Office of Graduate Studies at CSUSB ScholarWorks. It
has been accepted for inclusion in Electronic Theses, Projects, and Dissertations by an authorized administrator of
CSUSB ScholarWorks. For more information, please contact [email protected].
STOCK MARKET FORECASTING BASED ON ARTIFICIAL INTELLIGENCE
TECHNOLOGY
A Project
Presented to the
Faculty of
San Bernardino
In Partial Fulfillment
Master of Science
in
by
Yuzhun Liang
August 2021
STOCK MARKET FORECASTING BASED ON ARTIFICIAL INTELLIGENCE
TECHNOLOGY
A Project
Presented to the
Faculty of
San Bernardino
by
Yuzhun Liang
(August 2021)
Approved by:
technology to forecast and analyze the stock market and construct complex
nonlinear relationships between the input data and the output data. This project
used a radial basis function neural network to forecast and analyze the stock
market data. Compared the radial basis function neural network performance
with the feed-forward neural network and showed clearly the superiority of the
radial basis function neural network over the feed-forward neural network in the
data processing. The results showed that AI technology could effectively predict
stock market performance. Based on the results, the conclusion is that the
prediction performance of the RBF neural network is better than that of the
multilayer feed-forward neural network. Areas for future research are to explore
the use of other AI and other Neural Network Algorithms such as Back
iii
TABLE OF CONTENTS
Basic Principle............................................................................... 25
Basic Principle............................................................................... 28
v
REFERENCES ................................................................................................... 46
vi
LIST OF FIGURES
vii
CHAPTER ONE
INTRODUCTION
predicting the stock market, the input and the output data of the stock are fitted
and analyzed with the help of computer technology and related algorithm
knowledge principles. The nonlinear relationships between the input and the output
are constructed, and the specific trend of the stock market is analyzed, which
provides a specific reference basis for the investors. After years of development,
artificial intelligence (AI) technology, combined with the Internet, big data, cloud
computing, and other mutual influences, has provided the corresponding technical
market, seeking the nonlinear relationship between the stock market data and
providing the corresponding basis for the investors to invest in the stock market.
psychology, foreign exchange risk, and many other factors. The stock market is a
great significance to predict the stock market accurately. For a long time, some
extract some meaningful patterns to predict the specific trend of the stock prices.
1
These patterns helped the researchers to develop many models, using scientific
and technological means to provide investors with the stock price prediction.
Although the price of a particular stock is difficult to predict accurately, the trend of
the stock market or the changing pattern of the stock market has certain regularity.
Therefore, if we can classify and predict the stock trend pattern, it will be helpful
for the further prediction of a particular stock price and promote the research of
securities investment.
2
The stock market is a vast nonlinear system. There are many nonlinear
and uncertain factors, its dynamic mechanism is very complex, describing its
analysis tools are not ideal results. At present, there are two main problems in
the stock market analysis. One is how to describe the nonlinear dynamic change
process of the stock market effectively. The other is how to forecast and analyze
the time series formed by the stock prices. As shown in Figure 1, it is the main
Neural network algorithms are the most widely used in artificial intelligence
network, computing speed and generalization ability is strong and has good
nonlinear mapping function. Therefore, this topic considers using the radial basis
function (RBF) neural network to the stock market's dynamic change process and
Recurrent NN, Long STM, and Modular. Each algorithm has its unique
including the input layer, the hidden layer, and the output layer. The
transformation from the input space to the hidden space is nonlinear, while the
transformation from the hidden space to the output space is linear. The
3
Feedforward neural network, referred to as the feed-forward network, is a kind of
artificial neural network. In this kind of neural network, each neuron starts from
the input layer, receives the input of the previous level, and inputs to the next
level, until the output layer, there is no feedback in the whole network, can be
represented by a directed acyclic graph. The goal of the neural training network
is to optimize the cost function so that it can find a global or local minimum value.
No matter what kind of gradient descent algorithm is used, the gradient of each
Convolutional neural networks include the convolutional layer and the pooled
neural network, the two-dimensional convolutional neural network, and the three-
Organizing network is to adjust the weight of the network with a large number of
sample training data through the self-organization method so that the output of
the final network can reflect the distribution of sample data. At the beginning of
network training, a certain output node can respond to a certain class of patterns
to represent the pattern class. However, it is stipulated here that adjacent nodes
class in the actual pattern distribution. The cycle is a sequence of the neural
4
networks linked to the current output from the previous output, the specific forms
of the memory for the information on the front of the network, and applied to the
nodes' connection, the input and the hidden layer include the output of the input
layer and a moment the output of the hidden layer. The neural network
structure, that is, the calculation process of building a model. The corresponding
RBF neural network has a high approximation accuracy, higher than the
general neural network, even can achieve complete approximation. And the
neural network design is very convenient, can automatically increase the number
RBF neural network has excellent performance. It can approximate any nonlinear
function with arbitrary accuracy and has global approximation ability. This makes
the optimal local problem solved. The topology has a compact structure, and the
characteristics of fast convergence. RBF neural network not only has the general
ability and generalization ability, parallel information processing ability, but also
has a strong clustering analysis ability. The advantage of the simple learning
algorithm is a kind of good performance for the network, with the interpolation in
5
Also, consider that the radial basis function neural network is implemented
function. The critical parameters in the network are the center of the basis
function and the width. The connection weights between the hidden layer and the
output layer. This topic was proposed using the backpropagation algorithm based
stock market, seeking the non-linear relationship between the stock market data
and providing the corresponding basis for the investors to invest in the stock
market.
model. Does not need to have a priori knowledge of the corresponding function
form, and does not depend on any parameter hypothesis, can effectively adapt to
Thirdly, this study intends to adopt the RBF neural network, whose core is
the radial basis function, a real value function whose value only depends on the
distance from the origin of the coordinates. RBF neural network is a three-layer
neural network structure, including input layer, hidden layer, and output layer.
6
3. What is the specific algorithm form of artificial neural network
technology?
algorithms.
this paper, I effectively reviewed the courses which I had learned during my
study, and systematically sorted out the relevant content and knowledge
topic and the basic theoretical knowledge I have learned before, I have a general
analyzed the theory of artificial intelligence. Through the systematic and in-depth
7
Literature Review
Since the birth of the stock market, the volatility of the stock's closing price
has been closely watched at all levels, and there have been several ways to
study the rules of the stock market to predict its performance. In a business
variables to make the right decisions to avoid huge losses. However, the financial
time series data analysis and prediction is extremely difficult, and the most
complex task is to improve the investment decisions because the stock market is
system. The price trend is extremely complex and easily affected by factors
how to predict the stock market more accurately is a subject of wide attention
tasks. The SVR model is an extension of the standard SVR and can be adapted
to the margin. The volatility of financial data and its variation can be achieved by
changing the marginal value of the SVR. At the same time, they also analyzed
(2014) used machine learning models to predict stock market prices. The
algorithm in this model combines the least square support vector machine (LS-
8
optimization algorithm can accurately predict the daily stock price by studying the
technical indicators and historical data of the stock. By selecting the best free
parameter combination for LS-SVM, PSO algorithm avoids overfitting and local
minimum problems, and improves the accuracy of prediction. They also applied
and evaluated their models using 13 benchmark financial data sets, and
artificial neural networks. Chang (2014) used artificial neural network (ANN) to
study various techniques for predicting the stock market. The purpose of his
clarify the future development direction. Olatunji (2014) predicted the Saudi Stock
market through artificial neural network. The model is based on historical data on
the Saudi stock market in various periods. The results of this study also
reference for traders and investors in the Saudi stock market. By improving the
Olatunji et al. (2014) used the closing price of a stock as a stock variable
and entered it into the system for prediction. Based on the experimental
simulation conducted, they selected the number of window gaps to determine the
number of previous days used to predict the next day's closing price data in order
to determine the best possible value (Olatunji et al., 2014). Devadoss et al.
(2013) attempted to analyze the stock price of the selected stock through neural
9
network modeling, so as to predict the closing price. The network they developed
consists of six parts: the input layer, the output layer, the hidden layer, the
opening price, the high and low closing price, and the volume. The performance
mean absolute deviation and root mean square error (Devadoss et al., 2013). In
and used a backpropagation algorithm to predict stock prices. There are several
ways to predict stock prices, but their results suggest that artificial neural
networks can be more accurate in predicting stock prices. In order to train the
neural network to improve the accuracy of the prediction, they used a training
data set consisting of input and output. The performance of the neural network
depends on the number of layers in the network, the number of neurons in the
input layer and hidden layer, the activation function used, the learning rate,
momentum and other parameters (Ramani et al., 2013). Nayak et al. (2014)
attempted to predict the closing price of the Indian stock market. He used two
ANN models and two neurogenetic hybrid models to make predictions. They
prediction models: simple neural network model for gradient descent training
addition, they also used the daily closing prices of the Bombay Stock Exchange
(BSE) for empirical research and evaluation in their research, and the results
10
showed that these models can make effective predictions for the Indian stock
market.
Navale (2016) designed a new system that was able to study a database of
stocks and make predictions about future data on stocks based on it. This
Therefore, the stock forecast given by this system is of the highest probability
(Navale et al., 2016). In 2017, Shah and others tried to make stock market
predictions using artificial neural networks. They studied the types, salient
features, internal workings of different types of neural networks, and the various
the advantages and disadvantages of these networks. Finally, they selected the
best one from these networks and combined it with the national stock index to
predict the stock prices of the selected companies (Shah et al., 2016).Deng et al.
Then, they put forward the problems existing in the current research methods of
stock forecasting and discussed the prospects of stock forecasting (Deng et al.,
2017). In 2018, Yao et al. conducted an in-depth analysis of 180 stocks that
could have an impact on the Shanghai Stock Exchange. Firstly, they analyzed
11
the closing price of The Shanghai Stock Exchange from January 1, 2005 to June
19, 2015, calculated the logarithmic correlation coefficient, and then established
the prediction model of the stock market by using the threshold method.
index for predicting node connection probability in different stock networks (Yao
et al., 2017).
stock market. He predicted daily price movements of the Indian stock market
(S&P CNX Nifty) over an eight-year period from January 1, 2008 to April 8, 2016.
Normalized mean square error (NMSE) and sign accuracy (SCP) measures were
used to measure the accuracy of the model. The results show that the
normalized error of one day lag is only 0.02. This suggests that the forecast is
very close to the actual stock market data. Further analysis of the data showed
that the model was 60 per cent accurate in predicting the daily direction of Indian
stock market prices after the 2008 financial crisis. In addition, the results also
show that the stock market price lagging by one day has a reasonable influence
on the predictive ability of the feedforward neural network model. Thus, the
practice of the Indian stock market does not support the EFFICIENT market
hypothesis. This model is very helpful for investors, professional traders and
12
regulators to understand the effectiveness of the Indian stock market and assist
al., 2018). Nti (2021) proposes a new stock price forecast framework. Based on a
hybrid deep neural network architecture (convolutional neural network (CNN) and
long - and short-term memory (LSTM)), this framework was named IKN-
analysis of stock related information from six different sources. Secondly, they
also used CNN and random search algorithm as feature selectors to build a basic
the stacked LSTM network using the tuning parameters (features) of the base
model, resulting in a much better prediction accuracy for this model. They further
validated the accuracy of the model with an empirical assessment using stock
data from the Ghana Stock Exchange (GSE) from 3 January 2017 to 31 January
stock market investments based on a sample of 2,326 papers from 1995 to 2015
on Scopus. Carta (2021) proposed that machine learning could be used to deal
with the binary classification problem. The technique can also be used to predict
how much future share prices of individual companies in the STANDARD &
Poor's 500 index will change -- high or low. Machine learning materials are drawn
from published articles around the world, making it easy to identify the most
influential words in specific industry markets and at specific time intervals. Then,
13
based on these, the vocabulary is generated. Perform feature engineering and
provide the final features to the decision tree classifier. The high or low of the
stock the next day. In 2021, Wang proposed that artificial intelligence technology
Composite Index from the beginning of 2005 to the beginning of 2019, including
opening price, highest price, closing price, lowest price and trading volume.
Then, he selected MA, KDJ and MACD as technical indicators, and made a
volatility has also incorporated logistic regression and support vector machines in
ai models. Finally, the research results show that the support vector basis
method based on radial basis is more suitable for the stock index prediction
Stock market prediction technology is for the stock market investors; the
investment institutions have great economic value. To help the investors and the
investment institutions profit, avoid the investment risk, but the value of the stock
market prediction technology is far more than that. From a social level, the stock
market prediction technology can prevent the financial market systemic risk,
helps the rational allocation of the social capital. Stock data has its
14
characteristics, and the existing methods of forecasting technology are not fully
heterogeneous data of various scales from multiple sources. The traditional idea
of simply relying on experts to analyze and forecast has been difficult to meet
industry development needs. To meet the rapid analysis of the massive stock
market data, auxiliary or even completely instead of the investors in the stock
emerged based on the information technology. The research also boosted rely
forecast the various types of investment targets in the stock market at multiple
scales and dimensions. Therefore, stock market forecasting has great economic
significance. At the same time, stock market forecasting is also full of challenges
15
CHAPTER TWO
ARTIFICIAL INTELLIGENCE
Brief Introduction
agent. It furthers means that the environment can be observed its and
intelligent system, has the capacity to interpret the external data accurately, and
further utilize that data as their knowledge to complete their missions where
every part of the branch field which is deep but not interconnected. The crucial
machines that are similar and even superior to humans. Several tools applying AI
16
As a result, artificial intelligence has the possibility to evolve into ultimately
Recently, more and more attention has been paid to artificial intelligence,
functions and some kinds of robots which can make decisions concerning
similarly as the brains of human, therefore, the computers can then achieve a
subjects including computer science, psychology, and so on, combing all natural
science and social science knowledge, which increases its complexity. It is also
hard to figure out the relationship between artificial intelligence and thinking
From the standpoint of thinking science, AI has its drawbacks as the ability
thinking, but can not get rid of its mathematical logic considering mathematics is
also a subject connected with the linguistics, thinking process. Therefore, the AI
17
system still rely on mathematical tools although it is not the only standard logic
applied when developing AI. Mathematics plays an important part in the artificial
intelligence development. And it further enhance the process and help to develop
are appeared to be sentient and self-aware and can further do reasoning and
problems resolution. While supporters who only believe in weak AI insisted that it
is hardly probable to invent such AI to address issues like human being. The
appearance of this technology seems smart but the implicit system still does not
The Principle of AI
This new technology, artificial intelligence is a science that has been studied
and developed for many years. Now, a large number of theories, approaches,
and learn like humans, that is, to use computers or other agents to simulate
human intelligence. One of the most popular ways to realize artificial intelligence
is to train the neural network to carry out the relevant information fitting analysis
algorithm through pairs of x and y values, making the result closer and closer to
the y value after the input of the x value. The neural network with x and y values
is the supervised learning type, while the neural network with x and y values is
18
al., 1984). Deep learning mainly relies on the data, the algorithms, the computing
power, etc. With the prevalence of the Internet, massive information are
and more strong. Further, the optimization of some algorithms become more and
al., 1987).
Where w refers to the weight and b refers to the thresholds. Represents the
Sigmoid function, and the function of Sigmoid is to convert the calculation result
to a value between 0 and 1 (there are only two results, yes or no, namely 1 or 0,
and the result should be controlled within 1 square root of 0, the closer to 1, and
The neural network uses the loss function to judge whether its prediction
the difference between the predicted value and the actual value (Menard, 2004).
19
A higher prediction accuracy is reflected by a smaller results. The neural
network's learning is to figure out a method to reduce the value of the loss
function, and the w and the b determine the value of the loss function, so the
issue can be turned into how to find the appropriate figures of the w and the b.
Gradient descent algorithms update w and b step by step, making the loss
function smaller and smaller, eventually finding the minimum or near the
minimum.
and engineering calculations. Nowadays, the computers can not only complete
such tasks, but also do them better, faster, and more accurately than the human
20
Figure 3. The application of AI technology
application field in terms of both the number of companies on the market and the
of all connections will be a great deal of the data is output to the network, the
network processing these actions and learning. If the action conforms to the
specified action, it will increase the weight if it does not conform to, reduce the
weight, adjust the weighting system through the above process, and learn more
than the human after hundreds of thousands of times. The concept of deep
learning comes from the research of the artificial neural network. A typical type of
21
Moreover, deep learning combines the low-level features to form a more
conception was put forward by Hinton et al.. They came up with an unsupervised
which is aimed to solve the optimization problems concerning the deep structure.
developed. Besides, The first real multilayer structure learning algorithm is the
convolutional neural network, invented by Lecun et al., which utilizes the relative
performance. The motivation is to create the neural network of the human brain
for analytical learning inside the machines. Therefore, machines are designed to
imitate the mechanism of the human brain to input and output the data, including
the linguistics, the voices, and the pictures. The methods of deep learning can be
networks (CNNs) are a machine learning model under deep supervised learning.
In contrast, deep belief networks (DCNS) is a machine learning model under the
unsupervised learning.
22
A computer's ability to recognize the objects, the scenes, and the images
is the definition of computer vision. Computer vision has a wide range of niche
processing and other technical tools to break down the image analysis tasks into
manageable chunks.
text and its recognition and processing. Speech recognition has many
actively discover the user's current or potential needs, actively push the data to
the user's data network, and then instantly transfer the preferable information to
the user, enhancing the efficiency of browsing the internet and improve the rate
of conversion.
23
CHAPTER THREE
Brief Introduction
The full name of the RBFNN is Radial Basis Function Neural Network. The
RBFNN is the single hidden layer of the feed-forward neural network based on
the function approximation proposed in the late 1980s (Lee et al. 1999.). With the
research becoming more and more mature, the RBFNN has appealed to the
nonlinear approximation ability, and strong generalization capacity, and has been
seen the prevalence of application in many scientific field, for example, the
pattern classification, the function approximation, and the data mining (Elanayar,
1994).
The RBF network can approximate any nonlinear function and tackle with
the complexity to analyze rules and laws in the system. It has marvelous
and fault diagnosis all adopt this approach. Network called the global
24
contributes to decreasing the speed of learning the global approximation
network.
If only a few connection weights affect the output of a local area in the
input space, the network is called a local approximation network. In 1985, Powell
proposed the radial basis function (RBF) method. The so-called radial basis
function is a kind of scalar function with radial symmetry. The distance between
input mode and center vector (such as Euclidean distance) is used as the
function's independent variable for the hidden nodes of the RBF neural network,
and the radial basis function (such as the Gaussian function) is used as the
activation function. The farther the input of neurons is from the center of the
radial basis function, the lower the activation degree of neurons. The output of
the RBF network is related to the local hidden node, which is hard to input from
the data center. Therefore, the RBF neural network has the characteristics of
local mapping.
Basic Principle
The function of radial basis lies in a natural function which the final value
relies solely on the distance from the origin. Simply put, the value of the function
depends only on the distance of the store from the center point. Typical radial
basis functions include the Gaussian function, the Multiquadric function, and the
follows:
25
(2) Multiquadric function:
RBF of the shape of the Gaussian function has good local characteristics,
and its response is significant only in a neighborhood near the center point. In
contrast, the value of the function decreases monotonically with the increase of
the distance from the center point and gradually approaches 0. A three-layer
neural network can fit any function. Similarly, RBFNN has three layers, and the
hidden layer uses radial basis functions. Therefore, it can fit any function
completely. The radial basis functions mentioned above are relatively simple
forms, but more complex radial basis functions may be used in practice. For
example, there is the superior form of the radial basis functions, and that is.
Moreover, the central point is the diameter base width. The width of the
radial basis determines how fast the radial basis function falls, which is also the
size of the circle. RBFNN has only three layers, the first layer is the input layer,
the second layer is the hidden layer, and the third layer is the output layer. The
weights between the input layer and hidden layer neurons are both 1. The hidden
layer is a neuron that uses a radial basis function as an activation function. The
connection relationship between the hidden layer and the output layer is an
ordinary neural network, and the weight between them can be changed through
training. The key of RBFNN is to determine the radial basis function to determine
where the center point is, how large the diameter is, the width of the basis, and
the number of radial basis functions will affect the effect of the neural network.
26
Figure 4. The main principle of the RBFNN
Brief Introduction
information only propagates forward in the neural network, through the input
nodes, then pass from the hidden layer, and finally through the output nodes. In
models (like the Sigmoid neurons), to feedback to itself. The feed-forward neural
nonlinearly separable data. The layer existing between the input and the output
layers is called the hidden layer. The hidden layer is used to deal with the
27
complex nonlinear separable relationship between the input and output. The
an input layer, several hidden layers and an output layer. There are no loops or
loops, each layer is composed of multiple neurons. Neurons are fully connected
with the input vector, but there is no links between neurons, and there is no
cross-layer connection. The input vector of the next layer is based on the output
of the former layer. The input of the neural network is a vector, and the final
The dimension of the output vector relies on the number of neurons in the
nonlinear composite function. It is the learning process of the input layer along
the direction of the network structure, a positive spread until the output layer, and
then by backpropagation algorithm to update the weights and bias. The whole
process cycle until meeting the maximum number of iterations or little change on
Basic Principle
Hidden layers refer to the layer between the input and output layers in
neural networks. The neurons in the hidden layer and output layer are functional
neurons with an activation function. If only one hidden layer is included, it can be
called the multilayer neural network, and the commonly used neural network is
28
◆ Each layer of the neurons and the next layer of the neurons are
completely interconnected.
refers to the absence of the loops or the loops in the network topology, rather
than that the network can only propagate forward and not backward. Information
flows through the function of x, through the middle of the calculation process, and
between the output of the model and the model itself. The general approximation
shows that the feedforward neural network has a linear output layer and at least
one activation function hidden layer with any compression property. As long as
sufficient hidden elements are provided for the network, it can accurately
another.
29
CHAPTER FOUR
The corresponding stock index data set is derived from the Shanghai
Stock Exchange composite index in China. The composite index of the Shanghai
and abroad, which can be used for measuring the overall performance of China's
securities market. The trading price of the same stock was recorded for ten
consecutive days in January 2016. The data for each day included 100 sample
points, and the total amount of samples in the data set was 1000. The actual
data of the 11th day are used as the expected output data, and the forecast data
are obtained by training the model with the data of the first ten days. The model
is evaluated by comparing the deviations between the actual data and the
expected data. The stock market is a dynamic change process that is very
unstable. It is affected not only by the domestic and foreign economic factors but
also by the speculations of bankers, the regulations of the government, and other
factors. Therefore, the sample data should be selected under normal operating
conditions (i.e., with little or no instability such as the booms and the crashes).
Otherwise, if the sample is very special, only some specific rules can be
30
Introduction of Simulation Software
sets for processing. Matrices and arrays are at the core of data processing in
MATLAB since all data in MATLAB is represented and stored in arrays. Even
interface tools, which facilitates the users in terms of carrying out various
application developments.
Simulation Results
(1) RBFNN
financial data of the stock fluctuations are very complex, and their changes are
highly disorderly, increasing the difficulty of predicting. The votes are generally
Because of the time series of stocks, the complexity and uncertainty of the
series, which inspire us to analyze the nonlinear time series, achieve effective
prediction.
its inherent law is unable to be revealed by using traditional time series prediction
technology. However, the neural network theory developed in the last ten years
31
has gradually become a powerful tool for modeling and forecasting nonlinear
nonlinear basis functions. There are two critical parameters in the network: the
center and width of the essential functions, and the other is the connection
weight between the output and hidden layers. The radial basis function neural
network is a kind of minimum local network. Compared with the standard feed-
forward network, its advantages are simple structure and simple training. The
linear learning algorithm, and the high precision characteristic of the nonlinear
32
Figure 6. Error curve of the RBFNN
(2) MLFFNN
the stock market has been one of the most important and challenging problems
possible to predict the closing price. In the traditional stock market, the prediction
of the stocks’ closing price is used in large quantities for reflecting the structure
data of the economy, such as opening price, volume, price index, etc. Therefore,
33
taping public opinion in the stock market is of great significance to the investors
by using the machine learning algorithm or the in-depth learning algorithm for
accurate and effective predictions of the closing price of the stock market.
In this section, the simulation results are mainly analyzed and explained.
This topic mainly uses two types of neural networks to analyze as well as
forecast the relevant data of the stock market, including the radial basis function
neural network and the multilayer feed-forward neural network. As shown in Fig.
5 and Fig. 7, the two types of network structures can effectively fit and predict the
data. However, Fig. 6 and Fig. 8 show that as the iteration times increase, the
error of RBFNN is much smaller than that of the MLFFNN, which verifies the
process, the trend of employing artificial intelligence is becoming more and more
learning recently. The potentiality of applied machine learning relies not only on
its fast and credible performance but also on its ability to uncover hidden
through more relevant data and information. Data mining refers to the process of
selecting effective and operable information from large databases and using the
34
selected information for making critical business decisions. The technology of
data mining is mainly based on statistics and machine learning, and the patterns
can be inferred from different models. Data mining is helpful in finding the
association between the assets and creating prediction models based on a broad
range of data. For example, historical data, the short-term exchange rates, the
interest rates can predict the stock price. Text mining is also a helpful tool in
terms of predicting the stock price. Data mining tools have the advantages of
being interactive, easy to understand, and low in cost. At the same time, they can
system through the specific knowledge obtained from human experts. The expert
system is aimed not to simulate the psychological process of the human experts
suggestions in every circumstance, even if the data are incomplete. This requires
genetic operators, the genetic algorithm can increase the individual adaptation
value in the iterative process of evolution, such as the mutation or the crossover.
The genetic algorithm is advantageous mainly in that its application does not
demand any clear knowledge about the objective function. Genetic algorithms
35
can perform well in a vast potential data set. A fuzzy system is an expert system
from fuzzy logic. Compared with the theory of probability, fuzzy logic does not
assume that the sum is equal. The fuzzy scheme system comprises three steps:
Therefore, they are especially suitable for being applied in financial markets for
operation. Compared with the function of the biological neural system, the
function of the artificial neural network in a large part relies on the relationship
between the elements. Through a clear understanding of the target value, the
network can learn by adjusting the value between connections (the weight
between elements). Artificial neural networks are extensively used for solving
artificial neural networks are advantageous mainly in that they can capture
al.1997). Comparing with the economic parameter model, the artificial neural
network provides the results quicklier. Neural networks have been proven to be
corporate bond rating prediction, and it is far more effective that of the traditional
36
mathematical modeling technology (Mittal, A. K.2012).
37
Figure 8. Error curve of the MLFFNN
38
CHAPTER FIVE
CONCLUSION
In the financial research field, stock market forecasting has always been a
hotspot. Stock market forecasting attempts to predict the future value of the stock
market forecasting research is usually based on the stock market data under a
certain scale.
After the analysis, some repeated patterns in the data are extracted to
provide predictions of the movement trend of the stock market on this scale.
Although the data at different scales may have different change rules, they are
considered, the stock market state can be described more accurately, and then
the stock market can be predicted better. The radial basis function network (RBF)
is a novel and effective feed-forward neural network with high computing speed
prediction of nonlinear time series such as stocks. Radial basis function networks
(RBF) have been widely used in predicting because of their fast convergence
and global optimality. The stock market is a sophisticated nonlinear system with
uncertainty, and its dynamic mechanism is very complex. In this paper, RBF
neural network model is used for forecasting stock prices. By comparing with
39
other forecasting methods, we can see that this method has advantages and
feasibility..
40
APPENDIX
41
The appendix mainly introduces the MATLAB source code used.
(1)RBFNN
clc
clear all
load ___individual_inputs
x1=(x1-min(x1))./(max(x1)-min(x1));
x2=(x2-min(x2))./(max(x2)-min(x2));
x3=(x3-min(x3))./(max(x3)-min(x3));
x4=(x4-min(x4))./(max(x4)-min(x4));
x5=(x5-min(x5))./(max(x5)-min(x5));
x6=(x6-min(x6))./(max(x6)-min(x6));
x7=(x7-min(x7))./(max(x7)-min(x7));
x8=(x8-min(x8))./(max(x8)-min(x8));
x9=(x9-min(x9))./(max(x9)-min(x9));
x10=(x10-min(x10))./(max(x10)-min(x10));
load ___stock_output
yd=stock_output(:,1);
yd=(yd-min(yd))./(max(yd)-min(yd));
p=30;
n=100;
h=2*rand(p,10)-1;
I=ones(p,1);
w1=rand(p,1);
rou=2/sqrt(2*p);
eta=0.0099;
MSE=0;
iter=1200;
for i=1:iter
for k=1:100
arg=((x1(k)*I-h(:,1)).^2+(x2(k)*I-h(:,2)).^2+(x3(k)*I-h(:,3)).^2+(x4(k)*I-
h(:,4)).^2+(x5(k)*I-h(:,5)).^2+(x6(k)*I-h(:,6)).^2+(x7(k)*I-h(:,7)).^2+(x8(k)*I-
h(:,8)).^2+(x9(k)*I-h(:,9)).^2+(x10(k)*I-h(:,10)).^2);
phi=exp(-arg./2*rou^2);
y(k)=phi'*w1;
e(k)=yd(k)-y(k);
MSE=MSE+0.5*e(k)^2;
h(:,1)=h(:,1)+eta*e(k).*w1.*phi.*(x1(k)*I-h(:,1))./rou^2;
h(:,2)=h(:,2)+eta*e(k).*w1.*phi.*(x2(k)*I-h(:,2))./rou^2;
h(:,3)=h(:,3)+eta*e(k).*w1.*phi.*(x3(k)*I-h(:,3))./rou^2;
h(:,4)=h(:,4)+eta*e(k).*w1.*phi.*(x4(k)*I-h(:,4))./rou^2;
h(:,5)=h(:,5)+eta*e(k).*w1.*phi.*(x5(k)*I-h(:,5))./rou^2;
h(:,6)=h(:,6)+eta*e(k).*w1.*phi.*(x6(k)*I-h(:,6))./rou^2;
h(:,7)=h(:,7)+eta*e(k).*w1.*phi.*(x7(k)*I-h(:,7))./rou^2;
42
h(:,8)=h(:,8)+eta*e(k).*w1.*phi.*(x8(k)*I-h(:,8))./rou^2;
h(:,9)=h(:,9)+eta*e(k).*w1.*phi.*(x9(k)*I-h(:,9))./rou^2;
h(:,10)=h(:,10)+eta*e(k).*w1.*phi.*(x10(k)*I-h(:,10))./rou^2;
w1=w1+eta*e(k)*phi;
end
AMSE(i)=MSE/k;
MSE=0;
end
figure
plot(yd,'k:','LineWidth',1.8)
hold on
plot(y,'r-<','LineWidth',1.3)
legend('Actual Output', 'Predicted Output')
xlabel('Numbers')
ylabel('Output')
set(gca,'fontsize',14,'Fontname', 'Times New Roman')
figure
plot(AMSE,'p')
xlabel('Iterations')
ylabel('Mean Square Error')
set(gca,'fontsize',14,'Fontname', 'Times New Roman')
(2)MLFFNN
clc
clear all
load ___individual_inputs
x1=(x1-min(x1))./(max(x1)-min(x1));
x2=(x2-min(x2))./(max(x2)-min(x2));
x3=(x3-min(x3))./(max(x3)-min(x3));
x4=(x4-min(x4))./(max(x4)-min(x4));
x5=(x5-min(x5))./(max(x5)-min(x5));
x6=(x6-min(x6))./(max(x6)-min(x6));
x7=(x7-min(x7))./(max(x7)-min(x7));
x8=(x8-min(x8))./(max(x8)-min(x8));
x9=(x9-min(x9))./(max(x9)-min(x9));
x10=(x10-min(x10))./(max(x10)-min(x10));
load ___stock_output
yd=stock_output(:,1);
yd=(yd-min(yd))./(max(yd)-min(yd));
n=100;
w1=0.1*rand(20,1);
w2=0.1*rand(20,1);
w3=0.1*rand(20,1);
w4=0.1*rand(20,1);
w5=0.1*rand(20,1);
43
w6=0.1*rand(20,1);
w7=0.1*rand(20,1);
w8=0.1*rand(20,1);
w9=0.1*rand(20,1);
w10=0.1*rand(20,1);
w11=0.1*rand(20,1);
wh=0.1*rand(20,1);
wo=0.1*rand;
eta=0.001;
MSE=0;
iter=1200;
for i=1:iter
for k=1:100
net1=tansig(x1(k)*w1+x2(k)*w2+x3(k)*w3+x4(k)*w4+x5(k)*w5+x6(k)*w6+x7(k)*w
7+x8(k)*w8+x9(k)*w9+x10(k)*w10-wh);
y(k)=purelin(net1'*w11-wo);
e(k)=yd(k)-y(k);
MSE=MSE+0.5*e(k)^2;
a=dpurelin(net1'*w11-wo,y(k))*e(k);
b=dtansig(x1(k)*w1+x2(k)*w2+x3(k)*w3+x4(k)*w4+x5(k)*w5+x6(k)*w6+x7(k)*w7
+x8(k)*w8+x9(k)*w9+x10(k)*w10-wh,net1);
delw1=eta*x1(k)*a*b.*w11;
delw2=eta*x2(k)*a*b.*w11;
delw3=eta*x3(k)*a*b.*w11;
delw4=eta*x4(k)*a*b.*w11;
delw5=eta*x5(k)*a*b.*w11;
delw6=eta*x6(k)*a*b.*w11;
delw7=eta*x7(k)*a*b.*w11;
delw8=eta*x8(k)*a*b.*w11;
delw9=eta*x9(k)*a*b.*w11;
delw10=eta*x10(k)*a*b.*w11;
delw11=eta*net1*a;
delwh=eta*(-1)*a*b.*w11;
delwo=eta*(-1)*a;
w1=w1+delw1;
w2=w2+delw2;
w3=w3+delw3;
w4=w4+delw4;
w5=w5+delw5;
w6=w6+delw6;
w7=w7+delw7;
w8=w8+delw8;
w9=w9+delw9;
w10=w10+delw10;
44
w11=w11+delw11;
wo=wo+delwo;
wh=wh+delwh;
end
AMSE(i)=MSE/k;
MSE=0;
end
figure
plot(yd,'k:','LineWidth',1.8)
hold on
plot(y,'g-*','LineWidth',1.3)
legend('Actual Output', 'Predicted Output')
xlabel('Numbers')
ylabel('Output')
set(gca,'fontsize',14,'Fontname', 'Times New Roman')
figure
plot(AMSE,'p')
xlabel('Iterations')
ylabel('Mean Square Error')
set(gca,'fontsize',14,'Fontname', 'Times New Roman')
45
REFERENCES
Burrell, P. R., & Folarin, B. O. (1997). The impact of neural networks in finance.
Carta, S. M., Consoli, S., Piras, L., Podda, A. S., & Recupero, D. R. (2021).
Devadoss, A. V., & Ligori, T. A. A. (2013). Stock Prediction Using Artificial Neural
Deng, J.-X., & Gan, G. (2017). A Survey of Stock Forecasting Model Based on
73–78.
Er, M. J., Chen, W., & Wu, S. (2005). High-speed face recognition based on
Neural Networks 5.
46
Genesereth, M. R. , & N. J. Nilsson. (1987). Logical Foundation of Artificial
Series 1864.1:012151.
Lee, et al. (1999). Robust Radial Basis Function Neural Networks. IEEE
Decisions.
Navale, G. S., Dudhwala, N., Jadhav, K., Gabda, P., & Vihangam, B. K. (2016).
1–28.
29.2:2 - 4.
47
Nayak, S. C. , Misra, B. B. , & Behera, H. S. . (2014). Impact of data
Forecasting the saudi arabia stock prices based on artificial neural networks
Tripathy, N. (2018). Predicting Stock Market Price Using Neural Network Model.
48
Wong, B. K., & Selvi, Y. (1998). Neural network applications in finance: a review
129–139.
Wang, Z. (2021). Predicting the rise and fall of Shanghai composite index based
Yang, H., Chan, L., & King, I. (2002). Support Vector Machine Regression for
Yao, H., & Lu, Y. (2017). Analyzing the Potential Influence of Shanghai Stock
49