The Machine Learning Crash Course - Welcome to the first episode of the Machine Learning Crash Course For Beginners.A self-study guide for aspiring machine learning practitioners...🌟🌟🌟🌟🌟

The Machine Learning Crash Course - Welcome to the first episode of the Machine Learning Crash Course For Beginners.A self-study guide for aspiring machine learning practitioners...

In this series you’ll learn everything you need to get started with Machine Learning from scratch. No prior knowledge is required. You’ll learn basic concepts and practical applications from start to finish.

In this first episode we’ll start to clarify what Machine Learning exactly is, how it is linked to terms like Artificial Intelligence and Deep Learning and what different types of Machine Learning are available.

We’ll also take a look at Google Colaboratory (Colab) which is a Python-based Machine Learning development environment in the cloud.

Artificial Intelligence, Machine Learning, and Deep Learning explained

In the context of Machine Learning people often talk about Artificial Intelligence and Deep Learning. So let’s see how these terminologies relate to each other.

The most comprehensive term is Artificial Intelligence. Artificial Intelligence is a field in computer science that aims to make computers achieve a human-style intelligence.

Machine Learning is then located within the area of Artificial Intelligence and describes a set of techniques which are used to train a computer to perform a certain task without providing the exact algorithm which is needed to solve that task.

Deep Learning is a sub-field of Machine Learning. In Deep Learning multi-layered neural networks are used to perform machine learning tasks. This is at the same time the reason why it is called “Deep” Learning. The term deep refers to the number of layers in the neural network through which the data is transformed.

Take a look at the following illustration to see how Artificial Intelligence, Machine Learning, and Deep Learning relate to each other:

Supervised vs. Unsupervised Learning

Let’s now take a closer took at Deep Learning. In general Deep Learning can again be split into two sub-fields: Supervised vs. Unsupervised Learning. The following illustration is showing that fact:

In general Supervised Learning is describing the learning process when the computer knows what to learn. That means that the input data which is provided to train a neural network is labeled. With the labels provided the computer knows what the correct answer would be.

A typical example of that type of learning is an image recognition task. For training the neural network images are provided which are labeled, so that the neural network knows what is shown on the images. E.g. you can think of images showing cats and dogs and those images are labeled with “cat” or “dog. Providing the set of training data makes it possible to train the neural network and afterwards provide images showing cats or dogs without label and letting the neural network recognise what is shown on the image by providing the answer “cat” or “dog”.

In contrast in Unsupervised Learning it is unkown what the computer needs to learn. That means that you only have input data without corresponding labels. In that case the Machine Learning algorithm needs to figure out how to interpret and how to structure the data by itself. There are two main tasks for Unsupervised Learning:

Unsupervised Learning For Clustering: Clustering means that the algorithm tries to group together the input data in categories. Example: red, blue, green etc. The category is then the label which is determined for the provided input data.

Unsupervised Learning For Association: Association means that the algorithm tries to determine rules which are describing large portions of the data. E.g. poeple that smoke tend to get cancer. Machine Learning vs. Traditional Programming

Now that we’ve taken a first look into concepts of Machine Learning you should have a first understanding of what Machine Learning / Deep Learning is. Let’s compare the general approach of Machine Learning to the approach of traditional programming to get a better understanding of the general concept.

Take a look at the following picture first:

What you can see here is the direct comparison of the approach of traditional programming and the approach which is taken which Machine Learning.

In traditional programming we’re used to provide input data and rules in order to implement the program. Usually rules are being used to implement an algorithm which is then processing input data which leads to a certain output.

In contrast to that the approach in Machine Learning is a little bit different. In Machine Learning we’re providing input data together with the related output first. Just think of the example with images (input) and the corresponding image labels (output). Based on what is being provided we’re training a neural network which then delivers the rules. With that trained neural network we’re then able to apple the neural network on new input data and it will be able to prodict the output with a certain accuracy.

Practical Machine Learning

Python And TensorFlow

Next, let’s start with the first practical part. In order to write code for Machine Learning we’ll use a framework which is called TensorFlow. TensorFlow is developed and provided by Google and is an end-to-end open source machine learning platform which is available for many programming languages.

For the first practical examples in this Machine Learning Crash Course we’ll be using TensorFlow together with the Python programming language. There are three main reasons for this choice:

Python is a programming language which is easy to learn and easy to read. Even if you’re not a Python expert you’ll be able to follow along the examples.

Python offers libraries which makes it easy to deal with large sets of data. This is the prerequisite for any machine learning exercise.

With Google’s Colab cloud environment we’re able to use a fully prepared Python Machine Learning development environment in the cloud which is ready-to-use without needed to setup anything on your local machine first.

If you’d like to get an overview of the TensorFlow platform first you can take a look at the project’s website at https://tensorflow.org:

https://www.python.org/ where you can find additional information on all aspects of the language.

Google’s Colab – A Machine Learning Development Environment In The Cloud

So now, that we know that Python and TensorFlow should be used when implementing our first Machine Learning examples we need to setup a development environment first.

Of course you can do that on your local system in many different ways:

You can download and install Python and TensorFlow and use any code editor you like to write your Machine Learning code

You can setup Jupyter Nodebook (https://jupyter.org/) "https://jupyter.org/)") in order to host your development environment on your local machine and access the Jupyter Nodebook web application in the browser.

You can use use Google Colaboratory (Colab) which is a Jupyter Notebook-based Python development environment which is provided in the Google Cloud. Colab provides everything what is needed to get started with Machine Learning. TensorFlow is already pre-installed and as Colab is free to use you just need to sign up with your Google Account to be able to access Colab.

For the following exercises we’ll be using Google’s Colab. This is the most easiest way to get a access to a full-featured Python-based Machine Learning development environment. Let’s take a closed look at the most important features Colab has to offer.

Go to https://colab.research.google.com/ and login with your Google account. Afterwards you will be presented with the with the following dialog which let’s you choose to

open any of the provided example notebooks

open existing notebooks from Google Drive or Github

open existing notebooks by selecting and uploading a file from your local machine

creating a new and empty Python 3 notebook by hitting the link NEW PYTHON 3 NOTEBOOK at the bottom:

In order to make ourselves familiar with some of the basic Colab functionalities let’s create such a new and empty Python 3 notebook:

The notebook editor is organised in cells. A notebook cell can contain two different types of content:

Code

Text

By default the notebook already contains one code cell, so that we can start typing in Python code like you can see in the following screenshot:

The code within the cell can then be executed by either hitting the play button located on the left side of the cell or hitting CTRL+RETURN. The code is being executed and the output which is generated by the code execution is displayed below:

By using the buttons + CODE and + TEXT you can add more cells to your notebook. For example add a new text cell to add some explanatory text:

As you can see the cell text content can also be formatted by using the corresponding icons are typing in markdown code. As long as you’re in editing mode the cell is displayed in a split view. The left side of the text cell is containing the markdown text editor and the right side of the cell is showing the resulting output.

If you’re leaving the edit mode of the text cell (e.g. by clicking just somewhere outside of the cell) the compiled text output is displayed in the notebook:

Let’s add another code cell next and include the Python code which is needed to iterate over a simple list of value. For each iteration the actual value is outputted:

Now you can see that the output of the cell is containing one line per iteration listing the respective values.

If you need additional functionality which is not part of the Python core language you can use additional. The most common libraries used in Machine Learning are already pre-installed, e.g. the NumPy library to manage arrays more easily. Let’s try it out by adding another code cell to our notebook:

Here we’re first making sure that the NumPy library is imported, so that we’re able to use it. Next we’re creating a new array a by using the NumPy array function. Initially this array is consisting of just two elements and then extended by two more elements (by using the append function). Finally the array is printed out. Once the code cell is being executed you should be able to see the corresponding output right below the code cell.

The NumPy library can also be used to do some basic mathematical operations on array values like you can see in the following:

Here we’re first initialising a array with numeric values. Then we’re printing out the maximum value of that array (by using function max*), the average of all values included in that array (by using *average function) and the index of the maximum value in the array (by using the argmax function).

A use case for which NumPy is often used in Machine Learning is creating Arrays of a certain dimension and initialising this array which random numbers:

You can also access the shape of a NumPy array and print it out:

The Colab environment is not limited to only execute code. Colab is also a virtual machine, so that you can execute commands that you also would also use on the command line. Take a look at the following example, another code cell is used to execute a few command:

What you can see here is that you need to prefix the line which contains the command with an exclamation mark.

Colab gives you also access to code snippets. To access the list of snippets just expand the left-side menu by clicking on the arrow and you should be able to see the list of available snippets:

You can use the search field to input text and search for matchings in the list of available snippets. Double-click on a specific entry to insert the code snippet as a new code cell to the notebook. In the following you can see the result of inserting and executing the snippet “Visualization: Histogram in Altair”:

Conclusion

In this first episode of the Machine Learning Crash Course you’ve learned about some basic terminologies and we’ve started to make ourselves familiar with Colab, so that we’re able to use this Python Cloud development environment to start with a first practical Machine Learning project in the next part of this tutorial.

machine-learning