Advertisement

I don't understand the rule for this weight determination of a NN, from book

Started by April 01, 2005 12:18 AM
1 comment, last by Dave Hunt 19 years, 7 months ago
Hi, I'm reading a book about neural networks, and I've come across a small example on how to determine the weights for a neural network that has 2 input neurons connections to 1 output neuron. heres the line I don't understand:
Quote: If the output with input pattern (a, b) is greater than what it should be, then subtract 1 from w1 if the product aw1 is smaller than 1, and adjust w2 similarly.
Theres two outputs. actualOutput = 0; //what the out neuron actually outputted shouldBeOutput = 1; //what the out neuron should be outputting And the input to input neuron1 is 'a'; From what I can tell it is,

if(actualOutput > shouldBeOutput) {
   w1--; //subtract 1 from weight1
   
   //I'm not sure if this is what the rule meant, which is underlined in the quote
   if(a*w1 < 1) {
      w2--; //subtract 1 from weight2

   }
}



So is the code above right or wrong from what you can tell from the quote? if you need anymore information, let me know. Thanks
I think it is saying "only adjust w1 and w2 if the product is less than 1". So:
if (actualInput > shouldBeOutput) {  if (a*w1 < 1) {    --w1;    --w2;  }}

I'm not familiar with the book, I'm just interpreting the quote you posted.
Advertisement
Another possible interpretation:
if (actualInput > shouldBeOutput) {  if (a*w1 < 1) {    --w1;  }  if (a*w2 < 1) {    --w2;  }}

This topic is closed to new replies.

Advertisement