As discussed in article #1, Machine learning (ML) is a subset of AI. Machine learning is the science of getting computers to learn from the data presented to them without being explicitly programmed. It is similar to how toddlers learn the alphabet – by trial and error. ML is one approach of AI, an approach that is based on statistics; hence it is also called the statistical approach or probabilistic approach.
So, how are you going to make the machines/computers learn from data? Here is one way practitioners do it. Split the data in two parts – training dataset and validation dataset in 80:20 proportion.
The training dataset is fed to the ‘learning algorithm’ (aka an ‘untrained model’) and the ‘learning algorithm’ finds patterns in the data. It generates a hypothesis or a formula that describes the relationship between two or more elements in the dataset. Mathematically, it is a mapping of the input variable “x” to an output variable “y” represented by the function “f” as y = f(x)
(If you want to dig deeper into the various algorithms, here is an article in towardsdatascience.com that highlights popular algorithms used in machine learning)
This is the dataset that is not used in the training of the model but is withheld to be used to test the generated function.
The model function is fine-tuned with help of this validation dataset. It provides an unbiased evaluation of how well the model fits other data not present in the training dataset. The model can then be fine-tuned by tweaking other parameters – often called ‘hyper parameters.’ to arrive at a better fit. After the final tuning of these ‘hyper parameters’ we arrive at a better fitting “Trained Model”.
The ‘Trained Model’ is now used for inferencing or predicting. If ‘new’ data, where only the ‘input x’ is known is fed to the trained model, the trained model will predict the output ‘y’.
The learning of computers happens in different ways and that gives rise to different kinds of Machine learning – Supervised learning, Unsupervised learning and Reinforcement learning. The compact Machine Learning Bubble chart below shows the various types of Machine learning and the various use cases for it.
Here is a brief about these various Machine Learning models.
In Supervised Learning, the data that is fed to the algorithm is labeled. The input and output (labels) are both known. The computer/machine ingests this data and spits out a logic, a formula. There are two kinds of Supervised Learning – Regression and Classification.
In a regression problem, we are trying to predict results within a continuous output – meaning we are trying to map input variables to some continuous function. Let me explain with an example; if somebody is asked to predict the amount of revenues generated with $1000 advertising budget, the person wouldn’t know where to start. But, if the person is given the data – (examples of revenues the previous advertising budgets have generated) he/she can generate a hypothesis (model).
The line that is drawn in the graph that fits the various points is the continuous output, a hypothesis, a model. If the person maps the input variable ($1000 advt. budget) to this continuous output, s/he will be able to predict the approximate revenues that budget might deliver is about $22,500.
In a classification problem, we are trying to map input variables into discrete categories. examples;
- Is this email a spam or not? Discrete categories: Spam & No spam.
- Is this pet a dog or cat? Discrete Categories: Dog and Cat.
- Is it this or that? Is it Yes or No?
All the above are examples of binary classification.
We also have multi-class classification where the data can be put into more than two classes.
- Coffee cup size – Small, Medium or Large.
- T-shirt size – XS, S, M, L, XL.
In summary: Classification separates the data, regression fits data!
(credit: Deep Math machine learning.ai)
In the last part (3 of 3) of this article series, we will throw light on the remaining two types of Machine Learning – Unsupervised Learning and Reinforcement Learning.