deep-learning-with-R-2nd-edition-code icon indicating copy to clipboard operation
deep-learning-with-R-2nd-edition-code copied to clipboard

Wrong order of arguments in sqare_loss?

Open yuriy-babenko opened this issue 1 year ago • 2 comments

https://github.com/t-kalinowski/deep-learning-with-R-2nd-edition-code/blob/5d666f93d52446511a8a8e4eb739eba1c0ffd199/ch03.R#L266C1-L270C5

Can it be that the order of arguments in the function is wrong?

loss <- square_loss(predictions, targets)

We defined square previously as:

square_loss <- function(targets, predictions) {
  per_sample_losses <- (targets - predictions)^2
  mean(per_sample_losses)
}

In text they say "the training loss .... stabilized around 0.025" which I only get once I change the order of arguments: loss <- square_loss( targets, predictions)

yuriy-babenko avatar Aug 07 '24 11:08 yuriy-babenko