Commit 548ed49
authored
fix(il): restore random val split and shape assert in sampler (#776)
get_val_mask hardcoded `val_idxs = -1` (the real `rng.choice(...)` selection was
commented out), so the validation set was always exactly the last episode
regardless of val_ratio/seed — every reported IL validation metric was computed
on one fixed episode. Restore the seeded random selection of n_val episodes.
create_indices had `episode_mask.shape == episode_ends.shape` as a bare no-op
expression (missing the `assert` keyword), so the shape precondition never ran.
Restore the assert (numba-nopython compatible; the sole caller always builds
matching shapes, so it never trips in practice but fails fast on misuse).
Adds general regression tests: val mask selects round(n*ratio) episodes and is
seed-reproducible; create_indices asserts on a shape mismatch. Red on pre-fix.1 parent 582c348 commit 548ed49
2 files changed
Lines changed: 38 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
| 71 | + | |
73 | 72 | | |
74 | 73 | | |
75 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
0 commit comments