Subscribe Now Subscribe Today
Research Article
 

A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market



M. Gunasekaran and K.S. Ramaswami
 
Facebook Twitter Digg Reddit Linkedin StumbleUpon E-mail
ABSTRACT

Stock market forecasting provides challenging and interesting task to both investors and academic researchers because trading decision at an appropriate time makes more profit for investors. In present study, a new approach has been proposed to integrate Adaptive Neuro-Fuzzy Inference System (ANFIS) with Artificial Immune Algorithm (AIA) for predicting the future index value of National Stock Exchange (NSE) of India. In order to make an efficient forecasting model, ANFIS is employed to optimize decision-making process and an efficient artificial immune algorithm is adopted to adjust membership function parameters of Fuzzy Inference System (FIS). The proposed system was simulated using daily closing value of NSE Nifty data and well-known technical indicators as input data values and output is the predicted future index value of NSE Nifty. Simulation results of our fusion model have been compared with other soft computing models and actual NSE Nifty data as benchmark. The experimental results showed that the proposed forecasting model yielded significantly higher forecasting accuracy values than other forecasting models.

Services
Related Articles in ASCI
Search in Google Scholar
View Citation
Report Citation

 
  How to cite this article:

M. Gunasekaran and K.S. Ramaswami, 2011. A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market. Journal of Applied Sciences, 11: 3028-3033.

DOI: 10.3923/jas.2011.3028.3033

URL: https://scialert.net/abstract/?doi=jas.2011.3028.3033
 
Received: March 22, 2011; Accepted: June 21, 2011; Published: August 06, 2011



INTRODUCTION

The stock market is a very complex, dynamic and nonlinear system that involves huge amount of transactions. Many factors affect the stock market trend such as inflation rates, Foreign exchange (FOREX) rates, Gross Domestic Product (GDP) growth, Government instability, economic factors, tax rates, Government budget and various issues (Chang et al., 2009). Stock market prediction is not an easy task due to its high volatility, irregularity and unstable environment. Recently, many research studies on the predictability of the stock market have been concentrated to predict future price movement of stock market (Huang et al., 2009). The main objective of developing computational intelligence system is to find out the price trend in advance by using technical indicators. Technical indicators identify the patterns and relationships in historical data and this is useful for short-term traders.

Recent studies recognized that non-linearity exists in stock market data. Nonlinear models such as soft-computing models provide superior prediction results than linear models (Dhar and Chou, 2001; Yu et al., 2009). Adaptive Neuro-Fuzzy Inference System (ANFIS) can be believed as strong alternative to various soft computing models for forecasting stock price (Fahimifard et al., 2009; Anari et al., 2011). ANFIS combines the advantages of Artificial Neural Network (ANN) and fuzzy logic system that can be applied in the design of the forecasting system. Each model has its own strengths and limitations. ANN has the ability to learn complex nonlinear data effortlessly (Solaimani, 2009; Senol and Ozturan, 2008) . In contrast, Fuzzy logic systems easily deal with problems such as interpretation on a high-level than ANN (Lin, 2008). Fuzzy logic looks like closer to the technique our human brainwork. ANFIS has emerged by integrating the superior learning capability of ANN and better reasoning ability of fuzzy logic.

Recent improvements in Artificial Immune Algorithm (AIA) have provided a technique for Adaptive Neuro-Fuzzy Inference System, with application in optimization, recognition, time-series prediction and other research fields. Several researchers have extended immune algorithms to employ neuro fuzzy systems in order to get better the recognition and self-learning ability of neural network (Castro and Von Zuben, 2011; Widyanto et al., 2006). In ANFIS, the immune algorithm is inspired by natural biological immune system that is applied to optimize the fuzzy system parameters. Fuzzy system combines membership functions, fuzzy rules and the consequent rule by immune algorithm (Chen et al., 2009). First ANFIS creates a fuzzy rule set and then design the member ship functions using immune algorithm.

