Compute the mean hinge loss of a linear classifier. Labels y are in {−1,+1} and scores are the real-valued model outputs.
Implement solve(y,scores).
Returns. Return a non-negative Python float n1∑imax(0,1−yisi).
Example 1
Input:
solve([1, -1, 1], [1.0, -1.0, -1.0])
Output:
0.666667
Example 2
Input:
solve([1, -1], [3.0, -0.5])
Output:
0.25
No results yet
Run your code to check it against the examples, or submit to run every test.