Prediction Of Stock Market Index Using Neural Networks Essay

Predicting stock informations with traditional clip series analysis has become one popular research issue. An unreal nervous web may be more suited for the undertaking, because no premise about a suited mathematical theoretical account has to be made anterior to calculating. Furthermore, a nervous web has the ability to pull out utile information from big sets of informations, which frequently is required for a hearty description of a fiscal clip series.

Subsequently an Error Correction Network is defined and implemented for an empirical survey. Technical every bit good as cardinal informations are used as input to the web. One-step returns of the BSE stock index and two major stocks of the BSE are predicted utilizing two separate web constructions. Daily anticipations are performed on a standard Error Correction Network whereas an extension of the Error Correction Network is used for hebdomadal anticipations. The consequences on the stocks are less convincing ; however the web outperforms the naif scheme.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!

order now

Keywords: – Prediction of stock, ECN, Backpropagation, Feedforward Neural Networks, Dynamic system.


Different techniques are being used in the trading community for anticipation undertakings. In recent old ages the construct of nervous webs has emerged as one of them. A nervous web is able to work parallel with input variables and accordingly manage big sets of informations fleetly. The chief strength with the web is its ability to happen forms and abnormalities every bit good as observing multi-dimensional non-linear connexions in informations. The latter quality is highly utile for patterning dynamical systems, e.g. the stock market.

Apart from that, nervous webs are often used for pattern acknowledgment undertakings and non-linear arrested development. An Error Correction Network ( ECN ) is built and implemented for an empirical survey. Standard benchmarks are used to measure the web ‘s ability to do prognosiss. The aim of this survey is to reason whether an ECN could be successfully used as determination support in a existent trading state of affairs. The affairs of buy-sell signals, dealing costs and other trading issues are non considered.

Nervous webs can be applied to all kinds of fiscal jobs, non merely stock anticipation undertakings, besides used for prognosiss of output curves, exchange rates, bond rates etc. The chief motive for the nervous web attack in stock anticipation is twofold:

Stock informations is extremely complex and difficult to pattern ; therefore a non-linear theoretical account is good

A big set of interacting input series is frequently required to explicate a specific stock, which suites nervous webs

This attack is besides applied for the anticipation undertaking from the angle of economic sciences. Such as stock prediction to foretell returns instead than existent stock monetary values. Another ground is that it facilitates stabilisation of the theoretical account over a long period of clip [ 1 ] , prior to theoretical account.

Documentation is made disregarding needed informations and importance is given to the informations irrelevant for the job. Frequently one has to manage losing informations at renegade intervals or even informations emerging discontinuous clip series. A convenient manner to work around these troubles is by allowing the web accept losing informations.

Error Correction Networks

Most dynamical systems contain both an independent portion and a portion governed by external forces. Many times relevant external forces may be difficult to place or informations could be noisy. As a effect a right description of the kineticss may be impossible to acquire. A redress for a better theoretical account description is to utilize the old theoretical account mistake as extra information to the system will take attention of all the above information.

Mathematical Description

Following set of equations dwelling of a province and end product equations is a perennial description of dynamic system is really general signifier for distinct clip grids. A basic dynamical recurrent system depicted in Fig. 1, at clip T, it can be expressed as follows:

province passage ( 1 )

end product equation ( 2 )

The province passage is a function from the pervious internal hidden province of the system st-1 and the influence of external inputs to the new province. The end product equation computes the discernible end product vector.

Figure 1: A dynamical system with input Us, end product Ys and internal province s. The designation of dynamical system utilizing a distinct clip description: Input conceal provinces and end product

The system can be viewed as a partly discernible autoregressive moral force province which besides driven by external perturbations. Without the external inputs the systems is called independent system [ 7 ] .The undertaking of indentify the dynamic system of equations 1 & A ; 2, can so be stated as undertaking to happen ( parameterized ) maps f, g such that an norm distanced measuring ( Eq. 3 ) between the ascertained informations, t=1,2, aˆ¦aˆ¦T and the computed information of the theoretical account is minimum [ 5 ]