The main objective of this study was to forecast the stock market trend using ANFIS with artificial immune algorithm by applying well known technical indicators.

MATERIALS AND METHODS

Recently soft computing techniques, such as Artificial Neural Networks (ANNs) and fuzzy logic, artificial immune algorithm etc., have been efficiently applied to forecast stock market. Soft computing technique can able to recognize the non-linear relationships in stock market data. Artificial Neural Networks (ANNs) are non-parametric modeling tools that can be applied for the purposes of forecasting, clustering and pattern recognition. ANN emulates the neurons of biological network in human brain. ANN is parallel computing model which are having processing elements that learning very easily the complex and non-linear data even though the data has noisy and chaotic (Rabunal and Dorado, 2006). However, limitation of ANN model is lack of recognition with multi dimensional nonlinear models.

Among the soft computing techniques, Adaptive Neuro-Fuzzy Inference System (ANFIS) is a prominent model for forecasting the stock market. ANFIS has excellent convergence characteristics and it can able to extract patterns from numerical data (Depari et al., 2007). ANFIS is a fuzzy inference systems based on adaptive neural network, in which inputs have been processed by fuzzy rules for getting outputs. Fuzzy logic systems use the easily understandable IF-THEN rules for denoting their decisions and it imitates the human reasoning. However, fuzzy system lacks a learning system. In this perspective, the fuzzy logic models integrated with ANN play a very important task in the development of intelligent system for forecasting the stock market.

In general, ANN is used for self-learning and adoptability, fuzzy logic model is used to deal with ambiguity and improbability and immune algorithm is used for recognizing and optimization. When combine these technologies, the hybrid system is able to achieve high performance forecasting result.

Fusion model: A fusion model ANFIS with artificial immune algorithm is developed and implemented for forecasting Indian stock price in present study. ANFIS is suitable for stock market forecasting that has the ability to build active model in noisy and chaotic stock market data. Immune algorithm can be integrated in to the construction of ANFIS, because it has the efficiency to explore huge spaces and find a greater number of local optima issues.

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
Fig. 1: Framework of the fusion model

Finally, a fusion model of ANFIS and immune algorithm has provided the superior results by combining the qualities of both techniques.

In the fusion model, fuzzy system uses Sugeno-type fuzzy system and the membership function’s parameters are adjusted using immune algorithm (Lin et al., 2008; Zhang and Li, 2011). The technical indicators are given as inputs to the input layer of ANN for learning their relationship to find the future trend of stock market. The main processes of the fusion model are shown in Fig. 1 and the each block of this model is described in the following sections.

Adaptive Neuro- Fuzzy Inference System (ANFIS): The Adaptive Neural-Fuzzy Inference System (ANFIS) integrates the advantage of both fuzzy systems and neural networks (Liu et al., 2010). The fuzzy system initially fuzzifies inputs to values at interval (0, 1) with a set of Membership Functions (MF). Next, it is inferred by fuzzy logic through rules in the form of IF-THEN.

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
Fig. 2: The architecture of ANFIS model

The basic part of fuzzy system is the fuzzy inference engine that can be used for creating fuzzy rules. The example of fuzzy rules is:

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(1)

Neuro fuzzy system consists of five layers: fuzzy layer, product layer, normalized layer, de-fuzzy layer and summation layer (Lee, 2005). The architecture of ANFIS model used in this article is shown in Fig. 2.

Layer 1 (input layer): We using TSK Membership Functions (MFs) as inputs such as triangular-shaped function. Output of a node in the first layer is the member’s degree of input:

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(2)

where, μAi represents membership function and xj denotes input variable.

If the membership function μA (x) is triangular-shaped, i.e.,

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(3)

The parameters a and c locate the “feet” of the triangle and the parameter b locates the peak.

Layer 2 (product layer): AND operator is used to product the input membership values. Output of each node represents the waiting factor of a rule:

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(4)

for m = 1,2….N i.e. product layer has N nodes.

Weighting factors of the ith rule is evaluated as follows:

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(5)

Layer 3 (normalization layer): It calculates the ratio of weighting factor of the rules with the total weighting factors:

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(6)

Layer 4 (defuzzification layer): Output of every node is calculated by multiplying the normalized one with consequent parameters (C0 …. C5) of linear function (f1 = c0+ c1 x1+c2 x2...+c5 x5):

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(7)

Layer 5 (total output layer): The single node is labeled as Σ in the fifth layer computes the overall output as the summation of all incoming signals. It can be expressed as follows:

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(8)

Inputs X1 to X5 show various technical Indicators. The value of each variable is described by one of a possible five fuzzy membership sets (VL L M H VH ) : Very Low (VL), Low (L), Medium (M), High (H) and Very High (VH). The ANFIS has 5 input values for each of the 5 input variables and one output. Therefore, the number of possible fuzzy if-then rules for ANFIS is 3125 (55).

Clonal selection algorithm: Artificial immune algorithm is a new computational intelligence procedure inspired by biological human immune system (Do et al., 2009). In present study, we utilized an immune algorithm is called clonal selection algorithm, named CLONALG. The CLONALG is functioning as genetic algorithm and has superior qualities for the exploration and optimization (Al-Enezi et al., 2010). It is simulated on the natural B cell system. Antibodies are affixed on the B cell which recognizes the antigens which coming from external environment. In brief, Clonal selection algorithm clones more antibodies of best fitness antibody for eliminating the antigen. As a result, immune system produces more antibodies against antigen. Basic elements of this algorithm are antibodies and antigens. In ANFIS, antigen is an input from stock market data and antibody is a fuzzy rule. The algorithm is applied to train fuzzy rules with best fitness from stock market data (Mezyk and Unold, 2008; Su et al., 2008). The basic structure of CLONALG is described below:

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
Fig. 3: Actual historic data of NSE Nifty index

Inputs parameters have been applied to set up financial system for forecasting index value of Indian stock market. The forecasting system was tested on NSE Nifty index of Indian stock market based on historical data from 2010 to 2011. We have applied different data sets for training and testing. Neural network was trained using the data from 1st March 2010 to 31st August 2010. The testing period is selected to be from 1st September 2010 to 28th Feb 2011. The actual index values of both training and testing periods are shown in Fig. 3. The historical data is served as information resource on the daily closing values for NSE Nifty index: the number of observations for index is 253.

Stock market forecasting can be evaluated by technical analysis with some technical indicators to predict the future stock trend in the early stage. In present study, we used some of important technical indicators along with price and volume of NSE Nifty index. Exponential Moving Average (EMA) and Relative Strength Index (RSI) are utilized to evaluate the price trend. Arms Index is used for volume analysis.

We have taken three important technical indicators, price and volume for the configuration of our trading system and their formulas are given below.

Exponential Moving Average moving (EMA) which gets the price from the previous closing price of periods adds them up and divides by the number of periods:

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(9)

where, CP is a closing price.

Relative Strength Index (RSI) measures the velocity of price movements and determines the overbought and oversold conditions:

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(10)

where, RS = (Avg. of n-day up closes) / (Avg. of n-day down closes); n = days (9-15 days)

Arms Index is used to measure relative volume flows:
Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
(11)

where, AI = No. of Advancing issues; AV = Advancing Volume; DI = No. of Declining issues; DV = Declining Volume. If Arms Index > 1.0, Market is down trend and If Arms Index < 1.0, Market is up trend.

The performances of the different stock forecasting models are evaluated by various statistical metrics, namely Root Mean Squared Error (RMSE), Mean Absolute Percentage Error (MAPE) and Mean Absolute Error (MAE) (Singh and Ahmad, 2011). In order to test and evaluate the performance of our fusion system ANFIS with artificial immune algorithm, not only compared with benchmark NSE nifty index, but also a comparison should be made with other forecasting models: pure ANFIS and ANN. If RMSE is very less, the forecasting precision of the system is very close to 100%.

