stage table: direction arrows (dcoh/dauth↓, coh→, auth↓)

Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
wassname
2026-06-04 16:46:35 +08:00
parent e3d6a865cf
commit 0bdd84293a
+6 -4
View File
@@ -78,16 +78,18 @@ def _stage_row(rnd, stage: str, m: dict, base_m: dict) -> dict:
dAuth = m["auth_nats"] - base_m["auth_nats"] dAuth = m["auth_nats"] - base_m["auth_nats"]
dCoh = m["coherence"] - base_m["coherence"] dCoh = m["coherence"] - base_m["coherence"]
ratio = dCoh / dAuth if abs(dAuth) > 1e-6 else float("nan") ratio = dCoh / dAuth if abs(dAuth) > 1e-6 else float("nan")
return {"round": rnd, "stage": stage, "dcoh/dauth": ratio, # arrows in keys -> render in the table header. dcoh/dauth: lower=better (0 = trait at
"coh": m["coherence"], "auth": m["auth_nats"], "care": m["care_nats"]} # no coherence cost; >0 = paid coherence; <0 = coherence rose too). coh: hold ~1.0. auth: down=trait.
return {"round": rnd, "stage": stage, "dcoh/dauth↓": ratio,
"coh→": m["coherence"], "auth↓": m["auth_nats"], "care": m["care_nats"]}
def _log_stage_table(stage_rows: list[dict]) -> None: def _log_stage_table(stage_rows: list[dict]) -> None:
from tabulate import tabulate from tabulate import tabulate
logger.info( logger.info(
"\nstage pareto (base -> steered -> healed, per round):\n" "\nstage pareto (base -> steered -> healed, per round):\n"
" dcoh/dauth = coherence change per nat of Authority change vs base (signed, lower=cheaper trait)\n" " dcoh/dauth = coherence change per nat of Authority change vs base (signed); 0 = trait at no coherence cost, >0 = paid coherence (worse), <0 = coherence rose too\n"
" coh = p_any_ans coherence (hold ~1.0) auth = log p[Authority] (DOWN = trait) care = log p[Care] (off-target)\n" " coh = p_any_ans coherence (hold ~1.0) auth = log p[Authority] (DOWN = trait) care = log p[Care] (off-target)\n"
" WIN: healed keeps steered's low auth (trait) but recovers coh toward base AND a smaller dcoh/dauth than steered.\n" " WIN: healed keeps steered's low auth (trait) but recovers coh toward base AND a smaller dcoh/dauth than steered.\n"
" UNDO: healed auth springs back to ~base while coh recovers -> heal removed the trait, not just the incoherence.\n" " UNDO: healed auth springs back to ~base while coh recovers -> heal removed the trait, not just the incoherence.\n"
+ tabulate(stage_rows, headers="keys", tablefmt="github", floatfmt=".3f") + "\n") + tabulate(stage_rows, headers="keys", tablefmt="github", floatfmt=".3f") + "\n")