Machines – How do they learn?
In my previous blog, I covered the relevance of Business Analytics and Machine Learning, followed by the various types of Machine Learning Algorithms, and problems solved. In this blog, and going forward, let’s start exploring the topic of Machine Learning.
First, the fundamentals.
What is Machine Learning?
Tom M. Mitchell, definition is widely adopted in the field, and it defines Machine Learning as:
“A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P if its performance at tasks in T, as measured by P, improves with experience E.”
I wrote about this, with an example of Gmail using spam filters, in this blog. The underlying principle is for the machines to learn. How do they do it?
How does the Machine Learn?
The Machine Learning algorithms are created to imitate the human learning, and knowledge acquisition process. They learn as humans do – improve with practice and experience. For all the cricket fans out there, let’s take an example closer to your heart – how to find the trick to taking wickets, consistently?
Let’s assume that we have 1000 observations of the best bowlers. There are a variety of information available in the data set (observations) relating to the bowling – bowler, style, speed, trajectory, angle, spin, outcome (wicket, runs scored, no-ball) etc.
Bowler | Match | Style | KMPH | Batsman | Outcome | ….. |
AAA | Ind vs Aus | Spinner | 80 | CCC | Wicket | |
AAA | Ind vs SL | Spinner | 75 | DDD | 4 runs | |
BBB | Ind vs Pak | Fast-Medium | 100 | EEE | 1 run | |
AAA | Ind vs SL | Spinner | 77 | DDD | Wicket | |
…. |
Our objective is to find the “trick” to the bowling actions (input), that will lead to the best outcome (wickets), using Machine Learning. For this to happen, we need to feed the data into the algorithms, and teach them to learn from the data, by creating associations. This is called as “Model building”. It is like a new bowler, watching hours of videos and live matches of the best bowlers in action, to learn.
Teaching through model building
Model building is an iterative process, and involves using multiple analytical and statistical tools, to get to the objective. A typical model building process, would look like:
Data set preparation: The data set is usually split in the ratio of 80/20 – 80% to train the model (training data set), and 20% to validate the model (validation data set). The training data set, is used to “teach” the machines to find relationship between features. Once a satisfactory model is built using the training data set, then the model is validated on the validation data set. If satisfactory results are achieved in the validation stage too, then the model is deployed into production. Splitting the training/validation data set is a science by itself, employing a statistical technique called sampling. More about it here.
Model build: An important activity in the model build, is the feature extraction. Each variable, in the data set, is referred to as a feature., Depending on the business objective, these may vary. For example, if our objective is to find the “best bowling action to consistently take wickets”, then the variables chosen will be different, from the objective of “should I choose a spinner or a fast-medium bowler, to bowl to the batsman DDD”.
Once the feature extraction is complete, then the overall model building takes place. This is an iterative process, and various statistical models are applied to find the best outcome. Predominantly, a technique called Hypothesis testing is used for this stage.
Model deploy: All well? Deploy it in the production. As a continuous learning process, a feedback mechanism is created for the model to learn and fine-tune frequently. For example, a new bowling action has been approved by the International Cricket Council. This could tilt the balance either in favour of the bowler or batsmen. The model doesn’t know anything about this, and requires further learning to fine-tune its’ models.
Did you notice something? There is a heavy emphasis on the data – it plays a critical part in Machine Learning. With data touted as “the next oil”, that should explain the rush for the companies to gather as much data as possible, and the pushback in the recent times over privacy concerns. We will continue to see this tug-of-war.
Well, do we always need to provide input and output to the models? Not necessarily, and that brings me to the last topic of this blog.
Supervised, Un-supervised, and Reinforcement Learning Algorithms
For the machine learning models, two sets are information are relevant – Input Variables (X), and Output Variables (Y). Various terminologies are used, in the context of Machine Learning, for Input and Output variables. They all essentially mean the same thing.
Variable | Terminology | Terminology | Terminology | Terminology |
X | Input | Predictor/Feature | Independent | Explanatory |
Y | Output | Outcome | Dependent | Response |
Depending on the nature of X & Y variables, there are three major categories of Machine Learning algorithms, one would encounter in a typical business context.
Type of Algorithm | Description | Example | Techniques |
Supervised Learning Algorithm | The training data set has both predictors (input) and outcome (output) variables. Objective is to find the existence of relationship between the IP/OP, and the strength of the relationship | In the bowling example, it could so happen that spinners have a higher success rate in taking wickets, as compared to the pace of the ball. Therefore, a relationship exists between style (spinner: IP variable) and outcome (wicket: OP variable), and the strength in simple terms the probability of this happening (e.g, 60% of the time this is true) | Regression, Logistic regression, decision tree etc are supervised learning algorithms |
Un-supervised Learning Algorithm | The training data set has ONLY predictors (input) and NOT the outcome (output) variables. Objective is to predict the outcome by looking for relationship across the feature set, and the strength of such a relationship | In the bowling example, if the entire data set was fed to the ML model, then the model could consider all possibilities, and come up with relationship + strength of the relationship For all we know, the model could say, the “Match” influences the “Outcome”. Possible ! | K-means clustering, Hierarchical clustering are un-supervised learning algorithms |
Reinforcement Learning Algorithm | There is randomness in BOTH input and output variables, in the training data set Objective is to predict the outcome despite the randomness/vagueness in the input and output | Take the example of “type-ahead/predictive text” in your smart phone keyboard. As you type, the IP is still random, but the keyboard, starts predicting words, based on the random input. | Markov decision process is a reinforcement learning algorithm |
I hope this gives a clear view on how the machines learn. In the upcoming blogs, let us start exploring the concepts in detail.