( 3 )

Where T is the figure of forms ( Forms are data points in a clip series ) . If we ignore the dependence on st-1 in the province passage equation by presuming and, we are back in the frame work where the nervous web attack without return i.e. a feedforward nervous web, can work out the system designation undertaking.

The Eq. 1 and 2 without external inputs would stand for an independent system. Let the ascertained theoretical account mistake at the old clip t-1 act as an extra input to the system. We get ( denotes observed informations, is the computed end product and depict the province. )

( 4 )

( 5 )

The designation undertaking of Eq. 1, 2 & A ; 3, can be implemented as a nervous web ( denoted ) so we get

( 6 )

( 7 )

By stipulating the maps f and g as nervous webs with parametric quantity vectors v and w, we have transformed the system designation undertaking of Eq. 3 into a parametric quantity optimisation job

( 8 )

The dynamic system described in Eq. 9 & A ; 10, can be model by Error Correction nervous web architecture as shown in fig 2. The weights are 5 = { A, B } and w = { C } . in general one may believe of a matrix D alternatively of the individuality matrix ( Idaho ) between the concealed bed this is non necessary because for additive end product bed can unite matrix A and D to a new matrix A ‘ between the input and the concealed bed. The end product equation ( ; tungsten ) is realized as a additive map. It is consecutive frontward to demo by utilizing an augmented inner province vector that this is nota functional limitation.

( 9 )

( 10 )

The term recomputed the last end product and compares to the observed informations. The matrix transmutation D is necessary in order to set different dimensionalities in the province passage equation.

Figure 2: The mistake rectification nervous web.

The designation of above theoretical account is equivocally making the numerical job, because autoregressive constructions i.e. the dependence of on, could either be coded in matrix A or DC. On this job, one may reason to transform Eq. 9, good define signifier ( Eq. 11 ) utilizing

( 11 )

Adding a non-linearity is a step to avoid this job [ 2 ] . This output

( 12 )

( 13 )

Distinguishing external inputs impacting the province passage st from mark inputs is of import. I denote the fixed individuality matrix. As a effect the mark values of end product bunchs are zero. Merely the difference between and influences. The ECN offers prognosiss based on the modeling of the recursive construction ( matrix A ) , the external forces ( matrix B ) and the mistake rectifying portion ( matrices C and D ) . The mistake rectifying portion can besides be viewed as an external input similar to.

Discrepancies and Invariants

Predicting a high-dimensional dynamical system is hard. A manner of cut downing the complexness of the undertaking is to divide the kineticss into clip discrepancy and invariant constructions. Let the system forecasts the discrepancies so finally this will unite this prognosis with the unchanged invariants. This can be done by linking the criterion ECN ( Fig. 2 ) to a compression-decompression web shown in Fig. 3. Matrix E separates discrepancies from invariants while matrix F reconstructs the kineticss. The existent prediction is coded in G, [ 3 ] .

Figure 3: Separation of discrepancies and invariants

Training The Proposed Model

After the description of the web construction, developing set-up has to be settled. As antecedently mentioned the overall aim in preparation is to understate the disagreement between existent informations and the end product of the web. This rule is referred to as supervised acquisition ( The other basic category of larning paradigms is unsupervised or self-organized acquisition. One good known larning method in this category is the Self Organizing Map ( SOM ) ) . In a bit-by-bit mode the mistake guides the web in the way towards the mark informations. The backpropagation algorithm belongs to this category and can be described as “ an efficient manner to cipher the partial derived functions of the web mistake map with regard to the weights ” [ 2 ] .

Learning Algorithm

The backpropagation algorithm supplies information about the gradients. However, a acquisition regulation that uses this information to update the weights expeditiously is besides needed. A weight update from loop K to k + 1 may look like

( 14 )

Where dk describes the hunt way and the acquisition rate ( or step length ) . Issues that have to be addressed are how to find ( I ) the hunt way, ( two ) the acquisition rate and ( three ) which patterns to include.

