A series of the Fundamentals of Machine Learning and Deep Learning

What is machine learning and deep learning?

The best introduction ever that you can get about machine learning and deep learning.

Ricardo da Rocha

--

(extracted from here)

During this series, will be provided links where you can find more information about the subjects exposed. Feel free to explore during or after the reading.

I was searching in my youtube account for videos about new exciting thing to learn about machine learning and surprised I was when I found out the Machine Learning Zero to Hero (Google I/O’19). Laurence Moroney and Karmel Allison made an amazing job of compressing the theoric 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 series of posts that will use their examples to explore the fundamentals of machine and deep learning. Because machine learning is already a huge field, this series will be primarily focused on machine learning applied to computer vision field using artificial neuronal networks, more specific, convolutional neuronal networks.

This is the first episode. Enjoy it! 😁

What is Machine Learning?

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

You can think 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. More images you show, 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 you present another kind of dog breed, it will be difficult for the child to actually 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 present new images of dogs and cats which the children never had seen before).

It not so difficult right?

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

In machine learning, you hard code all your rules in order 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, eyes color and so one. Image how difficult and complex is this task! And this is a big struggle for traditional programming approach: more variance your input data has (more characteristics), more rules you should write and more complex will be your solution. Also, new data means more rules to write. This translates in complex software solutions that are difficult to understand and maintain. And, there is a lot of problems that are almost impossible to solve using traditional programmings such as image classification and speech recognition.

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

Traditional programs vs Machine learning (extracted from here)

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 as well as choosing the best machine learning algorithm that fits in our data.

Like Oleksii Kharkovyna 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

Also, if you want to know more about this subject, you can learn it from here.

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 created a sheet that explained well the flow of picking the best model that fits in our problem.

Follows an image of the diagram, but I advice you to consult the original webpage in here since you can interact with the image and find more information about each model.

Scikit-learn model cheat-sheet

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

  1. Supervised Learning: usage of data in the that has already the answers and learn 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 give 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 hasn’t the answers.
  4. Reinforcement Learning: the learning process is based on punishments and rewards.

You can go deeper on this subject by consulting this and this.

The importance of training, testing, and inference Phases

Essential, 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 in fine-tuning your model in order to achieve the best results.

Training Phase

In the training phase, the models (algorithms) are trained in order to find patterns in our data. The data should be normalized into a format that contains the data and the answers. This will allow for 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 with the model inference. Typical you should divide your data from training, validation and test set. The training data will be used to train your model, the validation data to fine-tune your model and the test data to test your model against a real-scenario (at least, closest as possible).

The testing phase is the most important phase in building a machine learning model. Is responsible to give you metrics about how well your model is fitting on your problem domain, allowing you to understand if your model is underfitting or overfitting. There is 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.

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 in order to learn from data. There are considered the most promising algorithms on machine learning not only because of the learning capabilities but also because of the current technological and community state (such as power computation work, available tools and really impressing research work results).

In 2016, Fjodo van Venn created a chart that shoes more than 27 types of neuronal networks topologies created which are applied in different problem-solving scenarios.

Artificial Neuronal Networks topologies Check here and here for more information)

More of this in here.

Don’t be scare. For now, we have full control of artificial neuronal networks. We will not be dominated by machines, at least, in the near future 😁.

Deep Learning

You probably already heard about deep learning field, but what is it? In practical terms, deep learning is just a subset of machine learning that uses artificial neuronal networks must deeper and in a more complex way (with more neurons and more hidden layers) than the original machine learning artificial neuronal networks. So, most of the topologies presented before, are considered being in the deep learning field because of there complexity.

Basically, deep learning is a field that exclusively builds and manipulates artificial neuronal networks.

Deep learning is already be used to build better products in companies such as Google, Facebook, Amazon, and Netflix. But Google is putting a great effort into deep learning democratization by releasing a bunch of tools, documentation, and tutorials 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 is convolutional neuronal networks

Convolutional neuronal networks is an artificial neuronal networks architecture which uses groups of convolutional and polling layers for compressing and highlight features from images in order to identify patterns and classify them. In other orders, it is a machine learning model specialize 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.

(extracted from here)

Imagenet database

The imagenet database and contest had a huge role one push 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 is the imagenet database content looks 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 which generalizes enough to find features on images that represent more than 5247 categories and surpassed the human capabilities? For me, it is a huge accomplishing for the deep learning field.

In here, you can find more about image net.

🎯 Bullet Points

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

Next episode

Stay tuned for the next episodes where the fundamentals of deep learning will be explored deeper.

--

--

Ricardo da Rocha

Technology Lover | Love Coding | AI Enthusiastic | Knowledge addicted | Passion about music