Skip to content

Add load_bet_log for validated CSV bet logs - #156

Merged
wdm0006 merged 1 commit into
masterfrom
autopilot/issue-150
Oct 18, 2026
Merged

wdm0006 merged 1 commit into
masterfrom
autopilot/issue-150

Conversation

@wdm0006

@wdm0006 wdm0006 commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Closes #150

Adds keeks.load_bet_log(path, *, probability_column="probability", outcome_column="outcome") -> (list[float], list[int]) in keeks/bet_log.py, re-exported from keeks. Stdlib csv only, file order preserved. Outcomes accept 0/1/true/false (case-insensitive); probabilities must be finite in [0, 1]. Every error is a ValueError naming the column and 1-based data row (missing columns name the column and list those available). examples/replay_bet_log.py now imports the public function instead of its private copy. Docs section added to docs/source/utils.rst; the function has a doctest using a temp file.

Verification

  • pytest: 3744 passed, 2 skipped, 94 failed. All 94 are tests/test_bit_exactness.py, which fails the same way on master in this environment (known NumPy golden-fixture drift). Nothing else fails.
  • keeks/bet_log.py is at 100% coverage.
  • ruff check and ruff format --check are clean.
  • pytest --doctest-modules keeks/: 79 passed.
  • sphinx -W -b dummy: build succeeded (the custom theme isn't installed locally).
  • Running examples/replay_bet_log.py leaves git status clean for examples/output/, so the committed CSV/PNG are unchanged.
  • Tests assert exact values for the known CSV, custom columns and bool words. Error tests cover missing column, empty probability, NaN/inf, out-of-range, outcome 2 and 1.0, each asserting the column and row appear in the message.

Screenshots

Screenshots: n/a — no user-visible change

@wdm0006
wdm0006 force-pushed the autopilot/issue-150 branch from b835ea6 to 58a326b Compare October 17, 2026 01:57
@wdm0006

wdm0006 commented Oct 17, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto the latest master and resolved the replay-example import conflict, preserving its calibration/bootstrap reporting and using the public load_bet_log. Pushed 58a326b; GitHub reports the PR is mergeable.

Validation: 28 loader/replay tests, 79 doctests, Ruff lint/format, and the Sphinx dummy build pass. Full suite: 3,746 passed, 2 skipped, with the same 94 test_bit_exactness.py golden-fixture failures previously reported on this PR. The example’s CSV, JSON, and PNG outputs match the committed artifacts byte for byte.

Screenshots: n/a — no user-visible change.

@wdm0006
wdm0006 merged commit ca67e13 into master Oct 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[autopilot] Add load_bet_log so a recorded CSV feeds calibration_report and compare_strategies directly

1 participant