In this article, I will walk you through the concept of machine learning. My attempt is to explain the concepts without complex mathematics or code. After reading it, you will be able to understand key ideas and hopefully will be able to apply them to solve problems.
Machine Learning Is Everywhere
You may not have noticed, but machine learning is all around you. When you read your email, you don’t see spam, because machine learning filters them out for you. When you type a query in Google, it is how Google recommends which result to show. When you receive a book recommendation by Amazon or a movie recommendation by Netflix, it is machine learning at play. Your Facebook & Instagram feeds are curated using machine learning. ML is responsible for automatically approving or declining credit card transactions, and continuously monitoring accounts for signs of fraud. Whenever you use a computer, chances are, machine learning is involved somewhere.
What is Machine Learning?
Once upon a time, when we wanted the computer to perform some tasks, we needed to provide it with a detailed set of instructions i.e., program. Computer then follows the instruction to execute the task at hand. For all different tasks, we painstakingly needed to write down the steps in detail.
Machine learning is different. In the case of machine learning, algorithms- learners for short, can figure out the instructions themselves. We don’t need to program the computer anymore; they program themselves by making inferences from data. The more data they have, the better they get.
No one programmed your tastes into Amazon recommendation engine, learners figured them out on their own by inferring from your past purchase data. Tesla’s self-driving car taught itself how to stay on the road – no programmer wrote an instruction for it. ML is something new under the sun: A technology that builds itself.
Machine learning is a process in which the computer learns to solve problems and make decisions like humans. Humans make decisions based on intuition, which is based on experience. In the case of ML, computers learn to make decisions based on experience (data) rather than instructions. Simply, ML is about teaching computers how to think like humans.
How Humans Make a Decision and How Computers do The Same
Humans make a decision mainly in two ways:
By reasoning and logic
Or by using experience
Similar to humans’ machines can also be taught to make decisions in two ways mentioned above. In short, when we talk about machines making decisions using both 1 & 2 ways it is called Artificial Intelligence (AI). And when a computer focuses on only the second way it falls under Machine learning. In the case of computers, experience equates to data. So, by this logic, Machine learning is a subset of a broader field called AI.
In order to understand how a machine can make a decision using data, let’s first try to understand how humans make decisions based on experience.
We humans use, remember- model – predict framework to make decisions. Let me explain:
We remember our experiences and situations we went through in our life
Based on the experience we formulate models to generalize
We can use models to predict what is likely to happen in a particular situation
For example, if the question is “Will India win the match against Bangladesh today? “
We will evaluate this question using remember-model-predict framework
We remember India won most of the matches against Bangladesh in the last two years.
We model that the Indian team is stronger compared to the Bangladeshi team.
Hence, India is likely to win the match today.
There are chances that we may be wrong in predicting this but this is the thought process we use to make predictions.
This is challenging for machines, as all they do is store numbers and do operations on them. Programming them to mimic human level of thoughts is challenging. Following the remember-model-predict framework, it is clear to see that ‘remember’ for machine stands for ‘data’.
Data is simply information. Anytime we have a table with information, we have data. Normally each row is a data point. For example, if we have a dataset of fruits, then in this case, each row represents a different fruit. Each fruit is described by certain features through columns. In our fruit’s dataset example, features will be color, size & shape. Features describe the data. Some features are special and we call them labels.
Label depends upon the context of the problem we are solving. For example, if we are trying to predict the type of fruit from the given data then the type of fruit is labeled.
For the purpose of machine learning data comes in two flavors: Labeled data & Unlabeled data.
When the data comes with a label attached to it, it is called Labeled data and similarly when data doesn’t have a label attached to it, it is called Unlabeled data.
The better the quality and quantity of data fed into the machine, the better the prediction will be. But, before we get into prediction let’s explore models.
Machine learning models can be broadly categorized into three different types.
Supervised learning is the most natural way to start on the machine learning journey and it is the most commonly used in ML tasks. Supervised learning algorithms take “labeled data” as an input. Data is labeled by predictions we wish to make using supervised learning algorithms or models.
Let me explain this with an example. Recalling our fruits dataset, if we feed the data into a supervised learning model, with labels ‘apples’ and ‘grapes’, the model will then use the fed data to predict if a new data is ‘apple’ or ‘grapes’. This means when we bring in a new image of a fruit, it can predict whether the new image is that of an ‘apple’ or ‘grapes’.
Recall the human decision-making framework: remember- model – predict, this is precisely how the supervised learning models work. The model first remembers the data we feed into it, then it makes rules or models what ‘A ‘and ‘B’ looks like and finally predicts the same for the new image.
Labeled data comes in two types. Data can be labeled with a number, such as weight of the fruit or data can be labeled as classes, such as apple, orange, banana etc. Based on the type of data there are two types of supervised learning models:
Regression models: These are the models which can predict a number as an output.
Classification models: These are the models which can predict the class as an output.
Note that output of a regression model is continuous while the output from the classification model is discrete, since it can predict from a finite set of output values.
Let’s take a few examples to understand them better.
Regression models are designed to predict numbers. These numbers are predicted from the features. Examples include
Predicting house prices based on features of a house such as number of bedrooms, location, etc.
Predicting the expected durationa user will use a website based on the source of traffic etc.
Predicting the lifetime value or the amount a customer is expected to spend with the company based on features such as customer type, consumption level etc.
Predicting the price of a particular stock based on other market signals or company specific features or other stock prices.
As you may notice, the result of such prediction is expected to be a number.
On the other hand, classification models predict a class. They help us answer questions such as looking at a picture of which fruit it is: Apple or Orange.
Examples may include:
Image recognition: Predict the content of the image. Is there an airplane in the picture or not?
User behavior: Predict if a user will click on Add to cart button based on users historical browsing history – Yes Or No
Social Media: Will the user like a picture or post based on their demographics, history and friends. Now you know how Facebook shows you posts which you are expected to engage with.
Unsupervised learning models take ‘unlabeled data’ as an input. Which means the data has no labels attached to them but only features. So for example the housing dataset which doesn’t have prices but only details such as room sizes, location etc.
The obvious question is then, what can you infer from such data. Well it is true that unlabeled data has a limited use but we can still achieve some insights from them which may be useful. For example if we have sets of pictures of different fruits without labels, we can use unsupervised models to break them into groups such as pictures of apples, pictures of oranges etc. This is called clustering – a task of grouping our data into clusters based on similarity.
Examples where clustering is used include:
Genetics: Clustering species into groups based on similarity
Market Segmentation: Grouping customers into different segments based on features such as company size, no of employees etc.
Let’s look at the data table below, grouping the data side is called clustering.
How about grouping the features side? Well, it is called dimensionality reduction. It is a very useful data preprocessing step which is used to simplify the data before it is fed into models.
Example of dimensionality reduction:
And finally there is a third type of machine learning.
Well simply put, this type of machine learning model solves problems without getting fed by any data. Ouch!
Instead of data these models are fed with the environment and an agent, which is expected to navigate within the environment. The agent may have a goal or a set of goals. On taking the right decision to reach the goal the agent is rewarded and on taking the wrong decision it is punished. Hence the learning is reinforced on it.
In case of reinforcement learning, an agent needs to take a sequence of actions within some environment. These actions influence the information that the environment provides to the agent in the next step. The agent receives direct feedback on the actions it takes. In supervised or unsupervised learning, in contrast, the model never impacts the underlying data, it simply consumes it.
For example, let’s assume that the agent is driving the car and its goal is to take the car from some point A to point B.
The actions the agent can take could be steering, accelerating and or pressing the brakes.
The environment in this case is the real world, consisting of roads, traffic, pedestrians etc.
The reward in this case is every meter the car travels towards the destination and punishment could be minor: traffic infractions or major: in the event of collision.
Reinforcement learning has cutting edge applications such as:
Self-driving car: Here the agent is expected to plan the route, control the car, keep the car on track etc.
Industrial Robotics: Here the agent’s task is to learn how to pick a box, how to walk or handle any particular task in the manufacturing process.
Gaming: Agents need to learn how to play Chess and so on.
Do follow our LinkedIn page for updates: [ Myraah IO on LinkedIn ]