SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
[course site]
Javier Ruiz Hidalgo
javier.ruiz@upc.edu
Associate Professor
Universitat Politecnica de Catalunya
Technical University of Catalonia
Loss functions
#DLUPC
Me
● Javier Ruiz Hidalgo
○ Email: j.ruiz@upc.edu
○ Office: UPC, Campus Nord, D5-008
● Teaching experience
○ Basic signal processing
○ Image processing & computer vision
● Research experience
○ Master on hierarchical image representations by UEA (UK)
○ PhD on video coding by UPC (Spain)
○ Interests in image & video coding, 3D analysis and super-resolution
2
Outline
● Introduction
○ Definition, properties, training process
● Common types of loss functions
○ Regression
○ Classification
● Regularization
● Example
3
Definition
In a supervised deep learning context the loss
function measures the quality of a particular
set of parameters based on how well the output
of the network agrees with the ground truth
labels in the training data.
4
Nomenclature
loss function
cost function
objective function
error function
5
=
=
=
Loss function (1)
6
How good does
our network with
the training data?
labels (ground truth)
input
parameters (weights, biases)error
Deep Network
input output
Loss function (2)
● The loss function does not want to measure
the entire performance of the network
against a validation/test dataset.
● The loss function is used to guide the
training process in order to find a set of
parameters that reduce the value of the loss
function.
7
Training process
Stochastic gradient descent
● Find a set of parameters which make the loss as small
as possible.
● Change parameters at a rate determined by the partial
derivatives of the loss function:
8
Properties (1)
● Minimum (0 value) when the output of the
network is equal to the ground truth data.
● Increase value when output differs from
ground truth.
9
Properties (2)
10
● Ideally → convex function
● In reality → some many
parameters (in the order of
millions) than it is not
convex
○ Varies smoothly with changes on the output
■ Better gradients for gradient descent
■ Easy to compute small changes in the
parameters to get an improvement in the
loss
Assumptions
● For backpropagation to work:
○ Loss function can be written as an average over loss
functions for individual training examples:
○ Loss functions can be written as a function of the
output activations from the neural network.
11Neural Networks and Deep Learning
empirical risk
Outline
● Introduction
○ Definition, properties, training process
● Common types of loss functions
○ Regression
○ Classification
● Regularization
● Example
12
Common types of loss functions (1)
● Loss functions depen on the type of task:
○ Regression: the network predicts continuous,
numeric variables
■ Example: Length of fishes in images,
temperature from latitude/longitud
■ Absolute value, square error
13
Common types of loss functions (2)
● Loss functions depen on the type of task:
○ Classification: the network predicts categorical
variables (fixed number of classes)
■ Example: classify email as spam, predict student
grades from essays.
■ hinge loss, Cross-entropy loss
14
Absolute value, L1-norm
● Very intuitive loss function
○ produces sparser solutions
■ good in high dimensional spaces
■ prediction speed
○ less sensitive to outliers
15
Square error, Euclidean loss, L2-norm
● Very common loss function
○ More precise and better than L1-norm
○ Penalizes large errors more strongly
○ Sensitive to outliers
16
Outline
● Introduction
○ Definition, properties, training process
● Common types of loss functions
○ Regression
○ Classification
● Regularization
● Example
17
Classification (1)
We want the network to classify the input into a
fixed number of classes
18
class “1”
class “2”
class “3”
Classification (2)
● Each input can have only one label
○ One prediction per output class
■ The network will have “k” outputs (number of
classes)
19
0.1
2
1
class “1”
class “2”
class “3”
input
Network
output
scores / logits
Classification (3)
● How can we create a loss function to
improve the scores?
○ Somehow write the labels (ground truth of the data)
into a vector → One-hot encoding
○ Non-probabilistic interpretation → hinge loss
○ Probabilistic interpretation: need to transform the
scores into a probability function → Softmax
20
Softmax (1)
● Convert scores into probabilities
○ From 0.0 to 1.0
○ Probability for all classes adds to 1.0
21
0.1
2
1
input
Network
output
scores / logits
0.1
0.7
0.2
probability
Softmax (2)
● Softmax function
22
0.1
2
1
input
Network
output
scores / logits
0.1
0.7
0.2
probability
scores (logits)
Neural Networks and Deep Learning (softmax)
One-hot encoding
● Transform each label into a vector (with only 1
and 0)
○ Length equal to the total number of classes “k”
○ Value of 1 for the correct class and 0 elsewhere
23
0
1
0
class “2”
1
0
0
class “1”
0
0
1
class “3”
Cross-entropy loss (1)
24
0.1
2
1
input
Network
output
scores / logits
0.1
0.7
0.2
probability
0
1
0
label
Cross-entropy loss (2)
25
Cross-entropy loss (3)
● For a set of n inputs
26
labels (one-hot)
Softmax
Cross-entropy loss (4)
● In general, cross-entropy loss works better than
square error loss:
○ Square error loss usually gives too much emphasis to
incorrect outputs.
○ In square error loss, as the output gets closer to either 0.0
or 1.0 the gradients get smaller, the change in weights gets
smaller and training is slower.
27
Multi-label classification (1)
● Outputs can be matched to more than one label
○ “car”, “automobile”, “motor vehicle” can be applied to a same image of a car.
● Use sigmoid at each output independently instead of softmax
28
Multi-label classification (2)
● Cross-entropy loss for multi-label classification:
29
Outline
● Introduction
○ Definition, properties, training process
● Common types of loss functions
○ Regression
○ Classification
● Regularization
● Example
30
Regularization
● Control the capacity of the network to prevent
overfitting
○ L2-regularization (weight decay):
○ L1-regularization:
31
regularization parameter
Outline
● Introduction
○ Definition, properties, training process
● Common types of loss functions
○ Regression
○ Classification
● Regularization
● Example
32
Example
33Why you should use cross-entropy instead of classification error
0.1 0.3 0.3
0.2 0.4 0.3
0.7 0.3 0.4
“1” “2” “3”
1 0 0
0 1 0
0 0 1
0.3 0.1 0.1
0.4 0.7 0.2
0.3 0.2 0.7
“1” “2” “3”
1 0 0
0 1 0
0 0 1
Classification accuracy = 2/3
cross-entropy loss = 4.14
Classification accuracy = 2/3
cross-entropy loss = 1.92
References
● About loss functions
● Neural networks and deep learning
● Are loss functions all the same?
● Convolutional neural networks for Visual Recognition
● Deep learning book, MIT Press, 2016
● On Loss Functions for Deep Neural Networks in
Classification
34
Thanks! Questions?
35
https://imatge.upc.edu/web/people/javier-ruiz-hidalgo

