## Introduction

Machine learning and deep learning on a rage! All of a sudden every one is talking about them – irrespective of whether they understand the differences or not! Whether you have been actively following data science or not – you would have heard these terms.

Just to show you the kind of attention they are getting, here is the Google trend for these keywords:

If you have often wondered to yourself what is the difference between machine learning and deep learning, read on to find out a detailed comparison in simple layman language. I have explained each of these term in detail. Then I have gone ahead to compare both of them and explained where we can use them.

## Table of Contents

- What is Machine Learning and Deep Learning?
- What is Machine Learning?
- What is Deep Learning?

- Comparison of Machine Learning and Deep Learning
- Data Dependencies
- Hardware Dependency
- Problem Solving Approach
- Feature Engineering
- Execution time
- Interpretability

- Where is Machine Learning and Deep Learning being applied right now?
- Pop Quiz
- Future Trends

## 1.What is Machine Learning and Deep Learning?

Let us start with the basics – What is Machine Learning and What is Deep Learning. If you already know this, feel free to move to section 2.

### 1.1 What is Machine Learning?

The widely-quoted definition of Machine learning by Tom Mitchell best explains machine learning in a nutshell. Here’s what it says:

“A computer program is said to learn from experience

Ewith respect to some class of tasksTand performance measurePif its performance at tasks inT, as measured byP, improves with experienceE”

Did that sound puzzling or confusing? Let’s break this down with simple examples.

**Example 1 – Machine Learning – Predicting weights based on height**

Let us say you want to create a system which tells expected weight based on height of a person. There could be several reasons why some thing like this could be of interest. You can use this to filter out any possible frauds or data capturing errors. The first thing you do is collect data. Let us say this is how your data looks like:

Each point on the graph represents one data point. To start with we can draw a simple line to predict weight based on height. For example a simple line:

Weight (in kg) = Height (in cm) - 100

can help us make predictions. While the line does a decent job, we need to understand its performance. In this case, we can say that we want to reduce the difference between the Predictions and actuals. That is our way to measure performance.

Further, the more data points we collect (Experience), the better will our model become. We can also improve our model by adding more variables (e.g. Gender) and creating different prediction lines for them.

**Example 2 – Storm prediction System**

Let us take slightly more complex example. Suppose you are building a storm prediction system. You are given the data of all the storms which have occurred in the past, along with the weather conditions three months before the occurrence of these storms.

Consider this, if we were to manually build a storm prediction system, what do we have to do?

We have to first scour through all the data and find patterns in this data. Our task is to search which conditions lead to a storm.

We can either model conditions like – if the temperature is greater than 40-degree celsius, humidity is in the range 80 to 100, etc. And feed these ‘features’ manually to our system.

Or else, we can make our system understand from the data what will be the appropriate values for these features.

Now to find these values, you would go through all the previous data and try to predict if there will be a storm or not. Based on the values of the features set by our system, we evaluate how the system performs, viz how many times the system correctly predicts the occurrence of a storm. We can further iterate the above step multiple times, giving performance as feedback to our system.

Let’s take our formal definition and try to define our storm prediction system: Our task ‘T’ here is to find what are the atmospheric conditions that would set off a storm. Performance ‘P’ would be, of all the conditions provided to the system, how many times will it correctly predict a storm. And experience ‘E’ would be the reiterations of our system.

### 1.2 What is Deep Learning?

The concept of deep learning is not new. It has been around for a couple of years now. But nowadays with all the hype, deep learning is getting more attention. As we did in Machine Learning, we will look at a formal definition of Deep Learning and then break it down with example.

“Deep learning is a particular kind of machine learning that achieves great power and flexibility by learning to represent the world as nested hierarchy of concepts, with each concept defined in relation to simpler concepts, and more abstract representations computed in terms of less abstract ones.”

Now – that one would be confusing. Let us break it with simple example.

**Example 1 – Shape detection**

Let me start with a simple example which explains how things happen at a conceptual level. Let us try and understand how we recognize a square from other shapes.

The first thing our eyes do is check whether there are 4 lines associated with a figure or not (simple concept). If we find 4 lines, we further check, if they are connected, closed, perpendicular and that they are equal as well (nested hierarchy of concept).

So, we took a complex task (identifying a square) and broke it in simple less abstract tasks. Deep Learning essentially does this at a large scale.

**Example 2 – Cat vs. Dog**

Let’s take an example of an animal recognizer, where our system has to recognize whether the given image is of a cat or a dog.

If we solve this as a typical machine learning problem, we will define features such as if the animal has whiskers or not, if the animal has ears & if yes, then if they are pointed. In short, we will define the facial features and let the system identify which features are more important in classifying a particular animal.

