eduzrh commited on
Commit
2e58f2f
·
verified ·
1 Parent(s): ecd982d

Rewrite manuscript in plain CRAD style; rebuild figures and tables

Browse files
Files changed (1) hide show
  1. scripts/make_figures.py +24 -21
scripts/make_figures.py CHANGED
@@ -82,24 +82,24 @@ def fig_framework() -> None:
82
 
83
  # top band: input -> retrieval -> evidence pack <- frozen KB
84
  box(0.10, 5.95, 1.75, 0.62, "研究问题\nGBM/TMZ 耐药", fc="#EEF3FA")
85
- box(2.10, 5.95, 2.20, 0.62, "混合证据检索\nBM25+主题/实体增强", fc="#E8F3EA", bold=True)
86
  box(4.55, 5.95, 1.85, 0.62, "证据包\n[E1…E8]+[K1…K2]", fc="#FFF6E5")
87
- box(6.75, 5.95, 3.15, 0.62, "冻结知识库:161 篇摘要 + 6 张 UniProt 卡", fc="#F2EAF7", fs=6.9)
88
  arrow((1.85, 6.26), (2.10, 6.26))
89
  arrow((4.30, 6.26), (4.55, 6.26))
90
  arrow((6.75, 6.26), (6.40, 6.26), ls="--", color="#999999")
91
 
92
  # left column: gap mining -> divergence -> domain review
93
- box(0.10, 4.55, 2.85, 0.80, "① 缺口挖掘\nG1–G3:矛盾/空白/未共现对", fc="#FDEBEC", bold=True)
94
- box(0.10, 3.35, 2.85, 0.80, "② 三候选发散\n每缺口一候选 + 非显然桥接", fc="#FDEBEC")
95
- box(0.10, 2.15, 2.85, 0.80, "③ 领域角色审查\n生信/PLM · 药理/转化 · 方法学", fc="#FFFFFF")
96
 
97
  # middle column: tournament -> convergence -> verification/repair
98
- box(3.55, 4.55, 2.95, 0.80, "④ 候选加权择优\n新颖 35% · 证据 35% · 可行 30%", fc="#EEF3FA", bold=True)
99
- box(3.55, 3.35, 2.95, 0.80, "⑤ PI 收敛\n最小推测:≤1 条无证据桥接", fc="#EEF3FA")
100
- box(3.55, 2.15, 2.95, 0.80, "⑥ 校验与条件修复\n标题/编号/绑定表/定量阈值", fc="#FFF6E5")
101
 
102
- box(7.10, 3.35, 2.80, 2.00, "⑦ 假设卡与证据审计\n\n七段结构 + 主张级绑定表\n\n引用有效 · 静默无据\n证据覆盖 · 披露率", fc="#E8F3EA", bold=True)
103
 
104
  arrow((1.52, 5.95), (1.52, 5.35))
105
  arrow((1.52, 4.55), (1.52, 4.15))
@@ -117,7 +117,7 @@ def fig_framework() -> None:
117
 
118
  ax.add_patch(FancyBboxPatch((0.10, 0.85), 9.80, 0.62, boxstyle="round,pad=0.05,rounding_size=0.10",
119
  linewidth=0.9, edgecolor="#333333", facecolor="#F4F4F4", zorder=2))
120
- ax.text(5.0, 1.16, "缓存 / 回放层:每次调用按内容哈希落盘,生成记录与评审结果随仓库发布,可离线重建全部表格与稿件",
121
  ha="center", va="center", fontsize=6.9, zorder=3)
122
  ax.plot([5.0, 5.0], [2.15, 1.47], color="#999999", lw=0.9, ls="--")
123
  ax.text(5.0, 6.85, "HypoAgent-Bio 框架", ha="center", fontsize=10.0, fontweight="bold")
@@ -215,7 +215,7 @@ def fig_main() -> None:
215
 
216
  ax = axes[1]
217
  metrics = [("citation_validity", "引用有效"), ("semantic_support_rate", "语义支持"),
218
- ("evidence_coverage", "证据覆盖"), ("unsupported_claim_rate", "无依据主张")]
219
  x = np.arange(len(metrics))
220
  for i, method in enumerate(methods):
221
  row = df[df["method"] == method].iloc[0]
@@ -232,7 +232,7 @@ def fig_main() -> None:
232
  ax.set_xticks(x)
233
  ax.set_xticklabels([m[1] for m in metrics], fontsize=7.5, rotation=20)
234
  ax.set_ylim(0, 1.05)
235
- ax.set_title("(b) 证据级指标", fontsize=9.5, fontweight="bold")
236
  fig.tight_layout()
237
  save(fig, "fig4_main")
238
 
@@ -264,7 +264,7 @@ def fig_ablation() -> None:
264
 
265
  ax = axes[1]
266
  metrics = [("citation_validity", "引用有效"), ("semantic_support_rate", "语义支持"),
267
- ("unsupported_claim_rate", "无依据主张")]
268
  x = np.arange(len(metrics))
269
  for i, method in enumerate(methods):
