---
name: visualization-ideas
description: Figures for Uncertain Systems knowledge-region results. Use with /skill.md field meanings. Cluster wheel, class overview, learner progress, cohort vs simulation, histograms, heatmaps, before/after trajectories, small multiples.
---

# Uncertain Systems visualization ideas

Use this skill after you have loaded `/skill.md` and fetched region plus candidate payloads. Field meanings live there. This file is **how to draw** those fields, not a second schema.

Data you actually have:

- `GET /api/v3/knowledge-regions/{id}` — cluster catalog (`clusters`, `ai_use_clusters`) and `samples` (`identity`, `origin`, `point_kind`, `cluster_id`, `run_id`, `flow_id`). **No distances and no vectors.**
- `GET …/candidates/{candidate_id}` — `observations[].unsys.distance` (and `excess`, `steps`), `cluster_distances[].l2` / `nearest` / `in_cluster`, `nearest_cluster_id`, `path`, `pairwise`. **Exploration-strategy clusters only** for L2. Same shape for simulated identities and real learners. Default Path model id is `flowcfg-v2.1-learned-d96` (`embedding_model_id`). Cluster / path / pairwise L2 is only comparable within one `model_id` (`model_versions[]` repeats cluster L2 per stored model). `unsys.*` does not depend on Path model. See **Path model versions** in `/skill.md`.
- `GET …/uncertainty-model` — reference tree vs walk, for a narrative next to the numbers.

Do not invent vectors. Do not treat nearness to an AI-use sample as a detection result. Each institution defines acceptable AI use; figures should ask whether the walk did the thinking the protocol asked for (unsys distance to the Uncertain Systems reference uncertainty model) and which simulated exploration cloud it resembles.

## Cluster wheel (required)

**Answers:** For each observation, which simulated **exploration** cluster is nearest, and how closely the walk matches the Uncertain Systems reference breakdown.

**Geometry:** a circle split into **equal sectors**, one per `candidate.clusters` (or `region.clusters` — same exploration family). Place each observation in the sector of `nearest_cluster_id`. Set **radius from the center by `observations[].unsys.distance`**: center = closest to the reference model (distance 0); rim = farthest in the current view.

Optional extra wheel: one sector per `region.ai_use_clusters` as well. You still **cannot** take AI-use L2 from the candidate payload; only use `samples` with `point_kind: "ai_use"` as labeled marks, or skip them on this wheel.

**Compute (public fields only):**

```
clusters = candidate.clusters  // [{ id, strategy_id, strategy_name }]
n = clusters.length
maxD = max(obs.unsys.distance for obs in candidate.observations if distance is finite)
for i, cluster in enumerate(clusters):
  start = -π/2 + i * 2π/n
  end   = start + 2π/n
  mid   = (start + end) / 2
for obs in candidate.observations:
  sector = index of cluster whose id == obs.nearest_cluster_id
  d = obs.unsys.distance
  t = 0.5 if d is null else (0 if maxD≈0 else min(1, d / maxD))
  r = inner + t * (outer - inner)   // e.g. inner=0.12R, outer=0.86R
  angle = mid[sector] + small jitter from hash(obs.id)  // keep marks from stacking
  x = cx + cos(angle) * r
  y = cy + sin(angle) * r
```

Ties: `nearest_cluster_id` is already the first row of `cluster_distances` sorted by `l2`. Do not split a point across sectors.

**D3 sketch:**

```javascript
const R = 160, inner = R * 0.12, outer = R * 0.86;
const n = clusters.length;
const maxD = d3.max(observations, (o) => o.unsys.distance) || 0;
const pie = d3.pie().value(() => 1).sort(null)(clusters);
svg.selectAll("path.sector").data(pie).join("path")
  .attr("d", d3.arc().innerRadius(0).outerRadius(R))
  .attr("fill", "none").attr("stroke", "currentColor");
svg.selectAll("circle.obs").data(observations).join("circle")
  .attr("cx", (o) => {
    const i = clusters.findIndex((c) => c.id === o.nearest_cluster_id);
    const mid = -Math.PI / 2 + (i + 0.5) * (2 * Math.PI / n);
    const t = o.unsys.distance == null || maxD < 1e-9 ? 0.5 : Math.min(1, o.unsys.distance / maxD);
    return Math.cos(mid) * (inner + t * (outer - inner));
  })
  .attr("cy", (o) => {/* same t, use Math.sin(mid) */})
  .attr("r", 4)
  .attr("fill", (o) => o.origin === "human" ? "#c4d4c8" : "#6ea8de");
```

Glyphs: different marks for `origin: "human"` vs simulated identities. Label sectors with `strategy_name`, not color alone.

## Other figures

### Professor class overview

**Answers:** Where the current group sits relative to simulated exploration clouds and the reference model.

1. `get_knowledge_region` for identities with `origin: "human"`.
2. For each distinct `identity`, `get_knowledge_region_candidate`.
3. One wheel (or one table) with every latest observation (`created_at` max per identity). Color/shape by protocol (`flow_id`) if the region has several.

Show a **table fallback**: identity, `unsys.distance`, `unsys.steps`, `nearest` strategy_name, nearest `l2`, `in_cluster`. The wheel is a map; the table is the accessible source of truth.

### Individual learner progress over time

**Answers:** Did later attempts move toward the reference (smaller `unsys.distance`) and/or change nearest cluster?

Use `observations` already sorted by `created_at`. Line chart: x = `created_at`, y = `unsys.distance` (skip nulls). Dual series: nearest `l2`. Annotate cluster name changes. `path.segments[].l2` is movement in Path space between attempts, **not** unsys distance — keep it on a separate axis.

### Cohort vs simulation comparison

**Answers:** How the human overlay (`origin: "human"`, `point_kind` `cohort` or `analysis`) sits next to exploration simulations and AI-use simulations.

Box or violin of `unsys.distance` by group: each exploration `strategy_id`, each `ai_use` identity you resolve via `get_knowledge_region_candidate` on that simulated `identity`, and humans. Same y-axis. Caption: groups are comparison clouds, not allowed/disallowed labels.

### Distance distributions / histograms

**Answers:** Spread and outliers inside one region.

Histograms (or ECDFs) of `unsys.distance` and of nearest `l2`, faceted by `point_kind`. Mark the median. Cap or bin outliers above the 95th percentile of the **current view** so one huge excess does not crush the axis; still list those ids in the table.

### Heatmap: learner × cluster

**Answers:** Which exploration clouds each person is near.

Rows: human identities. Columns: `candidate.clusters` (`strategy_name`). Cell: that learner’s latest `cluster_distances[].l2` (or “—” if missing). Darker = smaller L2. Include `in_cluster` as a border, not as the only encoding. AI-use columns do not belong here unless you have L2 (the candidate API does not).

### Before / after trajectories on the wheel

**Answers:** One person, two (or more) attempts.

Same sector rules as the cluster wheel. Draw a polyline in time order (`path.segments` ids). First point: open marker; last: filled. If `unsys.distance` is null on a step, keep angle from `nearest_cluster_id` and use mid-radius, or omit that vertex and note it.

### Small multiples per assignment

**Answers:** One protocol at a time (`unsys.flows[]` or filter observations by `flow_id`).

One small wheel per `flow_id` in the region’s `protocols`. Shared radius scale: **one** `maxD` across all multiples so assignment A and assignment B remain comparable. Title each with the protocol name.

## Shared notes

**Normalization.** Unsys radius on a wheel is min–max of finite `unsys.distance` **in the current figure** (class, person, or assignment). Do not mix regions on one scale. Unsys is Path-model-independent, so one wheel can mix people whose Path `model_id` differs; **do not** mix cluster L2 or pairwise L2 across `model_id` on the same axis. L2 heatmaps may use a log1p scale when the nearest cloud is tiny and others are large; say so. Pick `model_versions` rows that share one `model_id`.

**Ties.** Equal L2: the API already picked one `nearest`. Equal unsys distances share a radius — jitter angle only, not radius.

**Outliers.** Prefer percentile caps on display radius/axes; never drop the row from the table. `null` unsys is missing, not zero.

**Accessibility.** Every figure has a table of the same rows. Sector labels as text. Do not encode group only with color. State “center = closer to the Uncertain Systems reference uncertainty model.”

**Small samples.** `samples_per_strategy` can be 3–48 (default 12). With few simulated points, sector membership is fragile — show sample counts on the legend (`clusters[].sample_count`) and prefer tables until clouds stabilize. Empty `observations` is “not in this region,” not a mark at the origin.

**What not to draw.** No “AI %” gauge. No red/green pass fail from L2. No hidden embedding coordinates. No claim that proximity to `ai_use_clusters` is misconduct.