A familiar manner of finding the hunt way dk is to use the gradient descent which is a comparatively simple regulation [ 4 ] . The major drawback though is that larning easy is caught in a local lower limit. To avoid this jeopardy the vario-eta algorithm can be chosen as acquisition regulation [ 5, 6 ] . Basically it is a stochastic estimate of a Quasi-Newton method. In the vario-eta algorithm a weight-specific factor, I? , is related to each weight. For an arbitrary weight, the jth weight-specific factor I? is defined harmonizing to Eq. 15.

( 15 )

Where denotes the E norm and E is error map

Assuming there are p weights in the web. The search way is determined by multiplying each constituent of the negative gradient with its weight-specific factor,

( 16 )

Above E denotes the mistake map and N the figure of forms. A benefit with the vario-eta regulation is that weight increases go non-static. This belongings implies a potentially fast larning stage in [ 2 ] . Refering a sensible value of the acquisition rate. The acquisition rate is many times determined on an ad hoc footing.

Sing pattern choice, a stochastic process can be used. This merely means that the gradient EM of a subset M of all forms are used as an estimate of the true gradient E harmonizing to

( 3.17 )

Where |M | denotes the figure of elements of M. M is subset web

M can be composed in several ways. In our empirical survey choice of M is made with equal chance, a predefined figure of forms ( less than 10 per centum of the preparation informations ) to stand for M. The gradient EM of Eq. 17 was computed and used as input to Eq. 16. Once all weights were updated, out of the staying preparation patterns a new subset was picked for the following loop. It is besides noted that recent forms are considered important one, may prefer a non-uniform chance distribution, where it is more likely to take a recent form [ 6 ] .


The quandary of overfitting is profoundly rooted in nervous webs. One manner to stamp down overfitting is to presume input informations non to be exact ( the instance in the field of fiscal analysis ) . The entire mistake of pattern Ts can be split into two constituents associated with the weights and the erroneous input severally. The corrected input informations, , can be expressed as

( 18 )

Where crosstalk is the original informations and a rectification vector. During developing the rectification vector must be updated in analogue with the weights.

To this terminal, the end product mark difference i.e. the difference in end product from utilizing original and corrected input informations has to be known which is merely true for developing informations. Consequently, the theoretical account might be optimised for developing informations but non for generalization informations because the latter has a different noise distribution and an unknown end product mark difference. To work around this disadvantage the theoretical account

is composed harmonizing to

( 19 )

I? is precisely one component drawn at random from { one = 1, . . . , T } ( memorised rectification vectors from developing informations ) . A composing with an extra noise term ( Eq. 19 ) benefits from distribution belongingss which is desirable for generalization, [ 5 ] .

The input alteration “ cleansing with noise ” described above helps the web to concentrate on broader constructions in informations. With this extent the theoretical account is prevented from set uping false causalities with considerable consequence.

Stoping Standards

It is besides underling to analyze the figure of era ( An era is completed when all preparation forms have been read in precisely one time ) are needed for a web to be trained. Chiefly two paradigms exist, late and early fillet. Late fillet means that the web is trained until a minimal mistake on the preparation set is reached, i.e. the web is clearly overfitted. Then different techniques are used to kill off nodes in the web ( known as pruning ) . By making so finally good generalization ability is reached.

The construct of early fillet is a manner of avoiding overfitting. During larning the patterned advance is monitored and preparation is terminated every bit shortly as marks of overfitting appear. A clear advantage with early fillet is that the clip of preparation is comparatively short. On the downside it is difficult to cognize when to halt.

Mistake Function

When patterning one besides has to be cognizant of outliers in informations. Outliers typically appear when the economic or political clime is unstable or unexpected information enters the market. By picking an appropriate mistake map the impact of outliers can be restrained.

( 20 )

The ln ( blackjack ( A· ) ) mistake map is a smooth estimate of the absolute mistake map |oi a?’ ti| . oi denotes the response from end product nerve cell I and ti the corresponding mark. a a?? [ 3, 4 ] has proven to be suited for fiscal applications [ 5 ] .

