All problems
OMD Regret Term
Problem
Compute the linearized regret accumulated by an online mirror descent player.
Given per-round gradient vectors grads, the played weights weights, and a fixed comparator u, return the sum over rounds t and coordinates i of grads[t][i] * (weights[t][i] - u[i]).
Hint
This is the linearized regret, where each round charges the gradient at the played point.
Test cases
case 1
in: [[[1,0],[0,1]],[[0.5,0.5],[0.4,0.6]],[0.5,0.5]]
expected: 0.09999999999999998
case 2
in: [[[1,2]],[[0.2,0.8]],[0.5,0.5]]
expected: 0.3000000000000001
case 3
in: [[[0,0],[0,0]],[[0.1,0.9],[0.3,0.7]],[0.5,0.5]]
expected: 0
Starter codePython
def omd_regret_term(grads, weights, u):
# Your code here
pass3 test cases · run your code against them in the editor