[Jprogramming] Output is not right

Alan Mac Hugh mach1982 at gmail.com
Sun Apr 29 05:05:18 HKT 2007


Hi I'm working on a assignment for college, I would e-mail my lecture, but
the  assignment due in on Monday at 12noon and I'm not sure if he checks his
e-mail  over the weekend. I have got the program working, but the output is
not right.

When I type in

NetParams calcNetError Weights

I should just get the answer.

I know the answer there as when I type calcNetError, the answer is  the last
thing displayed.The propagate function is my lectures solution to a previous
assignment all the rest is my own code.

Below is the code:

[code]

nProd =:  +/ . *     NB. dyad: returns inner product of x and y

sig =:  [: %@:>: [: ^@:- ]   NB. monad: returns sigmoid function of y

getIHW =:   (2 2) $ (i. 4) { ]    NB. monad: returns the input->hidden
weight matrix from y

getHOW =:   (2 1) $ (4 + i. 2) { ]   NB. monad: returns the hidden->output
weight matrix from y

 calcHiddenOut =:[: sig [ inProd getIHW   NB. dyad: returns the hidden unit
activations

      NB. from input x to network with y weights

propagate =:  [: sig calcHiddenOut inProd getHOW NB. dyad: returns the
output from the output unit

      NB. from input x to a network with y weights





] Weights =: 10 5 15 30 1 1

10 5 15 30 1 1



  NIn=: 2

  NHid=:2

  Nout=:1

  Data=:0 1 1, 1 0 1, 0 0 0,: 1 1 0



 NetParams=:NIn; NHid; Nout; Data

 Input=: |: (0 1 { |: > Data)

 desOutputs=:|: ( 2 { |: > Data)

 Output=:Input  propagate Weights

 Error=:+/ *: Output-desOutputs

 calcNetError=: Input,desOutputs, Output, Error

 NetParams calcNetError Weights


[/code]


More information about the Programming mailing list