Deep learning
1
Machine Learning: Rappel
2
Machine Learning
– Machine Learning is the ability to teach a computer without explicitly
programming it
– Examples are used to train computers to perform tasks that would be
difficult to program
3
Types of Machine Learning
– Supervised Learning
– Training data is labeled
– Goal is correctly label new data
– Reinforcement Learning
– Training data is unlabeled
– System receives feedback for its actions
– Goal is to perform better actions
– Unsupervised Learning
– Training data is unlabeled
– Goal is to categorize the observations
4
Applications of Machine Learning
– Handwriting Recognition
– convert written letters into digital letters
– Language Translation
– translate spoken and or written languages (e.g. Google Translate)
– Speech Recognition
– convert voice snippets to text (e.g. Siri, Cortana, and Alexa)
– Image Classification
– label images with appropriate categories (e.g. Google Photos)
– Autonomous Driving
– enable cars to drive
5
Features in Machine Learning
– Features are the observations that are used to form predictions
– For image classification, the pixels are the features
– For voice recognition, the pitch and volume of the sound samples are the features
– For autonomous cars, data from the cameras, range sensors, and GPS are features
– Extracting relevant features is important for building a model
– Time of day is an irrelevant feature when classifying images
– Time of day is relevant when classifying emails because SPAM often occurs at night
– Common Types of Features in Robotics
– Pixels (RGB data)
– Depth data (sonar, laser rangefinders)
– Movement (encoder values)
– Orientation or Acceleration (Gyroscope, Accelerometer, Compass)
6
Measuring Success for Classification
– True Positive: Correctly identified as relevant
– True Negative: Correctly identified as not relevant
– False Positive: Incorrectly labeled as relevant
– False Negative: Incorrectly labeled as not relevant
7
Example: Identify Cats
Prediction:
Image:
True True False False
Positive Negative Negative Positive
Images from the STL-10 dataset
8
Precision, Recall, and Accuracy
– Precision
– Percentage of positive labels that are correct
– Precision = (# true positives) / (# true positives + # false positives)
– Recall
– Percentage of positive examples that are correctly labeled
– Recall = (# true positives) / (# true positives + # false negatives)
– Accuracy
– Percentage of correct labels
– Accuracy = (# true positives + # true negatives) / (# of samples)
9
Training and Test Data
– Training Data
– data used to learn a model
– Test Data
– data used to assess the accuracy of model
– Overfitting
– Model performs well on training data but poorly on test data
10
Bias and Variance
– Bias: expected difference between model’s prediction and truth
– Variance: how much the model differs among training sets
– Model Scenarios
– High Bias: Model makes inaccurate predictions on training data
– High Variance: Model does not generalize to new datasets
– Low Bias: Model makes accurate predictions on training data
– Low Variance: Model generalizes to new datasets
11
Supervised Learning Algorithms
– Linear Regression
– Decision Trees
– Support Vector Machines
– K-Nearest Neighbor
– Neural Networks
12
Supervised Learning Frameworks
Tool Uses Language
Scikit-Learn Classification, Regression, Python
Clustering
Spark MLlib Classification, Regression, Scala, R, Java
Clustering
Weka Classification, Regression, Java
Clustering
Caffe Neural Networks C++, Python
TensorFlow Neural Networks Python
13
Introduction to Neural Networks
14
Biological Inspiration
15
Neural Network Architecture
Input Layer Hidden Layer Output Layer
Neuron
Synapse
16
Neuron
17
Activation Functions
– Activation Functions are applied to the inputs at each neuron
– A common activation function is the Sigmoid
18
Inference
H1 Weights = (1.0, -2.0, 2.0)
0.5 H1 H2 Weights = (2.0, 1.0, -4.0)
H3 Weights = (1.0, -1.0, 0.0)
O1 O1 Weights = (-3.0, 1.0, -3.0)
O2 Weights = (0.0, 1.0, 2.0)
0.9 H2
O2
-0.3 H3
19
Inference
H1 Weights = (1.0, -2.0, 2.0)
0.5 .13 H2 Weights = (2.0, 1.0, -4.0)
H3 Weights = (1.0, -1.0, 0.0)
O1 O1 Weights = (-3.0, 1.0, -3.0)
O2 Weights = (0.0, 1.0, 2.0)
0.9 .96
O2
-0.3 .40
H1 = S(0.5 * 1.0 + 0.9 * -2.0 + -0.3 * 2.0) = S(-1.9) = .13
H2 = S(0.5 * 2.0 + 0.9 * 1.0 + -0.3 * -4.0) = S(3.1) = .96
H3 = S(0.5 * 1.0 + 0.9 * -1.0 + -0.3 * 0.0) = S(-0.4) = .40
20
Inference
H1 Weights = (1.0, -2.0, 2.0)
0.5 .13 H2 Weights = (2.0, 1.0, -4.0)
H3 Weights = (1.0, -1.0, 0.0)
.35 O1 Weights = (-3.0, 1.0, -3.0)
O2 Weights = (0.0, 1.0, 2.0)
0.9 .96
.85
-0.3 .40
O1 = S(.13 * -3.0 + .96 * 1.0 + .40 * -3.0) = S(-.63) = .35
O1 = S(.13 * 0.0 + .96 * 1.0 + .40 * 2.0) = S(1.76) = .85
21
Matrix Formulation
H1 Weights = (1.0, -2.0, 2.0)
H2 Weights = (2.0, 1.0, -4.0)
H3 Weights = (1.0, -1.0, 0.0)
Hidden Layer Weights Inputs
1.0 -2.0 2.0 0.5 Hidden Layer Outputs
S( 2.0 1.0 -4.0
* 0.9 ) = S( -1.9 3.1 -0.4 )= .13 .96 0.4
1.0 -1.0 0.0 -0.3
22
Training Neural Networks
– Procedure for training Neural Networks
– Perform inference on the training set
– Calculate the error between the predictions and actual labels of the training set
– Determine the contribution of each Neuron to the error
– Modify the weights of the Neural Network to minimize the error
– Error contributions are calculated using Backpropagation
– Error minimization is achieved with Gradient Descent
23
Backpropagation
– Problem: Which weights should be updated and by how much?
– Insight: Use the derivative of the error with respect to weight to assign “blame”
24
Backpropagation Example
I
w
0.5 .13 O
T (Ground Truth)
.35 0.9
0.9 .96
.85
-
.40
0.3
25
Gradient Descent
– Gradient Descent minimizes the neural network’s error
– At each time step the error of the network is calculated on the training data
– Then the weights are modified to reduce the error
– Gradient Descent terminates when
– The error is sufficiently small
– The max number of time steps has been exceeded
26
Convolutional Neural Networks
27
Convolutional Neural Networks
28
Max-Pooling
1 0 2 2
1 3 0 1 3 2
2x2 Max Pooling
3 1 4 1 3 4
2 0 2 1
29
to see
– [Link]
– [Link]
course/backprop-scroll/
30