Skip to content
DeepForgeby svx
All problems

BCQ Perturbation Filter

Problem

Filter a BCQ candidate action by its perturbation distance.

Return action when |action - mu| <= threshold, otherwise fall back to the behavior mean mu.

Hint

BCQ only trusts candidate actions that stay near the behavior policy.

Test cases

case 1
in: [0.55,0.5,0.1]
expected: 0.55
case 2
in: [0.8,0.5,0.1]
expected: 0.5
case 3
in: [-0.5,0.5,0.2]
expected: 0.5
Starter codePython
def bcq_perturbation_filter(action, mu, threshold):
    # Your code here
    pass

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