What is Machine Learning?
What is the difference between Machine Learning (ML) and AI? How does ML differ from traditional programming? How can ML benefit you? All this, and more.
We’d like to welcome you to a new series of posts on our blog. We’ll break down the fundamental concepts of Machine Learning (ML) and Artificial intelligence (AI) in non-technical terms, and into bite-sized content. You’ll grasp key concepts faster and get a feel of the underlying mechanics. And with as little math as possible.. This is going to be a fun ride.
Artificial Intelligence and Machine Learning - Synonyms?
Where do we begin? Right - AI and ML. Both of them are two very hot buzzwords right now and used almost interchangeably. But they are not quite the same.
The meaning of Artificial Intelligence derived from the individual words that make up the term would help us arrive at something like: “a human-made thinking power”. This is the grand goal, isn't it? A fully General AI, which can cope with any task, much like a human. Picture the cute Wall-E, Samantha in Her, or Schwarzenegger from the Terminator series. We are not there yet, and we might not get there. (People don't agree on this point…)
But these days , AI is a field in computer science through which intelligent systems can be developed that can creatively solve problems. Such Narrow AI is built to handle specific tasks and have a limited scope. Think of Gmail’s spam filter or Facebook’s automatic photo tagger. Although it sounds easy, believe us, it’s extremely difficult to get machines to perform such seemingly intuitive stuff. This interesting blog article from Hackernoon says:
“Narrow AI is where we have been, and General AI is where we are heading towards.”
Then, what about Machine Learning?
Machine Learning is really the verb in this process. How do we expect our AIs to learn? From data, of course, just like we do, absorbing the stimuli and from the environments around us. Somehow we must make machines gain the ability to think and perform actions based on their past experiences (i.e. the data fed in).
So, how do machines learn from data??
If you are a programmer, you might already be trying to decipher the difference between traditional programming (TP) and machine learning. Both of them are designed by humans to solve problems using computing power. In TP, we provide the system a set of instructions and the input to get the desired output, commonly called a rule-based approach.
Now, ready to be amazed? In ML, you give the system the input and the output and the system learns the rules by itself. But you might ask, if you have the input and the output, of what use are the rules? The rules are used for generating the output (“predicting”) based on future inputs.
Let us clarify that with an example.
Lessons from an Orchard
Let’s say you have an orchard that yields both oranges and apples. After keeping a few for yourself, you decide to sell the remaining in the nearby market. But to do so, you need labor to at least separate the fruits and pack them. Since you are a rapacious capitalist, you decide to do away with the labor and automate the process by using a combination of an advanced overhead camera and a conveyor belt. The camera captures data about each fruit passing by it - for example, it’s color, texture, and shape. The plan is to use these data points to figure out the type of fruit on the conveyor belt and divert them to different boxes. There are two options in front of you - stick to a traditional programming approach or try out the ML methods your friend happened to mention the other day.
A traditional program will contain multiple “if-else” loops. For example, to check the color and texture of the fruit i.e. if it’s red and texture is smooth, then the fruit is an apple but if its color is orange and rough, then it is an orange. You are explicitly setting the rules here based on your knowledge and experience of observing fruits from your orchard. This is the reason for calling it a rule-based approach. The system uses the input i.e. data from the camera and the pre-programmed rules to produce the output i.e. predict the type of fruit.
But what if we tell you that such rules need not be hardcoded into the system i.e. it can infer them on its own. If you remember from our initial discussion, for an ML system, both input and output is required. The output over here is the type of fruit, but if you have to figure it out by yourself, then why use ML? Well, the output is required for just a few fruits. The rest will be predicted by the system. So, you put in the extra efforts of collating the camera data with the type of fruit on the belt. It will look somewhat like this:
Take a good look at the above table. Based on the data collected, it’s very easy to figure out why traditional programming might not be a good fit for this task. The simple program will not produce any output with the third data point i.e. when the fruit is greenish-yellow. This can be handled by adding another “if-else” construct. But you can figure out the limitations. The number of such constructs will increase with the number of unique values in each column i.e. adding constructs for different possible color shades of the fruit. Now, this problem can very well be handled by ML algorithms. The algorithm will take in the above four data points and simply put - create its own rules internally (think of multiple “if-else” constructs). This process is referred to as “training”. During this process, the system figures out the relation between camera data and the assigned label. For example, it concludes from the data that a smooth red or greenish-yellow, non-circular fruit should be an apple.
Now, the next time a fruit passes on the conveyor belt, the input from the camera will be fed into the ML algorithm. Lo and behold! It will produce an output - a prediction - the type of the fruit. So, as promised, the data collection stage and manually tagging the points with the output type (called a “labeling”) is required initially for a few samples. Once the system “learns” draws out its own rules, it will start predicting the fruit type on its own - just like a traditional program. The illustration below should paint a better picture.
If you think a bit deeper, you might have noticed that in TP, the program doesn’t depend on the data (seems obvious). But in ML, the inferred rules might change drastically depending on the “training” data. That means that the if-else constructs and the conditions used will differ. For example, if the third data point in the above table about a greenish-yellow apple fruit is not provided, the ML algorithm will be as clueless as a TP program when it sees such a fruit later (i.e. post-training). It might throw out a wrong prediction as the system didn’t see such a combination earlier. Curious about what’s going on within?
The above type of problem which the “black-box” ML algorithm handled is known as a “binary classification” problem and the mysteries about the internal mechanics of the “black-box” will be unraveled in the upcoming articles.
Summarizing, machine learning is the process by which a system can be “trained” to create rules and links between pre-fed input and output data. Such a “trained” system can be used to predict the output for future unlabeled input data points. Well, in a few cases, the initially tagged output “labels” is not available (i.e. just the data from the camera without tagging them as “apple” and “orange”), but ML can work in such scenarios too. You will find out how in the next article, which will explore the different types of problems where ML can be employed.
We hope, by now, the following few things are clarified:
- Difference between AI and ML
- Difference between Traditional Programming and ML
- A basic idea of scenarios where ML has an upper hand over TP
Alright, now we believe you can truly appreciate this - Go watch Google DeepMind’s Alpha Go defeat a human in the game of Go (that’s enough “go”s in a sentence). What do you think? Is it based on TP or ML or some combination of both?
And, if you feel that you are comfortable with a slightly technical handling of the concepts introduced above, we have collated a few resources to aid you in this journey:
- Machine Learning by Andrew NG - Week 1 - on Coursera
- How Machine Learning Algorithms Work - on machinelearningmastery.com
Until next time!