All problems
Compatible Features Check
Problem
Check whether the actor features match the score function gradient, the condition for compatible function approximation. Return True when every element differs by at most tol.
Hint
Compatible features make the policy gradient exact for the linear critic.
Test cases
case 1
in: [[1,2],[1,2],1e-9]
expected: true
case 2
in: [[1,2],[1,2.0000001],0.000001]
expected: true
case 3
in: [[1,2],[1,2.1],0.000001]
expected: false
case 4
in: [[],[],1e-9]
expected: true
Starter codePython
def compatible_features_check(phi, grad_log_pi, tol):
# Your code here
pass4 test cases · run your code against them in the editor