How to solve XOR problem with MLP neural network?
Asked Answered
D

1

13

Tomorrow morning I have to give neural network final exam, but there is a problem, I cannot solve XOR problem with MLP, I don't know how to assign weights and bias values :(

Directive answered 27/6, 2011 at 16:0 Comment(1)
I answered a similar question: https://mcmap.net/q/747134/-neural-network-xor-gate-not-learningIndihar
L
19

So, seeing as you posted this 2 days ago, I guess I'm a lil late to help with your exam :(

However, learning is always a good thing, and learning about neural nets doubly so!

Normally I'd answer this question by telling you to use a network with 2 input units (one for each boolean), 2 hidden units, and 1 output unit (for the boolean answer), and then directing you towards the wikipedia article on the backprop learning algorithm to find the correct weights.

However, your phrasing -- "I cannot solve" makes it sound like your teacher wants you to find the weights yourself. In which case, a solution would be to think of one hidden unit as representing an OR gate and the other representing an AND gate. The connections from the those units to the output would allow you to say 'fire if the OR gate fires and the AND gate doesn't', which is the definition of the XOR gate. Anyways, that's just the intuition, the actual net is shown below.

Notice that the thresholds of some of the units in the diagram aren't 0 as they normally are -- this is just shorthand for having the bias unit connected to those units with the threshold as the weight.

enter image description here

Lurlinelusa answered 29/6, 2011 at 23:48 Comment(1)
For future readers: the picture works but the blue threshold activates (i.e. outputs 1) when t > 0, not when t >= 0.Nolte

© 2022 - 2024 — McMap. All rights reserved.