Web Ste: www.jettcs.org Emal: edtor@jettcs.org, edtorjettcs@gmal.com Volume 2, Issue 3, May June 23 ISSN 2278-686 Stock volatlty forecastng usng Swarm optmzed Hybrd Network Puspanjal Mohapatra, Soumya Das 2, Tapas Kumar Patra 3 and Munnang Anrudh 4 &2 Dept of Computer Scence and Engneerng IIIT Bhubaneswar 3 Dept of Instrumentaton & Electroncs Engneerng College of Engneerng Technology Bhubaneswar, Inda 4 Dept of Electroncs and Telecommuncatons Engneerng IIIT Bhubaneswar Abstract: Swarm networks are a new class of neural networks whch are nspred by swarm ntellgence. Swarm ntellgence s the property of co-ordnated behavour seen amongst the socal organsms. The smple local nteracton of the swarm members results n complex and ntellgent global behavour. Ths phenomenon s adapted n swarm ntellgence so as to solve many problems.ths paper presents a comparatve study of partcle swarm optmzaton (PSO) based hybrd swarmnet and smple FLANN model. Here both the models are ntally traned wth LMS algorthm, then wth PSO algorthm. The models are forecastng the stock ndces of two dfferent datasets.e. NIFTY and NASDAQ on dfferent tme horzons.e. one day, one week, and one month ahead. The performance s evaluated on the bass of Root Mean Square Error (RMSE) and Mean Absolute Percentage Error (MAPE). It was verfed that PSO based hybrd swarmnet performed better n comparson to PSO based FLANN model, smple hybrd model traned wth LMS and smple FLANN model traned wth LMS. Keywords: FLANN, hybrd swarm net, PSO. INTRODUCTION In case of a stock market the shares are ssued and traded through exchanges by takng the help of varous ndces.stock market consttute an nvaluable asset for the economy of any naton. For the long term nvestors t acts as a door to purchase busness whch s expected to do well n the near future.as far as the short term nvestors (traders) are concerned they get a quck proft out of the tradng n the stock []. As more and more money s beng nvested, the nvestors get anxous of the future trends of the stock prces n the market. But the stock prce data are very chaotc, nonlnear, and nonseasonal as well as very volatle n nature and poltcal events, nternal developments, nflaton and exchage rates as well as world events are some of the factors that are responsble for ts nonstatonary nature. Therefore t has always been remaned as a challenge for the common nvestors, stock buyers/sellers, polcy makers, market researchers and captal market role players to gan knowledge about the daly stock market prce values. There are many technques avalable to predct the stock prces namely fundamental analyss, techncal analyss [9], statstcal technques [2][3]. However these technques fal to draw out the hdden non-lnear patter n of the stock market data. On the other hand neural networks have been found to be successful n dscoverng the non-lnear pattern nsde the data and to adopt accordngly[4]. The neural networks after dscoverng the pattern adjust ther weght parameters so as to predct the data one day ahead, one week ahead as well as one month ahead by usng dfferent models such as radal bass functon neural network(rbfnn),functonal lnk artfcal neural network(flann)[6] and adaptve neuro fuzzy nformaton system(anfis) etc and by usng algorthms such as least mean square(lms)[7][],recursve least square(rls) for updatng the weghts. Many research have been carred out to know whether the neural networks are really capable n handlng the nonlnear pattern od the fnancal tme seres data [8].Varous hybrd models also have been proposed combnng statstcal technques wth neural networks [] and combnng wavelet transform and fuzzy logc wth neural networks [].However these technques are dervatve n nature and are most lkely to be trapped n local mnma. To overcome the above flaw bo-nspred technques come to pcture [2],[22]. The bo nspred computng technques are optmzaton methods that have been nspred by socal behavour of the organsms. There has been numerous applcatons of genetc algorthms to be appled n fnancal sector[3][4].swarm ntellgence s another recent and emergng paradgm n the feld of bo nspred computng whch mmc the socal behavour of the brds, ants, and fshes to search for ther optmum food source.in ths regard varous applcatons of ant colony optmzaton and fsh swarm algorthm n the feld of fnance s also seen [][6].Partcle swarm optmzaton(pso) s a robust optmzaton technque that s nspred by self coordnated behavour of brds [7][8]. For predctng varous stock ndces namely s&p and DJIA partcle swarm optmzaton has been appled and promsng results were obtaned [9].The pso technque s also Volume 2, Issue 3 May June 23 Page 78
Web Ste: www.jettcs.org Emal: edtor@jettcs.org, edtorjettcs@gmal.com Volume 2, Issue 3, May June 23 ISSN 2278-686 appled along wth fuzzy garch models [2] and wth neural networks n dfferent models namely radal bass functon neural network and adaptve neuro fuzzy nformaton system[2]. Ths paper s organsed as follows: Secton 2 dscusses the Least Mean Square algorthm; secton 3 dscusses the partcle swarm optmzaton algorthm. The performance crteron and result analyss are dscussed n secton 4 and respectvely.fnally the concluson s drawn n secton 6. X X X X 2 X 3 X 4 X X X X X X X F (X ) F 2(X ) Functo nal expans on unt Funct onal expans on unt W Y = W wcosx wsn X f Y 2= w f2 Y = wcosx wsn X Y 2 = w x x Y = tanh(y + Y 2) Y 2=tanh(Y + Y 2) Y Y 2 Y DESIRED 2. LEAST MEAN SQUARE ALGORITHM (LMS): The least mean square algorthm s an adaptve algorthm whch uses gradent based method of steepest descent.t was orgnally the dea of Wdrow Anfhoff n 99.t s an teratve method whch makes successve mprovements to the weght vector n the drecton of steepest descent whch eventually resultsn mnmzaton of the error.from the method of steepest descent the weght updaton equaton s: W(n+)=W(n)- Where W (n+) s the weght correspondng to the( n+) th teraton and W(n) s the weght correspondng to the n th teraton g(n) s the gradent vector evaluated n case of LMS algorthm the weght updaton equaton s done wth the help of followng equaton W(n+)=W(n)- (2) Dsadvantages: The lms algorthm s taratve n nature It nvolves calculaton od complex dervatve functons whch make the computaton tough Rate of convergence s very low. ERROR PSO In order to overcome these dffcultes the optmzaton technques are used among whch swarm ntellgence takes the leadng role. 3. PARTICLE SWARM OPTIMIZATION (PSO): Partcle swarm optmzaton s one of the leadng optmzaton methods whch s nspred by brds and fshes to exhbt co-ordnated, collectve behavour. It was orgnally proposed by Eberhart and Kennedy n 99.Each partcle n pso has a poston vector as well as a velocty vector represented by X =[x, x 2,,x ] T and V =[v,v 2, v ] spread over a D-dmensonal search space.for each partcle there s a personal best poston(pbest) represented as Pb=[pb,pb,,pb ] T. the global best poston(gbest) of all partcles s determned by takng all pbest nto consderaton. Gven for each partcle a poston vector, velocty vector, personal best vector as well as global best vector, the velocty vector for the next tearaton s calculated. From the recent velocty vector and prevous poston vector the poston vector for the next tearaton s calculated. The pseudocode for pso can be wrtten as follows:. For each partcle Intalze partcle END 2. Do For each partcle Calculate ftness value If the ftness value s better than the best ftness value (pbest) n hstory set current value as the new pbest End 3.Choose the partcle wth the best ftness value of all the partcles as the gbest 4. For each partcle Calculate partcle velocty accordng equaton V t+ t =V U t (Pb t t -X 2U t 2 (Gb t -X t ) (3) Pb-partcle best (pbest) Gb-global best (gbest) U, U 2 random values t+ V - velocty of partcle at t+ teraton t X - poston of partcle at t teraton Update partcle poston accordng equaton X t+ =x t +V t+ End Whle maxmum teratons or mnmum error crtera s not attaned V t+ t =V U t (Pb t t -X 2U t 2 (Gb t -X t ) Inerta component Cogntve component (4) Socal component Volume 2, Issue 3 May June 23 Page 79
Web Ste: www.jettcs.org Emal: edtor@jettcs.org, edtorjettcs@gmal.com Volume 2, Issue 3, May June 23 ISSN 2278-686 The cogntve component corresponds to personal nfluence whch represents the prvate thnkng of the partcle hmself where as the socal component corresponds to socal nfluence representng collaboraton among partcles. It can be noted here that U as well as 2U 2 corresponds to the randomness of the loop. So these parameters must be carefully chosen to land n a sem-optmal soluton. and 2 are the acceleraton constants determng the mportance of personal best and global best.low values allow partcles to roam far from target regons whle hgh values result n abrupt movements. Each acceleraton constant s usually taken to be 2. for almost all applcatons. U and U 2 are two random functons n the range [, ]. 4. FLANN FUZZY SYSTEM The FLANN fuzzy hybrd system s responsble for the determnaton of the knowledge base whch conssts of the followng subsystems of developng the membershp functon, defnng a fuzzy reasonng mechansm, the number of rule and rule base. The proposed FLANN based Neurofuzzy hybrd model uses a FLNN based combnaton of nput varables. Each fuzzy rule corresponds to a sub-flann, comprsng a lnk. The FLANN model realzes a fuzzy IF-THEN rule n the followng form and the same P number of patterns Xp s passed through the lnear combner and multpled wth the weght to generate the partal sum. Rule j: IF x s A and x 2 s A 2j..... and x s A j..... and x N s A Nj Then Y = ) () Where x and Y I are the nput and local output varables respectvely; A j s the lngustc term of the precondton part wth Gaussan membershp functon, N s the number of nput varables, W s the lnk weght of the local output, k s the bass functon of nput varables, M s the number of bass functon, and rule j s the j th fuzzy rule. The operaton of each layer of FLANN fuzzy system s descrbed as follows:u denotes the output of l th layer Layer : No computaton s performed n layer. Each node n ths layer only transmts nput values to the next layer drectly. U =X (6) Layer 2: Each fuzzy set Aj s descrbed here by a Gaussan membershp functon. Therefore, the calculated membershp value n layer 2 s U 2 j= (7) Layer 3: Nodes n layer 3 receve one-dmensonal membershp degrees of the assocated rule from the nodes of a set n layer 2. Here, the product operator descrbed earler s adopted to perform the precondton part of the fuzzy rules. As a result, the output functon of each nference node s U j 3 = (8) Where of a rule node represents the frng strength of ts correspondng rule. Layer 4: Nodes n layer 4 are called consequent nodes. The nput to a node n layer 4 s the output from layer 3, and the other nputs are calculated from the FLANN that has used the functon tanh ( ), as shown n Fg.. For such a node (9) U j 4 = U j 4 Where the lnk s weght of FLANN and s the functonal expanson of the nputs. Layer : The output layer n node acts as the defuzzfcaton layer. So, the fnal output of the FLANN model y s expressed as y= y F z F z y F z 22 () Where y and y22 are the output from the FLANN model and Fz and Fz22 are the output from the NeuroFuzzy hybrd model or output from layer 3.. SIMULATION STUDY. Dataset for tranng and testng: The daly closng prce of NIFTY data and NASDAQ data from.3.29 to..22 s taken as tranng samples(approxmately samples).all the nputs are normalzed wthn a range of [, ] usng the followng formula. () Where X norm s the normalsed value, X org s the currency value, X max s the maxmum value and X mn s the mnmum value..2 Tranng and testng of the forecastng model: Tranng of the FLANN model s carred out usng the DE and PSO algorthm gven n Secton 3 and 4 and the optmum weghts are obtaned. Then usng the traned model, the forecastng performance s tested usng test patterns for one-day, one week and one-month ahead. MAPE and RMSE (as defned n table ) s computed to compare the performance of varous models. Table : Performance evaluaton crtera Evaluaton Formula used crtera 22 F z 22 Volume 2, Issue 3 May June 23 Page 8
Web Ste: www.jettcs.org Emal: edtor@jettcs.org, edtorjettcs@gmal.com Volume 2, Issue 3, May June 23 ISSN 2278-686 Root mean square error(rmse).9 versus predcted durng tranng data data2 Mean absolute percentage error(mape).8.7.6 Usng the tranng sample frst a FLANN based LMS model s mplemented and the and stock prces are compared.then a PSO based FLANN model s mplementedroot mean square error (RMSE) and Mean absolute percentage error (MAPE) are consdered for performance evaluaton. The results of nfty dataset and NASDAQ dataset are lsted n table-2 and table-3..9.8 target&predcted of tranng.4.3.2. 2 3 4 6 no.of data samples Fgure 4: one day ahead versus predcted values of stock ndces for NASDAQ data set durng tranng usng FLANN LMS model.7.6.9.8 versus predcted durng tranng data data2.4.7.3.6.2..4 2 2 3 3 4 4.3 Fgure 2: one day ahead versus predcted values of stock ndces for nfty data set durng tranng usng FLANN PSO model.7.6 target&predcted of testng.2. 2 3 4 6 no.of data samples Fgure : one week ahead versus predcted values of stock ndces for NASDAQ data set durng tranng and testng for nfty dataset usng FLANN LMS model.2 error durng tranng.4..3.8.2.6..4 2 2.2 Fgure 3: one day ahead versus predcted values of stock ndces for nfty data set durng testng usng FLANN PSO model 2 3 4 6 no of data samples Fgure 6:error value n one month ahaead forecast usng NASDAQ data set Volume 2, Issue 3 May June 23 Page 8
Web Ste: www.jettcs.org Emal: edtor@jettcs.org, edtorjettcs@gmal.com Volume 2, Issue 3, May June 23 ISSN 2278-686 2. mape value durng testng.9.8 target&predcted of testng 2.7..6.4.3.2 2 3 4 6 Fgure 7: mape value n one month ahaead forecast usng NASDAQ data set.9 Actual Vs Predcted durng tranng predcted ac tual. 2 2 3 Fgure : versus predcted values of one week ahead stock ndces for nfty data set durng tranng and testng usng FLANN-LMS.8.7.6.9 target&predcted of testng.4.8.3.7.2.6. 2 4 6 8 2 4 No of teratons.4.3 Fgure 8: versus predcted values of week ahead stock ndces for nfty data set durng tranng and testng usng FLANN-fuzzy PSO model.9.8.7.6.4.3 Actual Vs Predcted durng testng predcted ac tual.2 2 3 4 6 No of teratons Fgure 9: versus predcted values of one week ahead stock ndces for nfty data set durng tranng and testng usng FLANN-fuzzy model.2 2 2 3 Fgure : versus predcted values of one month ahead stock ndces for nfty data set durng tranng and testng usng FLANN fuzzy PSO model.9.8.7.6.4.3.2. target&predcted of tranng 2 2 3 3 4 4 Fgure 2: versus predcted values of one month ahead stock ndces for nfty data set durng tranng and testng usng FLANN fuzzy PSO model Volume 2, Issue 3 May June 23 Page 82
Web Ste: www.jettcs.org Emal: edtor@jettcs.org, edtorjettcs@gmal.com Volume 2, Issue 3, May June 23 ISSN 2278-686.9.8 target&predcted of testng.9.7.8.6.7.6.4.4.3.3.2.2.. 2 2 3 2 3 4 6 Fgure 3: versus predcted values of one month ahead stock ndces for nfty data set durng tranng and testng usng FLANN fuzzy PSO model Fgure 6: versus predcted values of one month ahead stock ndces for nfty data set durng tranng and testng usng FLANN fuzzy model.7 MSE curve durng tranng.6..9.8.7.4.3.6.4.2.3. 2 3 4 6 7 8 9 No of teratons Fgure 4: MAPE values of one month ahead stock ndces for nfty data set durng tranng and testng usng FLANN fuzzy PSO model.2 2 2 3 Fgure 7: versus predcted values of one month ahead stock ndces for nfty data set durng tranng and testng usng FLANN fuzzy model. Table 2: Detals of NIFTY dataset.4 MSE curve durng tranng.2..8.6.4.2 2 3 4 6 7 8 9 No of teratons Fgure : MSE values of one month ahead stock ndces for nfty data set durng tranng and testng usng FLANN fuzzy PSO model Volume 2, Issue 3 May June 23 Page 83
Web Ste: www.jettcs.org Emal: edtor@jettcs.org, edtorjettcs@gmal.com Volume 2, Issue 3, May June 23 ISSN 2278-686 Table 3: Detals of NASDAQ dataset 6. CONCLUSION Stock ndces are hghly non-lnear, chaotc and volatle n nature. Predctng the stock prces accurately have always been remaned a mystery to the manknd.in ths paper frst a smple FLANN model s gettng traned wth LMS. In order to overcome the lmtatons of neural nets, fuzzy logc was ntegrated to form the hybrd network.the performance of hybrd network s determned usng LMS.However the dervatve free tranng algorthms lke GA,PSO are makng the computaton faster,smpler and better n comparson to the tradtonal dervatve based LMS method. Fnally pso based FLANN fuzzy hybrd network s predctng the stock prces very accurately.for further work ths hybrd network s to be combned wth other dervatve free tranng algorthms lke BFO, ACO etc. REFERENCES [] ser-huang poon and Clve w. J. Granger, Forecastng Volatlty n Fnancal Markets: A Revew, Journal of Economc Lterature, Vol. XLI, June 23, pp: 478 39. [2] Chand Sohal et al, Modelng and Volatlty Analyss of Share Prces Usng ARCH and GARCH Models, World Appled Scences Journal, pp: 77-82, 22. [3] John J. Sparks and Yulya V. Yurova, Comparatve Performance of ARIMA and ARCH/GARCH Models on Tme Seres of Daly Equty Prces for Large Companes, Department of Informaton and Decson Scences Unversty of Illnos at Chcago, pp: 63-73. [4] Adya M and Fred Collopy, How Effectve are Neural Networks at Forecastng and Predcton? A Revew and Evaluaton, Journal of Forecastng J. Forecast. 7, pp: 48-49, (998). [] Jung Hua Wang and Ja Wan Leu, Stock market trend predcton usng ARIMA based neural networks,ieee, 996,pp-26-266 [6] Kumaran Kumar. J, Kalas, A Predcton of Future Stock Close Prce usng Proposed Hybrd ANN Model of Functonal Lnk Fuzzy Logc Neural Model IAES Internatonal Journal of Artfcal Intellgence (IJ-AI) Vol., No., March 22, pp. 2-3 ISSN: 222-8938. [7] Feng L, Cheng Lu, Applcaton Study of BP Neural Network on Stock Market Predcton Nnth Internatonal Conference on Hybrd Intellgent Systems,IEEE computer socety,29,pp:74-79. [8] Dase R.K. and Pawar D.D, Applcaton of Artfcal Neural Network for stock market predctons: A Revew of lterature, Internatonal Journal of Machne Intellgence, ISSN: 97 2927, Volume 2, Issue 2, 2, pp-4-7. [9] A.A. Adeby, C.K. Ayo, M.O Adeby, and 2S.O. Otokt, An Improved Stock Prce Predcton usng Hybrd Market Indcators,Afrcan Journal of Computng & ICT, IEEE, Vol. No., Sept 22, pp: 24-3. [] Sngle Layer Perceptrons Least-Mean-Square Algorthm Perceptron Neural Networks and Learnng Machnes, Thrd Edton Smon Haykn, PEARSON. [] Nassm Homayoun and Al Amr, Stock prce predcton usng a fuson model of wavelet, fuzzy logc and ANN, Internatonal Conference on E-busness, Management and Economcs IPEDR Vol.2 (2) (2) IACSIT Press, Sngapore, pp: 277-282. [2] Mohanty D,Nayak S,K R,Rout P, Comparatve study of fve bo-nspred evolutonary optmzaton technques for varous engneerng applcaton,natonal conference on advances n computatonal ntellgence applcaton n power,control,sgnal processng and telecommuncatons(ncaci). [3] Kyoung-jae Km, Ingoo Han, Genetc algorthm approach to feature dscreetzaton n artfcal neural networks for predcton of stock prce ndex Expert systems wth applcatons,29, ELSEVIER, 2-32 [4] Efstathos Kalyvas Usng neural networks and genetc Algorthms to predct stock market returns, a thess submtted to the unversty of manchester For the degree of master of scence In advanced computer scence In the faculty of scence and engneerng,2. [] W. Gao, New Neural Network Based on Ant Colony Algorthm for Fnancal Data Forecastng,Internatonal Conference on Intellgent Informaton Hdng and Multmeda Sgnal Processng,IEEE computer socety,28. [6] We Shen et al forecastng stock ndces usng radal bass functon neural networks optmzed by artfcal fsh swarm algorthm, knowledge based systems,elsevier,2,pp:378-38 [7] Satyobroto Talukder, Mathematcal Modellng and Applcatons of Partcle Swarm Optmzaton, Master s Thess Mathematcal Modellng and Smulaton Thess no: 2:8 [8] Dan Palup Rn et al, Partcle Swarm Optmzaton: Technque, System and Challenges, Internatonal Journal Volume 2, Issue 3 May June 23 Page 84
Web Ste: www.jettcs.org Emal: edtor@jettcs.org, edtorjettcs@gmal.com Volume 2, Issue 3, May June 23 ISSN 2278-686 of Computer Applcatons (97 8887) Volume 4 No., January 2. [9] Majh Rtanjal, Panda G, Panda Abhsek, Choubey Arvnd, Predcton of S&P and DJIA stock ndces usng partcle swarm optmzaton Technque, 978-- 4244-823-7/8,IEEE. [2] Ju Chang Hung, Adaptve Fuzzy-GARCH model appled to forecastng the volatlty of stock markets usng partcle swarm optmzaton, journal of Informaton Scence,2, pp:4673-4683. [2] Puspanjal Mohapatra, Munnang Anrdh, Tapas Kumar Patra, Forex Forecastng: A Comparatve Study of LLWNN and NeuroFuzzy Hybrd Model, Internatonal Journal of Computer Applcatons (97 8887) Volume 66 No.8, March 23. [22] Puspanjal Mohapatra, Soumya Das, stock market predcton usng bo-nspred computng:a survey, Internatonal Journal of Engneerng Scence and Technology (IJEST), Vol. No.4 Aprl 23,pp:739-746. AUTHOR Puspanjal Mohapatra receved the B.E n Electrcal Engneerng from IGIT Sarang, M.Tech n Computer Scence from Utkal Unversty n 999 and 22 respectvely.snce Aprl 23; she has been n teachng professon. Currently she s workng as an Asst.Prof.n CSE department of IIIT Bhubaneswar. She has proposed many papers n natonal and nternatonal, conference n the area of Tme Seres data mnng usng Soft Computng Technques. Soumya Das receved her B.Tech degree n CSE from BPUT, Odsha, Inda n 2.Currently she s pursung M.Tech n IIIT Bhubaneswar under the department of computer scence engneerng.her prmary research nterest are neural networks,soft computng technques. Tapas Kumar Patra has a B.E. n Electroncs and Telecommun caton engneerng from Sambalpur Unversty. He passed M.E.From NIT, Rourkela n 993. He s pursung PhD n Centre for Electroncs Desgn and Technology at Indan Insttute of Scence, Bangalore.. Hs research nterests nclude wreless moble network, sensor network, modelng, analyss and control of stochastc systems, soft computng technques Munnang Anrudh s a B.Tech student n IIIT Bhubaneswar under the department of Electroncs and Telecommuncatons Engneerng.Hs prmary research nterests are neural networks, fuzzy logc and Soft computng technques. Volume 2, Issue 3 May June 23 Page 8