Machine Learning Vs Traditional Programming
Intuitive Explanation of Machine Learning Algorithm
In Traditional Programming we have
Input + Program = Output
Let's say we want to write a program to calculate the average of given numbers.
here programmer will write logic,
get those numbers as input.
then use the formula for average.
Show output.
In this case, we have a formula or procedure for desired output and we can write that logic.
But there are some problems where we know, what we want to achieve but it's hard (or impossible) to write logic or procedure for it.
e.g. let's say we want to write a program that takes an image as input and identify whether it's a cat or dog?
In this, we need to describe the features of dogs and cats and write logic to compare those features.
but it's hard to enumerate every possible feature of the cat and dog so that the program can differentiate between two images.
Rather we use the machine learning approach,
Input + Output = Program
We give the machine learning algorithm input (data) and output (labels) we want to achieve.
Essentially we tell the algorithm which image is of Dog and which image is of a cat.
The Machine Learning algorithm goes through 1000s of images iteratively uses optimization techniques and figures out how one set (cats) of images are different from another set (dogs).
Comparing pixel values from both sets of images, the algorithm will create some internal presentation of cat vs dog.
When we give a new image, it will predict by comparing it with whatever it has learned from data.
This is how humans also learn, When kids learn to identify animals we don't describe the properties of animals to them, rather we show them examples like this is cat or dog.
After seeing a few of these examples child creates a mental model of an animal in his mind. next time if it sees a cat of different colors and even different sizes it still identifies it as a cat.
Here is a link to how to write a simple image classification program