Maarten
Maarten

Reputation: 4749

Can a neural network learn a multiplexer pattern?

Let's say you have 3 inputs: A, B, C. Can an artificial neural network (not necessarily feed forward) learn this pattern?

if C > k
   output is A
else
   output is B

Are there curtain types of networks, which can or which are well suited for this type of problem?

Upvotes: 5

Views: 996

Answers (2)

Vladislav Gladkikh
Vladislav Gladkikh

Reputation: 407

If the inputs can be only zeros and ones, then this is the network:

enter image description here

Each neuron has a Heaviside step function as an activation function. The neurons y0 and z have bias = 0.5; the neuron y1 has a bias = 1.5. The weights are shown above the corresponding connections. When s = 0, the output z = d0. When s = 1, the output z = d1.

If the inputs are continuous, then Sigmoid, tanh or ReLU can be used as the activation functions of the neurons, and the network can be trained with the back-propagation algorithm.

Upvotes: 3

mikera
mikera

Reputation: 106351

Yes, that's a relatively easy pattern for a feedforward neural network to learn.

You will need at least 3 layers I think assuming sigmoid functions:

  • 1st layer can test C>k (and possibly also scale A and B down into the linear range of the sigmoid function)
  • 2nd layer can calculate A/0 and 0/B conditional on the 1st layer
  • 3rd (output) layer can perform a weighted sum to give A/B (you may need to make this layer linear rather than sigmoid depending on the scale of values you want)

Having said that, if you genuinely know the structure of you problem and what kind of calculation you want to perform, then Neural Networks are unlikely to be the most effective solution: they are better in situations when you don't know much about the exact calculations required to model the functions / relationships.

Upvotes: 2

Related Questions