Depending upon the business use cases, there are different kinds of machine learning algorithms. In this post we are going to learn about three basic machine learning approaches:
- Supervised Learning
- Unsupervised Learning
- Reinforcement Learning
In any machine learning project, we generally follow a fixed pattern. We have tried to define those points below, it will help us in understanding this different kind of machine learning algorithms.
Gathering Data — The Quality, and quantity of data that you gather will directly determine how good your predictive model can be. Some models require continuous live fed data. In any machine learning project, it is the most important step.
Data Visualization (Exploratory Data Analysis): With the help of exploratory data analysis, we try to get various insights about the data. It helps us in feature engineering/data preparation, appropriate model selection, evaluation metric, etc.
Data Preparation — In real life almost all the time data is noisy and messy. We need to prepare the data to make any machine learning model on top of that. This process of data preparation is called data preprocessing. In the end, to train and test our model, we split the data into training and test data sets.
Choice of the ML algorithm — Depending on factors such as the nature of data (labeled or unlabelled), type of data (numerical, Audio-visual, categorical), the measures of accuracy, cost of human intervention/correction. We choose the appropriate algorithm although its kind of a hyperparameter but a good knowledge of maths behind some particular algorithm helps in choosing the appropriate algorithm.
Continuous Learning of the model — Incrementally improve the model’s performance, by adjusting output parameters or rewards in each iteration. Evaluate model accuracy.
Prediction/Result Analysis: Predict the expected results by running the model. Present the output in meaningful human-readable forms (Tables, graphs, images, etc).
Why is it important?
- It is a fact that data scientists spend 80% of their time cleaning and manipulation of data, and only 20% of their time actually analyzing or building the model on top of it !!
- Administratively, incorrect/inconsistent data can lead to false conclusions and misdirected investments.
- In the real world businesses, incorrect data can be costly. Many companies use customer databases that record data like contact information, addresses, and preferences.
Types of Machine Learning:
Supervised Learning:
Supervised Learning is a process of inferring a function from labeled training data. A supervised machine learning algorithm analyses the training data and produces an inferred function, which can be used for mapping new examples.
Supervised learning problems can be further grouped into Two Parts:
Regression: A regression problem is when the output variable is a real value, such as “dollars” or “weight” or “price of some home”.
Classification: A classification problem is when the output variable is categorical, such as “red” or “blue” or “disease” and “no disease”. Example of Supervised Machine Learning Algorithms: Naive Bayes, KNN, SVM, Logistic Regression, Decision Tree, Linear Regression, Random Forest, etc.
NOTE: A vast majority of practical machine learning uses supervised learning.
Steps in Supervised Learning:
- We will be having training data, in which corresponding to each data point we will be having a continuous value or a label.
- We will train and validate the model by showing the example available in the training data.
- Once we validate the model’s performance, we will test it on the unseen data or test dataset.
If the model was able to identify the output (almost matching the actual output, you hide from the model), you are ready to deploy your model. This process is also called the validation stage.
Real-World Application of Supervised Learning:
- Predict the flight ticket prices on Diwali to obtain the maximum profit to the airline company.
- Given an image, identify if it has been modified by some software such as Adobe Photoshop or not.
- Identify whether a website has obscene images or not.
- Predict an unusual behavior in an internet banking transaction.
Supervised Algorithms Working Cycle
Unsupervised Learning:
Unsupervised Learning is an ML technique to find patterns in data, in an exploratory manner. The data is not labeled, which means only the input variables(X) are given with no corresponding output variables. Algorithms are left to themselves to discover interesting patterns in the given data set. Since data is unlabelled, there is no easy way to evaluate the accuracy of the algorithm — one feature that distinguishes unsupervised learning from supervised learning and reinforcement learning. Grouping of similar data into groups or clusters.
Unsupervised Learning problems can be further grouped into two parts:
Clustering: Grouping of similar data into groups or clusters.
Example: K-Means, K-Means++, K-Medoid, etc.
Dimensionality Reduction: Compression of the data to reduce the its complexity without altering its structure.
Example: Principal Component Analysis, Singular Value Decomposition, etc
Steps in Supervised Learning
- We will be having training data, in which corresponding to each data point we will be not having a label.
- Train the model on the training data, during training, we will be exploring the data, we will not be having any idea which variables are the output target in the data.
- Simplify and group the data so that it can be categorized into distinct sets.
If the model helps to identify useful real-world patterns, your model is successful. Measuring the accuracy of prediction is domain-specific and highly subjective.
Real-World Application of Unsupervised Learning:
- Recommendation systems in e-commerce sites such as Flipkart or Amazon work on the principle of unsupervised learning.
- Grouping the customers of a supermarket based on their purchasing behavior.
Workflow of Unsupervised Learning Algorithms
Reinforcement Learning:
The reinforcement learning algorithm (called the agent) continuously learns from the environment in an iterative fashion. Aims at using observations gathered from the interaction with the environment to take actions that would maximize the reward or minimize the risk. In the process, the agent learns from its experiences of the environment until it explores the full range of possible states. The decision-making function is used to make the agent perform an action. After the action is performed, the agent receives a reward or reinforcement from the environment. The state-action pair of information about the reward is stored.
Steps in Reinforcement Learning:
- We will be having an initial state, corresponding to each initial state we will be having more than one next state. The input state is fed into the model and observed by the agent.
- Based on the input, the model returns a STATE. The decision-making function is used to make the agent perform an action. After the action is performed, based on its output, the agent receives a reward or reinforcement from the environment/user. The state-action pair of information about the reward is stored. This process continues in iterations and the model continuously keeps on learning from live data. At every step, it presents actions from states. The agent choosing the right step at each iteration is based on the Markov Decision Process.
EXAMPLE — “I don’t know how to act in this environment. Can you find a good policy/behavior and meanwhile I’ll give you feedback.”
Real-World Applications:
- Self-Driving cars work on the principle of Reinforcement learning.
- Games such as alpha go, chess, etc are a really nice example of Reinforcement Learning.
- Robots are another good example of Reinforcement Learning.
You May Also Like:
- All You Need to Know about Activation Functions (Sigmoid, Tanh Relu, Leaky Relu, Softmax)
- All You Need to Know About Sampling Distribution in Statistics
- Scratch Implementation of Stochastic Gradient Descent using Python
- Evaluation Metrics for Classification (Accuracy Score, Precision, Recall, Confusion Metric, F1-Score)
- Top Skills You Must Not Avoid to Become a Great Data Scientist
- Feedback on Your Preparation for Data Science or Machine Learning Jobs (Mock Interview)