San Francisco AI
SF AI & Emerging Tech
SF East Bay AI and Emerging Tech (Berkeley)
Organizers:
Mia Dand
Manas Mudbari
Federico Gobbi
Rae
100 Women in AI Ethics
Predictions for 2019
AI/Machine Learning 101: Demystifying DNNs
Rosie Campbell, Assistant Director of the Center for Human-Compatible AI (CHAI) at UC Berkeley. Rosie previously worked as a research engineer at the BBC and co-founded a thriving futurist group in the UK. She is an aspiring rationalist, effective altruist, and is a pioneer in exploring how emerging technologies can shape a positive future.
Thank you!
More information:
Twitter: @RosieCampbell Email: rosiecampbell@berkeley.edu
PSA: Please take your empty plates/glasses with you :)
**Take a few minutes to rate this meetup**
Demystifying Deep �Neural Networks
@RosieCampbell
CONTENTS
@RosieCampbell
INTRODUCTION
Context:
@RosieCampbell
WHO AM I?
BSc Physics (& Philosophy)
MSc Computer Science
Research Engineer at BBC R&D
Machine Learning PhD (Dropout)
Founder of Manchester Futurists
Assistant Director of the Center for Human-Compatible AI at UC Berkeley
@RosieCampbell
HISTORY
1940s - 1960s �Cybernetics
1980s - 1990s �Connectionism
~2006 - now �Deep Learning
@RosieCampbell
CONTENTS
@RosieCampbell
RECOGNIZING A CAT
Conventional Computing:�
IF (furry) AND
IF (has tail) AND
IF (has 4 legs) AND
IF (has pointy ears) AND
Etc…
@RosieCampbell
RECOGNIZING A CAT
Neural Networks:
Cats
Not cats
@RosieCampbell
CONVENTIONAL COMPUTING �VS NEURAL NETS
Source: kevinbinz.com
@RosieCampbell
A RULE OF THUMB
Good at things that �humans are good at �(e.g. pattern matching)
Bad at things that �computers are good at �(e.g. maths)
Neural Networks are:
@RosieCampbell
CONTENTS
@RosieCampbell
A TRIVIAL EXAMPLE
Shall I go to the festival?
Will the weather be nice?
What’s the music like?
Do I have anyone to go with?
Can I afford it?
Do I need to write my thesis?
Will I like the food?
@RosieCampbell
A SINGLE NEURON
Weather
Music
Company
Money
Importance
Importance
Importance
Importance
Is
total �over a certain�Threshold�?
Answer
@RosieCampbell
A SINGLE NEURON
Score �(out of 4)
Importance
(out of 4)
3
2
4
2
12
4
8
2
> 25?
Yes!
Weather
Music
Company
Money
4
2
2
1
26
@RosieCampbell
A SINGLE NEURON
Move this to the other side of the equation
Score �(out of 4)
Importance
(out of 4)
3
2
4
2
12
4
8
2
> 25?
Yes!
Weather
Music
Company
Money
4
2
2
1
26
@RosieCampbell
A SINGLE NEURON
Score �(out of 4)
Importance
(out of 4)
3
2
4
2
12
4
8
2
> 0?
Yes!
Weather
Music
Company
Money
4
2
2
1
1
-25
@RosieCampbell
A SINGLE NEURON
Input
Input
Input
Input
Weight
Weight
Weight
Weight
Output
Activation�function
Bias
@RosieCampbell
A SINGLE NEURON
Bias
Input
Input
Input
Input
Weight
Weight
Weight
Weight
Output
Activation�function
@RosieCampbell
CONTENTS
@RosieCampbell
A NEURAL NETWORK
Input�layer
Hidden
layer
Output
layer
Each of these blobs is a neuron
@RosieCampbell
A DEEP NEURAL NETWORK
Input
layer
Hidden
layer
Output �layer
Hidden
layer
Each of these blobs is a neuron
@RosieCampbell
ACTIVATION FUNCTIONS
Step
Sigmoid
ReLU
What we’ve used so far
Popular historically
Popular these days
@RosieCampbell
A SINGLE NEURON
Input
Input
Input
Input
Weight
Weight
Weight
Weight
Output
Activation�function
Bias
Those graphs go here
@RosieCampbell
Isn’t it all just simple arithmetic then?!
@RosieCampbell
CONTENTS
@RosieCampbell
TRAINING THE NETWORK
(The short version)
@RosieCampbell
TRAINING THE NETWORK
Input
layer
Hidden
layer
Output �layer
Hidden
layer
62% Dog
38% Cat
It should be 100% Cat :(
(The short version)
@RosieCampbell
TRAINING THE NETWORK
Input
layer
Hidden
layer
Output �layer
Hidden
layer
62% Dog
38% Cat
It should be 100% Cat :(
Go backwards and nudge weights to increase Cat probability
(The short version)
@RosieCampbell
(The long version)
How do we know how wrong the network is?
We measure the difference between the network’s output and the correct output using the ‘Loss Function’
TRAINING THE NETWORK
@RosieCampbell
THE LOSS FUNCTION
Sometimes called the ‘error’, ‘energy’ or ‘cost’ function�
A simple example is �‘mean squared error’
@RosieCampbell
THE LOSS FUNCTION
Just think of it as:
The difference between what the network should output and what it does output
The goal of training is to find values for the weights and biases that minimize the loss function
@RosieCampbell
MINIMIZING THE LOSS FUNCTION
Source: firsttimeprogrammer.blogspot.co.uk
Loss
Weights
Starting here
We want to get to here
Weights
@RosieCampbell
MINIMIZING THE LOSS FUNCTION
Starting here
Where is the lowest point?!
@RosieCampbell
GRADIENT DESCENT
Find the direction of the steepest slope downwards, �and take a small step by nudging the weights
@RosieCampbell
GRADIENT DESCENT
Starting here
Cat
Dog
Network predictions
@RosieCampbell
GRADIENT DESCENT
Starting here
Cat
Dog
Network predictions
@RosieCampbell
GRADIENT DESCENT
Starting here
Cat
Dog
Network predictions
@RosieCampbell
GRADIENT DESCENT
Starting here
Cat
Dog
Network predictions
@RosieCampbell
GRADIENT DESCENT
Starting here
Cat
Dog
Network predictions
@RosieCampbell
GRADIENT DESCENT
Starting here
Cat
Dog
Network predictions
@RosieCampbell
GRADIENT DESCENT
Starting here
Cat
Dog
Network predictions
@RosieCampbell
GRADIENT DESCENT
Starting here
Cat
Dog
Network predictions
@RosieCampbell
GRADIENT DESCENT
Starting here
Can’t get any lower. �We made it!
Cat
Dog
Network predictions
@RosieCampbell
Back Propagation
@RosieCampbell
Phew!
@RosieCampbell
IN PRACTICE...
TensorFlow takes care of (most of) it! 🎉
(Other libraries are available...)
@RosieCampbell
CONTENTS
@RosieCampbell
CONVOLUTIONAL NEURAL NETWORKS
ConvNets take advantage of structure in input data
Images have a 2D structure
So ConvNets are great for image processing �and computer vision tasks
@RosieCampbell
IMAGES ARE 2D ARRAYS OF NUMBERS
0 | 0 | 0 |
0.8 | 0 | 0 |
1 | 0 | 0 |
@RosieCampbell
CONVOLUTION
1 | 0 | 1 |
0 | 1 | 0 |
1 | 0 | 1 |
Pass an array of numbers
(known as a ‘kernel filter’)
Over every pixel
Multiply and add together to get new value at that pixel
Source: ufldl.stanford.edu
@RosieCampbell
EXAMPLES
Images by Michael Plotke (Wikimedia Commons)
1 | 1 | 1 |
1 | 1 | 1 |
1 | 1 | 1 |
0 | -1 | 0 |
-1 | 5 | -1 |
0 | -1 | 0 |
-1 | -1 | -1 |
-1 | 8 | -1 |
-1 | -1 | -1 |
Original:
Blur:
1
9
Sharpen:
Edge detect:
@RosieCampbell
A NEURAL NET
Input
Input
Input
Input
Weight
Weight
Weight
Weight
Output
Activation�function
Bias
Add them all up
Put through the activation function
Output result
Take some inputs
Multiply by weights
@RosieCampbell
A CONVNET
Output
array
Activation�function
W | W | W |
W | W | W |
W | W | W |
Shared kernel filter
Input
array
Input
array
Input
array
Input
array
Convolution operator
Bias
Take some inputs
Multiply by weights
Add them all up
Put through the activation function
Output result
@RosieCampbell
IMAGENET CHALLENGE
Source: kaggle.com
@RosieCampbell
IMAGENET CHALLENGE
Deep ConvNet introduced
Percentage error
Until 2011, a good result was 25% error.
In 2012, ConvNets were introduced and the error plummeted to just 15.3%!
@RosieCampbell
IMAGENET CHALLENGE
Deep ConvNet introduced
Percentage error
@RosieCampbell
INSIDE A CONVNET
Early layers
Mid layers
Later layers
Source: xlgps.com
@RosieCampbell
CONTENTS
@RosieCampbell
SEPARATING STYLE FROM CONTENT
Source: Gatys et al, ‘A Neural Algorithm of Artistic Style’, 2015
@RosieCampbell
SEPARATING STYLE FROM CONTENT
@RosieCampbell
ADVERSARIAL EXAMPLES
Truck
Imperceptible distortion
Ostrich
Source: karpathy.github.io
@RosieCampbell
ADVERSARIAL EXAMPLES
100.0% Goldfish
Source: karpathy.github.io
@RosieCampbell
GOOGLE’S DEEP DREAM
@RosieCampbell
GOOGLE’S DEEP DREAM
Before
After
Source: fromthegrapevine.com
@RosieCampbell
Source: telegraph.co.uk
@RosieCampbell
@RosieCampbell
Source: killscreen.com
@RosieCampbell
So many dogs!?
@RosieCampbell
Pitfalls
@RosieCampbell
CONTENTS
@RosieCampbell
AI ETHICS & SAFETY
@RosieCampbell
ORGANIZATIONS
@RosieCampbell
CONTINUED BREAKTHROUGHS
@RosieCampbell
CONTENTS
@RosieCampbell
Unsupervised learning
Reinforcement Learning
Pooling
Strides
Stochastic & batch training
One hot encoding
Dropout
Regularisation
Recurrent neural nets
Generative adversarial nets
Transfer learning
STUFF WE HAVEN’T COVERED...
...and tons more.
BUT
@RosieCampbell
@RosieCampbell
Construct these with TensorFlow
@RosieCampbell
Construct these with TensorFlow
Good Luck!
@RosieCampbell
THANK YOU!
Blog post
bit.ly/deep-neural-networks
�Resources
tensorflow.org
karpathy.github.io
deeplearningbook.org
dataskeptic.com/podcast�neuralnetworksanddeeplearning.com
online.stanford.edu/courses/cs229-machine-learning
kadenze.com/courses/creative-applications-of-deep-learning-with-tensorflow-iv
@RosieCampbell