← Quiz: Gradient Descent: all 10 questions
Quiz: Gradient Descent · Question 3 of 10
What does this print? (code)
What does this print?
import numpy as np
x = np.array([1.0, 2.0])
y = np.array([3.0, 5.0])
w, b = 2.0, 0.0
print(np.mean((w * x + b - y) ** 2))
- A.0.0
- B.1.0
- C.2.0
- D.1.5
Answer & explanation
Correct answer: 1.0
Predictions 2 and 4, errors −1 and −1, squared errors 1 and 1, mean 1.0.
Can you get the rest right without peeking?
Take the timed Quiz: Gradient Descent quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →