Restructure: descriptive tier and experiment names, paper/manuscript

- paper/pnas -> paper/manuscript (venue-neutral)
- configs/layer1 -> configs/inheritance, src/knowledge -> src/inheritance
  (imported as `inheritance`), make layer1 -> make inheritance; layer2 alias dropped
- inheritance and trained-network bundles named after the manuscript figure
  they feed (fig2_grounding_sweep, figS3_rebaselining, ...), or descriptively
  where they feed none; configs keep their `experiment:` value so parquet
  hashes are unchanged, only output.dir moves
- figure scripts, SI figure sources, notebooks, REPRODUCING.md, README and the
  SI Methods/tables updated; make clean no longer deletes tracked manifests;
  reproduce.sh hashes the s{seed}/ layouts too

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y64o8FKP7rCuXzC48pxpMm
This commit is contained in:
Giorgio Gilestro 2026-09-13 17:00:40 +01:00
parent 84124de143
commit ab3dc10587
240 changed files with 477 additions and 476 deletions

View file

@ -0,0 +1,68 @@
"""E11 figure — the dynamic Lamarckian society: the vertical claim (C3).
A finite population of agents evolves on a rugged NK landscape (reality). The **full** society
grounding + directed recombination (sex) + quality-diversity selection climbs to the global optimum
while maintaining diversity longest. A 4-arm ablation shows every operator is load-bearing, each
breaking distinctly: **no_grounding** collapses to a fit-looking but actually-poor consensus
(self-consumption); **no_sex** plateaus (can't recombine to escape local optima); **no_diversity**
(greedy) collapses diversity fastest and stalls at a worse local optimum.
Three panels over generations: (A) best real capability the vertical climb, full highest, no_grounding
crashing below the rest; (B) population diversity full explores longest, no_grounding collapses
almost immediately; (C) the self-consumption signature conformity minus true fitness (how far the
population's mutual agreement exceeds its real capability), largest for no_grounding. Reads only the
committed bundle.
Usage: python figures/plot_fig4_society_ablation.py [results/fig4_society_ablation]
"""
from __future__ import annotations
import sys
from pathlib import Path
import matplotlib.pyplot as plt
sys.path.insert(0, str(Path(__file__).parent))
from _figlib import load_bundle, mean_ci, savefig # noqa: E402
_ARMS = [("full", "#2ca02c", "full society"),
("no_sex", "#ff7f0e", "no sex (no recombination)"),
("no_diversity", "#9467bd", "no diversity (greedy)"),
("no_grounding", "#d62728", "no grounding (self-consumption)")]
def main(results_dir: str = "results/fig4_society_ablation") -> None:
df, _ = load_bundle(results_dir)
arms = [a for a in _ARMS if a[0] in set(df["arm"].unique())]
g_opt = df["global_opt"].mean()
fig, axes = plt.subplots(1, 3, figsize=(16, 4.8))
def traj(ax, col, title, ylabel, hline=None):
for name, c, lab in arms:
sub = df[df["arm"] == name]
g, m, ci = mean_ci(sub, "generation", col)
ax.plot(g, m, "-", color=c, lw=1.9, label=lab)
ax.fill_between(g, m - ci, m + ci, color=c, alpha=0.15)
if hline is not None:
ax.axhline(hline[0], ls=":", color="gray", lw=1, label=hline[1])
ax.set(xlabel="generation", ylabel=ylabel, title=title)
ax.legend(frameon=False, fontsize=8)
traj(axes[0], "best_fitness", "The vertical climb: general capability\n"
"(full climbs highest; no-grounding collapses)", "best real fitness",
hline=(g_opt, "global optimum"))
traj(axes[1], "diversity", "Specialties maintained: diversity during search\n"
"(full explores longest; ablations collapse fast)", "population diversity")
traj(axes[2], "conformity_true_gap", "Self-consumption signature:\n"
"agreement minus real capability", "conformity true fitness")
fig.suptitle("E11 — the dynamic Lamarckian society: grounding + directed sex + diversity climb to "
"the optimum; remove any one and it breaks (the vertical claim, C3)", y=1.02, fontsize=12)
fig.tight_layout()
savefig(fig, results_dir, "fig4_society_ablation")
if __name__ == "__main__":
main(*sys.argv[1:])