Weitere ähnliche Inhalte

Was ist angesagt?

Autoencoders
AutoencodersAutoencoders
AutoencodersCloudxLab
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent methodSanghyuk Chun
 
Multilayer perceptron
Multilayer perceptronMultilayer perceptron
Multilayer perceptronomaraldabash
 
Autoencoder
AutoencoderAutoencoder
AutoencoderHARISH R
 
Perceptron (neural network)
Perceptron (neural network)Perceptron (neural network)
Perceptron (neural network)EdutechLearners
 
Neural Networks: Multilayer Perceptron
Neural Networks: Multilayer PerceptronNeural Networks: Multilayer Perceptron
Neural Networks: Multilayer PerceptronMostafa G. M. Mostafa
 
Introduction to CNN
Introduction to CNNIntroduction to CNN
Introduction to CNNShuai Zhang
 
Dimensionality Reduction
Dimensionality ReductionDimensionality Reduction
Dimensionality Reductionmrizwan969
 
Machine learning clustering
Machine learning clusteringMachine learning clustering
Machine learning clusteringCosmoAIMS Bassett
 
Autoencoders in Deep Learning
Autoencoders in Deep LearningAutoencoders in Deep Learning
Autoencoders in Deep Learningmilad abbasi
 
Hyperparameter Tuning
Hyperparameter TuningHyperparameter Tuning
Hyperparameter TuningJon Lederman
 
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hakky St
 
Artificial neural network
Artificial neural networkArtificial neural network
Artificial neural networkmustafa aadel
 
Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)Gaurav Mittal
 
Regularization in deep learning
Regularization in deep learningRegularization in deep learning
Regularization in deep learningKien Le
 
Perceptron & Neural Networks
Perceptron & Neural NetworksPerceptron & Neural Networks
Perceptron & Neural NetworksNAGUR SHAREEF SHAIK
 
An overview of gradient descent optimization algorithms
An overview of gradient descent optimization algorithms An overview of gradient descent optimization algorithms
An overview of gradient descent optimization algorithms Hakky St
 
Machine Learning with Decision trees
Machine Learning with Decision treesMachine Learning with Decision trees
Machine Learning with Decision treesKnoldus Inc.
 

