Deep Learning · Module 2
Answers and explanations · Follow a prediction into its loss
Compare these references after your own attempt. You can read them at any time; they do not record a live model or vendor run.
Deep Learning · Module 2
Compare these references after your own attempt. You can read them at any time; they do not record a live model or vendor run.
02A. z=-0.9, h=0 after ReLU, prediction=0.2. Error relative to y=0.5 is -0.3. Half-squared loss is 0.045; MSE for this one scalar is 0.09. The factor of two belongs to the loss definition.
02B. Prices: floating output/target (6,1), MSELoss. Binary rings: raw-logit output (6,1), floating 0/1 targets (6,1), BCEWithLogitsLoss. Three classes: raw logits (6,3), integer targets (6,), values 0–2, CrossEntropyLoss. Do not pass an extra sigmoid/softmax into these logits losses.
02C. Exponentiating logits gives [2,1,1], normalized to [0.5,0.25,0.25]. Target class two has probability 0.25, so loss is -ln(0.25)=ln4≈1.386294. The highest-scoring class stays zero; changing the observed target changes which probability is penalized.