Theory 0
Theory 0
Theory 0
Practice:
Consider the following image I, represented as a matrix:
1 1 1 1
1 1 2 1
I= 1 −3 −4 1
1 1 1 1
Max Pooling divides the input image into sections of a given size and returns
the biggest value in each section. Apply valid Max Pooling with a filter size of
(2, 2) on the result of the previous task.
1
Task 0.4 Flattening
Theoretical Background
Softmax operation transforms the raw output of the network into probabili-
ties. The highest number after softmax is selected as the output class. Practice:
Apply softmax to the output of the previous task and determine the output
class.
P
Hinge Loss (or SVM Loss) SV M (y, j) = i|i̸=j max(0, yi − yj + 1)
Task: Consider the following two vectors: g = [0, 1, 0] y = [0.25, 0.6, 0.15]
Calculate the values:
• Cross-Entropy Loss
• Mean Squared Error Loss
• Hinge Loss
Resources:
• What’s an intuitive way to think of cross entropy?
2
• Section 3.13 from the Deep Learning Book
• Notes from CS231n
Evaluation Metrics
Task 0.1 Theoretical Foundations
Typically people refer to accuracy as THE evaluation metric, but there are a
lot of evaluation metrics which can be better suited than accuracy depending
on the task/dataset.
Given the following prediction and ground truth (note: this is a multi-class
and multi-label scenario!), where B stays for background, T for text, D for dec-
oration and C for comment.
1 2 3 4 5 6 7 8
GT B T B B TD TD TD TD
P B B TD BD BC TC T TD
Compute the class frequencies and the following metrics per class:
• Jaccard Index
• Precision
• Recall
• F1-measure
Then compute their mean in two different ways: once with class balance
(sum of per class values divided by number of classes) and once with the class
frequencies
3
Resources:
• Jaccard Index (or Intersection over Union): https://en.wikipedia.org/
wiki/Jaccard_index
• Exact Match (and others metrics): https://en.wikipedia.org/wiki/
Multi-label_classification
• Precision and Recall: https://en.wikipedia.org/wiki/Precision_and_
recall