Evaluate the ridge-regression objective: the mean squared prediction error plus λ times the squared L2 norm of the weights. The intercept b is not penalised.
Implement solve(X, y, w, b, lam).
Returns. Return a Python float n1∑i(xi⊤w+b−yi)2+λ∥w∥22.
Example 1
Input:
solve([[1.0, 0.0], [0.0, 1.0]], [1.0, 2.0], [1.0, 1.0], 0.0, 0.5)
Output:
1.5
Example 2
Input:
solve([[2.0], [4.0]], [1.0, 2.0], [0.5], 0.0, 10.0)
Output:
2.5
No results yet
Run your code to check it against the examples, or submit to run every test.