2
Machine Learning
AGENDA
- Machine Learning
- Neural Networks
- Types and Tasks
– Practical Example
- Classification
- Tools Used
- Data Preparation
- Training
- Neural Network Architecture
4
MACHINE
LEARNING
Machine learning is not just HYPE.
It is much more, and currently is a technology that is being used more and more
often.
5
MACHINE LEARNING
In its most basic conception, it allows a generic algorithm to solve a problem
where the input information is not exactly as expected.
It gives a program the ability to interpret new information and understand its
meaning.
6
DIFFERENT WAYS TO LEARN
Supervised
The model is built
upon previous
data. This data,
used for learning is
already known.
The computer works
out the relationship
between input -
output.
Task driven.
Unsupervised
There is no previous
information in this
model.
The algorithm must
be able to extract
valid (useful)
information from
the data presented.
Data driven.
Reinforcement
Interaction with a
dynamic
environment
(constantly
changing) provides
information as
feedback to the
Machine Learning
algorithm.
The feedback takes
the form of
“rewards” and
“punishments”.
SUPERVISED LEARNING
APPLICATIONS
• Database Marketing
• Handwriting Recognition
• Object Recognition
• OCR
• Spam Detection
• Pattern Recognition
• Speech Recognition
7
UNSUPERVISED LEARNING
APPLICATIONS
• Cluster Analysis
• Anomaly Detection
• Multivariate Analysis
8
REINFORCEMENT LEARNING
APPLICATIONS
• Game Theory and Multi-Agent Interaction
• Robotics
• Computer Networking
• Vehicular Navigation
• Industrial Logistic
9
10
NEURAL
NETWORKS
NEURAL NETWORKS
What is a Neural Network?
A neural network is a set of connected nodes (grouped in one or more layers).
Each node can take a set of inputs, applies weight to them and calculate an
output value.
These output values are the input for the next layer of nodes.
What we call “nodes” are in reality large matrices being kept in memory.
A layer is a collection of matrices.
11
DIFFERENT MODELS OF
NETWORKS
Stateless
The algorithm has no memory,
there is no effectivity to
respond to patterns over time.
Stateful
The algorithm saves a set of the
internal calculation, and this is
re-used the next time as part
of the input.
It has memory. It can produce a
result based not only on
current data but also on
previously computed data.
12
MACHINE LEARNING TASKS
Classification
The output is a classification (i.e.
Spam or Not Spam).
This is an example of Supervised
learning, the classes are all
known beforehand.
Dimensionality Reduction
Reduces the dimensions of the input
data, in order to simplify a
problem, and to filter out outliers
and random variables (Variables
that are not functional to the
statistical solution of the problem).
Regression
The output is a continuous
value, a probability value
(0 to 1) for each input
class.
Naturally, the sum of all
probabilities must
amount to 1.
13
Clustering
Grouping of information.
Similar to Classification,
but on an Unsupervised
network. Information is
grouped in classes,
unknown at the start of
the process.
14
CLASSIFICATION
15
Sure, easy GIS lookup, give me a few hours!
When a user takes a photo, the APP should
check whether they are in a National Park …
… and check whether the photo is of a bird.
I will need a research team and five years.
Ref: https://xkcd.com/1425/
16
CLASSIFICATION
SIMPLIFIED MODEL
17
Example:
COINS
IDENTIFICATION
25
1
10
2
?
50
2
1
50
2
25
2
10
10
TOOLS
OpenCV
Computer Vision.
• Edge detection.
• Image transformations
(depth, size, shape, etc.)
• Accessing camera feeds.
• Filtering images (applying all
types of filters)
It has implementations for
c++, Java, Python, Android
and IOS.
Also there is a component
called Emgu, which is a port
for .NET applications.
Scipy
Open Source python
ecosystem of software for
mathematics, science and
engineering.
Tensorflow
Google Deep Learning library.
It provides method for
handling Data input /
output, construct a ML
model (with many different
options) and adding all kinds
of configurable layers.
18
TFLearn
Python wrapper around
Tensorflow. Exposes a
simplified library allowing
easier scripting and
modeling of Neural
Networks, handling data
sets, etc.
Python
Powerful scripting Language.
Supports multithreading, 64
bits, etc.
Anaconda
Anaconda provides work
environment isolation and
package management for
Python.
Multiple environments can be
defined, each one with a
different Python version and
modules loaded.
Tensorbox
Java desktop application that
enables monitoring training of
the Neural Networks in real
time.
MODEL SELECTED
Learning Type : Supervised Learning
Clear classification, known beforehand. The only result expected is a
classification whithin a restricted universe (Just three classes). There are
no other classes allowed.
Learning Task : Regression
Having a probability value allows for thresholding of the final result (fine
tunning). The final user could decide to adjust the value for reducing either
“false positives” or “true negatives”.
19
DATA PREPARATION
Images of both sides of One Peso and Two Pesos current Arengentine coins
(Most ordinary, not special editions).
All images where converted to 128x128 size and also to 24 Bits Per Pixel
(this is important, it will determine the dimensions of the matrices in the
Tensorflow Vectors).
So, ten classes (Two for each denomination, side A and B), with a total of
451 images.
Each image is rotated every 15 degrees, and each resultant image is
augmented in brightness 4 times (So each image, results in 96 images).
Final data set, 43296 images. 30 % of this set is used for validation.
20
SUMMARY - Training
21
Neural Network Model
Convolutional Neural Network Architecture
• 1st Layer: Convolutional, Max Pooling, Relu
• 2nd Layer: Convolutional, Max Pooling, Relu
• 3rd Layer: Convolutional, Max Pooling, Relu
• Layer Flattening
• Fully Connected Layer
• Fully Connected Layer (With Number of Nodes = Number of Classes)
• Softmax
22
DETECTION APP
23
Circle detection is done
using OpenCV
HoughCircles function.
1
2
The image to compare to
the trained model has to
be as similar as those used
to train the model in the
first place.
1 2
REFERENCES
LINKS:
OpenCV : http://opencv.org
Tensorflow: https://tensorflow.org
TFLearn: http://tflearn.org
Anaconda:
https://anaconda.org/anaconda/python
Scipy: https://www.scipy.org
Emgu: http://www.emgu.com
24
Thanks…
http://www.xgem.com.ar
@JuanCarniglia