Compared to a quadratic mistake map the ln ( blackjack ) mistake map has a evocative behavior in the part around zero but non for big positive or negative values as we see in Fig. 4. The advantage with this map when patterning fiscal information is that a big difference in end product and mark outputs a limited and

more sensible mistake.

Figure 4: The lncosh mistake map of Eq. 20, a = 3.

Evaluation of the Study
A important portion of fiscal prediction is the rating of the anticipation algorithm. Several public presentation steps are widely used, but a public presentation step in itself is non sufficient for a hearty rating. Relevant benchmarks are besides needed. A benchmark is fundamentally a different anticipation algorithm used for comparing. In this survey, the quality of a anticipation algorithm is judged with the aid of bing offered informations.


Any anticipation algorithm claiming to be successful should surpass the naif forecaster defined as

( 21 )

Where is the current value of the stock and A·t+1 the predicted value one time-step into the hereafter. The Eq. 21 provinces that the most intelligent suggestion of tomorrow ‘s monetary value is today ‘s monetary value which is a direct effect of the Efficient Market Hypothesis ( EMH ) , ( The EMH provinces that the current market monetary value reflects the assimilation of all information available. Therefore no anticipation of future alterations in the monetary value can be made given this information ) . In the empirical survey a comparing to the naif anticipation of returns was made. The definition is

( 22 )

Where Rt is the last known return and the predicted one-step return. For a anticipation algorithm with integrated bargain and sell signals it could be utile to make a comparing with the buy-and-hold return Rb. This scheme expresses the net income made when doing an investing at the start of a clip period and selling n time-steps into the hereafter, i.e.

( 23 )

A comparing to the buy-and-hold scheme merely gives an indicant of the quality of the signals. Is it more profitable to be a “ inactive ” investor?

Performance Measures

Three often used steps, viz. hit rate, return on investing and accomplished potency, and are defined below. Get down with the hit rate HR.

( 24 )

Where is the existent ( predicted ) k-step return at clip t. ( Harmonizing to the definition the k-step return ) . The norm merely is the figure of elements in the series. Eq. 24 indicates how frequently the algorithm produces a right anticipation. In this context a anticipation is right when the way of the stock K time-steps into the hereafter is successfully predicted. The return on investing ROI takes into history non merely the rightness of the mark, but besides the measure of the existent return. The definition is

( 25 )

Finally, in Eq. 26 the definition of accomplished possible RP is given.

( 26 )

The accomplished possible provinces how big portion of the entire motion ( upwards and downwards ) the anticipation algorithm successfully identifies.

Empirical Study: Forecasting the INR/USD Fx-Rate
In the empirical survey good traded stocks with a sensible spread were considered. Chiefly because a big spread may be fatal if one wishes to integrate the anticipations in existent trading. Hence a determination is farther to do one-day anticipations ( utilizing daily informations ) of the Bombay stock exchange ( BSE ) , AxisBank B and Cipla B with a standard ECN. Besides one-week anticipations ( utilizing hebdomadally informations ) of AxisBank B and Cipla B were performed on an ECN separating discrepancies and invariants. Basically, one assumes that certain clip invariant constructions can be identified and learned rapidly. This means that the latter portion of the preparation is performed with some weights frozen. The happening of invariant constructions could turn out to be more apparent in a hebdomadal compared to a day-to-day theoretical account, because forms originate from the same twenty-four hours of the hebdomad in a hebdomadal theoretical account.

Data Series

For all anticipations the following four clip series were used as natural input:

Closing monetary value Y ( monetary value of the last fulfilled trade during the twenty-four hours )

Highest monetary value paid during the twenty-four hours, yH

Lowest monetary value paid during the twenty-four hours, yL

Volume V ( entire sum of traded stocks during the twenty-four hours )

Additionally, external clip series served as input. Table 1 gives a sum-up of clip series considered to hold a important impact on the behavior of the AxisBank B and Cipla B. Sing the BSE anticipation, another set of external inputs was used. Table 2 gives the full list. All informations used in the mold was acquired from the day-to-day service supplier and yahoo finance

