Skip to content
DeepForgeby svx
All problems

IRL Max-Entropy Gradient

Problem

Compute the max-entropy inverse RL gradient as the difference between expert and policy feature expectations: expert_feats[i] - policy_feats[i].

Hint

The gradient vanishes when the policy matches the expert's feature counts.

Test cases

case 1
in: [[2,3],[1,1]]
expected: [1,2]
case 2
in: [[1],[1]]
expected: [0]
case 3
in: [[0,0],[2,-1]]
expected: [-2,1]
Starter codePython
def maxent_irl_gradient(expert_feats, policy_feats):
    # Your code here
    pass

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