Monday, June 21, 2021

Introduction To Machine Learning

Introduction to Machine Learning


We are living in a world of humans and machines. Humans have been evolving and learning from past experience for millions of years, on the other hand, the era of machines and robots have just begun in today's world. These machines and the robots need to be programmed before they actually follow our instructions. But, what if the machine started to learn on their own and this is where machine learning comes into the picture. Machine learning is the core of many futuristic technology advancements in our world.

Today, we can see various examples or implementations of machine learning around us such as Tesla's self-driving car Apple Siri, Sophia AI robot, and many more are there.

 

What exactly does machine learning mean?

Machine learning is an area of artificial intelligence that focuses on the design of a system that can learn and make decisions and predictions based on experience (That is data). Machine Learning enables computers to act and make data-driven decisions rather than being explicitly programmed to perform a certain task. These programs are designed to learn and improve over time when exposed to new data.

AI, Machine Learning, and Deep Learning?

Artificial intelligence is a broader concept of machines being able to carry out tasks in a smarter way. It covers anything which enables the computer to behave like humans do. You can think of a famous Turing Test to determine whether a computer is capable of thinking like a human being or not.

If you are talking to Siri on your phone and you get an answer you're already very close to it. So machine learning is a subset of AI. Machine Learning is based on the idea that we should be able to give machines access to data and let them learn from that data. This means that the machine can not only find the rules for optimal Behaviour but also can adapt to the changes in the world. Many of the algorithms involved have been known for decades now, thanks to the advances in computer science and parallel Computing. They can now scale up to massive data volumes. 

  

Deep Learning is a subset of Machine Learning

It is very similar to machine learning. However, it used to train deep neural networks. So, to achieve better accuracy in those cases where Machine Learning was not performing up to the mark Deep Learning is used.

img


How does Machine Learning work?

Machine Learning algorithms are trained using a labeled or unlabelled training data set to produce a model. New input data is introduced to the machine learning algorithm and it makes a prediction based on the model. This prediction is evaluated for accuracy and if the accuracy is acceptable the machine learning algorithm is deployed.




If the accuracy is not acceptable the machine learning algorithm is trained again, and again with an extended training data set.

This was just a high-level example as there are many more factors and other steps involved in it. We can subcategorize Machine Learning into three different types

  •       Supervised learning
  •       Unsupervised learning
  •       Reinforcement

 

We can see how each of them is used in the field of banking, Healthcare retail, and other domains.

 
Supervised learning


Supervised learning is the subcategory of machine learning that focuses on learning a classification or regression model, which is, learning from labeled training data.

img

A binary classification problem (plus, minus) and two feature variable (x1 and x2)

Or in simple words

Supervised learning is a type of Machine Learning method, where each instance of a training data set is composed of different input attributes and expected output. 

The input attributes of a training data set can be of any kind of data. It can be a pixel of the image. It can be a value of a database row or it can even be an audio frequency histogram.

For each input instance and expected output values, the associated value can be discrete, representing a category, or can be a real or continuous value in either case.

The algorithm learns the input pattern that generates the expected output. Once the algorithm is trained, it can be used to predict the correct output for a never-seen input.

We can see this in the following image.

 

img

We are feeding raw inputs as images of Apple to the algorithm as a part of the algorithm. We have a supervisor who keeps on correcting the machine or who keeps on training the machine. It keeps on telling him that yes, it is an Apple. Or No, it is not an apple thing. This process keeps on repeating until we get a final trained model. Once the model is ready. It can easily predict the correct output of a never-seen input.

For example, we are giving an image of a green apple to the machine and the machine can easily identify it as yes, it is a green apple and it is giving the correct result.

Let's see, another example of supervised learning is,

The image below shows an example of a supervised learning process used to produce a model which is capable of recognizing the ducks in the image.




The training data set is composed of labeled pictures of ducks and not Ducks. The result of the supervised learning process is a predictor model which is capable of associating a label duck, or not a duck, to the new image presented to the model. Once trained successfully and the model achieves a satisfactory level of acceptance, the resulting predictive model can be deployed to the production environment.

Why is this category of Machine Learning named Supervised Learning?

It is called supervised learning because the process of an algorithm learning from the training data set can be thought of as a teacher supervising the learning process.

Some popular Supervised Learning algorithms are,

  •       Linear regression
  •       Random forest
  •       Support Vector machines.

We will discuss these algorithms later,

Now, let's see some of the popular use cases of supervised learning.

We have Crotona or another speech recognition automation in your mobile phone that trains using your voice. Once, it is trained, it starts working based on the training. This is an application of supervised learning.

Suppose, you are telling “Ok! Google call Sam” or you say “Hey! Siri call Sam”. You get an answer and the action is performed automatically. A call is made to Sam. Another example of supervised learning is the weather app based on some of the prior knowledge like when it is sunny the temperature is high. Actually, as we are feeding the data to the machine and telling that whenever it is sunny. The temperature should be higher whenever it is cloudy. The humidity should be higher. So, it's an example of supervised learning.

Another example is biometric attendance where you train the machine and after a couple of inputs of your biometric identity, you put your thumb upon the device. The trained machine automatically validates your future input and can identify you.

Next comes the field of the banking sector in the banking sector supervised learning is used to predict the creditworthiness of a credit card holder by building a machine learning model to look for faulty attributes by providing it with data on delinquent and non-delinquent customers.

Next comes the healthcare sector in the healthcare sector.

It is used to predict the patient's readmission rates by building a regression model by providing data on the patient’s treatment, admissions, and readmissions to show variables that best correlate with readmission. The next example comes from the retail sector and retail sector. Here, It is used to analyze the product. We can build a supervised model to identify frequent itemsets and association rules from the transactional data.


Unsupervised Learning


In contrast to supervised learning, unsupervised learning is a branch of machine learning that is concerned with unlabelled data. Common tasks in unsupervised learning are clustering analysis (assigning group memberships) and dimensionality reduction (compressing data onto a lower-dimensional subspace or manifold). The goal for unsupervised learning is to model the underlying structure or distribution.


Unsupervised learning

In the unsupervised learning approach, the data instances of a training data set do not have an expected output associated with them instead unsupervised learning algorithm detects patterns based on innate characteristics of the input data.

Tasks that apply unsupervised learning are clustering. In clustering, similar data instances are grouped together in order to identify clusters of data. 



 

Unsupervised learning


In the above image can see that initially, we have different varieties of fruits as input. Now, these sets of fruits as input X are given to the model.

Now, what will be the model?

It is trained using an unsupervised learning algorithm. The model will create clusters on the basis of its training. It will group the similar fruits and make their cluster.

Let's take another example

The image below shows an example of the unsupervised learning process. This algorithm processes an unlabelled training data set based on the characteristics.


Unsupervised learning


It groups the picture into three different clusters of data despite the ability of grouping similar data into clusters.

The algorithm is not capable to add labels to the row. The algorithm only knows which data instances are similar, but it cannot identify the meaning of this group. You must be wondering why this category of machine learning is named unsupervised learning.

It is called unsupervised learning because, unlike supervised learning, there is no correct answer and there is no teacher. The algorithms are left on their own to discover and present the interesting structure in the data.

Some of the popular unsupervised learning algorithms are,

  • K-Means Algorithm
  • Apriori Algorithm
  • Hierarchical Clustering Algorithm

 

Few examples of unsupervised learning

Suppose, a friend invites you to his party, where you meet total strangers. Now, you will classify them using unsupervised learning as you don't have any prior knowledge about them and this classification can be done on the basis of gender, age group, dressing, education, qualification, or whatever way you might like. But, why this learning is different from supervised learning. Since you do not use any past or prior knowledge about the people. You kept on classifying them on the go as they kept on coming. You just kept on classifying them.

Another example

Suppose, you are a cricket fan and you have never seen a football match before and by chance you watch a video on the internet. You can easily classify the players on the basis of different criteria, like players wearing the same kind of Jersey are in one class, and the players wearing different kinds of Jersey are in different classes. You can classify them on the basis of their playing style like this guy is an attacker and another one is the defender. So this was also an example of unsupervised learning.

How unsupervised learning is used in the sectors of banking and Healthcare?

In the banking sector, it is used to segment customers by behavioral characteristics by surveying prospects and customers to develop multiple segments using clustering.

In the Healthcare sector, it is used to categorize the MRI data by normal or abnormal ages. It uses deep learning techniques to build a model that learns from different features of images to recognize a different pattern.

In the Retail sector, it is used to recommend the products to customers based on their past purchases. It does this by building a collaborative filtering model based on their past purchases.


Reinforcement Learning


Reinforcement learning is a type of machine learning algorithm which allows software agents and machine to automatically determine the ideal behavior within a specific context to maximize its performance. Reinforcement learning is about the interaction between two elements, the environment, and the learning agent. The learning agent leverages two mechanisms namely exploration and exploitation. When a learning agent acts on a trial and error basis it is termed exploration and when it acts based on the knowledge gained from the environment, it is referred to as exploitation.

 

Reinforcement Learning

The environment rewards the agent for correct actions, which is a reinforcement signal. Leveraging the rewards agent improves its environment knowledge to select the next action.

Reinforcement Learning


In the image above, you can see that the machine is confused about whether it is an apple or it's not an apple. The machine is trained using reinforcement learning, If, it makes a correct decision it gets a reward point for it, and in case of wrong it gets a penalty for that.

Now, the machine can easily identify which one of them is an apple and which one is not.

Typical applications of reinforcement learning involve playing games (chess, Go, Atari video games) and some form of robots, e.g., drones, warehouse robots, and more recently self-driving cars.

Let's see an example here

We can see that we have an agent who has to judge from the environment to find out which of the two is a duck. The first task he did is to observe the environment next it select some action using some policy. If the machine has made a wrong decision by (for example) choosing a bunny as a duck. So the machine will get a penalty for it. For example -50.4 for the wrong answer.

The machine will update its policy and this will continue till the machine gets an optimal policy. From the next time onwards the machine will know that bunny is not a duck.

How reinforcement learning is applied in the field of banking, Healthcare, and Retail sector?

In the banking sector,

Reinforcement learning, for example, can be used to create the next best offer model for a call center by building a predictive model that learns over time as users accept or reject offers made by the sales staff.

 In the healthcare sector, for example, it can be used to allocate the resources to handle different type of cancer cases by building a Markov decision process that learns treatment strategies for each type of cancer case next and the last comes

In the retail sector, for example, it can be used to reduce excess stock with dynamic pricing by building a dynamic pricing model that is just the price based on customer response to the offers.


AI versus Machine learning versus Deep learning


These are the terms that have confused a lot of people.

Artificial intelligence is a broader area in which machine learning and deep learning come. Deep learning is a subset of machine learning and Machine learning is the subset of AI.

How exactly they differ from each other?

The term artificial intelligence was first coined in the year 1956. The concept is pretty old, but it has gained popularity recently.

But why AI has gained its popularity recently?

The reason is earlier we had a very small amount of data the data we had was not enough to predict the correct result but now there's a tremendous increase in the amount of data. Statistics suggest that by 2020 the accumulated volume of data will increase from 4.4 zettabytes to roughly around 44 zettabytes or 44 trillion GBs of data along with such an enormous amount of data.

Now, we have more advanced algorithms and high-end computing power and storage that can deal with such a large amount of data as a result.

What actually AI is?

It's nothing but a technique that enables the machine to act like humans by replicating the behavior and nature with AI. It is possible for machines to learn from experience like humans do. The machines just respond based on new input thereby performing human-like tasks artificial intelligence can be and to accomplish specific tasks by processing a large amount of data and recognizing patterns in them.

You can consider that building an artificial intelligence application is like Building a Church. The first church took generations to finish. So most of the workers were working on it never saw the final outcome. So, those working on it took pride in their craft building bricks and chiseling stone that was going to be placed into the great structure.

So as AI researchers, we should think of ourselves as a humble brick maker’s job. It's just a study of how to build components. Examples of AI are Apple series chess-playing, computer Tesla self-driving car. Many more such examples are based on deep learning and natural language processing.


What is deep learning?


The concept of deep learning is not new, but recently it's getting hype as increased demand. This field is a particular kind of machine learning that is inspired by the functionality of our brain cells called neurons which led to the concept of artificial neural network. It simply takes the data connection between all the artificial neurons and adjusts them according to the data pattern.

More neurons are added as the size of the data is large. It automatically features learning at multiple levels of abstraction. Thereby allowing a system to learn complex function mapping without depending on any specific algorithm.

Let us try and understand Deep Learning with the help of an example, how would you recognize a square from other shapes. The first thing we can do is check whether there are four lines associated with a figure. If yes, we further check that if they are connected and closed again. We finally check whether incident sides are perpendicular to each other and all its sides are equal. If all conditions are satisfied.

Yes, it is a square.

Actually, it is nothing but a nested hierarchy of Concepts. What we did here we took a complex task of identifying a square and broke it into simpler tasks. Deep learning also does the same thing but on a larger scale.