Table 1: external clip series used foretelling AxisBank B and Cipla B.

Stock Model Input

6 months involvement rate Bombay

Bombay INR/USD FX – rate


1 twelvemonth involvement rate Bombay

Bombay INR/USD FX – rate

Table 2: external clip series used foretelling the BSE.

Index Model Input
BSE- IT ( Infotech )


6 months involvement rate Bombay


Bombay INR/USD FX – rate



1 twelvemonth involvement rate Bombay


Bombay INR/USD FX – rate

Technical Considerations

Prior to each preparation session relevant informations series were transformed and preprocessed in different ways. For all external clip series ( Tab. 1 and 2 ) we calculated the normalized one-step return Rt is calculated. The Gaussian volume was computed in a running window of 30 yearss and 12 hebdomads for day-to-day and hebdomadal anticipations severally. On inputs y, yH and yL, we was applied the log-return. The definition is given in Eq. 27. For little alterations the log-return is similar to the one-step return Rt.

( 27 )

Datas were besides divided into three subsets: a preparation set, a proof set and a generalization set. Roughly, half of all forms available were used for preparation and one-quarter each for proof and generalization. The generalization period ran over 12 months for both the day-to-day and the hebdomadal theoretical account. ( In the day-to-day theoretical account some preparation Sessionss were performed on a shorter generalization set due to losing data. ) . As mistake map we used the ln ( blackjack ) map of Eq. 20 with a=3 is used. The standard tanh ( A· ) map served as activation map.

Training Procedure

Weights were initialized indiscriminately ( uniformly distributed in the interval [ a?’1, 1 ] ) . The ECN was trained ( on the preparation set ) for 500 and 1000 era in the day-to-day theoretical account and hebdomadal theoretical account severally. It is noticed that this was plenty for the cleansing mistake ( rectification to the net inputs ) to stabilise. After preparation, weights associated with the best public presentation ( in footings of hit rate ) on the proof set were selected and applied to the generalization set to acquire the concluding consequences.


Neuro Dimension supply a package for nervous computer science, NSNN ( Neuro Solutions for Neurel Networks ) is designed to construct ANN, based on which mimic the acquisition procedure of the encephalon in order to pull out forms from historical informations. Once these files are loaded into the package it is possible to get down preparation.

Experimental Consequences
In the undermentioned subdivisions, consequences from the empirical survey are presented. Tables are based on generalization informations. The naif anticipations of returns constitute benchmark for each anticipation theoretical account. Valuess of hit rate ( HR ) and realised possible ( RP ) utilizing the ECN and the naif scheme are given in tabular arraies below.

Daily Predictions


The most important issue of stock anticipation is how to acquire stableness over clip in this regard neither the day-to-day nor the hebdomadal theoretical account is non optimized and polishs have to be made. However, there is no uncertainty about nervous webs possible in a trading environment. As already exhibited in old subdivision, the ECN on occasion shows good consequences.

Intuitively, one may believe that the weight low-level formatting stage is decisive for the result of the anticipations. Theoretically, this should non be the instance though due to the stochastisity in the choice of forms during preparation. To corroborate this impression a preparation strategy where was set up the net to initialized with the “ best ” ( in footings of hit rate ) generalization weights from the old preparation period.

The consequences gave indicants of an even negative impact ( on the hit rate ) utilizing a colored low-level formatting compared to a random one. This phenomenon typically illustrates the challenge faced when seeking to formalize a dynamical system for a longer period of clip. Previously gained information about the system may be difficult to use successfully in future clip position.

A farther development is to unite one-day anticipations with multi-day anticipations. To gauge the relevancy of a possible detected tendency a leaden amount could be calculated, where weights are associated with the one-day prognosis, two-day prognosis and so on in falling order. Finally, the sum is used to do an appraisal of whether the tendency id likely to turn out as predicted or non. Furthermore, the prognosiss of a commission of theoretical accounts could be averaged. This will convey about a decrease of the prognosis discrepancy, therefore a more dependable end product