What is Machine Learning ? (Explained with a not-so technical example)
To solve a problem using computers, we write programs. Programs are sequence of instructions which can be understood by computer, usually written in a high-level languages like C, C++, Java. Computers executes these instruction to get the desired results.
However there are lot of problems in real-world for which humans are unable to write such unambiguous programs. For example, recognising people in a given image, recognising what is being said in an audio/video clip etc … Machine Learning (ML) evolved to solve such real-world problems (I hope everyone must have heard about ML as computers learning to think like human, write code automatically etc … ). ML is one of the hottest and fastest evolving fields of computer science. Most of you might have heard computers learn automatically using ML, ML generates programs/code automatically for any problem, ML is computers thinking like human etc … Believe me, we are no where close to understanding how human thinks, ML just works because of the mathematical models behind them.
Press enter or click to view image in full size
Bookish Definition: Machine learning is subfield of computer science and artificial intelligence that deals with the constructions and study of systems that can learn from data, rather than follow only explicitly programmed instructions.
Rather than traditional sequence of instructions, ML uses lot of data to build a model and make decisions. If you didn’t understand what is ML using above definition/explanation, don’t worry. I will explain what is ML, how it works using a simple example that my friend used to explain me.
A fruit stall owner receives a stock of apples and oranges completely mixed up. He appoints Tom to sell these apples and oranges, however Tom cannot differentiate between apples and oranges (Yes, he can’t). In order to help Tom, owner decides to separate apples and oranges. When stall owner has classified around 50% of the stock he leaves the town on an urgent business trip. As days pass by, Tom notices that the stock of classified fruits are reducing and he will not be able to sell the unlabelled stock as he doesn’t know how to distinguish them.
Tom starts thinking now and decides to learn to distinguish them. Tom takes all the classified apples, weighs them and finds they are all between 70–120 grams. Similarly he weighs all the labelled oranges and finds they are between 100–160 grams. Also he observes that most of the oranges have a pebbly skin.
Having made these observations, he now picks a fruit from unlabelled stock, weighs it, if it is from 70–100 grams he confidently says it is Apple and if it is from 120–160 grams he confidently says it is Orange. He is unable to classify those that fall in the range of 100–120 grams. Because he has seen both apples and oranges in that weight range. Remember he had made another observation about orange, most of the oranges have a pebbly skin. When he picks a fruit which weighs between 100–120 grams he observes the skin, if it is pebbly he classifies it as orange else as apple.
Press enter or click to view image in full size
In this example, Tom built a model based on series of if-else conditions (also technically known as Decision Tree model) using weight and nature of skin of the fruit to decide whether it is an apple or an orange. Similarly one can build complex models like k-Nearest-Neighbour (kNN), Linear Regression, Neural Network … to solve such complex real-world problems.
Our focus in this post is not to understand what these complex models are, how they work, but to understand that these models are built using examples.
In above example Tom is like our computer. Initially it doesn’t know how to classify apples and oranges i.e. humans are unable to write program to solve this problem. However with lot of examples Tom i.e. computer automatically built itself a model that it can use for classifying apples from oranges. Hence we can say that,
Machines learn using examples.
Note — I recommend everyone to read Pararth Shah’s answer to How do you explain Machine Learning and Data Mining to non Computer Science people ? It is again simple, fun to read and you will be able to reinforce your understanding about Machine Learning.
How Human Learning has evolved to mimic Machine Learning ? Why it is bad ?
To explain this I will have to recall “The History of Books” as said by Prof. B. Yegnanarayana at IIIT Hyderabad.
The History of Books
During 1960’s, typically a book consisted of 50 pages or less as the topics were relatively new and understanding of author was very less. More importantly the book was filled with questions that author was unable to answer or answering those might help the community. Also as text was very much limited, students started asking questions that author hadn’t discussed in the text. Asking such questions is a good trait that everyone should possess, as answering them makes a breakthrough in that subject. However, the books that evolved later killed this art of asking questions.
As the understanding of concept evolved over time, books came with lot of text and they became bigger. As more and more things became clear they were being included in book and around 1990’s they were so huge that people started adding summary i.e. just a list of bulleted points that you need to remember. Also problems section (exercises) were introduced. Obviously these exercises consisted of those questions for which you can figure out answers from the text (which are no longer useful for coming up with new theories). To add to the dismay recently books have started to add example problems, step-by-step solutions inside the chapter itself. Now you can solve the exercises at end of chapter by mimicking the steps in example problems to get desired answer.
For instance, if you are learning binary search trees, you see an example of how to insert data. You see the first example and find out insertion happens at right child. You try to apply the same logic to an exercise problem and see it is wrong. Then from another example you find it has to be at left child. You try to apply this logic and figure out it is correct. As you solve many examples you finally figure out if the value of element to be inserted is less than the current node you insert as left child else as right child. But what you are missing to understand is why such binary search trees were introduced, what disadvantages of previous approaches it solves and what are its advantages etc …
Thus humans are learning from examples too.
Ok, Human Learning == Machine Learning. Who cares ? Is that your state of mind now ? Just read on,
Machine Learning may look like it has solved the problem but it has not. They are not exact solutions but approximate. One can achieve 70% to 99% accuracy with proper effort but to make them work for 99.99999% is very tough. They work sometimes, they don’t many times. It depends on the problem, dataset size and many other factors. For instance in our scenario where Tom developed rules/model to classify apples and oranges, it is not perfect. There may be apples that don’t weigh in the range of 70–120 grams. Suppose an apple from unclassified stock weighs 135 grams Tom may falsely classify it as orange, which is a mistake.
Learning from examples doesn’t work exactly if you haven’t exhausted all possibilities. This implies learning becomes hard. If I have to learn addition by example, I would need to try out all possible infinite instances of addition, which is insane.
Press enter or click to view image in full size
Humans have the unique capability of generalisation, which machines have not mastered yet. When a human is shown a chair, however innovative design of a chair you make, human always figures out it is a chair. But a machine cannot. You need to show tonnes and tonnes of instances of chair a-priori so that it can also predict it as chair next time it sees it.
How should we really learn ?
This has been partially answered in previous section however I will explain a bit in detail. This is a small excerpt from my conversation with Dr. Kannan Srinathan at IIIT Hyderabad.
Imagine you have given the last exam (literally the last one in your life), I come to you and give a book (approximately has 300 pages), say nothing and leave. Whenever you see that book, you will be just in state of fear, what question he might ask me next time we meet. You are always worried what questions will be thrown at you and how to answer them. We always study a book with the focus to answer questions that will be posed to us either to get good marks in exam or appreciation from peer group for knowing things. This is a completely wrong way of learning.
Lets imagine you are reading a book on Operating Systems, the topic is scheduling algorithms. Just learn what are scheduling algorithms, close the book come up with your own scheduling algorithms, first you may come up with naive or brute force approach FIFO, then try to think of advantages and disadvantages of this approach. Based on the disadvantages try to devise an algorithm that tackles it efficiently, you may have come up with Round robin by yourself and keep on doing this until a fine point where you feel you have solved the problem efficiently. Now check up with the solutions, there are two possibilities. You would have enlisted all the scheduling algorithms proposed by author yourselves or you might have took a different path altogether & proposed a better algorithm. Either way you win. If you have enlisted all the algorithms proposed by author you need not learn the book again in your life because you have understood why, how, what works, what doesn’t work by solving the problem entirely by yourselves. In other case you have made a ground-breaking contribution to subject which is how many successful researchers learn. Yes, I admit this is a very hard technique & takes lot of time. It needs lot of practice. You need to literally unlearn the way you have learnt all the while.
Another point as I mentioned in previous section, when you are reading a book, you should ask lot of questions, those questions that are not answered by author. Answering which will create a dent in the universe.
Thanks! Hope you enjoyed learning to learn.
Note — I recommend everyone to try Learning How to Learn course offered by Coursera. It explains to laymen how brain works while learning, realise its potential, strength and use it in right way.