Make Your Own Neural Network

Passion and Dedication
May 10, 2020
The Disruptors – CNote
May 14, 2020

In todays blog we will cover making a neural network and that means we will try to mimic human brain which operates using millions of clustered neural networks. The better the technology is getting; it is making it complex with a clear-cut advantage to it. It is a branch of machine learning which is considered most evidently used when creating systems based on artificial intelligence.

What are Neural Networks?

A neural network is a branch of machine learning also known as artificial neural network, is a set or combination of algorithms that is used to identify the relations between set of complex data through iterating and adapting in return trying to reach the nearest to the results. It is identical to the process of human brains which consists of 100 billion cells called neurons, that to have a neural network to operate and perform functions or simply think. It barely starts with the inputs and outputs required using which it starts to learn and create hidden layers that adjust to reach as near to the result as possible with every iteration.

How to build a neural network in just under 10 lines of python code?

Code:

from numpy import exp, array, random, dot
training_set_inputs = array([[0, 0, 1], [1, 1, 1], [1, 0, 1], [0, 1, 1]])
training_set_outputs = array([[0, 1, 1, 0]]).T
random.seed(1)
synaptic_weights = 2 * random.random((3, 1)) - 1
for iteration in xrange(10000):
    output = 1 / (1 + exp(-(dot(training_set_inputs, synaptic_weights))))
    synaptic_weights += dot(training_set_inputs.T, (training_set_outputs - output) * output * (1 - output))
print 1 / (1 + exp(-(dot(array([1, 0, 0]), synaptic_weights))))

Explanation (line by line):

Line1: We import few methods from numpy library. Where exp is for the natural exponential, array is for matrix, dot for multiplying matrices and random to give random numbers.
Line2&3: Training set for input and output.
Line4: Seed the random number generator, so it generates the same numbers every time the program runs.
Line5: Model each neuron with 3 input connection and one output connection, i.e. 3 X 1 matrix, with values range -1 to 1 and mean 0.
Line6,7&8:  Iterate 10000 times making small adjustments every time.
Line9: Print the output.
Resource and more detailed explanation by Milo Spenser- Haper on medium.com

Applications:

There are many fields of profession where we are applying solutions built based on neural networks which use adaptive learning, self-organizing, fault tolerance ad predictions that to with the real-time answers which is helping in developing technologies the mankind had dreamt about in scientific fictions. It is used to classify, predict, cluster and associate data with giving computers the ability to actually retain what they learned.

There are many real-world applications of its use for example:

  • Aerospace
  • Automotive
  • Electronics
  • Manufacturing
  • Mechanics
  • Robotics
  • Telecommunication
  • Banking
  • Defense
  • Education
  • Financial
  • Medical
  • Securities
  • Transportation

Conclusion:

It is one of the examples of a blog I wrote on biomimicry, it has raised the human capability in artificially producing human like results, not only this has increased the all over human capacity to perform tasks. This field has seen an in-depth research and so is its connection with machine learning, artificial intelligence and data mining.

I hope this was a learning experience, leave your comments, thoughts and questions below. If you find it helpful try to continue sharing the content with others.

Leave a Reply

Your email address will not be published. Required fields are marked *