I implemented a neural network for AND gate with 2 input units, 2 hidden units and 1 output unit. I trained the neural network using 40 inputs for 200 epochs with a learning rate of 0.03. When I try to test the trained neural network for AND inputs, it gives me output as :
- 0,0 = 0.295 (0 expected)
- 0,1 = 0.355 (0 expected)
- 1,0 = 0.329 (0 expected)
- 1,1 = 0.379 (1 expected)
This is not the output which is expected from the network. But if I set the threshold as 0.36 and set all values above 0.36 as 1 and rest as 0, the neural network output is just as expected every time. My question is that : Is applying a threshold to the output of the network necessary in order to generate expected outputs like in my case ?