Rename showcase readout dlogit->dclr to match steering-lite

The MFV foundation readout is centered log-ratio (clr), not a logit. Renames the
showcase JSON/CSV consumers' keys (dclr/dclr_sem) and the shared reader-space-shift
column to match steering-lite's writers; the survey 'C = logit contrast' readout
keeps its logit naming.

Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
wassname
2026-07-15 19:50:04 +08:00
co-authored by Claudypoo
parent 7f873ffb42
commit a9a01327e7
3 changed files with 13 additions and 13 deletions
+7 -7
View File
@@ -33,7 +33,7 @@ from moralmaps.zones import zones_for
ORDINAL = ["mfq2", "big5", "humor_styles"]
FOUNDATION_ORDER = ["care", "fairness", "loyalty", "authority", "sanctity", "liberty"]
_MFV_INSTR = "mfv"
_MFV_YLABEL = "MFV: logit violation (nat, base-relative)"
_MFV_YLABEL = "MFV: clr violation (nat, base-relative)"
def _read_grid_csv(path: Path) -> list[dict]:
@@ -61,7 +61,7 @@ def _grid_values(rows: list[dict], value_key: str, foundations: list[str]) -> di
def plot_mfv_grid_maps(run_dir: Path, out: Path, vec_label: str) -> list[Path]:
"""5x5 grid of ipsative culture maps, one per (hc, cc) cell."""
rows = _read_grid_csv(run_dir / "mfv_profiles.csv")
# build profile per cell: {foundation: mean} (using dlogit relative to base)
# build profile per cell: {foundation: mean} (using dclr relative to base)
hc_vals = sorted(set(float(r["honesty_c"]) for r in rows))
cc_vals = sorted(set(float(r["credulity_c"]) for r in rows))
founds = sorted(set(r["foundation"] for r in rows))
@@ -93,7 +93,7 @@ def plot_mfv_grid_maps(run_dir: Path, out: Path, vec_label: str) -> list[Path]:
ax.set_xlabel("honesty ->", fontsize=8)
if j == 0:
ax.set_ylabel("credulity ^", fontsize=8)
fig.suptitle(f"MFV profile grid: {vec_label} (dlogit per foundation, base-relative)", fontsize=12)
fig.suptitle(f"MFV profile grid: {vec_label} (dclr per foundation, base-relative)", fontsize=12)
fig.tight_layout()
path = out / "mfv_grid_bars.png"
fig.savefig(path, dpi=150)
@@ -132,10 +132,10 @@ def plot_ordinal_heatmaps(run_dir: Path, out: Path, name: str, vec_label: str) -
def plot_mfv_heatmaps(run_dir: Path, out: Path, vec_label: str) -> list[Path]:
"""2D heatmaps of MFV dlogit per foundation."""
"""2D heatmaps of MFV dclr per foundation."""
rows = _read_grid_csv(run_dir / "mfv_profiles.csv")
founds = FOUNDATION_ORDER
grids, hc_vals, cc_vals = _grid_values(rows, "dlogit", founds)
grids, hc_vals, cc_vals = _grid_values(rows, "dclr", founds)
n = len(founds)
ncols = 3
nrows = (n + ncols - 1) // ncols
@@ -148,13 +148,13 @@ def plot_mfv_heatmaps(run_dir: Path, out: Path, vec_label: str) -> list[Path]:
extent=[cc_vals[0] - 0.25, cc_vals[-1] + 0.25,
hc_vals[0] - 0.25, hc_vals[-1] + 0.25],
cmap="RdBu_r", vmin=-vmax, vmax=vmax)
ax.set_title(f"{f} (dlogit)", fontsize=9)
ax.set_title(f"{f} (dclr)", fontsize=9)
ax.set_xlabel("credulity-c", fontsize=8)
ax.set_ylabel("honesty-c", fontsize=8)
plt.colorbar(im, ax=ax, shrink=0.8)
for idx in range(len(founds), nrows * ncols):
axes[idx // ncols][idx % ncols].set_visible(False)
fig.suptitle(f"MFV: {vec_label} 2D steer grid (dlogit per foundation)", fontsize=11)
fig.suptitle(f"MFV: {vec_label} 2D steer grid (dclr per foundation)", fontsize=11)
fig.tight_layout()
path = out / "mfv_heatmap.png"
fig.savefig(path, dpi=150)
+5 -5
View File
@@ -73,7 +73,7 @@ def _survey_rows(run_dir: Path, name: str, cs: list[float]) -> list[dict[str, st
"c path": _cs_label(cs),
"profile shift / human SD": _fmt_pct(100 * profile_delta / human_sd),
"profile shift": _fmt(profile_delta),
"reader-logit shift": f"{_fmt(logit_delta)} ± {sem:.2f}",
"reader-space shift": f"{_fmt(logit_delta)} ± {sem:.2f}",
})
return out
@@ -91,21 +91,21 @@ def _mfv_rows(run_dir: Path, cs: list[float]) -> list[dict[str, str]]:
pos = by_key[(foundation, pos_c)]
human_sd = float(human_M[:, j].std(ddof=1))
profile_delta = float(prof[pos_c][j] - prof[neg_c][j])
logit_delta = float(pos["dlogit"]) - float(neg["dlogit"])
sem = float(np.hypot(float(pos["dlogit_sem"]), float(neg["dlogit_sem"])))
clr_delta = float(pos["dclr"]) - float(neg["dclr"])
sem = float(np.hypot(float(pos["dclr_sem"]), float(neg["dclr_sem"])))
out.append({
"dataset": DISPLAY["mfv"],
"axis": foundation,
"c path": _cs_label(cs),
"profile shift / human SD": _fmt_pct(100 * profile_delta / human_sd),
"profile shift": _fmt(profile_delta),
"reader-logit shift": f"{_fmt(logit_delta)} ± {sem:.2f}",
"reader-space shift": f"{_fmt(clr_delta)} ± {sem:.2f}",
})
return out
def _markdown_table(rows: list[dict[str, str]]) -> str:
cols = ["dataset", "axis", "c path", "profile shift / human SD", "profile shift", "reader-logit shift"]
cols = ["dataset", "axis", "c path", "profile shift / human SD", "profile shift", "reader-space shift"]
lines = ["| " + " | ".join(cols) + " |", "| " + " | ".join(["---"] * len(cols)) + " |"]
for row in rows:
lines.append("| " + " | ".join(row[c] for c in cols) + " |")
+1 -1
View File
@@ -416,7 +416,7 @@ def evaluate(
# Unscorable rows (self-close with no answer slot, or a non-finite forward) carry NaN:
# the read is undefined, not "zero coherence", so they drop from the means (nanmean,
# matching the dlogit path) and surface as frac_unscorable. That rate IS the coherence-
# matching the clr path) and surface as frac_unscorable. That rate IS the coherence-
# loss signal: pmass under forced reads is pinned high (the scaffold primes a valid token),
# so a low mean_pmass no longer flags breakage -- a high frac_unscorable / high
# mean_nll_prefill does.