Working of artificial neurons
Just like the biological brain, ANNs are made up of independent units called neurons. Like the biological neuron, the artificial neuron has a body that does some computation and has many inputs that are feeding into the cell body or neuron:
For example, let's assume we have three inputs to the neuron. Each input carries a binary value of 0 or 1. We have an output flowing out of the body, which also carries a binary value of 0 or 1. For this example, the neuron decides whether I should eat a cake today or not. That is, the neuron should fire an output of 1 if I should eat a cake or fire 0 if I shouldn't:
In our example, the three inputs represent the three factors that determine whether I should eat the cake or not. Each factor is given a weight of importance; for instance, the first factor is I did cardio yesterday and it has a weight of 2. The second factor is I went to the gym yesterday and weighs 3. The third factor is It is an occasion for cake and weighs 6.
The body of the neuron does some calculation to inputs, such as taking the sum of all of these inputs and checking whether it is over some threshold:
So, for this example, let's set our threshold as 4. If the sum of the input weights is above the threshold, then the neuron fires an output of 1, indicating that I can eat the cake.
This can be expressed as an equation:
Here, the following applies:
- Xi is the first input factor, I did cardio yesterday.
- Wi is the weight of the first input factor, Xi. In our example, Wi = 2.
- Xii is the second input factor, I went to the gym yesterday.
- Wii is the weight of the second input factor, Xii. In our example, Wii = 3.
- Xiii is the third input factor, It is an occasion for cake.
- Wiii is the weight of the third input factor, Xiii. In our example, Wiii = 6.
- threshold is 4.
Now, let's use this neuron to decide whether I can eat a cake for three different scenarios.