Skip to content
DeepForgeby svx
All problems
EasyML Fundamentalsml-257

Group Lasso Penalty

Problem

Compute the group lasso penalty: the sum over groups of the Euclidean norm sqrt(sum(w_j^2)).

Hint

Groups of coefficients are regularized jointly with an L2 norm.

Test cases

case 1
in: [[[3,4]]]
expected: 5
case 2
in: [[[1,0],[0,1]]]
expected: 2
case 3
in: [[[2,2,1]]]
expected: 3
case 4
in: [[]]
expected: 0
Starter codePython
def group_lasso_penalty(groups):
    # Your code here
    pass

4 test cases · run your code against them in the editor