A single neuron in a neural network.
Artificial Intelligence is a simulation where machines mimics the capabilities of human and may surpass the human intelligence to perform some tasks.
The power house of human intelligence is the brain. So the basic instinct we get is why not create an artificial brain which can become the power house of machine with artificial intelligence.
The anatomy of a brain?
This is what a human rain looks like on a macro level.
But we are not interested in what it looks like we are interested in how the brain works, what is the smallet building block of human intelligence which can be simulated on a machine.
The human nervous system is made up of a a unique type of cell called the neurons which are responsible to transmit signals from one cell to other.
And it turns out that the Human brain consists an average of 86 billion neurons.
Structure of a Biological neuron?
Dendrite: A treelike extension of the neuron cell body. The dendrite is the primary site for receiving and integrating information from other neurons.
Axon: The fiber-like extension of a neuron by which it sends information to target cells.
Cell Body: Also called the soma, the part of a neuron that contains the nucleus (with DNA) and the organelles, but not the projections such as the axon or dendrites.
Making an Artificial Neuron.
Now that we know what neurons are made up of we can design an artificial neuron.
The anatomy of an artificial will have three major parts namely:
- The Input / Dendrite
- The processing unit / cell body
- The output / Axons
Simplified Block Representation of a Neuron.
Before we jump to make a python programs lets first understand what is the mathematical recipe to make a neuron.
So to make a neuron you will need .
- x inputs (collecting the ingredients)
- w weights associated with the input, weights the quantity of the input which goes in the summation function,hence deciding which input will effect the least and most, input weights changes as the model trains. Better the weights better the results. (generally weights ranges from 0 to 1)
- a summation function ( mixing all the input ingredients)
- a activation function (processing the mixture)
- and finally you will get a y output ( result)
So Finally we get a formula of a neuron:
Python Program of a simple Neuron.
Now that we have all the specification of a neuron we can create one in any programming language we want.
I will be using python and would appreciate if you translate and the same code in any other programming language you like.
Will be using numpy library which the most common and robust library for mathematical computation.
Summation Function: It is just the sum all the weighted inputs.
For simplicity we will be using a step activation function and hence creating a perceptron neuron.
Step Activation Function: If the input (from summation block) is <= 0 the output is 0 else the output is 1.
The Neuron Code :
Download the code and your push changes on github: Give me the Code