Milestone 6 of 8

Inspect predictions numerically and visually

Check matched and mismatched queries and plot traceable query-to-neighbor links without treating the picture as an explanation of cause.

The checking summary is a compact view of the prediction records. Inspect the records and the selected links before explaining what the figure seems to show.

Goal

Create the checking summary, inspect matched and mismatched queries, and plot selected query-to-neighbor links with IDs and labels without turning a visible pattern into an unsupported explanation.

Inputs

Use predictions.csv, neighbor_traces.json, vote_traces.json, the validated source records, and the original coordinate values. The checking summary contains exact match count, query count, and match_count / query_count as a supplied fixture summary.

Use the expected label only to mark match status. Keep reference labels, predicted labels, IDs, and distances visible in the inspection evidence.

Deliverables

Implement the summary and plotting parts of src/report.py. Save output/checking_summary.json and output/neighbors_and_queries.png.

The figure should show the two-dimensional records and selected links for clearly identified queries, references, and labels. Record two observations in the report: one about a matched or mismatched query and one about a distance or tie trace. State observations before proposing any reason for them.

Checks

Recalculate exact match count and query count from predictions.csv; compare the fraction with the saved summary. Reconstruct plotted query and reference coordinates from IDs and traces, and check that the figure data uses those values rather than a new selection.

Inspect at least one matched and one mismatched query when both exist. A mismatch may be evidence about this fixture; it is not proof of a general classification property. Use a deliberate trace mutation to confirm that the audit can detect a plot-data mismatch.

Workspace

Keep summary and plotting code in src/report.py. Read the prediction and trace artifacts from output/ and leave them unchanged. Keep the report at report.md for the final milestone.

Hints

HintSummaries are derived evidence
Count the saved prediction rows. Do not accept a displayed fraction that cannot be traced back to query IDs.
HintDraw only selected links
The plot should use the neighbor trace for each displayed query. A visually close reference that was not selected is not part of that query's evidence.

Review

Read the summary, one prediction row, its traces, and the corresponding figure together. Separate what is directly visible from any hypothesis about why a query matched or mismatched.

How to check your work

Checks compare summary fields, selected-link data, labels, and figure identity with the supplied fixture. The supplied fixture keeps the plot tied to saved traces.

LLM PrimerInspect predictions numerically and visuallyhttps://llmprimer.com/python/projects/build-a-nearest-neighbor-system/inspect-predictions-numerically-and-visually© 2026 LLM Primer