Machine Learning
IS
* (because the tools will do most of the work)
Easy!
INSANELY
Easy!
INSANELY
Easy!
Doing Hard Stuff
Can be
Easy
* ...if you have the right tools and know how to use them
Machine Learning Is Hard!
It’s common knowledge.
* everybody.knows/already
Machine Learning
Machine Learning Is Easy!
“
”
Machine learning is a type of artificial intelligence (AI)
Machine learning is a type of artificial intelligence (AI) that provides computers with the ability to learn without being explicitly programmed.
whatis.techtarget.com/definition/machine-learning
Machine learning
Machine Learning Is Easy!
Where would you use that?
Machine Learning Is Easy!
Machine learning tasks
Machine Learning Is Easy!
* typically supervised
Machine learning tasks
Machine Learning Is Easy!
Machine learning tasks
* also typically supervised
Machine Learning Is Easy!
Machine learning tasks
* Unlike in classification, the groups are not known beforehand, making this typically an unsupervised task.
Machine learning tasks
Machine Learning Is Easy!
Machine learning tasks
Machine Learning Is Easy!
https://en.wikipedia.org/wiki/Machine_learning
Machine learning tasks
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
Machine Learning Is Easy!
Approaches
https://en.wikipedia.org/wiki/Machine_learning
Machine Learning Is Easy!
Bear with me just a few more minutes
Machine Learning Is Easy!
http://www.dictionary.com/browse/artificial-neural-network
A neural network is a processing device, either an algorithm or actual hardware, whose design was inspired by the design and functioning of animal brains
Machine Learning Is Easy!
http://www.dictionary.com/browse/artificial-neural-network
A network of many very simple processors ("units" or "neurons"), each possibly having a (small amount of) local memory.
Machine Learning Is Easy!
http://www.dictionary.com/browse/artificial-neural-network
The units are connected by unidirectional communication channels ("connections"), which carry numeric data.
Machine Learning Is Easy!
http://www.dictionary.com/browse/artificial-neural-network
The units operate only on their local data and on the inputs they receive via the connections.
Machine Learning Is Easy!
https://en.wikipedia.org/wiki/Artificial_neural_network
These systems are self-learning and trained, rather than explicitly programmed
Machine Learning Is Easy!
Three prominent learning paradigms:
Machine Learning Is Easy!
Machine Learning Is Easy!
Machine Learning Is Easy!
Machine Learning Is Easy!
Enough with the theory. What now?
Machine Learning Is Easy!
Train a Neural Network
...to do what?
Data classification
...of hand-written characters
Machine Learning Is Easy!
Our task:
Train a network to recognize hand-written numeric digits
Machine Learning Is Easy!
Where to start?
We have 10,000 examples to train with
With the MNIST data set
http://yann.lecun.com/exdb/mnist/
Machine Learning Is Easy!
Designing a network
A neural network may have any number of layers
Machine Learning Is Easy!
Designing a network
We will start with a simple one-layer network
Machine Learning Is Easy!
Designing a network
Each "neuron" in a neural network does a weighted sum of all of its inputs, adds a constant called the "bias" and then feeds the result through some non-linear activation function.
Machine Learning Is Easy!
Designing a network
Machine Learning Is Easy!
How does the network process input?
Machine Learning Is Easy!
How does the network process input?
Machine Learning Is Easy!
How does the network process input?
Machine Learning Is Easy!
Almost there!
...but it has been proven to be useful to also introduce a “bias” offset
http://stackoverflow.com/questions/2480650/role-of-bias-in-neural-networks?lq=1
Machine Learning Is Easy!
...and lastly...
It is also helpful to transform the output of the system to “accentuate” the classification
L = fa(X.W + b)
https://www.quora.com/What-is-the-role-of-the-activation-function-in-a-neural-network
Machine Learning Is Easy!
The activation function
For classification problems, the softmax function has been shown to be effective
(...and, lastly…)
Machine Learning Is Easy!
Told you it was easy.
Now you know neural networks. You’re welcome!
That’s it.
Machine Learning Is Easy!
Ok, let’s do it!
Um. Where do we start?
Machine Learning Is Easy!
...I don’t want to do a bunch of complicated matrix algebra...
It’s ok.
You don’t have to.
Machine Learning Is Easy!
Train a Neural Network
“That looks like a product logo.”
“He’s probably selling something.”
Machine Learning Is Easy!
What’s TensorFlow ?
TensorFlow is an open source software library for machine learning in various kinds of perceptual and language understanding tasks.
https://en.wikipedia.org/wiki/TensorFlow
Machine Learning Is Easy!
What’s TensorFlow ?
It is currently used for both research and production by [at least] 50 different teams in dozens of commercial products, such as speech recognition, Gmail, Google Photos, and search.
https://en.wikipedia.org/wiki/TensorFlow
Machine Learning Is Easy!
What’s TensorFlow ?
TensorFlow was originally developed by the Google Brain team for Google's research and production purposes and later released under the Apache 2.0 open source license on November 9, 2015.
https://en.wikipedia.org/wiki/TensorFlow
Machine Learning Is Easy!
...and what’s a “Tensor” again ?
A "tensor" is like a matrix but with an arbitrary number of dimensions. A 1-dimensional tensor is a vector. A 2-dimensional tensor is a matrix. And then you can have tensors with 3, 4, 5 or more dimensions.
Machine Learning Is Easy!
Wanna see TensorFlow at work?
Try the TensorFlow Playground
http://playground.tensorflow.org/
Machine Learning Is Easy!
So... TensorFlow is a web tool?
Machine Learning Is Easy!
TensorFlow : get started (Mac)
Python
Install the latest version of python 3 from https://www.python.org/downloads/
TensorFlow
pip3 install --upgrade tensorflow
MatPlotLib
pip3 install --upgrade matplotlib
Machine Learning Is Easy!
TensorFlow : get started (Windows)
Anaconda, Python
https://www.continuum.io/downloads#windows
Anaconda comes with matplotlib built in.
TensorFlow
(in the anaconda shell)
pip3 install --upgrade tensorflow
Machine Learning Is Easy!
Now get the example project
$ git clone …
https://github.com/martin-gorner …
/tensorflow-mnist-tutorial
Machine Learning Is Easy!
See this exercise online
Machine Learning Is Easy!
There are 50,000 training digits in this dataset.
We feed 100 digits into the training loop each iteration
Thus the system will have seen all the training digits once after 500 iterations. We call this an "epoch".
Machine Learning Is Easy!
Can we make it work better?
Add Layers
mnist_2.0_five_layers_sigmoid.py
Machine Learning Is Easy!
Now we’re getting somewhere. What next?
Learning rate decay
mnist_2.1_five_layers_relu_lrdecay.py
Machine Learning Is Easy!
What happens if we train the network “too well”?
Overfitting
Dropout!
Overfitting
mnist_2.2_five_layers_relu_lrdecay_dropout.py
Machine Learning Is Easy!
Is there a more optimal way to train for two-dimensional input?
Machine Learning Is Easy!
Core Building Block:
the convolutional layer
Convolutional Neural Networks
Machine Learning Is Easy!
small receptive field
Convolutional Neural Networks
Machine Learning Is Easy!
Forward pass:
dot product between the filter and the input
Convolutional Neural Networks
Machine Learning Is Easy!
Learns filters that activate when it detects some specific type of feature at some spatial position in the input.
Convolutional Neural Networks
Machine Learning Is Easy!
Applying CNN’s to the MNIST data:
98%
Convolutional Neural Networks
mnist_3.0_convolutional.py
Machine Learning Is Easy!
Wow -- 98% accuracy.
Can we do better?
More COWBELL!
DROPOUT
DROPOUT !
Machine Learning Is Easy!
Considerations?
Machine Learning Is Easy!
Applications?
Machine Learning Is Easy!
(Mic dropped)
That’s it. Thanks!
Special thanks to
Martin Görner
Twitter: @martin_gorner
Google +: plus.google.com/+MartinGorner