Was ist angesagt? (20)

Autoencoders
AutoencodersAutoencoders
Autoencoders
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent method
 
Multilayer perceptron
Multilayer perceptronMultilayer perceptron
Multilayer perceptron
 
Autoencoder
AutoencoderAutoencoder
Autoencoder
 
Perceptron (neural network)
Perceptron (neural network)Perceptron (neural network)
Perceptron (neural network)
 
Neural Networks: Multilayer Perceptron
Neural Networks: Multilayer PerceptronNeural Networks: Multilayer Perceptron
Neural Networks: Multilayer Perceptron
 
Activation function
Activation functionActivation function
Activation function
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent method
 
Introduction to CNN
Introduction to CNNIntroduction to CNN
Introduction to CNN
 
Dimensionality Reduction
Dimensionality ReductionDimensionality Reduction
Dimensionality Reduction
 
Machine learning clustering
Machine learning clusteringMachine learning clustering
Machine learning clustering
 
Autoencoders in Deep Learning
Autoencoders in Deep LearningAutoencoders in Deep Learning
Autoencoders in Deep Learning
 
Hyperparameter Tuning
Hyperparameter TuningHyperparameter Tuning
Hyperparameter Tuning
 
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
Hands-On Machine Learning with Scikit-Learn and TensorFlow - Chapter8
 
Artificial neural network
Artificial neural networkArtificial neural network
Artificial neural network
 
Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)Convolutional Neural Networks (CNN)
Convolutional Neural Networks (CNN)
 
Regularization in deep learning
Regularization in deep learningRegularization in deep learning
Regularization in deep learning
 
Perceptron & Neural Networks
Perceptron & Neural NetworksPerceptron & Neural Networks
Perceptron & Neural Networks
 
An overview of gradient descent optimization algorithms
An overview of gradient descent optimization algorithms An overview of gradient descent optimization algorithms
An overview of gradient descent optimization algorithms
 
Machine Learning with Decision trees
Machine Learning with Decision treesMachine Learning with Decision trees
Machine Learning with Decision trees
 

Ähnlich wie Loss functions (DLAI D4L2 2017 UPC Deep Learning for Artificial Intelligence)

DALL-E.pdf
DALL-E.pdfDALL-E.pdf
DALL-E.pdfdsfajkh
 
Deep Learning Module 2A Training MLP.pptx
Deep Learning Module 2A Training MLP.pptxDeep Learning Module 2A Training MLP.pptx
Deep Learning Module 2A Training MLP.pptxvipul6601
 
Eye deep
Eye deepEye deep
Eye deepsveitser
 
Deep learning
Deep learningDeep learning
Deep learningJin Sakuma
 
Deep MIML Network
Deep MIML NetworkDeep MIML Network
Deep MIML NetworkSaad Elbeleidy
 
Mirko Damiani - An Embedded soft real time distributed system in Go
Mirko Damiani - An Embedded soft real time distributed system in GoMirko Damiani - An Embedded soft real time distributed system in Go
Mirko Damiani - An Embedded soft real time distributed system in Golinuxlab_conf
 
Introduction to nand2 tetris
Introduction to nand2 tetrisIntroduction to nand2 tetris
Introduction to nand2 tetrisYodalee
 
Data Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLData Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLEDB
 
Important Concepts for Machine Learning
Important Concepts for Machine LearningImportant Concepts for Machine Learning
Important Concepts for Machine LearningSolivarLabs
 
Quantization and Training of Neural Networks for Efficient Integer-Arithmetic...
Quantization and Training of Neural Networks for Efficient Integer-Arithmetic...Quantization and Training of Neural Networks for Efficient Integer-Arithmetic...
Quantization and Training of Neural Networks for Efficient Integer-Arithmetic...Ryo Takahashi
 
Towards hasktorch 1.0
Towards hasktorch 1.0Towards hasktorch 1.0
Towards hasktorch 1.0Junji Hashimoto
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 Linaro
 
ICT FIRST LECTURE.pptx
ICT FIRST LECTURE.pptxICT FIRST LECTURE.pptx
ICT FIRST LECTURE.pptxjulitapelovello
 
Lcdf4 chap 03_p2
Lcdf4 chap 03_p2Lcdf4 chap 03_p2
Lcdf4 chap 03_p2ozgur_can
 
Computer Architecture and Organization
Computer Architecture and OrganizationComputer Architecture and Organization
Computer Architecture and Organizationssuserdfc773
 
