Learning the XOR function

Round 1: No success...
Success in 982 training rounds!

Result

Testset 0; expected output = (-1) output from neural network = (-0.990887543267)
Testset 1; expected output = (1) output from neural network = (0.991831297138)
Testset 2; expected output = (1) output from neural network = (0.991594016921)
Testset 3; expected output = (-1) output from neural network = (-0.986825700641)

Playing around...

The following is to show how changing the momentum & learning rate, in combination with the number of rounds and the maximum allowable error, can lead to wildly differing results. To obtain the best results for your situation, play around with these numbers until you find the one that works best for you.

The values displayed here are chosen randomly, so you can reload the page to see another set of values...

Learning rate 0.1, momentum 0.2 @ (1000 rounds, max sq. error 0.001)

Round 1: No success...
Round 2: No success...

Learning rate 0.25, momentum 1 @ (100 rounds, max sq. error 0.001)

Round 1: No success...
Round 2: No success...

Learning rate 0.5, momentum 1 @ (500 rounds, max sq. error 0.1)

Success in 152 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.980717611009)
Testset 1; expected output = (1) output from neural network = (0.939821720355)
Testset 2; expected output = (1) output from neural network = (0.968780093361)
Testset 3; expected output = (-1) output from neural network = (-0.999771165805)

Learning rate 0.75, momentum 1 @ (2000 rounds, max sq. error 0.001)

Round 1: No success...
Round 2: No success...

Learning rate 0.25, momentum 1 @ (1000 rounds, max sq. error 0.001)

Round 1: No success...
Round 2: No success...

Learning rate 0.25, momentum 0.8 @ (2000 rounds, max sq. error 0.01)

Round 1: No success...
Success in 518 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.986807263575)
Testset 1; expected output = (1) output from neural network = (0.993748536216)
Testset 2; expected output = (1) output from neural network = (0.989359827271)
Testset 3; expected output = (-1) output from neural network = (-0.991528129983)

Learning rate 0.75, momentum 1 @ (2000 rounds, max sq. error 0.1)

Success in 50 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.956278071804)
Testset 1; expected output = (1) output from neural network = (0.994140105359)
Testset 2; expected output = (1) output from neural network = (0.819804178976)
Testset 3; expected output = (-1) output from neural network = (-0.999040243408)

Learning rate 1, momentum 0.6 @ (2000 rounds, max sq. error 0.05)

Round 1: No success...
Round 2: No success...

Learning rate 0.25, momentum 0.8 @ (1000 rounds, max sq. error 0.01)

Success in 287 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.985506288363)
Testset 1; expected output = (1) output from neural network = (0.991242479409)
Testset 2; expected output = (1) output from neural network = (0.992807055091)
Testset 3; expected output = (-1) output from neural network = (-0.992302374914)

Learning rate 0.5, momentum 1 @ (2000 rounds, max sq. error 0.1)

Round 1: No success...
Round 2: No success...
Success in 53 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.998635638413)
Testset 1; expected output = (1) output from neural network = (0.972961361553)
Testset 2; expected output = (1) output from neural network = (0.976788301132)
Testset 3; expected output = (-1) output from neural network = (-0.997764833259)