All problems
Contextual Bandit Linear Payoff
Problem
Compute the predicted payoff of a contextual bandit as the dot product theta . x.
Hint
This is the expected reward of an action under a linear reward model.
Test cases
case 1
in: [[1,2],[3,4]]
expected: 11
case 2
in: [[0,0],[5,6]]
expected: 0
case 3
in: [[-1,1],[2,2]]
expected: 0
case 4
in: [[0.5],[4]]
expected: 2
Starter codePython
def linear_payoff(theta, x):
# Your code here
pass4 test cases · run your code against them in the editor