Hi Frida!



 Frida:

Any idea why it becomes lower and then becomes greater, although is greater then the loss before?


The short answer that I should have included a regularization
“importance factor” as a hyperparameter:
loss_total = loss + reg_weight * l1_reg
My apologies for leaving out this important detail.
I am assuming that the “it” that “becomes lower and then becomes
greater” is l1_reg (or l2_reg, if that’s the one you’re using).
First, some context:
If you use just loss for training, training will push your model
parameters to make loss smaller (presumably making better
predictions).  But the training won’t care what your parameter
sum is.
Similarly, if you use just l1_reg for training, you will push your
parameter sum to its desired value.  But the training won’t care
about loss, and your model won’t learn anything about making
good predictions.
These two goals – “good predictions” and “desired sum” – can
potentially be in competition with one another.  reg_weight tunes
this trade-off.
Add reg_weight to your training, and try increasing it until you get
adequately close to desired_sum.
(It is sometimes helpful to start with a smallish value of reg_weight
and increase it gradually as training progresses.  But there’s no real
wisdom about whether or not this will be helpful – like so much in
neural networks, sometimes you just have to try it.)
Best.
K. Frank