Bitpath

Lesson 1 · Unit 04

Loss and descent

Measure how wrong, then step downhill

13 exercisesabout 3 min

What you practise

  • Mean squared error, a loss surface, one step of gradient descent by hand, local minima, why features get scaled

Try a question from this lesson

Pick one

True prices: 100, 200, 300. Model A predicts 110, 190, 310. Model B predicts 100, 200, 240. If one big miss should count for more than a few small ones, which is worse?

Hint

Square each error before you add them up, and compare the totals.

The idea

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

Mean squared error

A loss is one number that says how wrong the model is. Training means making it small.

Mean squared error (MSE): take each prediction minus its target, square it, and average.

Squaring does two jobs. Errors of +10 and -10 cannot cancel, and large errors dominate.

Python
import numpy as np

y = np.array([100, 200, 300])
pred = np.array([110, 190, 310])
mse = ((pred - y) ** 2).mean()
print(mse)   # 100.0

11 more exercises in the app

  • 3× type the answer
  • 4× multiple choice
  • 1× fill the blanks
  • 1× true or false
  • 1× order the lines
  • 1× match the pairs

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy