File size: 2,129 Bytes
4acbf63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Render the structured-source delivery figure from aggregate-only data."""
from pathlib import Path
import json
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt

ROOT = Path(__file__).resolve().parent
DATA = json.loads((ROOT / "results.json").read_text())
OUT = ROOT / "figures"
OUT.mkdir(exist_ok=True)
plt.rcParams.update({"font.family": "DejaVu Sans", "font.size": 11,
                     "axes.spines.top": False, "axes.spines.right": False,
                     "axes.titleweight": "bold", "figure.facecolor": "white",
                     "savefig.facecolor": "white", "axes.axisbelow": True})
fig, axes = plt.subplots(1, 2, figsize=(10, 4.8))
colors = ["#60758a", "#087f75", "#ad8b52"]
names = ["Model", "Guarded\ndelivery", "Direct\nlookup"]
for ax, field, title in (
    (axes[0], "unsupported_on_negative", "Unsupported answers when evidence is inadequate"),
    (axes[1], "correct_on_positive", "Correct answers when evidence supports a gene"),
):
    values = [DATA[field][k] for k in ("unmodified", "guard", "lookup")]
    bars = ax.bar(np.arange(3), values, color=colors, width=.65)
    ax.bar_label(bars, labels=[f"{v}/60" for v in values], padding=4, fontweight="bold")
    ax.set_xticks(np.arange(3), names)
    ax.set_ylim(0, 72)
    ax.set_ylabel("Tasks out of 60")
    ax.set_title(title, fontsize=11, pad=12)
    ax.grid(axis="y", alpha=.16)
fig.suptitle("Source verification changes delivered answers", x=.05, ha="left", fontsize=16, fontweight="bold")
fig.text(.05, .095, "Guarded delivery and direct lookup agreed on all 120 tasks. Three baseline negative tasks were unscorable.", fontsize=9, color="#495866")
fig.text(.05, .055, "One-sided 95% lower bound on corrections minus possible harms: 29.27 percentage points.", fontsize=9, color="#495866")
fig.text(.05, .02, "One-sided 95% upper bounds on correct-answer loss and coverage loss: 4.87% each. 60 families.", fontsize=9, color="#495866")
fig.tight_layout(rect=(0, .14, 1, .91))
for ext in ("png", "pdf"):
    fig.savefig(OUT / ("01_source_delivery." + ext), dpi=210, bbox_inches="tight")
plt.close(fig)