← Quiz: ML and Regression: all 10 questions
Quiz: ML and Regression · Question 7 of 10
What does this print? (code)
What does this print?
actual = [5.0, 6.0, 8.0]
predicted = [5.5, 5.0, 8.0]
mae = sum(abs(a - p) for a, p in zip(actual, predicted)) / len(actual)
print(mae)
- A.1.5
- B.0.0
- C.0.5
- D.0.25
Answer & explanation
Correct answer: 0.5
Errors are 0.5, 1.0 and 0, so the mean absolute error is 1.5 / 3 = 0.5.
Can you get the rest right without peeking?
Take the timed Quiz: ML and Regression quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →