What are you trying to do?

  NetParams calcNetError Weights
┌─────────┬────────────┬───────┐
│NetParams│calcNetError│Weights│
└─────────┴────────────┴───────┘

  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

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

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

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

  ] 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
|value error: inProd
|   Output=:Input     propagate Weights
|[-0]

  inProd =:  +/ . *     NB. dyad: returns inner product of x and y
   Output=:Input  propagate Weights

   Error=:+/ *: Output-desOutputs

   calcNetError=: Input,desOutputs, Output, Error

   NetParams calcNetError Weights
|syntax error
|       NetParams calcNetError Weights
|[-0]

   NetParams
┌─┬─┬─┬─────┐
│2│2│1│0 1 1│
│ │ │ │1 0 1│
│ │ │ │0 0 0│
│ │ │ │1 1 0│
└─┴─┴─┴─────┘

  Weights
10 5 15 30 1 1

  calcNetError
      0 1 0 0
      1 0 0 0
      0 0 0 0
      1 1 0 0
      1 1 0 0
0.880797 0 0 0
0.880088 0 0 0
0.731059 0 0 0
0.880797 0 0 0
1.33884 0 0 0

  Input
0 1
1 0
0 0
1 1

  desOutputs
1 1 0 0

  Output
0.880797
0.880088
0.731059
0.880797

  Error
1.33884


2007/4/28, Alan Mac Hugh <[EMAIL PROTECTED]>:

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]
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm




--
Björn Helgason, Verkfræðingur
Fugl&Fiskur ehf, Þerneyjarsund 23, Box 127
801 Grímsnes ,t-póst: [EMAIL PROTECTED]
Skype: gosiminn, gsm: +3546985532
Landslags og skrúðgarðagerð, gröfuþjónusta
http://groups.google.com/group/J-Programming


Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans

góður kennari getur stigið á tær án þess að glansinn fari af skónum
         /|_      .-----------------------------------.
        ,'  .\  /  | Með léttri lund verður        |
    ,--'    _,'   | Dagurinn í dag                     |
   /       /       | Enn betri en gærdagurinn  |
  (   -.  |        `-----------------------------------'
  |     ) |        (\_ _/)
 (`-.  '--.)       (='.'=)
  `. )----'        (")_(")
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to