Skip to content

feat(ranking): per-class metric weights, gt.tl.ranking, and dataset-level plot#3

Merged
PauBadiaM merged 4 commits into
mainfrom
feat/ranking-metric-weights
Jun 22, 2026
Merged

feat(ranking): per-class metric weights, gt.tl.ranking, and dataset-level plot#3
PauBadiaM merged 4 commits into
mainfrom
feat/ranking-metric-weights

Conversation

@PauBadiaM

Copy link
Copy Markdown
Collaborator

Summary

Adds configurable per-class metric weights to GRN method ranking, a new public gt.tl.ranking function as the single source of the ranking math, and a level='dataset' view for gt.pl.ranking.

  • metric_weights on gt.pl.ranking (default dict(predictive=1, genomic=1, literature=1, mechanistic=1)): weights are validated to be non-negative and restricted to the four metric-class keys. A class omitted from the dict is treated as weight 0.
  • Per-dataset weighting: classes are combined with a weighted mean within each dataset, and the final mean_f01 is the mean of those per-dataset values across datasets (rather than collapsing datasets first).
  • gt.tl.ranking(df, metric_weights=None): returns a DataFrame indexed by method name, with mean_f01 as the first column followed by one column per dataset (that dataset's weighted mean F0.1), sorted descending. gt.pl.ranking calls it internally so plot ordering and exact values stay in sync.
  • gt.pl.ranking(..., level='dataset'): heatmap with datasets as columns, per-column ranks inside each cell, rows ordered by the final mean_f01, and (like level='task') no overall barplot.
  • Updated docs/notebooks/eval.ipynb vignette explaining default equal weighting, how to reweight/filter, and how to read exact values via gt.tl.ranking.

Test plan

  • pytest tests/test_pl_ranking.py tests/test_tl_ranking.py — 54 passing, covering weight validation, per-dataset-then-across-dataset aggregation, zero/missing-class handling, NaN coverage, and the new dataset-level figure.
  • ruff check / ruff format --check clean.
  • Notebook re-executed end to end.

🤖 Generated with Claude Code

PauBadiaM and others added 3 commits June 10, 2026 15:41
Add a metric_weights argument to gt.pl.ranking so users can weight the
four metric classes (predictive, genomic, literature, mechanistic) when
computing the mean F0.1 that determines method ordering. Weights default
to 1 each, must be non-negative, keys are restricted to valid classes,
and any omitted class is treated as weight 0. The overall score is the
weighted mean across present classes.

Extract the numeric logic into a new public gt.tl.ranking(df,
metric_weights) that returns the exact weighted mean F0.1 per method as a
DataFrame (index name, column mean_f01, sorted descending). gt.pl.ranking
now delegates to it, keeping a single source of truth.

Document both in the eval vignette, add tests for tl/pl ranking, and bump
version to 0.0.3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Weight metric classes per dataset, then average the per-dataset weighted
means across datasets for the final mean_f01. gt.tl.ranking now returns
mean_f01 as the first column followed by one column per dataset holding
that dataset's weighted mean. gt.pl.ranking gains level='dataset', a
heatmap with datasets as columns and per-column ranks, ordered by the
final mean_f01 and (like level='task') without the overall barplot.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Pre-release numpy/pandas/sklearn can no longer fancy-index a pandas Index
with sklearn's integer position array, raising "only integer scalar arrays
can be converted to a scalar index" in the py3.14-pre CI job. Passing a
plain list routes sklearn through its list-indexing path, which is robust
across versions. Behavior is unchanged on stable deps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@PauBadiaM PauBadiaM merged commit d7696a2 into main Jun 22, 2026
7 checks passed
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.

1 participant