bugger.
RL environments/Pythonmediumrl-heldout-rollouts-v1
IMPLEMENTATION LAB

Compare policies on held-out scenarios

Pair rollout results by scenario and keep infrastructure failures visible.

RL Environments

Your task

A report currently counts every success in a candidate log, including training scenarios. Input contains heldout, a list of unique scenario IDs, and baseline and candidate, objects mapping scenario ID to success, failure, or infra_error. A missing entry is also unavailable. Compare only the IDs in heldout and only when both policies returned success or failure.

Return matched, baseline_successes, candidate_successes, and unavailable. Count each held-out scenario once. An unavailable pair increments unavailable once, even when both policies failed to produce a verdict. Successful rollouts in an unavailable pair do not count.

Expected behavior

Compare outcomes over the same valid scenario pairs and report how many held-out comparisons were unavailable.

Examples

01 Ignore a training win and count paired holdouts
{"heldout":["a","b"],"baseline":{"b":"failure","a":"success"},"candidate":{"a":"failure","b":"success","train":"success"}}
{"matched":2,"baseline_successes":1,"candidate_successes":1,"unavailable":0}
02 A timeout removes both sides from the pair
{"heldout":["a"],"baseline":{"a":"success"},"candidate":{"a":"infra_error"}}
{"matched":0,"baseline_successes":0,"candidate_successes":0,"unavailable":1}
03 No held-out cases
{"heldout":[],"baseline":{},"candidate":{}}
{"matched":0,"baseline_successes":0,"candidate_successes":0,"unavailable":0}

Before you begin

  • Python functions, lists, and dictionaries

Need a nudge?

Reveal one investigation hint at a time. Try each clue before opening the next.

    Run the examples, then submit to check the full contract.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.