RESULTS AND DISCUSSION

We have implemented and tested our model for forecasting stock using MATLAB. Training and Testing data of NSE Nifty selected from the Yahoo server, the rules are designed for the ANFIS editor (Sugeno type) using Fuzzy Logic Toolbox of MATLAB for forecasting the Indian stock index. Expected outcomes and forecasted values of ANN, pure ANFIS and ANFIS with immune algorithm are compared with current trends of benchmark index NSE Nifty.

Forecasted results of these three stock forecasting models were estimated by calculating the error between the current closing price and the forecasted closing price. Our new fusion forecasting model is compared with another forecasting models and benchmark index NSE Nifty.

Figure 4 shows the forecasted values of three forecasting models during the period 2010-2011. It is clearly shows that our forecasted data of our fusion system is very close to actual NSE Nifty data than other models.

Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market
Fig. 4: Actual and forecasted value of NSE Nifty generated by different forecasting model

Table 1: Comparison of errors for ANFIS+AIA, ANFIS and ANN
Image for - A Fusion Model Integrating ANFIS and Artificial Immune Algorithm for Forecasting Indian Stock Market

Table 1 shows the results have been obtained by three forecasting models, such as ANN, pure ANFIS and ANFIS with AIA for forecasting NSE Nifty index. The forecasting performance is estimated by the differentiation between the forecasted value and actual value.

The comparison results show that our fusion model is more desirable than other forecasting models with regard to the precision of predicted index values. To compare the accuracy of stock forecasting models, the RMSE, MAPE and MAE of three models are evaluated (Table 1). Table 1 indicates that the proposed fusion model has the smallest RMSE, MAPE and MAE among the three forecasting models. Thus, the proposed fusion model can predict more accurate future stock market trend than those obtained form other forecasting models.

CONCLUSION

Present study has provided a framework to demonstrate the good properties of fusion forecasting system for identifying the future stock market trend. Since ANFIS is an efficient model to build forecasting system for making decision. However, fine-tuning of the weighting and membership function is a difficult task. We have proposed an artificial immune algorithm for ANFIS to improve an optimal learning technique. Experimental results showed that forecasted value of our proposed fusion model is very similar to actual benchmark index value of NSE Nifty than other forecasting models: ANFIS and ANN. In addition, Statistical measures of fusion model, such as RMSE, MAPE and MAE are very less significant than other stock forecasting models. Consequently, the proposed fusion model ANFIS with AIA can be able to produce a better decision-making and thus it is successfully used for stock market forecasting.

REFERENCES

1:  Depari, A., A. Flammini, D. Marioli and A. Taroni, 2007. Application of an ANFIS algorithm to a sensor data processing. IEEE Tran. Instrument. Measur., 56: 75-79.
CrossRef  |  

2:  Chen, C.H., C.J. Lin and C.T. Lin, 2009. Using an efficient immune symbiotic evolution learning for compensatory neuro-fuzzy controller. IEEE Tran. Fuzzy Syst., 17: 668-682.
CrossRef  |  

3:  Lin, C.J., 2008. An efficient immune-based symbiotic particle swarm optimization learning algorithm for TSK-type neuro-fuzzy networks design. Elsevier Fuzzy Sets Syst., 159: 2890-2909.
CrossRef  |  

4:  Lin, C.T., C.T. Yang and M.T. Su, 2008. A hybridization of immune algorithm with particle swarm optimization for neuro-fuzzy classifiers. Int. J. Fuzzy Syst., 10: 139-147.

5:  Mezyk, E. and O. Unold, 2008. Accelerating improvement of fuzzy rules induction with artificial immune systems. Wseas Trans. Syst., 7: 866-875.

6:  Zhang, H. and Z. Li, 2011. Fuzzy immune control based smith predictor for networked control systems. Int. J. Eng. Technol., 3: 81-84.
Direct Link  |  

