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:
co-authored by
Claude Opus 5.5
parent
d37eaa3378
commit
c0355616b6
+21
-6
@@ -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")
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
# Which runs the route model (data/public/policy.json) learns from. planner/build_policy.py reads this file.
|
||||
#
|
||||
# The model estimates the game's rolls (first dragon, deaths, shadow, meadow dragon, bond chances) given the choices
|
||||
# made before them, so any run that records its choices and what happened can teach it, whoever chose the route.
|
||||
# Deliberate deaths (Malek, the bot's "no shadow" / "no Blue" burns) are never counted as failed bond attempts.
|
||||
version: 1
|
||||
|
||||
# the `source` values of data/public/runs_clean.csv the model learns from
|
||||
sources: [reddit spreadsheet, reported, bot]
|
||||
|
||||
# Two samples. "all" is every run above. "lowBias" leaves out runs where a rare sighting is more likely to have
|
||||
# been reported than a miss: form submissions and reports from riders chasing Blue or Black. The bot logs every
|
||||
# run, and bulk-pasted logs record every run of the players who kept them, so both stay in.
|
||||
low_bias:
|
||||
always: [bot] # sources whose every run is kept
|
||||
entries_kept: [bulk] # spreadsheet rows whose `entry` is not "Form" (bulk-pasted logs)
|
||||
rare_goals: [Blue, Black, Blue or Black]
|
||||
Reference in New Issue
Block a user