asdfasdfqrqwer Claude Opus 4.8 commited on
Commit
06bc164
·
1 Parent(s): ed7aee5

Sync web app: diagnosticity plane view, panels into expanders, terminology align (accounts of generalization), chance 0.50

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +150 -114
  3. tide.py +1 -1
README.md CHANGED
@@ -13,7 +13,7 @@ license: mit
13
  # tide — interactive transfer-design audit
14
 
15
  An interactive front end for the [`tide`](../package) toolkit. Describe a transfer-generalization
16
- design and the candidate learning accounts you want to tell apart. The app reports, before any data
17
  are collected, whether those accounts actually make different predictions on the design: candidate
18
  separation, candidate recovery, their condition-level atlases, and a plain-language reading.
19
 
 
13
  # tide — interactive transfer-design audit
14
 
15
  An interactive front end for the [`tide`](../package) toolkit. Describe a transfer-generalization
16
+ design and the candidate accounts you want to tell apart. The app reports, before any data
17
  are collected, whether those accounts actually make different predictions on the design: candidate
18
  separation, candidate recovery, their condition-level atlases, and a plain-language reading.
19
 
app.py CHANGED
@@ -1,7 +1,7 @@
1
  """tide — interactive transfer-design audit (Streamlit, for Hugging Face Spaces).
2
 
3
  Wraps the `tide` library end to end: describe a transfer-generalization design and a set of candidate
4
- learning mechanisms, and see whether the design can tell them apart -- the candidate separation, the
5
  candidate recovery, their condition-level atlases, and a plain-language reading -- before any data are
6
  collected.
7
 
@@ -205,7 +205,7 @@ def pair_cells(i, j, kind):
205
 
206
  def least_resolved(R):
207
  """The candidate pair(s) the design resolves least: the smallest off-diagonal pairwise resolve
208
- R[i,j] (closest to the two-candidate chance of 0.5), and every pair tied at it. Returns
209
  (value, [(i, j), ...])."""
210
  R = np.asarray(R, float); C = len(R)
211
  off = [(float(R[i, j]), i, j) for i in range(C) for j in range(i + 1, C)]
@@ -217,7 +217,7 @@ def least_resolved(R):
217
  def heatmap(M, labels, vmax, cells=(), zmin=0.0):
218
  # title is rendered as markdown above the chart (not in the figure) so the top-axis labels never
219
  # collide with it; automargin reserves room for the rotated column labels. `cells` are (row, col)
220
- # positions to outline. `zmin` lifts the colour floor (0.5 for the pairwise resolve, whose chance is 0.5).
221
  M = np.asarray(M, float)
222
  fig = go.Figure(go.Heatmap(
223
  z=M, x=labels, y=labels, zmin=zmin, zmax=vmax, colorscale=BLUESCALE,
@@ -233,6 +233,45 @@ def heatmap(M, labels, vmax, cells=(), zmin=0.0):
233
  return fig
234
 
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  def separation_atlas_bars(sep_atlas, show_geo=True, show_pol=True):
237
  # only chart (and add to the legend) the axes actually varied; when neither is varied, fall back to
238
  # showing both so the panel is not empty.
@@ -362,7 +401,7 @@ def curve_fig(counts, overall, nC, Ntot):
362
  fig.update_layout(height=320, margin=dict(l=10, r=10, t=30, b=10), plot_bgcolor="white",
363
  paper_bgcolor="white", showlegend=False,
364
  xaxis=dict(type="log", title="test items (resampled from your design)", tickvals=counts),
365
- yaxis=dict(title="pairwise resolve (chance 0.5)", range=[0.45, 1.03]))
366
  return fig
367
 
368
 
@@ -458,7 +497,7 @@ def summary_overall(sep, rec, sep_atlas, labels, show_geo, show_pol, ia, ib):
458
 
459
 
460
  # ----------------------------------------------------------------------------- header
461
- st.title("🔬 Can your transfer design tell learning accounts apart?")
462
  st.markdown(
463
  "When someone learns a category or a rule, we infer *how* they learned it from how they generalize "
464
  "to new test items. Each proposed account is a **candidate mechanism**. The trouble is that "
@@ -784,123 +823,120 @@ if res:
784
  st.markdown(f"<div style='border-left:4px solid {vcol};padding:10px 14px;background:#f6f8fa;"
785
  f"border-radius:4px;margin:4px 0 14px;font-size:15px'>{verdict}</div>", unsafe_allow_html=True)
786
 
787
- metrics = []
788
- if show_geo:
789
- metrics.append(("Geometry axis", grec, 0.5, "identified", "not identified"))
790
- if show_pol:
791
- metrics.append(("Policy axis", prec, 0.5, "identified", "not identified"))
792
- if not metrics: # no matched contrast: read jointly
793
- off = [R[i, j] for i in range(C) for j in range(C) if i != j]
794
- metrics.append(("Mean pair resolve", float(np.mean(off)) if off else 1.0,
795
- 0.5, "separable", "not separable"))
796
- pair_html = ", ".join(f"{labels[i]} ↔ {labels[j]}" for i, j in ties)
797
- pair_sub = ("tied, each resolves" if len(ties) > 1 else "resolves") + f" {mnres*100:.0f}% (chance 50%)"
798
- blocks = [("metric",) + m for m in metrics] + [("pair",)]
799
- for col, blk in zip(st.columns(len(blocks)), blocks):
800
- if blk[0] == "metric":
801
- metric_card(col, *blk[1:])
802
- else:
803
- # the label and the sub-line stay fixed; only the pairs line scrolls horizontally (nowrap +
804
- # overflow-x) so any number of tied pairs fits without growing or wrapping the card.
805
- col.markdown(
806
- f"<div style='{CARD_STYLE}'>"
807
- f"<div style='color:#6b7280;font-size:13px'>least-resolved pair</div>"
808
- f"<div style='font-size:15px;font-weight:700;line-height:1.25;color:{ACCENT};"
809
- f"white-space:nowrap;overflow-x:auto'>{pair_html}</div>"
810
- f"<div style='font-size:13px;color:#6b7280'>{pair_sub}</div>"
811
- f"</div>", unsafe_allow_html=True)
812
 
813
- if not show_geo and not show_pol:
814
- st.caption("These candidates differ on more than one axis at once (or share an axis value), so "
815
- "resolving power is read jointly, not per axis. For a clean per-axis reading, include "
816
- "matched contrasts: candidates that differ on only one axis.")
817
- elif not show_geo:
818
- st.caption("Only the policy axis varies across these candidates, so only it is reported.")
819
- elif not show_pol:
820
- st.caption("Only the geometry axis varies across these candidates, so only it is reported.")
821
-
822
- # the pair to inspect drives the outline here and the per-condition pair view below; it defaults to
823
- # the least-resolved pair (the lowest off-diagonal resolve, often a configural-policy pair), so a
824
- # specific debate is inspected by choosing its two candidates.
825
  pc1, pc2 = st.columns(2)
826
- ca = pc1.selectbox("Inspect the pair", labels, index=int(bi), key="pairA")
827
  cb = pc2.selectbox("against", labels, index=int(bj), key="pairB")
828
  ia, ib = labels.index(ca), labels.index(cb)
829
  same = ia == ib
830
-
831
- vmax = max(1e-6, float(D.max()))
832
- h1, h2 = st.columns(2)
833
- with h1:
834
- st.markdown("**Separation** &nbsp;·&nbsp; $D_{ab}$")
835
- st.plotly_chart(heatmap(D, labels, vmax, cells=() if same else pair_cells(ia, ib, "sep")),
836
- use_container_width=True)
837
- with h2:
838
- st.markdown("**Pairwise resolve** &nbsp;·&nbsp; symmetric (chance 0.5)")
839
- st.plotly_chart(heatmap(R, labels, 1.0, cells=() if same else pair_cells(ia, ib, "rec"), zmin=0.5),
840
- use_container_width=True)
841
- where = ("the whole design, pooled over its conditions" if scope == "Whole design (pooled)"
842
- else f"the **{scope}** condition alone")
843
- st.caption(f"Read for {where}. Left, candidate separation $D_{{ab}}$ (symmetric, so a pair "
844
- f"is two cells); right, achieved at the chosen sample, the pairwise resolve: the "
845
- f"two-candidate recovery rate for each pair, also symmetric, with a chance baseline of "
846
- f"0.5 (the diagonal is a trivial 1). Read each resolve cell against the separation on the "
847
- f"left: where $D_{{ab}}\\approx0$ the two candidates are non-separable and the resolve "
848
- f"sits at 0.5, reporting non-identification rather than a false commitment; where $D_{{ab}}>0$ "
849
- f"the resolve climbs to 1 as evidence accumulates. The outlined pair is the one you chose "
850
- f"above, defaulting to the least-resolved. Switch the scope to compare the whole design with "
851
- f"a single condition: a pair the pool resolves but a condition leaves near 0.5 is "
852
- f"non-diagnostic on the condition an experiment is read through.")
853
-
854
- # -------------------------------------------------------------- 2. where the power lives
855
- st.markdown("### Where the separating power lives")
856
- st.plotly_chart(separation_atlas_bars(sep_atlas, show_geo, show_pol), use_container_width=True)
857
- st.caption("Per condition, the matched separation on each varied axis. Tall bars are the "
858
- "conditions that carry the diagnostic signal.")
859
-
860
- st.markdown("#### A pair, condition by condition")
861
  if same:
862
- st.info("Pick two different candidates in **Inspect the pair** above to compare a pair "
863
- "across conditions.")
864
  else:
 
 
 
 
 
 
 
 
 
 
 
 
865
  st.plotly_chart(pair_recovery_bars(rec, sep, ia, ib), use_container_width=True)
866
- st.caption(f"For the inspected pair **{labels[ia]} ↔ {labels[ib]}**: bars are how well each "
867
- f"condition's items *alone* resolve the pair (achieved, chance 0.5), the line is that "
868
- f"condition's candidate separation $D_{{ab}}$. A condition with low $D_{{ab}}$ "
869
- f"and resolve near 0.5 is one the design cannot settle this pair on, even where the "
870
- f"whole design resolves it.")
871
-
872
- st.markdown("#### Predicted correctness by condition")
873
- spread = st.checkbox("Show the per-item spread", key="spread")
874
- if spread and is_multi_design:
875
- st.info("Per-item spread is available for single-design uploads. The mean bars below use the "
876
- "full multi-design audit.")
877
- st.plotly_chart(accuracy_bars(sep), use_container_width=True)
878
- elif spread:
879
- pdist = tide.predicted_distributions(primary_exp, cands)
880
- st.plotly_chart(accuracy_boxes(pdist, sep), use_container_width=True)
881
- st.caption("Each bar replaced by its spread over test items, the probability each candidate "
882
- "assigns to the correct class (box = quartiles, dashed = mean, the bar value; heads "
883
- "pooled). Two candidates with the same mean accuracy can sit at different "
884
- "confidences here, the difference the separation $D_{ab}$ counts and accuracy does "
885
- "not.")
886
- else:
887
- st.plotly_chart(accuracy_bars(sep), use_container_width=True)
888
- st.caption("For each condition, the joint accuracy each candidate predicts against the "
889
- "design's correct outputs. Candidates whose bars track each other within a "
890
- "condition are pairs that condition cannot tell apart by choice; where they fan "
891
- "out, it can. Tick the box above for the per-item spread behind each bar.")
892
-
893
- # -------------------------------------------------------------- 3. in words
894
- st.markdown("### Summary")
895
- st.dataframe(axis_table_df(rec, show_geo, show_pol, n_geo, n_pol),
896
- hide_index=True, use_container_width=True)
897
- for line in summary_overall(sep, rec, sep_atlas, labels, show_geo, show_pol, ia, ib):
898
- st.markdown("- " + line)
899
- st.markdown("**By condition**")
900
- st.dataframe(condition_table_df(sep, rec, sep_atlas, labels),
901
- hide_index=True, use_container_width=True)
902
-
903
- # -------------------------------------------------------------- 4. about this design
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
904
  st.markdown("### About this design")
905
  with st.expander("Transfer relation of each condition"):
906
  prof = tide.suggest_relations(primary_exp) # uses the rule-bearing features
 
1
  """tide — interactive transfer-design audit (Streamlit, for Hugging Face Spaces).
2
 
3
  Wraps the `tide` library end to end: describe a transfer-generalization design and a set of candidate
4
+ mechanisms, and see whether the design can tell them apart -- the candidate separation, the
5
  candidate recovery, their condition-level atlases, and a plain-language reading -- before any data are
6
  collected.
7
 
 
205
 
206
  def least_resolved(R):
207
  """The candidate pair(s) the design resolves least: the smallest off-diagonal pairwise resolve
208
+ R[i,j] (closest to the two-candidate chance of 0.50), and every pair tied at it. Returns
209
  (value, [(i, j), ...])."""
210
  R = np.asarray(R, float); C = len(R)
211
  off = [(float(R[i, j]), i, j) for i in range(C) for j in range(i + 1, C)]
 
217
  def heatmap(M, labels, vmax, cells=(), zmin=0.0):
218
  # title is rendered as markdown above the chart (not in the figure) so the top-axis labels never
219
  # collide with it; automargin reserves room for the rotated column labels. `cells` are (row, col)
220
+ # positions to outline. `zmin` lifts the colour floor (0.5 for the pairwise resolve, whose chance is 0.50).
221
  M = np.asarray(M, float)
222
  fig = go.Figure(go.Heatmap(
223
  z=M, x=labels, y=labels, zmin=zmin, zmax=vmax, colorscale=BLUESCALE,
 
233
  return fig
234
 
235
 
236
+ def diagnosticity_plane(D, R, labels, bi, bj):
237
+ """Every candidate pair as one point on the (separation, resolve) plane, the single picture the
238
+ audit reduces to: x is the candidate separation D_ab (the evidence one observation carries), y is
239
+ the pairwise resolve at this sample. The wall at x=0 is the design limit (predictions coincide, no
240
+ sample resolves the pair); pairs climb toward 1 as separation grows. Colour marks the regime so a
241
+ reader sees at a glance which contrasts are stuck and which the design settles."""
242
+ D = np.asarray(D, float); R = np.asarray(R, float); C = len(labels)
243
+ GREEN = "#1a7f4b"
244
+ xs, ys, cols, txt = [], [], [], []
245
+ for i in range(C):
246
+ for j in range(i + 1, C):
247
+ d = float(D[i, j]); y = float(0.5 * (R[i, j] + R[j, i]))
248
+ xs.append(d); ys.append(y)
249
+ cols.append(ACCENT if (d < 0.005 and y < 0.55) else (GREEN if y >= 0.90 else DARK))
250
+ txt.append(f"{labels[i]} &harr; {labels[j]}<br>separation {d:.3f} · resolve {y:.2f}")
251
+ fig = go.Figure()
252
+ fig.add_vline(x=0, line=dict(color=ACCENT, width=1.1, dash="dash"))
253
+ fig.add_hline(y=0.5, line=dict(color="#9aa5b1", width=1, dash="dot"))
254
+ fig.add_scatter(x=xs, y=ys, mode="markers", showlegend=False,
255
+ marker=dict(size=13, color=cols, line=dict(width=1, color="white")),
256
+ text=txt, hovertemplate="%{text}<extra></extra>")
257
+ wd, wy = float(D[bi, bj]), float(0.5 * (R[bi, bj] + R[bj, bi]))
258
+ fig.add_scatter(x=[wd], y=[wy], mode="markers", showlegend=False, hoverinfo="skip",
259
+ marker=dict(size=22, color="rgba(0,0,0,0)", line=dict(width=2, color="#1a1a1a")))
260
+ fig.add_annotation(x=wd, y=wy, text=f"weakest: {labels[bi]} &harr; {labels[bj]}", showarrow=True,
261
+ arrowhead=0, arrowcolor="#1a1a1a", ax=34, ay=-26, font=dict(size=11, color="#1a1a1a"))
262
+ # a faint legend of the three regimes, drawn as off-canvas points
263
+ for nm, cc in [("design-limited", ACCENT), ("evidence-limited", DARK), ("resolved", GREEN)]:
264
+ fig.add_scatter(x=[None], y=[None], mode="markers", name=nm,
265
+ marker=dict(size=10, color=cc), showlegend=True)
266
+ fig.update_layout(height=430, margin=dict(l=10, r=10, t=10, b=10), plot_bgcolor="white",
267
+ paper_bgcolor="white",
268
+ legend=dict(orientation="h", y=1.08, x=0.5, xanchor="center", font=dict(size=11)),
269
+ xaxis=dict(title="candidate separation D<sub>ab</sub> (evidence per observation)",
270
+ rangemode="tozero", gridcolor="#eef2f6", zeroline=False),
271
+ yaxis=dict(title="pairwise resolve (chance 0.50)", range=[0.45, 1.04], gridcolor="#eef2f6"))
272
+ return fig
273
+
274
+
275
  def separation_atlas_bars(sep_atlas, show_geo=True, show_pol=True):
276
  # only chart (and add to the legend) the axes actually varied; when neither is varied, fall back to
277
  # showing both so the panel is not empty.
 
401
  fig.update_layout(height=320, margin=dict(l=10, r=10, t=30, b=10), plot_bgcolor="white",
402
  paper_bgcolor="white", showlegend=False,
403
  xaxis=dict(type="log", title="test items (resampled from your design)", tickvals=counts),
404
+ yaxis=dict(title="pairwise resolve (chance 0.50)", range=[0.45, 1.03]))
405
  return fig
406
 
407
 
 
497
 
498
 
499
  # ----------------------------------------------------------------------------- header
500
+ st.title("🔬 Can your transfer design tell accounts of generalization apart?")
501
  st.markdown(
502
  "When someone learns a category or a rule, we infer *how* they learned it from how they generalize "
503
  "to new test items. Each proposed account is a **candidate mechanism**. The trouble is that "
 
823
  st.markdown(f"<div style='border-left:4px solid {vcol};padding:10px 14px;background:#f6f8fa;"
824
  f"border-radius:4px;margin:4px 0 14px;font-size:15px'>{verdict}</div>", unsafe_allow_html=True)
825
 
826
+ # the diagnosticity plane: every candidate pair as one point, the picture the audit reduces to
827
+ st.plotly_chart(diagnosticity_plane(D, R, labels, bi, bj), use_container_width=True)
828
+ st.caption("Each dot is one candidate pair. On the left wall (separation 0) the design cannot tell "
829
+ "the pair apart at any sample size; climbing up and to the right, the pair separates and "
830
+ "the planned sample resolves it. Hover a dot for the pair and its numbers.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
831
 
832
+ # inspect your own debate: pick the two accounts in question and read that contrast directly
833
+ st.markdown("#### Inspect your debate")
 
 
 
 
 
 
 
 
 
 
834
  pc1, pc2 = st.columns(2)
835
+ ca = pc1.selectbox("one account", labels, index=int(bi), key="pairA")
836
  cb = pc2.selectbox("against", labels, index=int(bj), key="pairB")
837
  ia, ib = labels.index(ca), labels.index(cb)
838
  same = ia == ib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
839
  if same:
840
+ st.caption("Pick two different accounts to read a specific contrast.")
 
841
  else:
842
+ pd_, pr_ = float(D[ia, ib]), float(0.5 * (R[ia, ib] + R[ib, ia]))
843
+ if pr_ >= 0.90:
844
+ msg, mc = f"resolves {pr_:.2f} at this sample (chance 0.50).", "#1a7f4b"
845
+ elif pd_ < 0.005 and pr_ < 0.55:
846
+ msg, mc = (f"sits at chance, separation {pd_:.3f}: the design cannot separate these two at any "
847
+ f"sample. The fix is a different design.", "#b9632b")
848
+ else:
849
+ msg, mc = (f"resolves {pr_:.2f} (chance 0.50); separation {pd_:.3f} &gt; 0, present but thin, "
850
+ f"so more clean data sharpens it.", "#2c5f86")
851
+ st.markdown(f"<div style='border-left:3px solid {mc};padding:7px 12px;background:#f6f8fa;"
852
+ f"border-radius:4px;font-size:14px'><b>{labels[ia]} &harr; {labels[ib]}</b> {msg}</div>",
853
+ unsafe_allow_html=True)
854
  st.plotly_chart(pair_recovery_bars(rec, sep, ia, ib), use_container_width=True)
855
+ st.caption(f"Where the pair resolves, condition by condition: bars are how well each condition's "
856
+ f"items alone resolve {labels[ia]} &harr; {labels[ib]} (chance 0.50); the line is that "
857
+ f"condition's separation $D_{{ab}}$. A condition near 0.5 cannot settle this pair, even "
858
+ f"where the pooled design does.")
859
+
860
+ with st.expander("Per-axis read and the full separation / resolve matrices"):
861
+ metrics = []
862
+ if show_geo:
863
+ metrics.append(("Geometry axis", grec, 0.5, "identified", "not identified"))
864
+ if show_pol:
865
+ metrics.append(("Policy axis", prec, 0.5, "identified", "not identified"))
866
+ if not metrics: # no matched contrast: read jointly
867
+ off = [R[i, j] for i in range(C) for j in range(C) if i != j]
868
+ metrics.append(("Mean pair resolve", float(np.mean(off)) if off else 1.0,
869
+ 0.5, "separable", "not separable"))
870
+ pair_html = ", ".join(f"{labels[i]} ↔ {labels[j]}" for i, j in ties)
871
+ pair_sub = ("tied, each resolves" if len(ties) > 1 else "resolves") + f" {mnres*100:.0f}% (chance 50%)"
872
+ blocks = [("metric",) + m for m in metrics] + [("pair",)]
873
+ for col, blk in zip(st.columns(len(blocks)), blocks):
874
+ if blk[0] == "metric":
875
+ metric_card(col, *blk[1:])
876
+ else:
877
+ col.markdown(
878
+ f"<div style='{CARD_STYLE}'>"
879
+ f"<div style='color:#6b7280;font-size:13px'>least-resolved pair</div>"
880
+ f"<div style='font-size:15px;font-weight:700;line-height:1.25;color:{ACCENT};"
881
+ f"white-space:nowrap;overflow-x:auto'>{pair_html}</div>"
882
+ f"<div style='font-size:13px;color:#6b7280'>{pair_sub}</div>"
883
+ f"</div>", unsafe_allow_html=True)
884
+ if not show_geo and not show_pol:
885
+ st.caption("These candidates differ on more than one axis at once (or share a value), so "
886
+ "resolving power is read jointly. For a per-axis reading, include matched "
887
+ "contrasts: candidates that differ on only one axis.")
888
+ elif not show_geo:
889
+ st.caption("Only the policy axis varies across these candidates, so only it is reported.")
890
+ elif not show_pol:
891
+ st.caption("Only the geometry axis varies across these candidates, so only it is reported.")
892
+ vmax = max(1e-6, float(D.max()))
893
+ h1, h2 = st.columns(2)
894
+ with h1:
895
+ st.markdown("**Separation** &nbsp;·&nbsp; $D_{ab}$")
896
+ st.plotly_chart(heatmap(D, labels, vmax, cells=() if same else pair_cells(ia, ib, "sep")),
897
+ use_container_width=True)
898
+ with h2:
899
+ st.markdown("**Pairwise resolve** &nbsp;·&nbsp; symmetric (chance 0.50)")
900
+ st.plotly_chart(heatmap(R, labels, 1.0, cells=() if same else pair_cells(ia, ib, "rec"), zmin=0.5),
901
+ use_container_width=True)
902
+ where = ("the whole design, pooled" if scope == "Whole design (pooled)" else f"the **{scope}** condition")
903
+ st.caption(f"Read for {where}. Left, separation $D_{{ab}}$ (symmetric); right, the pairwise resolve "
904
+ f"(symmetric, chance 0.50, diagonal a trivial 1). A pair at $D_{{ab}}\\approx0$ sits at "
905
+ f"0.5; positive separation climbs to 1 as evidence accumulates. The outlined pair is the "
906
+ f"one chosen above.")
907
+
908
+ with st.expander("Where the separating signal lives (by condition)"):
909
+ st.plotly_chart(separation_atlas_bars(sep_atlas, show_geo, show_pol), use_container_width=True)
910
+ st.caption("Per condition, the matched separation on each varied axis. Tall bars are the "
911
+ "conditions that carry the diagnostic signal.")
912
+
913
+ with st.expander("Predicted accuracy by condition", expanded=bool(st.session_state.get("spread"))):
914
+ spread = st.checkbox("Show the per-item spread", key="spread")
915
+ if spread and is_multi_design:
916
+ st.info("Per-item spread is available for single-design uploads; the bars use the full audit.")
917
+ st.plotly_chart(accuracy_bars(sep), use_container_width=True)
918
+ elif spread:
919
+ pdist = tide.predicted_distributions(primary_exp, cands)
920
+ st.plotly_chart(accuracy_boxes(pdist, sep), use_container_width=True)
921
+ st.caption("Each bar replaced by its spread over test items (box = quartiles, dashed = mean). "
922
+ "Two candidates with the same mean accuracy can differ in confidence, which the "
923
+ "separation $D_{ab}$ counts and accuracy does not.")
924
+ else:
925
+ st.plotly_chart(accuracy_bars(sep), use_container_width=True)
926
+ st.caption("The joint accuracy each candidate predicts per condition. Bars that track each "
927
+ "other are pairs that condition cannot tell apart by choice; where they fan out, "
928
+ "it can.")
929
+
930
+ with st.expander("Summary tables"):
931
+ st.dataframe(axis_table_df(rec, show_geo, show_pol, n_geo, n_pol),
932
+ hide_index=True, use_container_width=True)
933
+ for line in summary_overall(sep, rec, sep_atlas, labels, show_geo, show_pol, ia, ib):
934
+ st.markdown("- " + line)
935
+ st.markdown("**By condition**")
936
+ st.dataframe(condition_table_df(sep, rec, sep_atlas, labels),
937
+ hide_index=True, use_container_width=True)
938
+
939
+ # -------------------------------------------------------------- about this design
940
  st.markdown("### About this design")
941
  with st.expander("Transfer relation of each condition"):
942
  prof = tide.suggest_relations(primary_exp) # uses the rule-bearing features
tide.py CHANGED
@@ -1,7 +1,7 @@
1
  """
2
  TIDE: Transfer-design Identifiability and Diagnosticity Evaluation.
3
 
4
- An extensible toolkit for asking whether a transfer design can tell candidate learning mechanisms
5
  apart. A candidate mechanism is one proposed way a learner solves the task and generalizes to new
6
  items. Given an experiment (training set + transfer conditions, decomposed into component slots with
7
  role vectors and one or more output heads) and a candidate set, the library computes:
 
1
  """
2
  TIDE: Transfer-design Identifiability and Diagnosticity Evaluation.
3
 
4
+ An extensible toolkit for asking whether a transfer design can tell candidate mechanisms
5
  apart. A candidate mechanism is one proposed way a learner solves the task and generalizes to new
6
  items. Given an experiment (training set + transfer conditions, decomposed into component slots with
7
  role vectors and one or more output heads) and a candidate set, the library computes: