# Learning the XOR function

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

## Result

Testset 0; expected output = (-1) output from neural network = (-0.990302695447)
Testset 1; expected output = (1) output from neural network = (0.990238673183)
Testset 2; expected output = (1) output from neural network = (0.990484225235)
Testset 3; expected output = (-1) output from neural network = (-0.989176317993)

# 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.25, momentum 0.2 @ (2000 rounds, max sq. error 0.001)

Round 1: No success...
Success in 1830 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.998938459606)
Testset 1; expected output = (1) output from neural network = (0.999129391127)
Testset 2; expected output = (1) output from neural network = (0.998855534982)
Testset 3; expected output = (-1) output from neural network = (-0.999107049518)

## Learning rate 0.5, momentum 0.2 @ (500 rounds, max sq. error 0.001)

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

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

Success in 331 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.990427253302)
Testset 1; expected output = (1) output from neural network = (0.990019656929)
Testset 2; expected output = (1) output from neural network = (0.992389039886)
Testset 3; expected output = (-1) output from neural network = (-0.987858824455)

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

Success in 839 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.990024377582)
Testset 1; expected output = (1) output from neural network = (0.99407812288)
Testset 2; expected output = (1) output from neural network = (0.987848508414)
Testset 3; expected output = (-1) output from neural network = (-0.989178121656)

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

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

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

Round 1: No success...
Success in 17 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.970345932097)
Testset 1; expected output = (1) output from neural network = (0.922368292233)
Testset 2; expected output = (1) output from neural network = (0.945922103577)
Testset 3; expected output = (-1) output from neural network = (-0.950765790386)

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

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

## Learning rate 0.75, momentum 0.4 @ (500 rounds, max sq. error 0.1)

Success in 19 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.982409923467)
Testset 1; expected output = (1) output from neural network = (0.931971801717)
Testset 2; expected output = (1) output from neural network = (0.989506132469)
Testset 3; expected output = (-1) output from neural network = (-0.984725038909)

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

Success in 774 training rounds!
Testset 0; expected output = (-1) output from neural network = (-0.998747361422)
Testset 1; expected output = (1) output from neural network = (0.999178195311)
Testset 2; expected output = (1) output from neural network = (0.999178195312)
Testset 3; expected output = (-1) output from neural network = (-0.998962754572)

## Learning rate 0.75, momentum 1 @ (1000 rounds, max sq. error 0.01)

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