Skip to content

feat: prediction-score histogram + plot_rank error bars/class colors #312

Description

@breimanntools

Part of #305.

Problem

Two prediction-result figures from the original project have no library API and
are reused across the paper but must be hand-built each time:

  1. Prediction-score distribution — per-class histogram of a model's
    prediction score (0–100%) showing how substrate / non-substrate / unknown
    separate (plot_pred1 / _plot_pred1, scripts/plot_cpp_pred.py): a
    sns.histplot(hue=..., binrange=(0,100), multiple="stack") plus ~30 lines of
    int-ytick / xlim / despine / custom-legend fiddling.
  2. Ranked candidates with agreement — proteins ranked by predicted score as
    horizontal bars colored by class, with per-protein std error bars and gene
    yticks (plot_pred3_top_hits, reused 3×): sns.barplot(orient="h") +
    plt.errorbar(fmt='none', capsize=...).

The library already has plot_rank, but it has no error-bar / class-color
variant for the "named top-N candidates" figure.

Goal

Add a prediction-score histogram and extend ranking so the two standard
prediction figures are one call each, driven by a model's per-sample scores.

Requirements

  • aa.plot_prediction_hist(df_pred, score=..., group=..., ...) (class-
    separated score distribution); consider a TreeModelPlot/ShapModelPlot
    home.
  • Extend plot_rank (or add a sibling) with per-item error bars + class
    colors + optional cutoff line, for the ranked-candidates figure.
  • House colors/legend via existing helpers; plotting.md compliance.
  • numpydoc + Examples include.

KPIs / Acceptance criteria

  • Both figures reproducible in one call each from a df_pred with score /
    std / class columns (visual + shape check).
  • plot_rank default output unchanged (additive args only; regression).
  • ≥1 unit test per new symbol/arg (positive + negative).

Scope / non-goals

Dependencies

Standards checklist

  • CONFIRM-FIRST (__init__.py/__all__ if new symbols) · plotting.md
    compliance · numpydoc · tests · no-print

Metadata

Metadata

Assignees

No one assigned

    Labels

    prio:2Importanttopic:XAIExplainability methods integrated into AAanalysistype:featureImplementation of feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions