Exercises

Use these exercises to check the chapter ideas. Work by hand first, then check the result.

MATH-C09-C-001Exercise: Squared loss

Let yhat = 8 and y = 5.

Compute (yhat - y)^2.

Compute it first, then check your number.

MATH-C09-C-002Exercise: Gradient descent step

Let w = 10, gradient = 6, and learning rate = 0.5.

What is the new w?

Compute it first, then check your number.

MATH-C09-C-003Exercise: Mini-batch count

A dataset has 1200 examples and each mini-batch has 300 examples.

How many mini-batches cover one pass through the dataset?

Compute it first, then check your number.

MATH-C09-C-004Exercise: Regularized objective

If data loss is 12 and penalty is 3, what is their sum?

Compute it first, then check your number.

MATH-C09-C-005Exercise: Learning rate scale

If learning rate is 0.1 and gradient is 20, what is the step size before the minus sign?

Compute it first, then check your number.

MATH-C09-C-006Exercise: Loss versus metric

If the training loss improves, does that automatically prove the reported evaluation metric improved?

Answer it first, then check.

MATH-C09-C-007Exercise: Convexity

For a convex function, is every local minimum also a global minimum?

Answer it first, then check.

MATH-C09-C-008Exercise: Regularization with lambda

If data loss = 8, penalty = 4, and lambda = 0.25, what is data loss + lambda * penalty?

Compute it first, then check your number.

MATH-C09-C-009Exercise: Momentum

Does momentum use information from previous update directions?

Answer it first, then check.

MATH-C09-C-010Exercise: Numerical stability

Is NaN loss by itself a complete diagnosis of the cause?

Answer it first, then check.

MATH-C09-C-011Exercise: Loss as proxy

Enter 1 if a loss is the number the optimizer can reduce, but it may still be only a proxy for the behavior we care about.

Compute it first, then check your number.

MATH-C09-C-012Exercise: Local direction and finite step

Enter 1 if a gradient can point in a useful local direction while a learning rate that is too large still makes the update harmful.

Compute it first, then check your number.

MATH-C09-C-013Exercise: Mini-batch tradeoff

Enter 1 if larger mini-batches usually reduce gradient noise but cost more per update.

Compute it first, then check your number.

MATH-C09-C-014Exercise: Convex guarantee boundary

Enter 1 if the guarantee "every local minimum is global" requires convexity and should not be assumed for general deep neural network losses.

Compute it first, then check your number.

MATH-C09-C-015Exercise: Regularization evidence

Enter 1 if regularization changes the training preference but held-out data is still needed to check whether generalization improved.

Compute it first, then check your number.

Next

Use the hints only after you have tried the exercises. Use the solutions after you can explain where you got stuck.