Introduction to Machine Learning with Spark
Introduction to Machine Learning with SparkIntroduction to Machine Learning with Spark
Introduction to Machine Learning with Sparkdatamantra
 

Ähnlich wie Loss functions (DLAI D4L2 2017 UPC Deep Learning for Artificial Intelligence) (20)

DALL-E.pdf
DALL-E.pdfDALL-E.pdf
DALL-E.pdf
 
Deep Learning Module 2A Training MLP.pptx
Deep Learning Module 2A Training MLP.pptxDeep Learning Module 2A Training MLP.pptx
Deep Learning Module 2A Training MLP.pptx
 
Eye deep
Eye deepEye deep
Eye deep
 
Deep learning
Deep learningDeep learning
Deep learning
 
Deep MIML Network
Deep MIML NetworkDeep MIML Network
Deep MIML Network
 
Neural networks
Neural networksNeural networks
Neural networks
 
Auto Tuning
Auto TuningAuto Tuning
Auto Tuning
 
Mirko Damiani - An Embedded soft real time distributed system in Go
Mirko Damiani - An Embedded soft real time distributed system in GoMirko Damiani - An Embedded soft real time distributed system in Go
Mirko Damiani - An Embedded soft real time distributed system in Go
 
Introduction to nand2 tetris
Introduction to nand2 tetrisIntroduction to nand2 tetris
Introduction to nand2 tetris
 
Data Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQLData Analysis with TensorFlow in PostgreSQL
Data Analysis with TensorFlow in PostgreSQL
 
Important Concepts for Machine Learning
Important Concepts for Machine LearningImportant Concepts for Machine Learning
Important Concepts for Machine Learning
 
Quantization and Training of Neural Networks for Efficient Integer-Arithmetic...
Quantization and Training of Neural Networks for Efficient Integer-Arithmetic...Quantization and Training of Neural Networks for Efficient Integer-Arithmetic...
Quantization and Training of Neural Networks for Efficient Integer-Arithmetic...
 
Towards hasktorch 1.0
Towards hasktorch 1.0Towards hasktorch 1.0
Towards hasktorch 1.0
 
BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2 BUD17-302: LLVM Internals #2
BUD17-302: LLVM Internals #2
 
ICT FIRST LECTURE.pptx
ICT FIRST LECTURE.pptxICT FIRST LECTURE.pptx
ICT FIRST LECTURE.pptx
 
Centernet
CenternetCenternet
Centernet
 
Lcdf4 chap 03_p2
Lcdf4 chap 03_p2Lcdf4 chap 03_p2
Lcdf4 chap 03_p2
 
Xgboost
XgboostXgboost
Xgboost
 
Computer Architecture and Organization
Computer Architecture and OrganizationComputer Architecture and Organization
Computer Architecture and Organization
 
Introduction to Machine Learning with Spark
Introduction to Machine Learning with SparkIntroduction to Machine Learning with Spark
Introduction to Machine Learning with Spark
 

Mehr von Universitat Politècnica de Catalunya

The Transformer in Vision | Xavier Giro | Master in Computer Vision Barcelona...
The Transformer in Vision | Xavier Giro | Master in Computer Vision Barcelona...The Transformer in Vision | Xavier Giro | Master in Computer Vision Barcelona...
The Transformer in Vision | Xavier Giro | Master in Computer Vision Barcelona...Universitat Politècnica de Catalunya
 
Towards Sign Language Translation & Production | Xavier Giro-i-Nieto
Towards Sign Language Translation & Production | Xavier Giro-i-NietoTowards Sign Language Translation & Production | Xavier Giro-i-Nieto
Towards Sign Language Translation & Production | Xavier Giro-i-NietoUniversitat Politècnica de Catalunya
 
Learning Representations for Sign Language Videos - Xavier Giro - NIST TRECVI...
Learning Representations for Sign Language Videos - Xavier Giro - NIST TRECVI...Learning Representations for Sign Language Videos - Xavier Giro - NIST TRECVI...
Learning Representations for Sign Language Videos - Xavier Giro - NIST TRECVI...Universitat Politècnica de Catalunya
 
Generation of Synthetic Referring Expressions for Object Segmentation in Videos
Generation of Synthetic Referring Expressions for Object Segmentation in VideosGeneration of Synthetic Referring Expressions for Object Segmentation in Videos
Generation of Synthetic Referring Expressions for Object Segmentation in VideosUniversitat Politècnica de Catalunya
 
Discovery and Learning of Navigation Goals from Pixels in Minecraft
Discovery and Learning of Navigation Goals from Pixels in MinecraftDiscovery and Learning of Navigation Goals from Pixels in Minecraft
Discovery and Learning of Navigation Goals from Pixels in MinecraftUniversitat Politècnica de Catalunya
 
Learn2Sign : Sign language recognition and translation using human keypoint e...
Learn2Sign : Sign language recognition and translation using human keypoint e...Learn2Sign : Sign language recognition and translation using human keypoint e...
Learn2Sign : Sign language recognition and translation using human keypoint e...Universitat Politècnica de Catalunya
 
Convolutional Neural Networks - Xavier Giro - UPC TelecomBCN Barcelona 2020
Convolutional Neural Networks - Xavier Giro - UPC TelecomBCN Barcelona 2020Convolutional Neural Networks - Xavier Giro - UPC TelecomBCN Barcelona 2020
Convolutional Neural Networks - Xavier Giro - UPC TelecomBCN Barcelona 2020Universitat Politècnica de Catalunya
 
Self-Supervised Audio-Visual Learning - Xavier Giro - UPC TelecomBCN Barcelon...
Self-Supervised Audio-Visual Learning - Xavier Giro - UPC TelecomBCN Barcelon...Self-Supervised Audio-Visual Learning - Xavier Giro - UPC TelecomBCN Barcelon...
Self-Supervised Audio-Visual Learning - Xavier Giro - UPC TelecomBCN Barcelon...Universitat Politècnica de Catalunya
 
Attention for Deep Learning - Xavier Giro - UPC TelecomBCN Barcelona 2020
Attention for Deep Learning - Xavier Giro - UPC TelecomBCN Barcelona 2020Attention for Deep Learning - Xavier Giro - UPC TelecomBCN Barcelona 2020
Attention for Deep Learning - Xavier Giro - UPC TelecomBCN Barcelona 2020Universitat Politècnica de Catalunya
 
Generative Adversarial Networks GAN - Xavier Giro - UPC TelecomBCN Barcelona ...
Generative Adversarial Networks GAN - Xavier Giro - UPC TelecomBCN Barcelona ...Generative Adversarial Networks GAN - Xavier Giro - UPC TelecomBCN Barcelona ...
Generative Adversarial Networks GAN - Xavier Giro - UPC TelecomBCN Barcelona ...Universitat Politècnica de Catalunya
 
Q-Learning with a Neural Network - Xavier GirĂł - UPC Barcelona 2020
Q-Learning with a Neural Network - Xavier GirĂł - UPC Barcelona 2020Q-Learning with a Neural Network - Xavier GirĂł - UPC Barcelona 2020
Q-Learning with a Neural Network - Xavier Giró - UPC Barcelona 2020Universitat Politècnica de Catalunya
 
Language and Vision with Deep Learning - Xavier GirĂł - ACM ICMR 2020 (Tutorial)
Language and Vision with Deep Learning - Xavier GirĂł - ACM ICMR 2020 (Tutorial)Language and Vision with Deep Learning - Xavier GirĂł - ACM ICMR 2020 (Tutorial)
Language and Vision with Deep Learning - Xavier Giró - ACM ICMR 2020 (Tutorial)Universitat Politècnica de Catalunya
 
Image Segmentation with Deep Learning - Xavier Giro & Carles Ventura - ISSonD...
Image Segmentation with Deep Learning - Xavier Giro & Carles Ventura - ISSonD...Image Segmentation with Deep Learning - Xavier Giro & Carles Ventura - ISSonD...
Image Segmentation with Deep Learning - Xavier Giro & Carles Ventura - ISSonD...Universitat Politècnica de Catalunya
 
Deep Self-supervised Learning for All - Xavier Giro - X-Europe 2020
Deep Self-supervised Learning for All - Xavier Giro - X-Europe 2020Deep Self-supervised Learning for All - Xavier Giro - X-Europe 2020
Deep Self-supervised Learning for All - Xavier Giro - X-Europe 2020Universitat Politècnica de Catalunya
 

Mehr von Universitat Politècnica de Catalunya (20)

Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
Deep Generative Learning for All
Deep Generative Learning for AllDeep Generative Learning for All
Deep Generative Learning for All
 
The Transformer in Vision | Xavier Giro | Master in Computer Vision Barcelona...
The Transformer in Vision | Xavier Giro | Master in Computer Vision Barcelona...The Transformer in Vision | Xavier Giro | Master in Computer Vision Barcelona...
The Transformer in Vision | Xavier Giro | Master in Computer Vision Barcelona...
 
Towards Sign Language Translation & Production | Xavier Giro-i-Nieto
Towards Sign Language Translation & Production | Xavier Giro-i-NietoTowards Sign Language Translation & Production | Xavier Giro-i-Nieto
Towards Sign Language Translation & Production | Xavier Giro-i-Nieto
 
The Transformer - Xavier GirĂł - UPC Barcelona 2021
The Transformer - Xavier GirĂł - UPC Barcelona 2021The Transformer - Xavier GirĂł - UPC Barcelona 2021
The Transformer - Xavier GirĂł - UPC Barcelona 2021
 
Learning Representations for Sign Language Videos - Xavier Giro - NIST TRECVI...
Learning Representations for Sign Language Videos - Xavier Giro - NIST TRECVI...Learning Representations for Sign Language Videos - Xavier Giro - NIST TRECVI...
Learning Representations for Sign Language Videos - Xavier Giro - NIST TRECVI...
 
Open challenges in sign language translation and production
Open challenges in sign language translation and productionOpen challenges in sign language translation and production
Open challenges in sign language translation and production
 
Generation of Synthetic Referring Expressions for Object Segmentation in Videos
Generation of Synthetic Referring Expressions for Object Segmentation in VideosGeneration of Synthetic Referring Expressions for Object Segmentation in Videos
Generation of Synthetic Referring Expressions for Object Segmentation in Videos
 
Discovery and Learning of Navigation Goals from Pixels in Minecraft
Discovery and Learning of Navigation Goals from Pixels in MinecraftDiscovery and Learning of Navigation Goals from Pixels in Minecraft
Discovery and Learning of Navigation Goals from Pixels in Minecraft
 
Learn2Sign : Sign language recognition and translation using human keypoint e...
Learn2Sign : Sign language recognition and translation using human keypoint e...Learn2Sign : Sign language recognition and translation using human keypoint e...
Learn2Sign : Sign language recognition and translation using human keypoint e...
 
Intepretability / Explainable AI for Deep Neural Networks
Intepretability / Explainable AI for Deep Neural NetworksIntepretability / Explainable AI for Deep Neural Networks
Intepretability / Explainable AI for Deep Neural Networks
 
Convolutional Neural Networks - Xavier Giro - UPC TelecomBCN Barcelona 2020
Convolutional Neural Networks - Xavier Giro - UPC TelecomBCN Barcelona 2020Convolutional Neural Networks - Xavier Giro - UPC TelecomBCN Barcelona 2020
Convolutional Neural Networks - Xavier Giro - UPC TelecomBCN Barcelona 2020
 
Self-Supervised Audio-Visual Learning - Xavier Giro - UPC TelecomBCN Barcelon...
Self-Supervised Audio-Visual Learning - Xavier Giro - UPC TelecomBCN Barcelon...Self-Supervised Audio-Visual Learning - Xavier Giro - UPC TelecomBCN Barcelon...
Self-Supervised Audio-Visual Learning - Xavier Giro - UPC TelecomBCN Barcelon...
 
Attention for Deep Learning - Xavier Giro - UPC TelecomBCN Barcelona 2020
Attention for Deep Learning - Xavier Giro - UPC TelecomBCN Barcelona 2020Attention for Deep Learning - Xavier Giro - UPC TelecomBCN Barcelona 2020
Attention for Deep Learning - Xavier Giro - UPC TelecomBCN Barcelona 2020
 
Generative Adversarial Networks GAN - Xavier Giro - UPC TelecomBCN Barcelona ...
Generative Adversarial Networks GAN - Xavier Giro - UPC TelecomBCN Barcelona ...Generative Adversarial Networks GAN - Xavier Giro - UPC TelecomBCN Barcelona ...
Generative Adversarial Networks GAN - Xavier Giro - UPC TelecomBCN Barcelona ...
 
Q-Learning with a Neural Network - Xavier GirĂł - UPC Barcelona 2020
Q-Learning with a Neural Network - Xavier GirĂł - UPC Barcelona 2020Q-Learning with a Neural Network - Xavier GirĂł - UPC Barcelona 2020
Q-Learning with a Neural Network - Xavier GirĂł - UPC Barcelona 2020
 
Language and Vision with Deep Learning - Xavier GirĂł - ACM ICMR 2020 (Tutorial)
Language and Vision with Deep Learning - Xavier GirĂł - ACM ICMR 2020 (Tutorial)Language and Vision with Deep Learning - Xavier GirĂł - ACM ICMR 2020 (Tutorial)
Language and Vision with Deep Learning - Xavier GirĂł - ACM ICMR 2020 (Tutorial)
 
Image Segmentation with Deep Learning - Xavier Giro & Carles Ventura - ISSonD...
Image Segmentation with Deep Learning - Xavier Giro & Carles Ventura - ISSonD...Image Segmentation with Deep Learning - Xavier Giro & Carles Ventura - ISSonD...
Image Segmentation with Deep Learning - Xavier Giro & Carles Ventura - ISSonD...
 
Curriculum Learning for Recurrent Video Object Segmentation
Curriculum Learning for Recurrent Video Object SegmentationCurriculum Learning for Recurrent Video Object Segmentation
Curriculum Learning for Recurrent Video Object Segmentation
 
Deep Self-supervised Learning for All - Xavier Giro - X-Europe 2020
Deep Self-supervised Learning for All - Xavier Giro - X-Europe 2020Deep Self-supervised Learning for All - Xavier Giro - X-Europe 2020
Deep Self-supervised Learning for All - Xavier Giro - X-Europe 2020
 

KĂźrzlich hochgeladen

CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...amitlee9823
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectBoston Institute of Analytics
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramMoniSankarHazra
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...only4webmaster01
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...amitlee9823
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfadriantubila
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptDr. Soumendra Kumar Patra
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...amitlee9823
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 

KĂźrzlich hochgeladen (20)

CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 7737669865 👗 Top Class Call Girl Service B...
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Predicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science ProjectPredicting Loan Approval: A Data Science Project
Predicting Loan Approval: A Data Science Project
 
Capstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics ProgramCapstone Project on IBM Data Analytics Program
Capstone Project on IBM Data Analytics Program
 
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
Call Girls Indiranagar Just Call 👗 9155563397 👗 Top Class Call Girl Service B...
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Thane West Call On 9920725232 With Body to body massage...
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 