Now, deep learning takes this one step ahead. Deep learning automatically finds out the features which are important for classification, where in Machine Learning we had to manually give the features. Deep learning works as follows:

Deep learning works as follows:

- It first identifies what are the edges that are most relevant to find out a Cat or a Dog
- It then builds on this hierarchically to find what combination of shapes and edges we can find. For example, whether whiskers are present, or whether ears are present, etc.
- After consecutive hierarchical identification of complex concepts, it then decides which of this features are responsible for finding the answer.

## 2. Comparison of Machine Learning and Deep Learning

Now that you have understood an overview of Machine Learning and Deep Learning, we will take a few important points and compare the two techniques.

### 2.1 Data dependencies

The most important difference between deep learning and traditional machine learning is its performance as the scale of data increases. When the data is small, deep learning algorithms don’t perform that well. This is because deep learning algorithms need a large amount of data to understand it perfectly. On the other hand, traditional machine learning algorithms with their handcrafted rules prevail in this scenario. Below image summarizes this fact.

### 2.2 Hardware dependencies

Deep learning algorithms heavily depend on high-end machines, contrary to traditional machine learning algorithms, which can work on low-end machines. This is because the requirements of deep learning algorithm include GPUs which are an integral part of its working. Deep learning algorithms inherently do a large amount of matrix multiplication operations. These operations can be efficiently optimized using a GPU because GPU is built for this purpose.

### 2.3 Feature engineering

Feature engineering is a process of putting domain knowledge into the creation of feature extractors to reduce the complexity of the data and make patterns more visible to learning algorithms to work. This process is difficult and expensive in terms of time and expertise.

In Machine learning, most of the applied features need to be identified by an expert and then hand-coded as per the domain and data type.

For example, features can be pixel values, shape, textures, position and orientation. The performance of most of the Machine Learning algorithm depends on how accurately the features are identified and extracted.

Deep learning algorithms try to learn high-level features from data. This is a very distinctive part of Deep Learning and a major step ahead of traditional Machine Learning. Therefore, deep learning reduces the task of developing new feature extractor for every problem. Like, Convolutional NN will try to learn low-level features such as edges and lines in early layers then parts of faces of people and then high-level representation of a face.

### 2.4 Problem Solving approach

When solving a problem using traditional machine learning algorithm, it is generally recommended to break the problem down into different parts, solve them individually and combine them to get the result. Deep learning in contrast advocates to solve the problem end-to-end.

Let’s take an example to understand this.

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

In a typical machine learning approach, you would divide the problem into two steps, object detection and object recognition. First, you would use a bounding box detection algorithm like grabcut, to skim through the image and find all the possible objects. Then of all the recognized objects, you would then use object recognition algorithm like SVM with HOG to recognize relevant objects.

On the contrary, in deep learning approach, you would do the process end-to-end. For example, in a YOLO net (which is a type of deep learning algorithm), you would pass in an image, and it would give out the location along with the name of object.

### 2.5 Execution time

Usually, a deep learning algorithm takes a long time to train. This is because there are so many parameters in a deep learning algorithm that training them takes longer than usual. State of the art deep learning algorithm ResNet takes about two weeks to train completely from scratch. Whereas machine learning comparatively takes much less time to train, ranging from a few seconds to a few hours.

This is turn is completely reversed on testing time. At test time, deep learning algorithm takes much less time to run. Whereas, if you compare it with k-nearest neighbors (a type of machine learning algorithm), test time increases on increasing the size of data. Although this is not applicable on all machine learning algorithms, as some of them have small testing times too.

### 2.6 Interpretability

Last but not the least, we have interpretability as a factor for comparison of machine learning and deep learning. This factor is the main reason deep learning is still thought 10 times before its use in industry.

Let’s take an example. Suppose we use deep learning to give automated scoring to essays. The performance it gives in scoring is quite excellent and is near human performance. But there’s is an issue. It does not reveal why it has given that score. Indeed mathematically you can find out which nodes of a deep neural network were activated, but we don’t know what there neurons were supposed to model and what these layers of neurons were doing collectively. So we fail to interpret the results.

On the other hand, machine learning algorithms like decision trees give us crisp rules as to why it chose what it chose, so it is particularly easy to interpret the reasoning behind it. Therefore, algorithms like decision trees and linear/logistic regression are primarily used in industry for interpretability.

## 3. Where is Machine Learning and Deep Learning being applied right now?

The wiki article gives an overview of all the domains where machine learning has been applied. These include:

- Computer Vision: for applications like vehicle number plate identification and facial recognition.
- Information Retrieval: for applications like search engines, both text search, and image search.
- Marketing: for applications like automated email marketing, target identification
- Medical Diagnosis: for applications like cancer identification, anomaly detection
- Natural Language Processing: for applications like sentiment analysis, photo tagging
- Online Advertising, etc

