1. Machine Learning Basics |
TensorFlow is Google's framework for developing Machine Learning models and is has developed into the most popular machine learning library. Since 2011, Google Brain Team has been developing TensorFlow and was used internally until is was released as an open-source software in Nov, 2015. It comes packed with the wide range of tools from dataset management to a good selection of high-level algorithms and even ready made models. That's a lot to pack in one solution!
The team that is working on developing TensorFlow are some of the most influencal researchers in machine learning. It also has a huge amount of contributors and commits for such a relativly new project on Github. You quickly realize that TensorFlow is getting more attention from people in the field than any other existing machine learning solution and will be the technology starndard for machine learning development.
OS Support:
Programming Languages:
Hardware:
There is also TensorFlow.js version which runs in browser on client-side with no need for a back-end. There is also TensorFlow Lite which converts machine learning models to a format that can run on mobile devices running iOS and Android.
With in two years of its release, TensorFlow has been downloaded over 11 million times from almost every country on earth.
From Ragat Monga @rajatmonga Slides in TensorFlow Dev Summit 2018 (2018-03-30)
Before we dive any deeper in TensorFlow, I will go over some basic concepts of machine learning and deep learning.
This tutorial is for developers who can develope in python but not well versed in machine learning or familiar with some other machine learning libraries but new to TensorFlow. It is also be useful for non-developers who are good at a specific knowledge domain like mathematics, statistics, medical field or, social studies and eager to experiment with machine learning in their fields.
Machine Learning (ML) is a branch of Artificial Intelligence (AI). It uses data instead of code to produce logic. The goal is to perform tasks that we usually equate human level intelligence and in many cases exceeds human level of intelligence like what happened with Alpha Go and many other examples. You actually use machine learning all the time without realizing when you use Google, YouTube, Amazon and so many other services that reley on machine learning to give you a better experience.
Machine learning is built on algorithms that use data to train models to perform a specific task.
Meet Tensy
, a robot eager to learn and solve human problems. @TensyRobot
Models can learn in three styles depending the the training algorithms:
Supervised learning is teaching a model to give an output based on some input. The the algorithm teachs the model by giving the it plenty of examples and their outputs. There are two types of problems that we can solve with supervised learning which are:
Classification is used to teach a model to output a category or a class based on a data point. Like learning if a photo has a cat or a dog.
I want Tensy
to learn how to tell cats from dog. We can give Tensy
photos of cats and until he learns to tell a cat from a dog. I can later test him on a new photos he has never seen before and see how accurate he is.
Regression is used to teach a model to output a continuous numerical value based on a data point. Like telling the age of a person based on their photo.
This time we are teaching Tensy
to tell the age of a person based on their photo. To do that we will give him a large amount of photos and tell him the age of each person. We can later test him by asking the age of people in new photos that he didn't see before.
Unsupervised Learning teaches a model to produce an output based on a data point without teaching the model the output. Like giving a model photos taken outdoor and photos taken indoor and ask then model to split them to two piles. There are many problems that can be solved using UL but the most common ones are:
Clustering is grouping similar data points into groups or clusters. different algorithms can find similarities in different ways and can end up clustering your data points into different groups. Some of these algorithms need you to tell them how many clusters do you want them to split your data into and some will try and figure that out of their own.
This time we gave Tensy
a group if photos and we asked him to split them into two groups. He is finding that all indoor photos are similar and all out door photos are similar.
Other UL algorithms can solve some interesting problems using like:
Reinforcement Learning uses an algorithm to teach a model to produce a desired output without explicitly explaining how to perform it. This works by gaving the model an input and rewarding good outcome and punishing bad outcome. This might be similar to how you would teach a child or even train an animal to perform the desired actions.
Let's teach Tensy
to play some Atari games. The input in the screen feed from the game. After each frame from the input he will be able to choose one action (right, left, up, down and press action button). That action might lead to increased score if it is a good action or to no increase score if it is a neutral action or to loosing a life and lower score for a bad action.
These major categories are not inclusive of every algorithms that you might use where some evolutionary algorithms, or recommendation systems do not fall under any of these categories. Some more complicated algorithms use multiple stages in a pipeline some with supervised and unsupervised so your end-to-end algorithm might also not fall under any specific category or sometimes will be called "Semi-Supervised".
This section will explain some mathematical concepts at the end of each tutorial. These tutorials are going to be code intensive and that will help you develop your coding skills and get your model working. But what if it doesn't work?
The math behind these algorithms use Linear Algebra, Tensor Calculus and Statistics. This section in each tutorial will explain the math behind what we discussed and will assume very little to no math background and will explain things from the ground up. This could help you fix your model or even improve your accuracy.
Finally, It will serve as a bidge between machine learning concepts and centuries of mathimatical reasearch. Mathematics is the language of science and learning this language will open the door for you to explore some of the latest academic research papers in the machine learning due to the fact that they mostly look like this:
A small section of "A Training Algorithm for Optimal Margin Classiers" By Boser, Guyon & Vapnik published 1992. AKA the original SVM paper
So to kick of this part I'll start with a few simple concepts:
The real numbers include positive, nagative numbers and zero. They can be of arbitrary precesion meaning they can have any number of decimal points or even numbers with infinite precision. The set real is denoted in mathimatics as $\mathbb{R}$. Examples of real numbers include:
To represent a finite sum of numbers in math, you can use the following:
$$ 1 + 2 + 3 + 4 + 5 $$For longer sums like getting the sum of all numbers from 1 to 1000 can be harder to write in that way. We use sum represented by capital letter Sigma $\Sigma$. To rewite the previous equation from 1 to 1000 using sum, you can do this:
$$\sum_{n=1}^{1000} n$$This can facilitate writing more complex functions like this:
$$f(x) = x + 2x + 3x + 4x + 5x = \sum_{n=1}^{5}nx$$With this notation we can even represent an infinite sum of numbers:
$$\frac{1}{1} + \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16} ... = \sum_{n=0}^{\infty} \frac{1}{2^n} = 2$$To represent a finite product of numbers in math, you can use the following:
$$ 1 \times 2 \times 3 \times 4 \times 5 $$For longer products like getting the products of all numbers from 1 to 1000 can be harder to write in that way. We use products represented by capital letter Pi $\Pi$. To rewrite the previous product from 1 to 5, we can write it this way:
$$\prod_{n=1}^{5} n$$NOTE: It should also be noted that the previous product can also be written as $5!$ which is called 5 factorial.
This can facilitate writing more complex products like:
$$f(x) = x \times 2x \times 3x \times 4x \times 5x = \prod_{n=1}^{5}nx$$Copyright © 2018 Abdullah Alrasheed and other contributes
Roshan Logo is not open sourced and is not covered by the GNU license