Loss functions (DLAI D4L2 2017 UPC Deep Learning for Artificial Intelligence)

  • 1. [course site] Javier Ruiz Hidalgo javier.ruiz@upc.edu Associate Professor Universitat Politecnica de Catalunya Technical University of Catalonia Loss functions #DLUPC
  • 2. Me ● Javier Ruiz Hidalgo ○ Email: j.ruiz@upc.edu ○ Office: UPC, Campus Nord, D5-008 ● Teaching experience ○ Basic signal processing ○ Image processing & computer vision ● Research experience ○ Master on hierarchical image representations by UEA (UK) ○ PhD on video coding by UPC (Spain) ○ Interests in image & video coding, 3D analysis and super-resolution 2
  • 3. Outline ● Introduction ○ Definition, properties, training process ● Common types of loss functions ○ Regression ○ Classification ● Regularization ● Example 3
  • 4. Definition In a supervised deep learning context the loss function measures the quality of a particular set of parameters based on how well the output of the network agrees with the ground truth labels in the training data. 4
  • 5. Nomenclature loss function cost function objective function error function 5 = = =
  • 6. Loss function (1) 6 How good does our network with the training data? labels (ground truth) input parameters (weights, biases)error Deep Network input output
  • 7. Loss function (2) ● The loss function does not want to measure the entire performance of the network against a validation/test dataset. ● The loss function is used to guide the training process in order to find a set of parameters that reduce the value of the loss function. 7
  • 8. Training process Stochastic gradient descent ● Find a set of parameters which make the loss as small as possible. ● Change parameters at a rate determined by the partial derivatives of the loss function: 8
  • 9. Properties (1) ● Minimum (0 value) when the output of the network is equal to the ground truth data. ● Increase value when output differs from ground truth. 9
  • 10. Properties (2) 10 ● Ideally → convex function ● In reality → some many parameters (in the order of millions) than it is not convex ○ Varies smoothly with changes on the output ■ Better gradients for gradient descent ■ Easy to compute small changes in the parameters to get an improvement in the loss
  • 11. Assumptions ● For backpropagation to work: ○ Loss function can be written as an average over loss functions for individual training examples: ○ Loss functions can be written as a function of the output activations from the neural network. 11Neural Networks and Deep Learning empirical risk
  • 12. Outline ● Introduction ○ Definition, properties, training process ● Common types of loss functions ○ Regression ○ Classification ● Regularization ● Example 12
  • 13. Common types of loss functions (1) ● Loss functions depen on the type of task: ○ Regression: the network predicts continuous, numeric variables ■ Example: Length of fishes in images, temperature from latitude/longitud ■ Absolute value, square error 13
  • 14. Common types of loss functions (2) ● Loss functions depen on the type of task: ○ Classification: the network predicts categorical variables (fixed number of classes) ■ Example: classify email as spam, predict student grades from essays. ■ hinge loss, Cross-entropy loss 14
  • 15. Absolute value, L1-norm ● Very intuitive loss function ○ produces sparser solutions ■ good in high dimensional spaces ■ prediction speed ○ less sensitive to outliers 15
  • 16. Square error, Euclidean loss, L2-norm ● Very common loss function ○ More precise and better than L1-norm ○ Penalizes large errors more strongly ○ Sensitive to outliers 16
  • 17. Outline ● Introduction ○ Definition, properties, training process ● Common types of loss functions ○ Regression ○ Classification ● Regularization ● Example 17
  • 18. Classification (1) We want the network to classify the input into a fixed number of classes 18 class “1” class “2” class “3”
  • 19. Classification (2) ● Each input can have only one label ○ One prediction per output class ■ The network will have “k” outputs (number of classes) 19 0.1 2 1 class “1” class “2” class “3” input Network output scores / logits
  • 20. Classification (3) ● How can we create a loss function to improve the scores? ○ Somehow write the labels (ground truth of the data) into a vector → One-hot encoding ○ Non-probabilistic interpretation → hinge loss ○ Probabilistic interpretation: need to transform the scores into a probability function → Softmax 20
  • 21. Softmax (1) ● Convert scores into probabilities ○ From 0.0 to 1.0 ○ Probability for all classes adds to 1.0 21 0.1 2 1 input Network output scores / logits 0.1 0.7 0.2 probability
  • 22. Softmax (2) ● Softmax function 22 0.1 2 1 input Network output scores / logits 0.1 0.7 0.2 probability scores (logits) Neural Networks and Deep Learning (softmax)
  • 23. One-hot encoding ● Transform each label into a vector (with only 1 and 0) ○ Length equal to the total number of classes “k” ○ Value of 1 for the correct class and 0 elsewhere 23 0 1 0 class “2” 1 0 0 class “1” 0 0 1 class “3”
  • 24. Cross-entropy loss (1) 24 0.1 2 1 input Network output scores / logits 0.1 0.7 0.2 probability 0 1 0 label
  • 26. Cross-entropy loss (3) ● For a set of n inputs 26 labels (one-hot) Softmax
  • 27. Cross-entropy loss (4) ● In general, cross-entropy loss works better than square error loss: ○ Square error loss usually gives too much emphasis to incorrect outputs. ○ In square error loss, as the output gets closer to either 0.0 or 1.0 the gradients get smaller, the change in weights gets smaller and training is slower. 27
  • 28. Multi-label classification (1) ● Outputs can be matched to more than one label ○ “car”, “automobile”, “motor vehicle” can be applied to a same image of a car. ● Use sigmoid at each output independently instead of softmax 28
  • 29. Multi-label classification (2) ● Cross-entropy loss for multi-label classification: 29
  • 30. Outline ● Introduction ○ Definition, properties, training process ● Common types of loss functions ○ Regression ○ Classification ● Regularization ● Example 30
  • 31. Regularization ● Control the capacity of the network to prevent overfitting ○ L2-regularization (weight decay): ○ L1-regularization: 31 regularization parameter
  • 32. Outline ● Introduction ○ Definition, properties, training process ● Common types of loss functions ○ Regression ○ Classification ● Regularization ● Example 32
  • 33. Example 33Why you should use cross-entropy instead of classification error 0.1 0.3 0.3 0.2 0.4 0.3 0.7 0.3 0.4 “1” “2” “3” 1 0 0 0 1 0 0 0 1 0.3 0.1 0.1 0.4 0.7 0.2 0.3 0.2 0.7 “1” “2” “3” 1 0 0 0 1 0 0 0 1 Classification accuracy = 2/3 cross-entropy loss = 4.14 Classification accuracy = 2/3 cross-entropy loss = 1.92
  • 34. References ● About loss functions ● Neural networks and deep learning ● Are loss functions all the same? ● Convolutional neural networks for Visual Recognition ● Deep learning book, MIT Press, 2016 ● On Loss Functions for Deep Neural Networks in Classification 34