🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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))
  1. A.0.0
  2. B.1.0
  3. C.2.0
  4. 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 →