Let's take another example of machine learning, which recognizes an animal. The task of the machine is to recognize whether the given image is of a cat or a dog. What if we were asked to resolve the same issue using the concept of machine learning what we would do first?

We would define the features such as check whether the animal has whiskers or not. The animal has pointed ears or not or whether its tail is straight or curved in short. We will define the facial features and let the system identify which features are more important in classifying a particular animal. When it comes to deep learning it takes this one step ahead.

Deep learning automatically finds the features which are most important for classification. On the other hand in machine learning, we have to manually provide the features. Also, the Deep Learning algorithm needs a large amount of data to understand it perfectly. On the other hand, the machine learning algorithm can easily work with smaller data set.


Machine Learning Vs Deep Learning


High-end machines

Deep learning algorithms are heavily dependent on high-end machines while the machine learning algorithm can work on low-end machines as well. This is because the requirement of a deep learning algorithm includes GPUs which is an integral part of its working the Deep learning algorithm. GPUs can do a large amount of matrix multiplication operations, and these operations can only be efficiently optimized using a GPU.

Feature engineering

Another parameter is feature engineering. Feature engineering is a process of putting the domain knowledge to reduce the complexity of the data. Make patterns more visible to learning algorithms. This process is difficult and expensive in terms of time and expertise in the case of machine learning. Most other features are needed to be identified by an expert and then hand-coded as per the domain requirement and the data type.

For example, the features can be a pixel value, shapes, texture, position, orientation, or anything. The performance of most of the machine learning algorithms depends on how accurately the features are identified and understood. As in the case of deep learning algorithms, they try to learn high-level features from the data.

This is a very distinctive part of deep learning which makes it way ahead of traditional machine learning deep learning,  reduces the task of developing a new feature extractor for every problem like in the case of the CNN algorithm. It first tries to learn the low-level features of the image such as edges and lines and then it proceeds to the parts of faces of people and then finally to the high-level representation of the face.

Problem-solving approach

The next parameter is the problem-solving approach. When we are solving a problem using a traditional machine learning algorithm. It is generally recommended that we first break down the problem into different sub-parts solve them individually and then finally combine them to get the desired result. This is how the machine learning algorithm handles the problem. On the other hand, the Deep learning algorithm solves the problem from end to end.

Let's take an example


Suppose we have a task of multiple object detection and your task is to identify that what is the object and where it is present in the image.


Deep Learning


 

How we can encounter this issue using the concept of machine learning and deep learning. In a typical machine learning approach, we would first divide the problem into two-step first object detection and then object recognition.

First of all, we can use a bounding box detection algorithm. Once the objects are recognized, an object recognition algorithm, like SVM to recognizes relevant objects. Finally, when you combine the result you would be able to identify that what the object is, and where it is present in the image.

Execution time

Another comparison parameter is the execution time. Usually, a deep learning algorithm takes a long time to train because there are so many parameters in a deep learning algorithm that makes the training longer than usual.

The training might even last for two weeks or more than that. If you are training completely from the scratch. Whereas in the case of machine learning, it relatively takes much less time to train. But, in certain scenarios, the execution time is completely reversed when it comes to the testing of data. During testing, the Deep learning algorithm takes much less time to run. Whereas if you compare it with a KNN algorithm, which is a type of machine learning algorithm the test time increases as the size of the data increase.

Interpretability

Last but not least we have interpretability as a factor for comparison of machine learning and deep learning. This fact is the main reason why deep learning is still thought ten times before anyone new uses it in the industry.

Let's take an example.

Suppose, we use deep learning to give automated scoring to essays. The performance it gives and scoring is quite excellent and is near to the human performance but there's an issue with it. It does not reveal why it has given that score indeed mathematically.

It is possible to find out which node of a deep neural network was activated, but we don't know what the neurons are supposed to model and what these layers of neurons are doing collectively. So, it is difficult to interpret the results.

On the other hand machine learning algorithm, like a decision tree gives us a crisp rule for choosing a node and for not choosing a node. So it is particularly easy to interpret the reasoning behind it. Therefore the algorithms like decision trees, linear or logistic regression are primarily used in industry for interpretability.

Machine learning uses algorithms to parse the data learn from the data and make an informed decision based on what it has learned. In deep learning structures algorithms in layers to create an artificial neural network that can learn and make intelligent decisions on its own. Deep learning is a subfield of machine learning while both fall under the broad category of artificial intelligence. Deep learning is usually what's behind the most human-like artificial intelligence.