The image given above aptly summarizes the applications areas of machine learning. Although it covers broader topic of machine intelligence as a whole.

One prime example of a company using machine learning / deep learning is Google.

In the above image, you can see how Google is applying machine learning in its various products. Applications of Machine Learning/Deep Learning are endless, you just have to look at the right opportunity!

## 4. Pop quiz

To assess if you really understood the difference, we will do a quiz. You can post your answers in this thread.

Please mention the steps below to completely answer it.

- How would you solve the below problem using Machine learning?
- How would you solve the below problem using Deep learning?
- Conclusion: Which is a better approach?

**Scenario 1:**

You have to build a software component for self-driving car. The system you build should take in the raw pixel data from cameras and predict what would be the angle by which you should steer your car wheel.

**Scenario 2:**

Given a person’s credentials and background information, your system should assess whether a person should be eligible for a loan grant.

**Scenario 3:**

You have to create a system that can translate a message written in Russian to Hindi so that a Russian delegate can address the local masses.

## 5. Future Trends

The above article would have given you an overview of Machine Learning and Deep Learning and the difference between them. In this section, I’m sharing my viewies on how Machine Learning and Deep Learning would progress in the future.

- First of all, seeing the increasing trend of using data science and machine learning in the industry, it will become increasing important for each company who wants to survive to inculcate Machine Learning in their business. Also, each and every individual would be expected to know the basics terminologies.
- Deep learning is surprising us each and every day, and will continue to do so in the near future. This is because Deep Learning is proving to be one of the best technique to be discovered with state-of-the-art performances.
- Research is continuous in Machine Learning and Deep Learning. But unlike in previous years, where research was limited to academia, research in Machine Learning and Deep Learning is exploding in both industry and academia. And with more funds available than ever before, it is more likely to be a keynote in human development overall.

I personally follow these trends closely. I generally get a scoop from Machine Learning/Deep Learning newsletters, which keep me updated with recent happenings. Along with this, I follow arxiv papers and their respective code, which are published every day.

### End notes

In this article, we had a high-level overview and comparison between deep learning and machine learning techniques. I hope I could motivate you to learn further in machine learning and deep learning. Here are the learning path for machine learning & deep learning Learning path for machine learning and Learning path for deep learning.

If you have any questions, feel free to drop them below in the comments section.

Thank you very much, it was helped me a lot.

Thanks manimaran!

Great Article !! Helped understand the concept in a lay man’s language !!

Thanks Preeti! Hope it helps others too

Top Quality Stuff. Great Article

Thanks usman!

Thnaks for y’r explanations , i have a question .wich language is more sophisticated to deal with Deep Learning algorithmes ?

Thanks amn! Can you clarify what “sophisticated” means? If you are asking which language is usually used in terms of deep learning, its python

HI Faizan,

A good one. What’s the units on Y axis for google trend displayed in first graphic?

Hey Vaibhav. The units are relative, and they are used to compare search history for ML with respect to DL.

Excellent, Faizan. Keep up the great work!

Thanks Krishna!

One of the best explanation I have come across on this topic. It was very insightful and simple to understand. Thanks Faizan. Keep up the great work.

Thanks Atul!

Great Article!

Thanks for writing it.

Is there any library in python for applying Deep Learning similar to scikit learn for ML?

Which will be an easy to learn tool for practising Deep Learning?

Thanks

Hey Tony! I think keras (https://keras.io/) might fit the profile, as it is easy to use and highly abstracted library similar to sklearn

Hello Faizan,

Its A Great Article ..! Appreciated..!!

Lot of People are considering Data Science as Deep Learning ..But, there is way to take and solve the problem of Deep learning

Thanks dheeraj.

This article was especially written for people to know that deep learning is not the answer to everything, and we should apply it only when it is essential.

It helped me a lot. Thanks!

Thanks David

Hi Faizan

Thanks for the wonderful article. It would be helpful if you would also provide your take on the above quiz.

Regards

Thanks Aditya! I will give my view on the discuss post 🙂

Good article.Great work Faizan

Thanks Nirav

Very nice. Thanks a lot

Thanks karthic

Great article , much appreciated!

Thanks Ru

HI Faizan,

Its very helpful material on D.L

Can you please suggest a reference for web related stuff to implement on Python like heat maps and other maps stuff.

I am a working guy i need to implement a web related application that should get data from AS400 via VPN.

Thanks & Regards,

Krishna

You can refer this article for getting started with data science from scratch in python https://www.analyticsvidhya.com/blog/2016/01/complete-tutorial-learn-data-science-python-scratch-2/

please give me a code of deep learning

You can refer this article for a basic understanding of deep learning from scratch https://www.analyticsvidhya.com/blog/2017/05/neural-network-from-scratch-in-python-and-r/