xGem Machine Learning

  • 2.
  • 3.
    AGENDA - Machine Learning -Neural Networks - Types and Tasks – Practical Example - Classification - Tools Used - Data Preparation - Training - Neural Network Architecture
  • 4.
  • 5.
    Machine learning isnot just HYPE. It is much more, and currently is a technology that is being used more and more often. 5 MACHINE LEARNING In its most basic conception, it allows a generic algorithm to solve a problem where the input information is not exactly as expected. It gives a program the ability to interpret new information and understand its meaning.
  • 6.
    6 DIFFERENT WAYS TOLEARN Supervised The model is built upon previous data. This data, used for learning is already known. The computer works out the relationship between input - output. Task driven. Unsupervised There is no previous information in this model. The algorithm must be able to extract valid (useful) information from the data presented. Data driven. Reinforcement Interaction with a dynamic environment (constantly changing) provides information as feedback to the Machine Learning algorithm. The feedback takes the form of “rewards” and “punishments”.
  • 7.
    SUPERVISED LEARNING APPLICATIONS • DatabaseMarketing • Handwriting Recognition • Object Recognition • OCR • Spam Detection • Pattern Recognition • Speech Recognition 7
  • 8.
    UNSUPERVISED LEARNING APPLICATIONS • ClusterAnalysis • Anomaly Detection • Multivariate Analysis 8
  • 9.
    REINFORCEMENT LEARNING APPLICATIONS • GameTheory and Multi-Agent Interaction • Robotics • Computer Networking • Vehicular Navigation • Industrial Logistic 9
  • 10.
  • 11.
    NEURAL NETWORKS What isa Neural Network? A neural network is a set of connected nodes (grouped in one or more layers). Each node can take a set of inputs, applies weight to them and calculate an output value. These output values are the input for the next layer of nodes. What we call “nodes” are in reality large matrices being kept in memory. A layer is a collection of matrices. 11
  • 12.
    DIFFERENT MODELS OF NETWORKS Stateless Thealgorithm has no memory, there is no effectivity to respond to patterns over time. Stateful The algorithm saves a set of the internal calculation, and this is re-used the next time as part of the input. It has memory. It can produce a result based not only on current data but also on previously computed data. 12
  • 13.
    MACHINE LEARNING TASKS Classification Theoutput is a classification (i.e. Spam or Not Spam). This is an example of Supervised learning, the classes are all known beforehand. Dimensionality Reduction Reduces the dimensions of the input data, in order to simplify a problem, and to filter out outliers and random variables (Variables that are not functional to the statistical solution of the problem). Regression The output is a continuous value, a probability value (0 to 1) for each input class. Naturally, the sum of all probabilities must amount to 1. 13 Clustering Grouping of information. Similar to Classification, but on an Unsupervised network. Information is grouped in classes, unknown at the start of the process.
  • 14.
  • 15.
    15 Sure, easy GISlookup, give me a few hours! When a user takes a photo, the APP should check whether they are in a National Park … … and check whether the photo is of a bird. I will need a research team and five years. Ref: https://xkcd.com/1425/
  • 16.
  • 17.
  • 18.
    TOOLS OpenCV Computer Vision. • Edgedetection. • Image transformations (depth, size, shape, etc.) • Accessing camera feeds. • Filtering images (applying all types of filters) It has implementations for c++, Java, Python, Android and IOS. Also there is a component called Emgu, which is a port for .NET applications. Scipy Open Source python ecosystem of software for mathematics, science and engineering. Tensorflow Google Deep Learning library. It provides method for handling Data input / output, construct a ML model (with many different options) and adding all kinds of configurable layers. 18 TFLearn Python wrapper around Tensorflow. Exposes a simplified library allowing easier scripting and modeling of Neural Networks, handling data sets, etc. Python Powerful scripting Language. Supports multithreading, 64 bits, etc. Anaconda Anaconda provides work environment isolation and package management for Python. Multiple environments can be defined, each one with a different Python version and modules loaded. Tensorbox Java desktop application that enables monitoring training of the Neural Networks in real time.
  • 19.
    MODEL SELECTED Learning Type: Supervised Learning Clear classification, known beforehand. The only result expected is a classification whithin a restricted universe (Just three classes). There are no other classes allowed. Learning Task : Regression Having a probability value allows for thresholding of the final result (fine tunning). The final user could decide to adjust the value for reducing either “false positives” or “true negatives”. 19
  • 20.
    DATA PREPARATION Images ofboth sides of One Peso and Two Pesos current Arengentine coins (Most ordinary, not special editions). All images where converted to 128x128 size and also to 24 Bits Per Pixel (this is important, it will determine the dimensions of the matrices in the Tensorflow Vectors). So, ten classes (Two for each denomination, side A and B), with a total of 451 images. Each image is rotated every 15 degrees, and each resultant image is augmented in brightness 4 times (So each image, results in 96 images). Final data set, 43296 images. 30 % of this set is used for validation. 20
  • 21.
  • 22.
    Neural Network Model ConvolutionalNeural Network Architecture • 1st Layer: Convolutional, Max Pooling, Relu • 2nd Layer: Convolutional, Max Pooling, Relu • 3rd Layer: Convolutional, Max Pooling, Relu • Layer Flattening • Fully Connected Layer • Fully Connected Layer (With Number of Nodes = Number of Classes) • Softmax 22
  • 23.
    DETECTION APP 23 Circle detectionis done using OpenCV HoughCircles function. 1 2 The image to compare to the trained model has to be as similar as those used to train the model in the first place. 1 2
  • 24.
    REFERENCES LINKS: OpenCV : http://opencv.org Tensorflow:https://tensorflow.org TFLearn: http://tflearn.org Anaconda: https://anaconda.org/anaconda/python Scipy: https://www.scipy.org Emgu: http://www.emgu.com 24
  • 25.