Datasets:
Download code/plot_figures_zh.py from 0721alex/a-plan-is-not-a-path: direct link, hf CLI and curl.
- Browser
- Download file 4.86 kB
-
https://huggingface.co/datasets/0721alex/a-plan-is-not-a-path/resolve/main/code/plot_figures_zh.py
- Command line
-
hf download hf://datasets/0721alex/a-plan-is-not-a-path/code/plot_figures_zh.py
-
curl -L -o plot_figures_zh.py https://huggingface.co/datasets/0721alex/a-plan-is-not-a-path/resolve/main/code/plot_figures_zh.py
4.86 kB
| """Re-render the three existing final figures in Chinese on Molab. | |
| Only saved estimates and intervals are read; no scoring or resampling runs. | |
| Run from /marimo/molab_runs/resource_planning with its existing environment. | |
| """ | |
| from pathlib import Path | |
| import urllib.request | |
| import pandas as pd | |
| from matplotlib import font_manager | |
| from analyze_results import plot_figures | |
| def chinese_font(): | |
| preferred = ("Noto Sans CJK SC", "Source Han Sans SC", "Noto Sans SC", | |
| "WenQuanYi Zen Hei", "SimHei") | |
| available = {font.name for font in font_manager.fontManager.ttflist} | |
| for name in preferred: | |
| if name in available: | |
| return name | |
| path = Path("work/fonts/NotoSansCJKsc-Regular.otf") | |
| path.parent.mkdir(parents=True, exist_ok=True) | |
| if not path.exists(): | |
| urllib.request.urlretrieve( | |
| "https://raw.githubusercontent.com/notofonts/noto-cjk/main/Sans/OTF/" | |
| "SimplifiedChinese/NotoSansCJKsc-Regular.otf", path) | |
| font_manager.fontManager.addfont(path) | |
| return font_manager.FontProperties(fname=path).get_name() | |
| def main(): | |
| source = Path("results/main_v1/analysis_with_diagnostics") | |
| destination = Path("outputs/figures_zh") | |
| destination.mkdir(parents=True, exist_ok=True) | |
| names = plot_figures( | |
| pd.read_csv(source / "main_curves.csv"), | |
| pd.read_csv(source / "main_overall.csv"), | |
| pd.read_csv(source / "paired_profile_summary.csv"), | |
| pd.read_csv(source / "paired_diagnostics.csv"), | |
| destination, "natural", "W0", "Qwen/Qwen3.5-4B", | |
| locale="zh", font_family=chinese_font(), | |
| ) | |
| captions = { | |
| "figure1_plan_and_execution": ( | |
| "图1|模型原生发布配置下,在原始现金网格上的计划与执行表现。阶段覆盖衡量计划中是否列出所需阶段;" | |
| "非资金结构有效检查完整格式、日期、依赖及方案兼容性。完整执行采用 full_schedule_feasible 判定," | |
| "同时要求非资金结构有效与现金充足。参考可行指在给定的有限日期范围和筹资选项中 B ≥ R*。" | |
| "B 为初始现金,R* 为参考方案所需最低启动现金;金额均为合成元,横轴以合成千元计。" | |
| "各情景等权,阴影为95%情景聚类自助法区间;曲线未经拟合,也未强制单调。" | |
| ), | |
| "figure2_oracle_feasible_loss": ( | |
| "图2|三个面板均限于参考可行请求。A:实线是这类请求中全体输出的失败比例;虚线是仅有效完整计划中的" | |
| "现金失败比例,后者额外要求计划完整且非资金结构有效。B:标注有效完整计划数/参考可行请求数," | |
| "仅在额外现金需求有定义时显示 R(计划) − R*(合成元);初始现金 B 的横轴以合成千元计。" | |
| "有效完整计划数为0时,曲线缺失表示未定义,不代表错误率为0。该子集的现金失败为0,不能证明" | |
| "不完整或无法解析的回答具有正确的资金推理。只要正的额外现金需求不超过 B − R*,模型可以用" | |
| "更多启动现金换取更少手续,而不造成执行失败。C:展示首个记录的阻碍,占参考可行请求的比例;" | |
| "数字为失败数/参考可行请求数。首个阻碍本身不能识别模型的推理错误。阴影沿用原95%情景聚类区间。" | |
| ), | |
| "figure3_paired_diagnostics": ( | |
| "图3|固定诊断子集上的配对完整执行率变化,复用已记录的基线。各比较均要求两侧的参考方案可行;" | |
| "灰点为各情景均值,彩点为情景等权均值,横线为95%情景聚类自助法区间。W1/W2的时点/手续变化" | |
| "与同一事实下的提示条件分开呈现。发布模式比较在改变思考模式的同时,也改变官方模式对应的采样参数," | |
| "不能解释为纯思考模式的因果效应。等价资源游戏比较是探索性结果,不能识别安全训练的因果作用或证明" | |
| "资金能力得到恢复。字段释义澄清是观察结果后增加的探索性比较,使用原结构化条件的全部16个4B请求," | |
| "仅补充必需组的OR含义与全局排斥字段含义;澄清条件14/16完整执行,原结构化条件4/16。" | |
| "该比较的基线是结构化条件,不能归因于纯JSON格式或纯认知效应。这4个合成情景不用于估计真实学生群体中的效应。" | |
| ), | |
| } | |
| (destination / "figure_captions.txt").write_text( | |
| "\n\n".join(captions[name] for name in names) + "\n", encoding="utf-8") | |
| print("Chinese figures rendered from the four saved final CSVs:", ", ".join(names), flush=True) | |
| if __name__ == "__main__": | |
| main() | |