1.4 A single neuron with two inputs
How does a single neuron with two outputs calculate its output?
On this page, the example of a single neuron with one input is extended by an additional input. This means that there are now two weights and a threshold value which can be changed and influence the behaviour of the neuron. Thus, the neuron’s output depends on a total of five factors: input x1, input x2, weight w1, weight w2 and the threshold value.
In this interactive figure, you can observe the influence these factors have on the output of the neuron. The sliders can be used to set the inputs x1 and x2 to values between 0 and 1. The two weights and the threshold value can be changed using the plus and minus signs. Each change to one of these factors results in a change to the neuron’s output, which is displayed graphically. In the lower part of figure, black vertical lines indicate which values the neuron can output with the currently set values. This part of the figure contains the actual mathematical sigmoid function with which the neuron's output is calculated. As in the simulation with only one input, the starting values for the weights and the threshold value are only examples.
Again, the intention here is to give you a rough idea of how artificial neurons work, but it is also possible to recalculate all steps in detail: The activation of the neuron is x1⋅w1 + x2⋅w2. The further the activation is below the threshold, the less the neuron fires. The further the activation is above the threshold, the more the neuron fires. To recalculate exactly how the neuron calculates its output, you can enter the result of the subtraction (activation minus threshold) as input value x in the calculation input field at the bottom of the page and click on Calculate
.
Instructions
- Drag the sliders back and forth to move the inputs x1 and x2 to values between 0 and 1.
- Click on the minus or plus signs to change the values for the weights w1 and w2 or the threshold value b.
- The neuron’s output o is calculated at all times.
- In the figure, blue stands for negative values and red stands for positive values.
Tasks
- Adjust both input sliders so that the output of the neuron is as close to 0 as possible.
- Adjust both input sliders so that the output of the neuron is as close to 1 as possible.
- Move both input sliders all the way to the right (x1 = 1, x2 = 1) and change the weights so that the output of the neuron is as close to 1 as possible.
- Adjust the weights and the threshold so that the neuron outputs a value close to 0 for the input combination (x1 = 0, x2 = 0) and a value close to 1 for the input combination (x1 = 1, x2 = 1).
- Set both weights and the threshold value to −4.0 and specify which output values the neuron returns if both inputs are 0 and if both inputs are 1.
Calculate activation function:
A single neuron is far from being a neural network
Although a single artificial neuron is quite simple in structure, one should not underestimate what can already be done with it: In the following units, for example, a single neuron is used to make simple yes/no decisions and even to distinguish ladybirds from caterpillars.
Share this page