Skip to content

feat(categorizer): add interactive diagnostics and triage plans - #5

Merged
btmlnsn merged 33 commits into
btmlnsn:publication/stagingfrom
AL3XPI:pr/categorizer-diagnostics-triage
Sep 24, 2026
Merged

btmlnsn merged 33 commits into
btmlnsn:publication/stagingfrom
AL3XPI:pr/categorizer-diagnostics-triage

Conversation

@AL3XPI

@AL3XPI AL3XPI commented Sep 24, 2026

Copy link
Copy Markdown

Summary

Author and primary contributor: Alexander Chumak

Integration and testing refinements: Bobby Tomlinson

This PR extends LabGym’s categorizer-evaluation workflow with interactive diagnostics, advisory triage, and representative embedding-based examples.


Changes

Interactive Model Diagnostics Window

Problem
Previously, evaluating a categorizer model via test_categorizer printed a static performance table in the terminal displaying precision, recall, F1-scores, and support values. Users had no practical visual or interactive way to analyze systematic confusions or inspect misclassified samples.

Implementation
Developed AutomatedDiagnosticsDialog inside the testing pipeline. When evaluation finishes, an interactive window displays a color-mapped confusion matrix with toggleable raw count and normalized (%) views, a natural language insight engine ranking confusions by frequency or proportion, and metric highlight filters for F1, precision, and recall.

Impact
Provides researchers with an immediate, visual diagnosis of model performance directly inside LabGym, making error patterns transparent without forcing users to parse raw text tables or manually compile confusion data.


Interactive Triage Assignment & Action Plan PDF

Problem
Identifying model weaknesses previously left users with no clear path forward on how to fix errors, such as determining whether to collect more training data, combine visually identical classes, or isolate unannotated behaviors.

Implementation
Built TriageBuilderDialog, providing a multi-select transfer interface where users assign systematic confusion pairs to three advisory hypotheses: Hypothesis 1 (potentially overlapping behavior definitions), Hypothesis 2 (possible labeling or class-definition issue requiring manual review), and Hypothesis 3 (insufficient independent training evidence for otherwise distinct behaviors). Integrated ReportLab to render a structured Triage_Action_Plan.pdf containing highlighted confusion patterns, plain-language descriptions, suggested follow-up steps, and visual sample references. Integrated ReportLab to headlessly render a structured Triage_Action_Plan.pdf report containing highlighted confusion patterns, layman descriptions of each error, explicit remediation steps, and extracted visual sample references.

Impact
Provides a structured follow-up plan that helps non-ML researchers investigate confusing predictions and decide how to refine their datasets.


High-Dimensional Feature Vector Centroids via Cosine Similarity

Problem
When a model confused two behavior classes, users had no way of identifying a representative video example of that confusion versus a possible outlier frame artifact.

Implementation
Refactored test_categorizer to extract feature embeddings from the network's penultimate layer (model.layers[-2]) alongside predictions during testing. Implemented a Cosine Similarity vector engine in get_centroid that calculates the mathematical mean embedding for confusion clusters and true-positive baselines, returning the exact video/image sample closest to the vector center.

Impact
Adds representative reference samples to the PDF report: the video or image examples closest to the mean embedding for selected confusion cells and true-positive groups. These samples help researchers inspect patterns for further review; they do not establish ground truth or determine what changes should be made to a dataset.


Testing

  • Focused automated tests: 70 diagnostics and triage tests passed on the prepared component branch.

  • Coverage: Raw and normalized confusion matrices, advisory summaries, hypothesis safeguards, test-source preservation, naming collisions, PDF/versioned-package creation, dependency failures, and partial-failure reporting.

  • Manual testing: Executed local categorizer evaluation passes and verified dialog rendering, multi-select assignment, sample-reference extraction, and PDF generation in LabGym_Diagnostics/.

  • Known limitations: The interactive dialogs require a desktop wxPython environment. The original test-example folder remains unchanged; any diagnostic copy is for inspection only and is not automatically suitable as training data. Researchers must independently curate training data, retrain, and re-evaluate.

  • Known limitations: The interactive triage interface requires a desktop display environment (wxPython); headless execution bypasses the dialog while retaining automated logging.

AL3XPI and others added 30 commits September 23, 2026 17:17
@btmlnsn
btmlnsn merged commit b5f8227 into btmlnsn:publication/staging Sep 24, 2026
3 checks passed
@btmlnsn

btmlnsn commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Nice work!

@btmlnsn

btmlnsn commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Quick integration note: I added a few follow-up commits to make the CI matrix reliable. THey isolate lifecycle-sensitive wx.App tests on macOS, remove obsolete pytest coverage-warning filters that blocked macOS 3.9 collection, and restore the pre-existing Windows installation documentation so the compatibility work remains scoped to CI. Full CI is now green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants