Machine Learning with
TensorFlow
Machine Learning
Machine Learning is the science of getting computers to
learn and act like humans do, and improve their learning
over time in autonomous fashion, by feeding them data
and information in the form of observations and real-
world interactions [1]
Machine Learning Categories
Source: MathWorks
Machine Learning
Algorithms
Source: MathWorks
Let's focus on supervised learning
TensorFlow
TensorFlow is fast, flexible, and scalable open-source
machine learning library for research and production.
Key Concepts
•TensorFlow bases its data management in tensors
•Tensors are manipulated using operations
•Each operations are executed in computational graph
•Computational graph are executed with CPU, GPU or TPU
Simple Computation with TF
Guess the output!
Now, try this
What Happened?
•Computational graph is not immediately evaluated when
they are declared
•The graph is executed with tf.Session's run function
Linear Regression
•Predict continuous values from previously acquired data
•We try to find linear equation that minimizes the
distance between data points and modeled line
Linear Regression
Image source: [2]
Demo
Artificial Neural Network
•ANN consists of artificial neuron, a mathematical
function modeled after a real biological neuron
•It receives one or more inputs, and sums them to
produce an output
•Additionaly, the sums are normally weighted and the
sum is passed to a nonlinear function (activation
function or transfer function)
Perceptron
Image source: [2]
Multilayer Perceptron
Image source: [2]
Convolution Neural Network
•Part of many of most advanched models currently being
employed.
•Used in numerous fields, but mainly used in image
classifications
Convolution
•Introducing kernel, a m x n-dimensional matrix and is
usualy a square matrix (m = n)
•Convolution process consist of multiplying the
corresponding pixels with the kernel and summing the
values for assigning to the central pixel
Convolution
Image source: [2]
Convolution
The images illustrates how the change
to parameters affect the output
Image source: [2]
Subsampling - pooling
•Reduce the quantity and complexity of information while
retaining the most important information elements
•Well known pooling operations are max pool and average
pool
Subsampling - pooling
Image source: [2]
CNN Architecture: LeNet5
Image source: [2]
Demo
Implementing simple CNN with TensorFlow
Alternatives to TensorFlow
•Theano
•tf.learn
•tf.keras / keras
Demo
Implementing simple CNN with Keras with TensorFlow as
Keras' backend
The Tools
•Anaconda (Python interpreter + libraries for scientific
computing)
•Jupyter Notebook (comes with Anaconda)
Hi, TensorFlow.js
js.tensorflow.org
TensorFlow.js
•Available for Node.js and browsers!
•High-level APIs similar to Keras!
References
[1] https://www.techemergence.com/what-is-machine-learning/
[2] Bonnin, Rodolfo. Building Machine Learning Projecs with TensorFlow. Packt
Publishing, 2016.
[3] McClure, Nick. TensorFlow Machine Learning Cookbook. Packt Publishing, 2017.

DyCode Engineering - Machine Learning with TensorFlow