1. Introduction
In the new global world, it has been a universal goal to make one’s life stress-free and to prepare oneself for upcoming challenges without any pressure. A fundamental concept in society is that wealth brings comfort and luxury, so it is not surprising that there has been so much research done on ways to predict the stock market values. It is due to the global issues such as increasing of population, transportation, water problems, and business [
1]. Furthermore, the absence of suitable predicting tools makes it more attractive to researchers. A stock market is a community market for trading the company’s shares daily at the approved stock price, which depends upon the demand and supply gap, quality, region, and global environment as well. Therefore, stock market prediction trend is a significant issue in finance for all developed countries. SSM has a key role for the economic development of many countries such as Egypt, India, Bangladesh, Pakistan, Philippines, China, Japan, America, United States, Afghanistan, and Indonesia.
The scientists and economic and computer science researchers have struggled to develop powerful finance position tools. Several approaches including mathematical, statistical, economic, and computational approaches have been proposed and used for forecasting of the economic position of different countries. Unfortunately, generally, these approaches are not perfect to predict the SSM values efficiently. There has been no specific research for prediction of SSM values.
Traditionally, different statistical prediction methods [
2,
3] such as linear regression, time series analysis, and chaos theory were used to predict the behavior of the stock price trends. However, these methods were partially successful due to their non-reliability. As an alternative to these approaches, soft computing techniques such as artificial neural network [
4,
5] and evolutionary algorithm [
6] are widely used to capture the non-linearity trend of the stock market price. In these approaches, Artificial Neural network (ANN) has the ability to adjust itself according to the given information while the evolutionary algorithm is captured to find the global or near-to-global solution of the problem. By keeping the advantages of its self-adjusting ability, researchers were paying more attention to ANN and evolutionary algorithms and presented several algorithms to solve the problems. In ANN, the performance depends upon learning algorithm, dataset nature, and suitable topology. The most commonly used training algorithm is the back-propagation (BP) algorithm [
7] which is at risk of sticking in local minima, so BP may lead to failure in finding the global optimal solution. On the other hand, the use of the evolutionary algorithms (EAs) is a successful method to find the global solution. The major advantages of the EAs are that finding the derivative of the functions is not required, and they use probabilistic transition rules instead of deterministic rules to update the solutions. Until now, several researchers have presented a variety of algorithms such as differential evolution (DE) [
8], harmony search (HS) [
9], genetic algorithm (GA) [
10], particle swarm optimization (PSO) [
11], artificial bee colony (ABC) [
12,
13], and some hybrid algorithms [
14,
15,
16]. Under these algorithms, Abdual-Salam et al. [
17] compared the DE and PSO algorithm for training the feed-forward neural network for stock price prediction. Garg [
15] presented a hybrid PSO-GA algorithm for solving the various constraint optimization problems. In this approach, PSO is used to explore the solution while GA is being used for updating the solution. In [
18], authors have presented a quick ABC algorithm for solving the optimization problems. Garg [
16] presented a penalty-guided ABC algorithm for solving structural engineering design problems. In [
19,
20], authors have presented a hybrid ABC algorithm for training neutral networks as well as predicting the time series data. In the field of time-series predictions, authors [
21,
22,
23] have presented an approach based on EAs for solving the stock time problems.
Thus, by keeping the advantages of both the artificial neural network and EAs, the goal of this paper is to find out a prediction system for Saudi Stock Market (SSM) values based mainly on SSM historical data covering a large span of time that can predict closing stock price precisely. For it, we propose an algorithm based on ABC to minimize the error in the trend and actual values by using the hybrid technique based on neural network and artificial intelligence. To increase the exploration and exploitation procedures of EAs, we presented a Quick Gbest Guided artificial bee colony (ABC) learning algorithm to train the feed-forward neural network (QGGABC-FFNN) model. In it, the effective amount of exploitation and exploration strategies are increased through global best (gbest) guided bee and quick bee strategy [
24]. The presented approach has been verified and tested to predict the accurate trend of SSM values.
The rest of the manuscript is organized as follows: In
Section 2, we present the concept of the feed-forward neural networks. In
Section 3, we present the concepts of ABC algorithm to solve the optimization problem. In
Section 4, we present a QGGABC algorithm to solve the time series data prediction problem.
Section 5 illustrates the presented approach, tests it on the SSM values, and discusses results. Finally, a conclusion and future work are stated in
Section 6.
2. Neural Networks and Saudi Stock Market
A stock market is a public market for the trading of company stock and derivatives at an agreed price, volume, and quality; these are securities listed on a stock exchange as well as those only traded privately [
1]. It is also called secondary market, as it involves trading between two investors, the public regulatory body and private investors [
25]. SSM is the economic hub of different countries especially for Asian and Gulf regions [
26]. Therefore, the prediction is an essential part of the economy in the KSA for shareholders and investors to estimate the stock values price and select the best trading opportunity accurately among different profitable organizations in advance.
Neural networks (NNs) are powerful soft-computing forecasting tools that predict different stock market values [
27]. It is the non-linear mathematical model used to map past and future values of time series datasets for the purpose of analysis of upcoming trends. The originality of the ANNs lies in their ability to determine nonlinear relationships in the input data set without a prior assumption of the knowledge of mapping between the input and the output patterns in different areas of knowledge like computer science, social studies research, engineering, biology, and mathematical sciences [
23,
25]. ANN tools are very famous for classification and prediction tasks of financial time series datasets, especially of stock exchange market values due to their unpredictable behaviors [
22].
For KSA stock exchange prediction, none of the traditional time series methods has proved to be consistently correct prediction tools investors would like to have. However, machine learning methods have been successfully used for Saudi stock exchange values prediction. For example, genetic fuzzy systems (GFS) and ANN used to construct a stock price forecasting expert system have obtained high accuracy for Airlines and IT centers [
21]. The three well-known feature selection methods, which are Principal Component Analysis, GA, and decision trees with BP algorithm, were used for better prediction the stock price for investors. Neuro-Fuzzy Inference System was used for stock exchange analysis. GA with feed-forward neural network (FFNN) was used to predict stock market prices [
28]. BPNN and GA were used for SSM to predict the direction of daily price changes, however, due to slow convergence speed and trapping in local minima [
22].
Multilayer Perceptron (MLP), which is also known as an FFNN, was introduced by F. Rosenblatt for solving non-linear XOR classification problems and was then successfully applied to different science and engineering problems [
29]. MLP is highly used and tested with financial problems such as in stock exchange market prediction. It consists of physical components called neurons, and the connection between them [
30]. The basic architecture of MLP with one input, two hidden and one output layers is shown in
Figure 1.
If we assume weights vector to be
w,
x is the vector of inputs,
b is the bias, and
f is the activation function then the output through MLP neurons is computed, mathematically, as
Here, the most commonly-used hidden neuron activation function is the sigmoid function which is given by Equation (2).
During the process, sometimes the supervised learning problem of the MLP failed to train the ANN effectively and cannot solve the given complex problems in an efficient way. Furthermore, the conventional algorithms methods trapped in local minima due to suboptimal weight values, wrong number of parameters selection, unsuitable network structure, and the fully random method of training as well. In order to overcome it, bio-inspired learning algorithms have been proposed for MLP such as ABC, ACO, and CS. Here, in these approaches, Artificial Neural network (ANN) has the ability to adjust itself according to the given information while the evolutionary algorithm is captured to find the global or near to global solution to the problem. Thus, we have incorporated the idea of the EAs into the present study and proposed a new updated efficient method based on honeybees’ intelligent behaviors, which are used to guide the ANN with enough suitable control parameters. The presented algorithm was used here to train and test MLP for SSM prices prediction of different business organizations.
3. Bees-Inspired Learning Algorithms
A rich source of inspiration is nature, which has motivated many researchers to develop a nature-inspired approach for solving complex problems. Therefore, from the last decade, bio-inspired algorithms have become famous due to natural behaviors and efficient results. Hybridization of these algorithms, either with typical computational or bio-inspired approaches, have become more popular. These are DE [
8], HS [
9], GA [
10], PSO [
11], ABC [
12,
13,
24], and some hybrid algorithms [
14,
15,
31,
32]. These algorithms, also called general swarm intelligence, work based on some successful characteristics of a biological system such as bees, birds, fishes, animals, etc. ABC algorithm is developed by Dervish Karaboga based on honey bees’ behavior [
33]. Details of ABC and its different variants are given in the following sections.
3.1. Artificial Bee Colony (ABC) Algorithm
ABC is one of the most attractive bio-inspired algorithms developed for solving complex science and engineering problems [
13] which simulate the foraging behavior of honey bees. It is characterized in the group of meta-heuristic algorithms. In this algorithm, the characteristics of bees are divided into three aspects namely employed, onlooker, and scout bees. During the process, exploitation process is carried out by the employed and onlooker bees while scout bees are used for the exploration process through the following strategy, as given in Equation (3).
where
Vij represents the number of new solutions in the neighbourhood of
xij for the employed bees,
k is a solution in the neighbourhood of
i, and
is a random number in the range [−1, 1].
Although the ABC algorithm is famous due to its robustness and high efficiency for clustering, classification, and numerical function optimization problems, due to the exploitation of the same approach, finding the optimal solution is not guaranteed; as well, sometimes it is trapped in local minima. The researchers improved the typical ABC algorithm by using different strategies such as gbest-guided and quick-within employed, onlookers, and scout bees.
3.2. Gbest Guided Artificial Bee Colony (GGABC) Algorithm
The sufficient and balanced amount of exploration and exploitation process can increase the performance of the bio-inspired algorithms, especially of the ABC approach is used. The optimal global solution can be easily archived through the strong exploration and exploitation process in a given region. GGABC algorithm is the improved version of typical ABC, which uses the PSO global best process to increase the exploitation amount similar to exploration [
24]. Therefore, Zhu and Kwong [
24] had merged the global best approach of PSO in the typical ABC algorithm for finding and selecting the best solution in the defined population. In GGABC algorithm, Equation (3) has been modified as,
where
yj is the gbest solution of the population,
ψij is a uniform random number in [0,
C],
C > 0. The value of
C can balance the exploitation ability. For more details, we refer to Ref. [
24].
3.3. Quick Artificial Bee Colony (QABC) Algorithm
QABC algorithm [
18] is an extension of the standard ABC which simulates the gbest intelligent foraging behavior of honey bees. In standard ABC algorithm, the employed and the onlooker bees both updates with the same Equation (3) to determine the new solutions. However, in [
18] authors have updated it by modifying the onlooker bees’ phase with Equation (6),
where
represents the best solution among the neighbors of
and itself (
). For more details, we refer to Ref. [
18].
4. The Proposed: Quick Gbest Guided Artificial Bee Colony Algorithm
The typical ABC is an efficient bio-inspired algorithm for solving the wide range of complex science and engineering problems [
12,
13,
24]. Although it is easy to understand and implement, sometimes it is trapped in local minima due to poor exploration and exploitation process. The ABC employed bee phase has been improved through the gbest guided approach called GGABC, as mentioned in
Section 3.2; it has successfully improved the performance of employed and onlooker bees with the same exploiting strategy. However, the scout bees section still used the same ABC random selected method. Later on, Karaboga modified the typical ABC onlooker bees’ selection phase though Equation (6); however, the employed bees section did not modify for strong exploitation process [
18]. Furthermore, sometimes the typically employed bee section was unable to reach global optima. Here, taking the advantages of a quick onlooker section with guided employed bees combined for strength and balance in exploration and exploitation processes. Therefore, Equation (3) will replace guided employed bees for increasing the exploitation process as:
In this guided approach, the guided employed bees section refers to the exploration of the best food sources in the various unknown regions in the solution space to reach to the global optimum. This method will no longer use random ways to find new suboptimal candidate solutions, but it will use the PSO global best (gbest) solution to guide the search for best candidate solutions. Therefore, the exploitation amount will be increased through the gbest term for the new candidate solution towards the best food sources, where the amount of exploration and exploitation can be balanced through the best value of parameter C. Equation (3) of the typical ABC algorithm is also used by the onlooker bees section, which gets a candidate solution through employed bees’ dancing behaviors. Onlooker bees do not have their own strategy to explore best food sources to reach global optima. Therefore, the typical onlooker bees will use the quick search strategy instead of following employed bees blindly. Equation (3) for the onlooker section will be modified as,
On the other hand, the new solution is generated using Equation (9).
The flowchart (
Figure 2) and pseudo code of the proposed QGGABC algorithm are given below:
- Step 1:
Initialize the population xi, where .
- Step 2:
Compute the fitness values.
- Step 3:
Cycle = 1.
- Step 4:
Repeat from step 2 to step 14.
- Step 5:
Produce new solutions in the neighbourhood of using Equation (7).
- Step 6:
Apply the Greedy Selection process.
- Step 7:
Calculate the probability values
pi for the solutions
xi using Equation (10).
where
is defined as,
- Step 8:
Apply greedy selection.
- Step 9:
Select the solution xi based on pi and generate the new solutions for the quick onlookers by Equation (8).
- Step 10:
For an abandoned source, if it exists, and replaces it with a new solution using Equation (9).
- Step 11:
Memorize the best solution achieved so far.
- Step 12:
Cycle = cycle + 1
- Step 13:
Until cycle = Maximum Cycle Number (MCN)
Therefore, the way to get the best generalization results for financial time series datasets set on prediction task is to apply the proposed QGGABC algorithm with enough of a number of cycles, input, and hidden nodes that can achieve the best food source position or solutions (i.e., network weights) corresponding to the best testing set performances. Also, discovering and selecting the best area and solution within the suitable size of colony can have a big effect on the simulation results. The proper selection of these parameters values can increase the effectiveness of the proposed method during training and testing phases as well.
5. Experimental Evaluation and Analysis
In this research, financial time series dataset of SSM was used for one-step-ahead prediction of the year 2015 and 2016. The financial time series are stationary which can be used in the original form for prediction tasks. Here, the SMM parameter named price, which is the average of open, low, high and closing price, will be used for prediction of the next value versus time. The financial time series datasets chosen for prediction purposes are Saudi Telecom Company (STC), Al Rajhi Bank, Zain mobile communication company, Saudi Arabian Projects Company (SAPCO), and Almarai Company. The details of the dataset are given in
Table 1 as:
FFNN used with different hidden and input nodes with single output node of SSM price. The network setting for all data types of different bio-inspired learning algorithms are detailed in
Table 2.
To evaluate the performance of the proposed QGGABC algorithm, results compare ABC, Gbest Guided ABC (GGABC), and QABC algorithms by Mean Square Error (MSE), Standard Deviation of MSE, Normalized Mean Square Error (NMSE), success rate, and accuracy.
The stopping criterion for the above-mentioned algorithm is 2000 MCN. The best average simulation results using all learning algorithms for SSM price prediction are given from
Table 3,
Table 4,
Table 5,
Table 6 and
Table 7 and
Figure 3,
Figure 4,
Figure 5,
Figure 6,
Figure 7 and
Figure 8, respectively. In
Table 3, the MSEs for training data set are presented by using proposed QGGABC and typical GGABC, ABC, and QABC algorithms. From the simulation results on all SSM price dataset, the QGGABC obtained minimum MSE during training phase except on Al Rajhi price. The QABC had less error than all above-mentioned algorithms. The typical algorithm QABC outperformed ABC and GGABC algorithms on all datasets in terms of MSE training as it is given in
Table 3.
In terms of MSE testing, the ABC reached 1.10 × 10
−4, 2.01 × 10
−4, 1.99 × 10
−4, 1.90 × 10
−5, and 7.99 × 10
−5 for STC, Zain, Almarai, SAPCO, and Al Rajhi prices, respectively. The improved GGABC-FFNN, QABC-FFNN MSE testing reached 9.89 × 10
−5, 1.52 × 10
−5, 1.11 × 10
−4, 9.30 × 10
−5, 1.12 × 10
−6 and 9.00 × 10
−5, 9.99 × 10
−6, 9.20 × 10
−6, 1.00 × 10
−7, 9.99 × 10
−7, respectively. Thus, we conclude that the proposed QGGABC-FFNN obtained the minimum MSE for STC, Zain, Almarai, SAPCO stock prices. On the other hand, the average SNR, NMSE, accuracy, and success rates are given in
Table 5,
Table 6,
Table 7 and
Table 8, respectively. From this table, it is seen that in terms of SNR and NMSE, the best values were obtained by the proposed QGGABC for STC, Zain, Almarai, SAPCO dataset, while QABC outperformed better for Al Rajhi dataset. The GGABC and ABC obtained enough SNR and NMSE values for all dataset prices predictions. However, in term of accuracy, the proposed QGGABC got higher accuracy than other algorithms except on Al Rajhi dataset where QABC reached a high accuracy of 98.81. Through the quick and gbest guided exploitation and exploration strategies, the proposed method achieved the highest accuracy compared to QABC and GGABC algorithms. Furthermore, the average success rate of 10 runs, ABC, QABC, and QGGABC got 100% success rate for STC dataset, while QGGABC and QABC got 100% on Almarai prices prediction as given in
Table 8.
Finally, it has been observed from the
Table 5,
Table 6,
Table 7 and
Table 8 that the proposed QGGABC offered better results than the conventional learning method for most of the financial time series signals using the MSE, NMSE, Accuracy, success rate, and the SNR measures. This clearly indicates that the FFNN structure trained by the QGGABC algorithm have provided the network with memory and hence better prediction with improvement in terms of the SNR, Accuracy, and Error.
Using the above learning techniques adjusts the weights of each connection in order to reduce the training error for the SSM prediction task. After repeating this process for a sufficiently large number of training cycles, the network will usually converge to some state where the error of the calculations is small with high prediction performance. In this case, one says that the network has learned a particular target function. The QGGABC converged faster than others during the training phase for STC price prediction as shown in
Figure 4. The ABC, GGABC, and QABC did not converge quickly on STC price datasets for the prediction task.
To ensure the capability of the proposed and standard learning algorithms, the predicted data and actual data were compared to see the performance of the algorithms.
Figure 4,
Figure 5,
Figure 6,
Figure 7 and
Figure 8 show the prediction for STC, Almarai, Zain, and Al Rajhi prices time series. The ABC, GGABC, and QABC did not succeed to predict the future prices of STC, Almarai, Zain, and Al Rajhi accurately, while the proposed QGGABC obtained the efficient and close prediction level for all these datasets through different ANN structures, as shown in
Figure 6,
Figure 7 and
Figure 9.
Figure 3 and
Figure 4 shows the learning curves where the network trained for STC prices prediction by a conventional and proposed method with the various numbers of control and learning parameters. In terms of convergence, the QGGABC quickly converged based on the optimal weight values of FFNN when compared with other algorithms on STC dataset as shown in
Figure 4 and Figure 11.
Figure 5,
Figure 6,
Figure 7,
Figure 8 and
Figure 9 show the original and predicted signals for STC, Almarai, Zain, and Al Rajhi using the FFNN for stationary data using one-step-ahead prediction.
Figure 7,
Figure 8 and
Figure 10 present the effect of the parameters quick and gbest-guided on Zain and Al Rajhi future values prediction, respectively. From the above tables values and figures, the performance of the proposed QGGABC algorithm successfully reached minimum training and testing prediction error, fast convergence, high success rate, high accuracy and maximum SNR values on STC, Zain, SAPCO, and Almarai stock prices. Based on the above simulation results (
Figure 7,
Figure 8,
Figure 10 and
Figure 11), the proposed QGGABC algorithm has the capability to predict accurate future SSM prices.
On learning phase of QGGABC algorithm converged quickly (around 70 cycles), while QABC failed to converge quickly on Al Rajhi prices, as shown in
Figure 11 below.
The proposed method has successfully reached the global optima in the quickest best manner and sufficient exploring and exploiting processes. The trained network obtained the best food sources/weight values for the prediction task. Overall, the performance of the QGGABC algorithm is higher than conventional bio-inspired methods such as ABC, QABC, and QGGABC in time series dataset prediction.