Skip to content
DeepForgeby svx
All problems

HER Relabel Goal

Problem

Relabel a hindsight-experience-replay transition with the achieved goal.

Return [achieved_goal, success_reward] when the achieved goal equals the desired goal, and [achieved_goal, failure_reward] otherwise.

Hint

Rewriting the goal as what actually happened turns failures into learning signal.

Test cases

case 1
in: [[1,2],[1,2],1,0]
expected: [[1,2],1]
case 2
in: [[0,0],[1,1],1,-1]
expected: [[0,0],-1]
case 3
in: [[3],[3],5,0]
expected: [[3],5]
Starter codePython
def her_relabel(achieved_goal, goal, success_reward, failure_reward):
    # Your code here
    pass

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