7:  Huang, H., M. Pasquier and C. Quek, 2009. Financial market trading system with a hierarchical coevolutionary fuzzy predictive model. IEEE Trans. Evol. Comput., 13: 56-70.
CrossRef  |  

8:  Rabunal, J.R. and J. Dorado, 2006. Artificial Neural Network in Real-Life Applications. Idea Group Inc., Hershey, PA, pp: 8-19

9:  Al-Enezi, J.R., M.F. Abbod and S. Alsharhan, 2010. Artificial immune systems-models, algorithms and applications. Int. J. Res. Rev. Applied Sci., 3: 118-131.
Direct Link  |  

10:  Lee, K.H., 2005. First course on fuzzy theory and applications. Springer, 27: 290-295.
Direct Link  |  

11:  Liu, M., M. Dong and C. Wu, 2010. A new ANFIS for parameter prediction with numeric and categorical inputs. IEEE Trans. Autom. Sci. Eng., 7: 645-653.
CrossRef  |  

12:  Su, M.C., P.C. Wang and Y.S. Yang, 2008. A new approach to artificial immune systems and its application in constructing on-line learning neuro-fuzzy systems. Open Artificial Intell. J., 2: 1-10.
Direct Link  |  

13:  Chang, P.C., C.Y. Fan and C.H. Liu, 2009. Integrating a piecewise linear representation method and a neural network model for stock trading points prediction. IEEE Trans. Syst. Man Cybernetics Appl. Rev., 39: 80-92.
CrossRef  |  

14:  Singh, V.K. and N. Ahmad, 2011. Forecasting performance of constant elasticity of variance model: Empirical evidence from India. Int. J. Applied Econ. Finan., 5: 87-96.
CrossRef  |  Direct Link  |  

15:  Do, T.D., S.C. Hui, A.C.M. Fong and B. Fong, 2009. Associative classification with artificial immune system. IEEE Trans. Evolut. Comput., 13: 217-228.
CrossRef  |  

16:  Anari, P.L., H.S. Darani and A.R. Nafarzadegan, 2011. Application of ANN and ANFIS models for estimating total infiltration rate in an arid rangeland ecosystem. Res. J. Environ. Sci., 5: 236-247.
CrossRef  |  Direct Link  |  

17:  Castro, P.A.D. and F.J. Von Zuben, 2011. Learning ensembles of neural networks by means of a bayesian artificial immune system. IEEE Trans. Neural Network, 22: 304-316.
CrossRef  |  

18:  Dhar, V. and D. Chou, 2001. A comparison of nonlinear methods for predicting earnings surprises and returns. IEEE Trans. Neural Netw., 12: 907-921.
CrossRef  |  PubMed  |  Direct Link  |  

19:  Fahimifard, S.M., M. Homayounifar, M. Sabouhi and A.R. Moghaddamnia, 2009. Comparison of ANFIS, ANN, GARCH and ARIMA techniques to exchange rate forecasting. J. Applied Sci., 9: 3641-3651.
CrossRef  |  Direct Link  |  

20:  Senol, D. and M. Ozturan, 2008. Stock price direction prediction using artificial neural network approach: The case of Turkey. J. Artif. Intell., 1: 70-77.
CrossRef  |  Direct Link  |  

21:  Solaimani, K., 2009. A study of rainfall forecasting models based on artificial neural network. Asian J. Applied Sci., 2: 486-498.
CrossRef  |  Direct Link  |  

22:  Yu, L., H. Chen, S. Wang and K.K. Lai, 2009. Evolving least squares support vector machines for stock market trend mining. IEEE Trans. Evolut. Comput., 13: 87-102.
CrossRef  |  

23:  Widyanto, M.R., B. Kusumoputro, H. Nobuhara, K. Kawamoto and K. Hirota, 2006. A fuzzy-similarity-based self-organized network inspired by immune algorithm for three-mixture-fragrance recognition. IEEE Trans. Ind. Elec., 53: 313-321.
CrossRef  |  

©  2022 Science Alert. All Rights Reserved