Skip to content

feat: add tooltips, failure definitions, and semantic class colours#7

Merged
jrkasprzyk merged 21 commits intomainfrom
feat/tooltips-failures-colors
May 7, 2026
Merged

feat: add tooltips, failure definitions, and semantic class colours#7
jrkasprzyk merged 21 commits intomainfrom
feat/tooltips-failures-colors

Conversation

@jrkasprzyk
Copy link
Copy Markdown
Owner

Summary

  • Add metric tooltips to whole-tree performance panel
  • Add Failure Definition overlay to tree canvas
  • Add semantic class colour coding for node types
  • Decouple node-class colours from confusion-matrix colours (style refactor)

What to review

  • Do the failure definition labels match your terminology?
  • Do the colour choices make sense for each node class?
  • Is the tooltip text clear and accurate?

jrkasprzyk added 9 commits May 6, 2026 13:44
add_performance.R: add whole-tree performance info from txt files into JSON files
also expose this information in the viewer

.gitattributes seeks to avoid LF and CRLF problems between windows and mac
  - Hover tooltips on performance stat labels (accuracy,
  kappa, etc.)
    using a fixed-position tooltip driven by CSS vars from
  styles.css
  - Success/Failure class names now resolve to
  --success/--failure CSS
    vars instead of Tableau10, keeping tree nodes, class bars,
   and
    confusion matrix highlights visually consistent
  - Single source of truth: change --success/--failure in
  styles.css
    to update all three colour sites at once
  Provides per-dataset context on what 'Failure' means, surfaced
  directly on the visualization rather than buried in docs.

  - Overlay panel: absolute-positioned top-left of canvas
  - ailure_definition?: string added to Arbor type
  - R/add_failure_definition.R: CLI patcher to set/clear the field
  - Muted placeholder when field absent; normal ink when set
  - README.md — added 2 features to list, new step 1c for add_failure_definition.R, updated project structure table, added
  failure_definition row to JSON schema table
  - public/about.md — new step 2 for Failure Definition panel, metric tooltip hint on performance step, renumbered steps
  - CHANGELOG.md — full Unreleased section now covers all 4 feature additions (failure def overlay, R CLIs, performance
  panel, metric tooltips, semantic colours) plus original Changed entries for node labels/spacing/drag
…lors

  Tree nodes encode predicted class label (domain meaning); confusion
  matrix encodes model accuracy. Sharing --success/--failure for both
  caused users to infer accuracy from node color — incorrect, since one
  leaf holds a mix of correct and incorrect observations.

  Split into four CSS variables, single source of truth in styles.css:
  - --node-success / --node-failure: blue/amber for class labels
  - --cm-correct / --cm-error: green/red for accuracy

  utils.ts semanticColors() reads --node-* vars.
  README documents the two-system distinction.
@jrkasprzyk jrkasprzyk requested review from Copilot and zaca1902 May 6, 2026 22:41
@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
arborview Ready Ready Preview, Comment May 7, 2026 8:03pm

@jrkasprzyk
Copy link
Copy Markdown
Owner Author

jrkasprzyk commented May 6, 2026

Edit: I intended to do the variable-importance stuff later, but because it was easier to handle, I did it first.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds UI affordances and supporting data/schema to better interpret classification trees: an always-visible “Failure Definition” overlay, a whole-tree performance panel (confusion matrix + stats) with metric tooltips, and semantic class coloring decoupled from confusion-matrix correctness coloring.

Changes:

  • Add optional failure_definition and performance fields to the dataset JSON schema and render them in the UI (overlay + sidebar panel).
  • Add metric hover tooltips for performance statistics, plus styling for confusion matrix / panels.
  • Introduce semantic class color mapping (Success/Failure) via CSS variables and use it for tree nodes and probability bars.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/utils.ts Adds semantic class → CSS-variable color mapping helper used across UI.
