← Quiz: Regularisation (Ridge and Lasso): all 10 questions
Quiz: Regularisation (Ridge and Lasso) · Question 5 of 10
What does this print? (code)
What does this print?
import numpy as np
w = np.array([3.0, -4.0])
print(np.sum(w ** 2), np.sum(np.abs(w)))
- A.7.0 7.0
- B.25.0 7.0
- C.25.0 -1.0
- D.5.0 7.0
Answer & explanation
Correct answer: 25.0 7.0
The L2 penalty sums squares (9 + 16); the L1 penalty sums absolute values (3 + 4).
Can you get the rest right without peeking?
Take the timed Quiz: Regularisation (Ridge and Lasso) quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →