Hi Saeed!



 saeed_i:

Can you explain with an example ??


When you use a loss function to train a model, the loss function is
telling you which set of model parameters is “better” than other sets
of model parameters.
Let’s say you have a model, and when it has weight_A as its
parameters it produces loss_vector_A = [1.1, 4.4, 2.2].
Let’s also say the when the same model has weight_B as its
parameters it produces loss_vector_B = [2.2, 1.1, 3.3].
Is the model a better model with weight_A or weight_B?  If the loss
function produced just a scalar (instead of a vector), we would just say
that the smaller scalar value corresponds to the better model.  (That’s
really what “loss function” means.)
(If you say just add up the elements of your loss vectors to see
which model is better, then you would really be saying that
loss_vector_A.sum() and loss_vector_B.sum() should be
your scalar loss-function values.)
Best.
K. Frank