270
  row = df[df["method"] == method].iloc[0]
@@ -281,7 +281,7 @@ def fig_ablation() -> None:
281
  ax.set_xticks(x)
282
  ax.set_xticklabels([m[1] for m in metrics], fontsize=7.5, rotation=20)
283
  ax.set_ylim(0, 1.05)
284
- ax.set_title("(b) 证据级指标", fontsize=9.5, fontweight="bold")
285
  fig.tight_layout()
286
  save(fig, "fig5_ablation")
287
 
@@ -315,26 +315,26 @@ def fig_case(qid: str = "Q18") -> None:
315
  ax.set_ylim(-0.2, max(len(rows), len(evidence_ids)) + 1.1)
316
  ax.axis("off")
317
  n_c, n_e = len(rows), len(evidence_ids)
318
- c_y = np.linspace(0.8, max(n_c, n_e) - 0.2, n_c)
319
  e_y = np.linspace(0.8, max(n_c, n_e) - 0.2, n_e)
320
  c_pos = {i: (2.9, y) for i, y in enumerate(c_y)}
321
  e_pos = {eid: (7.1, y) for eid, y in zip(evidence_ids, e_y)}
322
  strength_color = {"强": "#2E7D32", "中": "#EF6C00", "弱": "#757575", "无": "#C62828"}
323
  for i, (claim, ev, strength) in enumerate(rows):
324
- if len(claim) <= 24:
325
  label = claim
326
  else:
327
  cut = None
328
  for sep in ["、", ",", ";", ":", "且"]:
329
- idx = claim.rfind(sep, 0, 24)
330
  if idx >= 8:
331
  cut = idx + 1
332
  break
333
  if cut is None:
334
- cut = 24
335
  second = claim[cut:]
336
- if len(second) > 24:
337
- second = second[:23] + "…"
338
  label = claim[:cut] + "\n" + second
339
  ax.text(2.8, c_y[i], label, ha="right", va="center", fontsize=6.6, linespacing=1.15)
340
  ax.add_patch(FancyBboxPatch((2.9, c_y[i] - 0.16), 0.12, 0.32, boxstyle="round,pad=0.01",
@@ -342,8 +342,11 @@ def fig_case(qid: str = "Q18") -> None:
342
  ids = re.findall(r"[EK]\d+", ev)
343
  color = strength_color.get(strength[0] if strength else "无", "#757575")
344
  if not ids:
345
- ax.plot([3.02, 7.0], [c_y[i], c_y[i]], color="#C62828", linestyle=":", linewidth=1.0)
346
  ax.text(5.0, c_y[i] + 0.12, "无直接证据", ha="center", fontsize=6.2, color="#C62828")
 
 
 
347
  for eid in ids:
348
  if eid not in e_pos:
349
  continue
 
82
 
83
  # top band: input -> retrieval -> evidence pack <- frozen KB
84
  box(0.10, 5.95, 1.75, 0.62, "研究问题\nGBM/TMZ 耐药", fc="#EEF3FA")
85
+ box(2.10, 5.95, 2.20, 0.62, "证据检索\nBM25+主题/实体匹配", fc="#E8F3EA", bold=True)
86
  box(4.55, 5.95, 1.85, 0.62, "证据包\n[E1…E8]+[K1…K2]", fc="#FFF6E5")
87
+ box(6.75, 5.95, 3.15, 0.62, "固定文献库:161 篇摘要 + 6 张 UniProt 卡", fc="#F2EAF7", fs=6.9)
88
  arrow((1.85, 6.26), (2.10, 6.26))
89
  arrow((4.30, 6.26), (4.55, 6.26))
90
  arrow((6.75, 6.26), (6.40, 6.26), ls="--", color="#999999")
91
 
92
  # left column: gap mining -> divergence -> domain review
93
+ box(0.10, 4.55, 2.85, 0.80, "① 找研究空白\nG1–G3:矛盾/空白/未共现", fc="#FDEBEC", bold=True)
94
+ box(0.10, 3.35, 2.85, 0.80, "② 提出3个候选\n每个空白1个 + 不显然桥接", fc="#FDEBEC")
95
+ box(0.10, 2.15, 2.85, 0.80, "③ 三类角色审查\n生信/PLM · 药理/转化 · 方法学", fc="#FFFFFF")
96
 
97
  # middle column: tournament -> convergence -> verification/repair
98
+ box(3.55, 4.55, 2.95, 0.80, "④ 按权重打分选择\n创新35% · 证据35% · 可行30%", fc="#EEF3FA", bold=True)
99
+ box(3.55, 3.35, 2.95, 0.80, "⑤ 收敛写作\n最多1条无证据推测", fc="#EEF3FA")
100
+ box(3.55, 2.15, 2.95, 0.80, "⑥ 规则检查与修改\n标题/编号/证据表/数值阈值", fc="#FFF6E5")
101
 
102
+ box(7.10, 3.35, 2.80, 2.00, "⑦ 假设卡与核查\n\n7段结构 + 证据对照表\n\n引用有效 · 未标注来源\n证据覆盖 · 语义支持", fc="#E8F3EA", bold=True)
103
 
104
  arrow((1.52, 5.95), (1.52, 5.35))
105
  arrow((1.52, 4.55), (1.52, 4.15))
 
117
 
118
  ax.add_patch(FancyBboxPatch((0.10, 0.85), 9.80, 0.62, boxstyle="round,pad=0.05,rounding_size=0.10",
119
  linewidth=0.9, edgecolor="#333333", facecolor="#F4F4F4", zorder=2))
120
+ ax.text(5.0, 1.16, "缓存与重放:每次调用按内容哈希存盘,生成与评审记录随仓库发布,可离线重建全部表格与稿件",
121
  ha="center", va="center", fontsize=6.9, zorder=3)
122
  ax.plot([5.0, 5.0], [2.15, 1.47], color="#999999", lw=0.9, ls="--")
123
  ax.text(5.0, 6.85, "HypoAgent-Bio 框架", ha="center", fontsize=10.0, fontweight="bold")
 
215
 
216
  ax = axes[1]
217
  metrics = [("citation_validity", "引用有效"), ("semantic_support_rate", "语义支持"),
218
+ ("evidence_coverage", "证据覆盖"), ("unsupported_claim_rate", "未标注来源")]
219
  x = np.arange(len(metrics))
220
  for i, method in enumerate(methods):
221
  row = df[df["method"] == method].iloc[0]
 
232
  ax.set_xticks(x)
233
  ax.set_xticklabels([m[1] for m in metrics], fontsize=7.5, rotation=20)
234
  ax.set_ylim(0, 1.05)
235
+ ax.set_title("(b) 核查指标", fontsize=9.5, fontweight="bold")
236
  fig.tight_layout()
237
  save(fig, "fig4_main")
238
 
 
264
 
265
  ax = axes[1]
266
  metrics = [("citation_validity", "引用有效"), ("semantic_support_rate", "语义支持"),
267
+ ("unsupported_claim_rate", "未标注来源")]
268
  x = np.arange(len(metrics))
269
  for i, method in enumerate(methods):
270
  row = df[df["method"] == method].iloc[0]
 
281
  ax.set_xticks(x)
282
  ax.set_xticklabels([m[1] for m in metrics], fontsize=7.5, rotation=20)
283
  ax.set_ylim(0, 1.05)
284
+ ax.set_title("(b) 核查指标", fontsize=9.5, fontweight="bold")
285
  fig.tight_layout()
286
  save(fig, "fig5_ablation")
287
 
 
315
  ax.set_ylim(-0.2, max(len(rows), len(evidence_ids)) + 1.1)
316
  ax.axis("off")
317
  n_c, n_e = len(rows), len(evidence_ids)
318
+ c_y = np.linspace(max(n_c, n_e) - 0.2, 0.8, n_c)
319
  e_y = np.linspace(0.8, max(n_c, n_e) - 0.2, n_e)
320
  c_pos = {i: (2.9, y) for i, y in enumerate(c_y)}
321
  e_pos = {eid: (7.1, y) for eid, y in zip(evidence_ids, e_y)}
322
  strength_color = {"强": "#2E7D32", "中": "#EF6C00", "弱": "#757575", "无": "#C62828"}
323
  for i, (claim, ev, strength) in enumerate(rows):
324
+ if len(claim) <= 30:
325
  label = claim
326
  else:
327
  cut = None
328
  for sep in ["、", ",", ";", ":", "且"]:
329
+ idx = claim.rfind(sep, 0, 34)
330
  if idx >= 8:
331
  cut = idx + 1
332
  break
333
  if cut is None:
334
+ cut = 30
335
  second = claim[cut:]
336
+ if len(second) > 30:
337
+ second = second[:29] + "…"
338
  label = claim[:cut] + "\n" + second
339
  ax.text(2.8, c_y[i], label, ha="right", va="center", fontsize=6.6, linespacing=1.15)
340
  ax.add_patch(FancyBboxPatch((2.9, c_y[i] - 0.16), 0.12, 0.32, boxstyle="round,pad=0.01",
 
342
  ids = re.findall(r"[EK]\d+", ev)
343
  color = strength_color.get(strength[0] if strength else "无", "#757575")
344
  if not ids:
345
+ ax.plot([3.02, 6.95], [c_y[i], c_y[i]], color="#C62828", linestyle=":", linewidth=1.0)
346
  ax.text(5.0, c_y[i] + 0.12, "无直接证据", ha="center", fontsize=6.2, color="#C62828")
347
+ ax.add_patch(FancyBboxPatch((7.0, c_y[i] - 0.16), 0.55, 0.32, boxstyle="round,pad=0.01",
348
+ facecolor="#FDECEA", edgecolor="#C62828", linewidth=0.8))
349
+ ax.text(7.275, c_y[i], "无", ha="center", va="center", fontsize=7, fontweight="bold", color="#C62828")
350
  for eid in ids:
351
  if eid not in e_pos:
352
  continue