‘Hello World’ of machine learning

A ‘hello world’ equivalent program for Machine learning would be to use the neural network to model XOR. These days neural nets are often the first ML concept to be learned (not counting stuff like genetic algorithms and linear regression).

XOR is the operation that kicks out a 0 if two binary values are the same, but 1 if they are different. It is expressed like this:

a     b     XOR

0    0    0

0    1    1

1    0    1

1    1    0


Why is it important?

A single layer neural nets can only model linear functions/linearly separable data.2 layer neural nets can model data that is not linearly separable.

Let’s have a look at what it means in this context:

How can you make a linear function (which doesn’t bend around and cross the same space in a dimension, rendering multiple values at the same points on one dimension) which can separate activated data points from the zeroes?

You can’t.

Hence a 2 layer neural net is required.

You can find implementation and explanation of XOR here




3 thoughts on “‘Hello World’ of machine learning

  1. Can you please describe in detail how these works in next or future posts i am really interesteed here to know abouot it and also the sources related to it.


    1. The XOR uses a simple propagation logic. Notice how XOR(1,1) => 0, that’s forward propagation. Similarly, XOR(0,0) => 0 is back propagation. I would write on all aspects of computer science. I have updated a link that provided implementation and explanation on XOR.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s