12.07.2015 Views

Neural Networks - Algorithms, Applications,and ... - Csbdu.in

Neural Networks - Algorithms, Applications,and ... - Csbdu.in

Neural Networks - Algorithms, Applications,and ... - Csbdu.in

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

2.5 Simulat<strong>in</strong>g the Adal<strong>in</strong>e S3Adal<strong>in</strong>e while it is runn<strong>in</strong>g. Based on these observations, there is no needto store or accumulate errors across all patterns with<strong>in</strong> the tra<strong>in</strong><strong>in</strong>g algorithm.Thus, we can design the tra<strong>in</strong><strong>in</strong>g algorithm merely to adapt the weights for as<strong>in</strong>gle pattern. However, this design decision places on the application programthe responsibility for determ<strong>in</strong><strong>in</strong>g when the Adal<strong>in</strong>e has tra<strong>in</strong>ed sufficiently.This approach is usually acceptable because of the advantages it offers overthe implementation of a self-conta<strong>in</strong>ed tra<strong>in</strong><strong>in</strong>g loop. Specifically, it means thatwe can use the same tra<strong>in</strong><strong>in</strong>g function to adapt the Adal<strong>in</strong>e <strong>in</strong>itially or whileit is on-l<strong>in</strong>e. The generality of the algorithm is a particularly useful feature,<strong>in</strong> that the application program merely needs to detect a condition requir<strong>in</strong>gadaptation. It can then sample the <strong>in</strong>put that caused the error <strong>and</strong> generate thecorrect response "on the fly," provided we have some way of know<strong>in</strong>g thatthe error is <strong>in</strong>creas<strong>in</strong>g <strong>and</strong> can generate the correct desired values to accommodateretra<strong>in</strong><strong>in</strong>g. These values, <strong>in</strong> turn, can then be <strong>in</strong>put to the Adal<strong>in</strong>etra<strong>in</strong><strong>in</strong>g algorithm, thus allow<strong>in</strong>g adaptation at run time. F<strong>in</strong>ally, it also reducesthe housekeep<strong>in</strong>g chores that must be performed by the simulator, s<strong>in</strong>cewe will not need to ma<strong>in</strong>ta<strong>in</strong> a list of expected outputs for all tra<strong>in</strong><strong>in</strong>g patterns.We must now def<strong>in</strong>e algorithms to compute the squared error term (£ 2 (t)),the approximation of the gradient of the error surface, <strong>and</strong> to update the connectionweights to the Adal<strong>in</strong>e. We can aga<strong>in</strong> simplify matters by comb<strong>in</strong><strong>in</strong>gthe computation of the error <strong>and</strong> the update of the connection weights<strong>in</strong>to one function, as there is no need to compute the former withoutperform<strong>in</strong>g the latter. We now present the algorithms to accomplish thesefunctions:function compute_error (A : Adal<strong>in</strong>e; TARGET : float)return floatvar tempi : float; {scratch memory}temp2 : float; {scratch memory}err : float;{error term for unit}beg<strong>in</strong>tempi = sum_<strong>in</strong>puts (A.<strong>in</strong>put.outs, A.output.weights);temp2 = compute_output (tempi, A.output~.activation) ;err = absolute (TARGET - temp2); {fast error}return (err);{return error}end function;function update_weights (A : Adal<strong>in</strong>e; ERR : float)return voidvar grad : float; {the gradient of the error}<strong>in</strong>s : "float[]; {po<strong>in</strong>ter to <strong>in</strong>puts array}wts : "float[]; {po<strong>in</strong>ter to weights array}i : <strong>in</strong>teger; {iteration counter}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!