# What is machine learning and deep learning?

I was searching in my YouTube account for videos about new exciting things to learn about machine learning and surprised I was when I found out the [Machine Learning Zero to Hero (Google I/O’19)](https://www.youtube.com/watch?v=VwVg9jCtqaU&t=1229s). Laurence Moroney and Karmel Allison did an amazing job of compressing the theoretical fundamentals and the best tools for creating and tuning artificial neuronal networks in just 30 minutes!

So, I decided to honor them by creating a blog post that will use their examples to explore the fundamentals of machine and deep learning. Because machine learning is already a huge field, this blog post will be primarily focused on machine learning applied to the [computer vision](https://towardsdatascience.com/what-even-is-computer-vision-531e4f07d7d0) field using artificial neuronal networks, more specifically, convolutional neuronal networks.

Enjoy it! 😁

# **What is Machine Learning?**

Machine learning is a subfield of artificial intelligence which uses algorithms (a.k.a models) to learn from data. The models find patterns in data without explicitly coding what these patterns are.

You can think of machine learning models as children. Imagine that you want to teach a child to distingue dogs and cats. You will present images of dogs and cats and the child will learn based on the characteristics of them. The more images you show, the better the child will distingue. After hundreds of images, the child will start to distingue dogs and cats with an accuracy sufficient to do it without any help. But if you present an image of a chicken, the child will not know what the animal is, because it only knows how to distingue dogs and cats. Also, if you only showed images of German Shepherd dogs and then presented another kind of dog breed, it would be difficult for the child to know if it is a dog or not.

**All you need in machine learning is to choose your data (dogs and cats), train your model (teach the children), and test it (by presenting new images of dogs and cats that the children never had seen before).**

It's not so difficult, right?

## **But, what are the differences between traditional programming and machine learning?**

In traditional programming, you hard-code all your rules to achieve some result from a given input. Taking the example of distingue dogs and cats, you need to code all possible characteristics that will distingue a dog from a cat such as the animal size, fur size and color, eye color, and so on. Imagine how difficult and complex is this task! This is a big struggle for the traditional programming approach: the more variance your input data has (more characteristics), the more rules you should write, and the more complex will be your solution. Also, new data means more rules to write. This translates into complex software solutions that are difficult to understand and maintain. And, there are a lot of problems that are almost impossible to solve using traditional programming such as [image classification and speech recognition](https://towardsdatascience.com/hot-topics-in-ai-research-4367bdd93564).

In machine learning, you don’t need to write all the rules. Instead, you create or use well-known algorithms that allow machines to find patterns in your data and give you the right answers, without the need to explicitly write all rules that cover all possible answers.

[![](https://miro.medium.com/v2/resize:fit:1276/1*SsFLm-005Yw_LPsC25JvTA.jpeg align="center")](https://image.slidesharecdn.com/machinelearningsecurity-ibmseoulcompressedversion-170417142748/95/machine-learning-security-ibm-seoul-compressed-version-12-638.jpg?cb=1492439498)

But, the real potential of machine learning is to handle data never seen before and yet provide the right answers. Because of this, **the center of machine learning is the** [**data amount and data quality**](https://www.dataversity.net/impact-data-quality-machine-learning-era/#) **as well as choosing the** [**best machine learning algorithm**](https://hackernoon.com/choosing-the-right-machine-learning-algorithm-68126944ce1f) **that fits in our data.**

Like [Oleksii Kharkovyna](https://towardsdatascience.com/@oleksii_kh) says:

> *In traditional programming you hard code the behavior of the program. In machine learning, you leave a lot of that to the machine to learn from data.*

Follows the section part of the “machine Learning Zero to Hero presentation” that explains the difference between traditional programming and machine learning.

[https://www.youtube.com/watch?v=VwVg9jCtqaU&start=41&end=200](https://www.youtube.com/watch?v=VwVg9jCtqaU&t=1229s)

*Also, if you want to know more about this subject, you can learn it from* [*here*](https://towardsdatascience.com/machine-learning-vs-traditional-programming-c066e39b5b17)*.*

Now, you are understanding better the potential of machine learning! It is huge right?

# **And, how many machine learning models exist?**

There are a lot of machine learning models and the [scikit](https://scikit-learn.org/stable/) created a sheet that explained well the flow of picking the best model that fits our problem.

Follows an image of the diagram, but I advise you to consult the original webpage [here](https://scikit-learn.org/stable/tutorial/machine_learning_map/index.html) since you can interact with the image and find more information about each model.

![](https://miro.medium.com/v2/resize:fit:4244/1*2NR51X0FDjLB13u4WdYc4g.png align="left")

Scikit-learn model cheat-sheet

This diagram will be your best friend each time you want to approach a new problem using machine learning. There are four main categories in machine learning:

1. Supervised Learning: usage of data that has the answers and learning the data patterns that lead to the given answer.
    
2. Unsupervised Learning: usage of data that doesn’t have answers, hoping the model finds patterns and gives the answers even if aren’t the best ones.
    
3. Semi-supervised learning: is the middle term of supervised and unsupervised learning since uses data that has and doesn’t have the answers.
    
4. Reinforcement Learning: the learning process is based on punishments and rewards.
    

You can go deeper on this subject by consulting [this](https://hackernoon.com/choosing-the-right-machine-learning-algorithm-68126944ce1f) and [this](https://towardsdatascience.com/types-of-machine-learning-algorithms-you-should-know-953a08248861).

# **The importance of training, testing, and inference Phases**

Essentially, the machine learning development process can be resumed in three main phases: training, testing, and inference (also known as prediction or classification phase). Each phase will help you fine-tune your model to achieve the best results.

## **Training Phase**

In the training phase, the models (algorithms) are trained to find patterns in our data. The data should be normalized into a format that contains the data and the answers. This will allow the model to correlate the characteristics of the data with a given answer (also known as prediction or classification).

For instance, if you are training a model to predict if a given image has dogs or cats, in the training phase, you will train the model with dogs and cats images, saying explicitly which images are dogs and which images are cats.

## **Testing Phase**

After training the model, you should test the performance by using the data that you already know the answer and compare it with the model inference. Typically you should divide your data from [training, validation, and test sets.](https://towardsdatascience.com/train-validation-and-test-sets-72cb40cba9e7) The training data will be used to train your model, the validation data to [fine-tune your model](https://medium.com/fintechexplained/how-to-fine-tune-your-machine-learning-models-to-improve-forecasting-accuracy-e18e67e58898), and the test data to test your model against a real scenario (at least, as closest as possible).

The testing phase is the most important phase in building a machine-learning model. Is responsible for giving you metrics about how well your model is fitting on your problem domain, allowing you to understand if your model is [underfitting or overfitting](https://medium.com/greyatom/what-is-underfitting-and-overfitting-in-machine-learning-and-how-to-deal-with-it-6803a989c76). There are a lot of metrics that you can use to evaluate your model such as [accuracy, precision, recall, and F-score that can be obtained from the confusion matrix](https://medium.com/datadriveninvestor/simplifying-the-confusion-matrix-aa1fa0b0fc35).

## **Inference Phase**

In this phase, is where you will change the world 🌍 by creating a software solution that will consume the model and solve real problems!

# **Artificial Neuronal Networks**

Artificial Neuronal Networks are software structure (or algorithms) that tries to imitate how the biological neurons interact with each other to learn from data. They are considered the most promising algorithms in machine learning not only because of their learning capabilities but also because of the current technological and community state (such as power computation work, available tools, and impressing research work results).

In 2016, [Fjodo van Venn](http://www.asimovinstitute.org/author/fjodorvanveen/) created a chart that shows more than 27 types of neuronal network topologies created which are applied in different problem-solving scenarios.

![](https://miro.medium.com/v2/resize:fit:1400/1*T9IHGIRKPAatpeyjkhUOBw.png align="left")

*Artificial Neuronal Networks topologies Check* [*here*](http://www.asimovinstitute.org/author/fjodorvanveen/) *and* [*here*](https://towardsdatascience.com/the-mostly-complete-chart-of-neural-networks-explained-3fb6f2367464) *for more information). More of this is in* [*here*](https://medium.com/datadriveninvestor/the-basics-of-neural-networks-304364b712dc)*.*

Don’t be scared. For now, we have full control of artificial neuronal networks. We will not be dominated by machines, at least, soon 😁.

# **Deep Learning**

You probably already heard about the deep learning field, but what is it? In practical terms, deep learning is just a subset of machine learning that uses artificial neuronal networks to go deeper and in a more complex way ([with more neurons and more hidden layers](https://medium.com/fintechexplained/what-are-hidden-layers-4f54f7328263)) than the original machine learning artificial neuronal networks. So, most of the topologies presented before, are considered to be in the deep learning field because of their complexity.

Deep **learning is a field that exclusively builds and manipulates artificial neuronal networks.**

Deep learning is already being used to build better products in companies such as [Google](https://www.bernardmarr.com/default.asp?contentID=1275), [Facebook](https://research.fb.com/category/machine-learning/), [Amazon](https://aws.amazon.com/deep-learning/), and [Netflix](https://becominghuman.ai/how-netflix-uses-ai-and-machine-learning-a087614630fe). But Google is putting a great effort into deep learning democratization by releasing a bunch of [tools, documentation, and tutorials](https://ai.google/education/) that are helping the deep learning community to build and maintain complex artificial neuronal networks. Also, helped to make convolutional neuronal networks a shining start in the machine learning community.

## **Humm, but what are convolutional neuronal networks**

Convolutional neuronal networks is an artificial neuronal network architecture that uses groups of convolutional and pooling layers for compressing and highlighting features from images to identify patterns and classify them. In other words, **it is a machine-learning model specialized in image classification.**

The convolutional neuronal networks' accuracy over time became better than humans for image classification. How incredible is that?

If you want to know more about convolutional neuronal networks, check [this](https://towardsdatascience.com/a-comprehensive-guide-to-convolutional-neural-networks-the-eli5-way-3bd2b1164a53).

![](https://miro.medium.com/v2/resize:fit:2000/1*F2Ik_XFzmu5jZF-byiAKQQ.jpeg align="center")

*(extracted from* [*here*](http://maco.palmex.co/convolution-neural-network/)*)*

## **Imagenet database**

The imagenet database and contest had a huge role one pushing forward the performance of convolutional neuronal networks. In just seven years (2010–2017) push forward the accuracy of classifying images from 71.8% to 97.3% surpassing human capabilities.

But what does the imagenet database content look like?

It consists of 3.2 million labeled images, divided into 5247 categories and sorted by 12 subtrees (like “mammal” and“vehicle”). Imagine how difficult is to create a model that generalizes enough to find features on images that represent more than 5247 categories and surpass human capabilities? For me, it is a huge accomplishment in the deep learning field.

*In* [*here*](https://qz.com/1034972/the-data-that-changed-the-direction-of-ai-research-and-possibly-the-world/)*, you can find more about image net.*

# [**🎯**](https://emojipedia.org/direct-hit/) **Bullet Points**

1. **Machine learning** is a subfield of artificial intelligence that **uses** algorithms (also known as **models**) to **learn from data**;
    
2. In **traditional programming**, you **hardcode** all **rules**. In **machine learning,** you create **models** that **find patterns** in your data;
    
3. There are four **categories** in **machine learning**: **Supervised**, **unsupervised**, **semi-supervised,** and **reinforcement learning;**
    
4. **The machine learning development process** is divided into **training**, **testing,** and **inference** phases;
    
5. **Artificial Neuronal Networks** are a kind of machine learning **model** that tries to **imitate** how **biological neurons** interact with each other;
    
6. **The deep learning field** is a subset of machine learning that **uses artificial neuronal networks in a much deeper and more complex way**;
    
7. **Convolution Neuronal Networks** **go deeper in size and complexity** than traditional **Artificial Neuronal Networks.**
    
8. **Imagenet** had an **important rule** for **improving** the **performance** of **convolutional neuronal networks**.
