Contents

Introduction to Machine Learning

Machine Learning, Artificial Intelligence, Data Science, Deep Learning are the buzzwords these days. All of these words are used interchangeably, but there are slight differences among them.

Artificial intelligence includes subfields such as machine learning, deep learning, and neural networks. Deep learning, on the other hand, is a branch of machine learning, and neural networks is a branch of deep learning.

Deep learning and Machine learning differs on how each algorithm learns. Machine Learning depends on humans to determine the set of features, choosing the right algorithm, also requires more structured data. Deep learning on the other hand, automates much of feature extraction process and also handles large unstructured datasets like text, images, videos, etc. We will focus on understanding machine learning in this post.

What is Machine Learning and how do Machines Learn?

Let’s have a look at how humans learn. Imagine a person X trying to throw a paper ball into a bin.

  • First attempt: He threw the ball and it fell before the bin.
  • Second attempt: As the ball fell before the bin, he tried increasing the force and threw it again. This time it fell farther than the bin.
  • Third attempt: He slightly decreased the force and tried again, and this time it was a win.

How do you think he was successful in the third attempt? He learned from his previous experience. Let’s move the bin to another position 2 and position 3. Our guy X might succeed with fewer attempts, as he can estimate the force needed from his previous experiences.

Estimating the force required based on the distance between the bin needs calculations, and all those calculations happen in our brain with decisions taken based on visual feedback from our eyes.

Let’s look at how a machine learns?

Assuming that all of the earlier attempts are recorded, (the force F, the distance X etc.), we can build a machine that learns and predicts the force F required for any new distance X.

As distance X is directly proportional to Force F, assuming that their relationship is linear, we could mathematically represent the relationship as $$ X = a * F + Ε $$ where a is coefficient and E is the error. With force F, distance X, and the relationship between the two(here it is linear), we can estimate a using methods like gradient descent. With the value of a, for any given F, we can find the distance X and this is called Statistical Learning - which refers to predicting or estimating an output based on one or more inputs.

Machine Learning is a subfield of Artificial Intelligence(AI) and refers to capability of a machine to learn from past experience without explicit instructions, by using statistical models to analyse and draw inferences from patterns in data.

Types of Machine Learning

Based on the methods and way of learning, machine learning is divided into mainly four types, which are:

  • Supervised Machine Learning
  • Unsupervised Machine Learning
  • Reinforcement Learning

Supervised Machine Learning

As the name suggests, Supervised Machine Learning is based on supervision. It is similar to how you teach a kid. Already labelled data is fed to the system and is trained on it. The system learns from the data and identifies patterns for each label, based on which it predicts the label for new data.

Let’s understand this with an example. Suppose we have an input data set of fruits like apples, oranges, pineapples, etc.. We train the machine with input data such as height, weight, colour, stem shape, stem size, etc. and also provide the label corresponding to each row of input, so that the machine knows how each fruit looks like. Post-training the machine, we input an image. The system then identifies the fruit in the image based on the features mentioned.

supervised learning - labelled data
supervised learning - labelled data

The objective while training is to map the input variables(predictor variables) to the output variable(target variable) and the goal while testing is to predict the label for new/unseen data(fruit in this case) based on the mapping/identified patterns during training. Some business use-cases of supervised learning are Bank Fraud Detection, Email Spam filtering, etc. Supervised Machine Learning can be categorised into two types. They are:

  • Regression - used to predict continuous output variables, such as stock price prediction, weather prediction, etc.
  • Classification - used to solve the classification problems where the output variable is categorical like spam/not spam, fraud transaction/non-fraud transaction, etc.

Unsupervised Machine Learning

Unsupervised Learning stands at 180 degrees to Supervised learning. In Unsupervised learning, the machine is trained on unlabelled data, the model acts on its own without supervision.

Unsupervised learning - unlabelled data
Unsupervised learning - unlabelled data
Let’s understand this with the same fruits example. We input the data set of fruits like apples, oranges, pineapples, etc. without any labels i.e, the machine does not know which one is apple, which one is pineapple. It looks at the images, identifies patterns like colour, size, stem, stem length, etc. and categorizes similar looking fruits.

The aim of unsupervised learning is to discover hidden patterns or data groupings, analyze them and cluster the unlabelled data.Some business use-cases of unsupervised learning are Recommendation Engines, News categorization, Customer personas, etc.

Reinforcement Learning

Reinforcement Learning is a technique in which the system learns by interacting with an environment. The RL agent performs actions in a hit and trial manner and will get rewarded for positive actions, penalized for negative actions. Thus the system learns by exploration and exploitation(trail and error).

Below experiment on chicken gives a clear understanding of Reinforcement Learning.

The Chicken is rewarded whenever it hits pink colour, it learned from hit and trial learning experience.