eval.vr_arena
eval.vr_arena
Net-vs-GNUBG matches with a variance-reduced ppg estimator.
Same games as :func:raccoon.train.td_selfplay.gnubg_arena — net plays 0-ply greedy value lookahead, GNUBG plays at gnubg_ply, seats alternate — but every pre-roll state is intercepted before the dice are sampled so the realised luck of the roll can be recorded (see :mod:raccoon.eval.luck for the estimator and why it is exactly unbiased). Each game then yields two numbers:
raw = the game result in points, from the net's POV
vr = raw - (accumulated luck)
mean(vr) estimates the same quantity as mean(raw) with far less variance, which is what makes sub-0.05-ppg differences measurable at a practical number of games.
Turning variance reduction off (vr=False) plays identical games from the same seed: the control variate reads gnubg through a pure C path and touches no RNG. That is what lets a plain run and a variance-reduced run be compared as two independent samples of one process rather than two different processes.
Functions
| Name | Description |
|---|---|
| gnubg_arena_vr | Play games net-vs-GNUBG games, returning per-game raw and VR results. |
gnubg_arena_vr
eval.vr_arena.gnubg_arena_vr(
net,
device,
games,
gnubg_ply=0,
cv_ply=0,
seed=0,
max_moves=2000,
vr=True,
joint_doubles=True,
)Play games net-vs-GNUBG games, returning per-game raw and VR results.
Returns {"games", "net_wins", "game_pts", "game_luck", "game_vr", "game_rolls"}. game_pts is the raw result in points from the net’s POV (±1/±2/±3 under full_scoring); game_luck is the accumulated dice luck, also from the net’s POV; game_vr = game_pts - game_luck. With vr=False the luck array is all zeros and game_vr equals game_pts.
cv_ply is the ply of the control-variate evaluator and must be 0 (gnubg-nn’s best_move segfaults deeper); gnubg_ply is the opponent’s strength and is unconstrained. The two are deliberately independent — the control variate stays a fixed function of (position, roll) whatever the opponent does, which is what keeps the estimator unbiased.
joint_doubles selects how the net executes a doubles turn — jointly over all four half-moves (the default, and what GNUBG’s side always did) or by the older greedy two-step path. It is the exp020 A/B; see :func:raccoon.train.lookahead.child_values. The control variate is unaffected either way: it is a fixed function of (position, roll) and never of the move played, so both arms are measured on the same unbiased ruler.
Seeds the global numpy RNG (dice), like the other arenas in this project.