Loss Functions
Loss Functions
40
Loss:
For a single example (a single input) the
difference between actual output (target) and
predicted output.
Example: Your model predicts an image as
"Dog", but it was actually "Cat" → This is an
error!
Loss Function:
Average error across all training samples.
This is a function that tells the model how
wrong it is.
41
LOSS
LOSS =
LOSS FUNCTION
42
Number of Observations
43
CROSS ENTROPY
If target columns has one hot encoded to classes like 001,
010 then use categorical cross entropy.
If target column has numerical encoding to classes like
1,2,3,4,…..N then use sparse categorical cross entropy.
TYPES OF GRADIENT DESCENT 50
MY COMPUTER
56
STOCHASTIC GRADIENT
DESCENT
1. Use one only(randomly picked) sample for a forward pass
and then adjust the weights.
2. Good when training set is very big and we don’t want too
much computation.
57
58
59
60
61
MINI BATCH GARDIENT 62
DESCENT
• Instead of choosing one randomly picked training sample you will use a
batch of randomly picked training samples.
For examples:
1)I have 20 training sample total.
2)Lets say I use 5 random samples for one forward pass to calculate
cumulative error
3)After that adjust the weights
63