after reading some articles about neural network(back-propagation) i try to write a simple neural network by myself.
ive decided XOR neural-network, my problem is when i am trying to train the network, if i use only one example to train the network,lets say 1,1,0(as input1,input2,targetOutput). after 500 trains +- the network answer 0.05. but if im trying more then one example (lets say 2 different or all the 4 possibilities) the network aims to 0.5 as output i searched in google for my mistakes with no results :S ill try to give as much details as i can to help find what wrong:
-ive tried networks with 2,2,1 and 2,4,1 (inputlayer,hiddenlayer,outputlayer).
-the output for every neural defined by:
double input = 0.0;
for (int n = 0; n \< layers.Count; n++)
input += layers[n].Output * weights[n];
while 'i' is the current layer and weight are all the weights from the previous layer.
-the last layer(output layer) error is defined by:
while 'value' is the neural output and 'targetvalue' is the target output for the current neural.
-the error for the others neurals define by:
foreach neural in the nextlayer
-all the weights in the network are adapt by this formula(the weight from neural -> neural 2)
while LearnRate is the nework learning rate(defined 0.25 at my network). -the biasweight for each neural is defined by:
bias is const value=1.
that pretty much all i can detail, as i said the output aim to be 0.5 with different training examples
ive upload my project here:
im realy stuck here,dunno where my mistake after checking the code again and again:(
thank you very very much for your help:)