src/types.ts Extends top-level Arbor schema with optional failure_definition and performance types.
src/tree.ts Applies semantic colors (with Tableau fallback) for node class coloring.
src/styles.css Adds styling for performance panel, confusion matrix, metric tooltip, and failure definition overlay; introduces new CSS variables.
src/main.ts Renders failure definition overlay + performance panel; adds metric-tooltip behavior; aligns probability bar colors with semantic mapping.
README.md Documents new features, new R scripts, and customization guidance for class/correctness colors.
R/add_performance.R New CLI script to parse caret confusionMatrix() text output and patch performance into exported JSON.
R/add_failure_definition.R New CLI script to set/clear failure_definition in exported JSON.
public/data/EOWY5_classification.json Adds performance + failure_definition to example dataset (and reformats JSON).
public/data/EOWY3_classification.json Adds performance + failure_definition to example dataset.
public/data/EOWY2_classification.json Adds performance + failure_definition to example dataset.
public/data/EOWY1_classification.json Adds performance + failure_definition to example dataset.
public/about.md Updates user-facing documentation to include failure definition + performance panel and metric meanings.
index.html Adds failure-definition overlay container, performance panel container, and metric-tooltip element.
example_data/SE_Oct2025_CART_performance_P3500_EOWY5.txt Adds sample caret output used for performance patching.
example_data/SE_Oct2025_CART_performance_P3500_EOWY4.txt Adds sample caret output used for performance patching.
example_data/SE_Oct2025_CART_performance_P3500_EOWY3.txt Adds sample caret output used for performance patching.
example_data/SE_Oct2025_CART_performance_P3500_EOWY2.txt Adds sample caret output used for performance patching.
example_data/SE_Oct2025_CART_performance_P3500_EOWY1.txt Adds sample caret output used for performance patching.
CHANGELOG.md Documents the new overlay/panel/scripts and color behavior (needs alignment with implementation).
.gitattributes Normalizes text files to LF endings.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/styles.css Outdated
Comment thread src/styles.css Outdated
Comment thread CHANGELOG.md Outdated
Comment thread README.md Outdated
Comment thread R/add_performance.R
Comment thread src/types.ts Outdated
Comment thread public/data/EOWY1_classification.json Outdated
Comment thread public/data/EOWY2_classification.json Outdated
Comment thread public/data/EOWY3_classification.json Outdated
Comment thread public/data/EOWY5_classification.json Outdated
Clarify in README that there are four colors for the classes and confusion matrix, but there are other colors elsewhere in the app.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This entry describes semantic class colours as --success/--failure and says the confusion matrix uses the same palette, but the implementation uses --node-success/--node-failure for node classes and separate --cm-correct/--cm-error for confusion-matrix correctness. Update this changelog item to match the actual CSS variables and the decoupled palettes.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
parse_num() assumes s is a non-empty string; if a statistic key is missing (so s is NULL), trimws()/grepl() will produce length-0 values and if (grepl(...)) will error. Handle NULL/empty input explicitly (e.g., return NA_real_ when is.null(s) or length(s)==0).

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Add validation to avoid errors

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… code

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jrkasprzyk added 2 commits May 6, 2026 17:00
In a previous commit, the failure definitions were truncated. They have now been edited!
…kasprzyk/ArborView into feat/tooltips-failures-colors

Update local copy to reflect new changes
  accuracy_ci typed as [number | null, number | null] → TS2531 on
  direct arithmetic. Vercel build failed. Null-check before formatting;
  fall back to empty string.
Comment thread README.md Outdated
Copy link
Copy Markdown
Collaborator

@zaca1902 zaca1902 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only left one comment regarding the wording of a paragraph that we looked at in yesterday's meeting regarding the reasoning for two color systems. I suggested a rewording that may be easier to understand, but we can definitely tweak it further!

Add language suggested here #7 (comment) to README.md
  src/main.ts declared importanceEl in both branches;
  kept all five selectors — resizeHandleEl from main,
  performanceEl/metricTooltipEl/failureDefTextEl from feat branch.
@jrkasprzyk jrkasprzyk merged commit 2b7431f into main May 7, 2026
2 checks passed
@jrkasprzyk jrkasprzyk deleted the feat/tooltips-failures-colors branch May 7, 2026 20:03
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.

4 participants