Compute the elastic-net penalty of a weight vector: an L1 term with strength l1 plus an L2 term with strength l2, where the L2 term carries a factor 21.
Implement solve(w,l1,l2).
Returns. Return a non-negative float l1∑j∣wj∣+21l2∑jwj2.
Example 1
Input:
solve([1.0, -2.0], 0.1, 0.2)
Output:
0.8
Example 2
Input:
solve([0.0, 0.0, 0.0], 1.0, 1.0)
Output:
0.0
No results yet
Run your code to check it against the examples, or submit to run every test.