Skip to content

feat: add violin plot option and threshold line to metric histograms#2460

Open
nuthalapativarun wants to merge 1 commit into
truera:mainfrom
nuthalapativarun:feat/leaderboard-score-distribution-2419
Open

feat: add violin plot option and threshold line to metric histograms#2460
nuthalapativarun wants to merge 1 commit into
truera:mainfrom
nuthalapativarun:feat/leaderboard-score-distribution-2419

Conversation

@nuthalapativarun
Copy link
Copy Markdown
Contributor

Description

Enhances the "Metric Histograms" tab on the Leaderboard page with violin plots and score threshold lines. Closes #2419.

Changes to src/dashboard/trulens/dashboard/tabs/Leaderboard.py:

  • Histogram/Violin toggle — a st.radio selector lets users switch between Histogram and Violin chart types
  • Histogram improvements:
    • Bars colored by mean score category (pass = green, warning = yellow, fail = red), using existing CATEGORY.of_score() and Category.color
    • Dashed vertical threshold line at 0.7 (higher-is-better metrics) or 0.3 (lower-is-better metrics)
  • Violin plot (go.Violin):
    • Shows box plot, mean line, and individual data points (jittered)
    • Dashed horizontal threshold line at the same pass/fail threshold
    • Y-axis fixed to [0, 1] for score-range consistency
  • feedback_directions passed from render_leaderboard down to _render_plot_tab so threshold direction is accurate per metric

Other details good to know for developers

The existing "Metric Histograms" tab already used go.Histogram and plotly — this PR builds on that foundation. go.Violin is part of the same plotly.graph_objects import already present.

Type of change

  • New feature (non-breaking change which adds functionality)

Adds a histogram/violin toggle and pass/fail threshold line to the
'Metric Histograms' tab on the Leaderboard page.

- Histogram bars colored by mean score category (pass/warn/fail)
- Violin plot shows box, mean line, and individual data points
- Dashed threshold line at 0.7 (higher-is-better) or 0.3 (lower)
- feedback_directions propagated from render_leaderboard to _render_plot_tab

Closes truera#2419
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Feedback Score Distribution Chart to Leaderboard

1 participant