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

This topic is 5006 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
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.

##### Share on other sites
Another possible interpretation:
if (actualInput > shouldBeOutput) {  if (a*w1 < 1) {    --w1;  }  if (a*w2 < 1) {    --w2;  }}

1. 1
2. 2
3. 3
Rutin
15
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633728
• Total Posts
3013577
×