Route model learns from bot runs; Thompson sampling in the advisor (work in progress)

- planner/policy.yaml: which sources the route model learns from (spreadsheet,
  reported, bot) and the low-bias sample
- bot runs: deaths coded by stage, Malek intent for runs with a target
- model: survival of the first dragon is not counted when nothing after it is
  known; the meadow dragon falls back to what the bot saw
- solver.js: advisor(..., {sampling: "thompson", seed, draws}) follows one
  posterior draw per attempt and reports each pick's propensity

Not shipped yet: mixing sources lowers the fitted shrinkage for the shadow roll
(alpha 500 -> 50 in the low-bias sample), see the conversation of 2026-11-09.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
ekcSchiano
2026-11-10 02:29:09 +00:00
co-authored by Claude Opus 5.5
parent d37eaa3378
commit c0355616b6
6 changed files with 121 additions and 22 deletions
+21 -6
View File
@@ -2,7 +2,8 @@
python planner/build_policy.py [--draws 200] [--out data/public/policy.json]
Two samples: every run, and a low-bias sample (bulk logs plus form runs from riders not chasing a rare dragon).
Two samples, from the runs and rules in planner/policy.yaml: every run, and a low-bias sample (bot runs, bulk logs,
and riders not chasing a rare dragon).
The output has a content id, so each bot run can record which policy it followed.
"""
import argparse
@@ -20,9 +21,19 @@ from atlas import runs as runs_io # noqa: E402
import yaml # noqa: E402
# the same runs the site's statistics use (analysis/stats/measures.yaml `sources`)
with open(ROOT / "analysis/stats/measures.yaml", encoding="utf-8") as _f:
SOURCES = yaml.safe_load(_f)["sources"]
# which runs the model learns from, and the low-bias sample (planner/policy.yaml)
with open(ROOT / "planner/policy.yaml", encoding="utf-8") as _f:
CONFIG = yaml.safe_load(_f)
SOURCES = CONFIG["sources"]
def low_bias(r, lb=CONFIG["low_bias"]):
"""Kept in the low-bias sample: every run of an always-kept source, bulk logs, and riders not chasing a rare dragon."""
if r["source"] in lb["always"]:
return True
if r["source"] == "reddit spreadsheet" and "bulk" in lb["entries_kept"] and r["entry"] not in (None, "Form"):
return True
return r["goal"] not in lb["rare_goals"]
def clean(o):
@@ -49,10 +60,14 @@ def main(argv=None):
rows = len(runs)
samples = {
"all": runs,
"lowBias": [r for r in runs if r["entry"] != "Form" or r["goal"] not in model.RARE_GOALS],
"lowBias": [r for r in runs if low_bias(r)],
}
t0 = time.time()
out = {"schema": 1, "source": {"form_rows": rows}, "samples": {}}
by_source = {}
for r in runs:
by_source[r["source"]] = by_source.get(r["source"], 0) + 1
out = {"schema": 1, "source": {"form_rows": by_source.get("reddit spreadsheet", 0), "runs": rows, "by_source": by_source},
"samples": {}}
for name, rs in samples.items():
out["samples"][name] = clean(solver.build_policy(rs, draws=a.draws))
print(f"{name}: {len(rs)} runs, {time.time() - t0:.1f} s")