Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
score bindingdb on only exact == measurements, accept partial submissions (single or few function only) with unsubmitted set to chance)
580f4e5 |
Download docs/scoring.md from PrismScienceOrg/PLUG-challenge: direct link, hf CLI and curl.
- Browser
- Download file 8.65 kB
-
https://huggingface.co/spaces/PrismScienceOrg/PLUG-challenge/resolve/main/docs/scoring.md
- Command line
-
hf download hf://spaces/PrismScienceOrg/PLUG-challenge/docs/scoring.md
-
curl -L -o scoring.md https://huggingface.co/spaces/PrismScienceOrg/PLUG-challenge/resolve/main/docs/scoring.md
8.65 kB
| # Scoring reference | |
| How a submission bundle becomes eleven numbers and one PLUG Score. The code is | |
| `plug_challenge/metrics.py` (the arithmetic), `scoring.py` (the dispatch) and | |
| `aggregate.py` (the aggregation); the per-benchmark choices are declared in | |
| `benchmarks.py`. | |
| Every metric here is **higher is better** and every one is a rank statistic or a | |
| threshold sweep β none of them depend on the absolute scale of your predictions. | |
| Both tracks are scored by the same code on different rows of the same ground truth: the | |
| **supervised** track on the Lo-Hi `test` rows of each benchmark, the **unsupervised** | |
| track on every row, including the ones the k-cut dropped | |
| (`benchmarks.select_track`). | |
| ## Per-benchmark metrics | |
| | Benchmark | Primary | Secondary | Grouped over | | |
| |---|---|---|---| | |
| | `megascale` | Spearman's Ο | Ο per protein | `pdb` | | |
| | `fireprot` | Spearman's Ο | Ο per protein | `pdb` | | |
| | `dms` | **Ο per assay** | pooled Ο | `dms_id` | | |
| | `cafa5` | Fmax, macro over branches | Fmax BP / MF / CC | β | | |
| | `allobench` | AUROC | AUROC per protein | `target_id` | | |
| | `passerrank` | AUROC | AUROC per protein | `uniprot` | | |
| | `ppi` | AUROC | β | β | | |
| | `shs27k` | Macro AUROC over 7 modes | β | β | | |
| | `lp-pdbbind` | Spearman's Ο | β | β | | |
| | `bindingdb` | Spearman's Ο | Ο per target | `target_key` (plug's sequence hash) | | |
| | `atlas` | Spearman's Ο | Ο per chain | `pdb_chain` | | |
| Two choices in that table are worth stating plainly, because they are judgement calls | |
| rather than definitions: | |
| - **`dms` is grouped by default and the others are not.** DMS assay scores share no | |
| common scale, so a pooled correlation would largely measure between-assay spread; | |
| `plug-baselines` scores DMS per assay and averages, and this follows it. | |
| - **`atlas`, `allobench` and `passerrank` pool residues by default.** Their per-protein | |
| means are arguably the better measurement β pooling lets a model win by getting | |
| between-protein scale right β but `plug-baselines` reports the pooled value, so that is | |
| the primary here and comparability with the published baselines is preserved. The | |
| per-protein number is reported beside it. To swap them, reorder `metrics=(...)` for | |
| those benchmarks in `benchmarks.py`; the first entry is the primary, and everything | |
| downstream follows. | |
| ### Undefined values | |
| A rank metric is undefined rather than zero when there is nothing to rank: a constant | |
| prediction column, a single-class label column, a group with one member. These return | |
| NaN (`metrics.UNDEFINED`), and: | |
| - Constant prediction columns are **rejected at validation** for the rank-scored | |
| benchmarks, so this cannot happen by accident. `cafa5` is exempt, because Fmax sweeps a | |
| threshold rather than ranking and a constant confidence is well-defined there β see | |
| `BenchmarkSpec.needs_varying_predictions`. | |
| - A grouped metric **skips** undefined groups and averages the rest; every scorable group | |
| counts once regardless of size. | |
| - `macro_auroc` skips single-class modes β a STRING mode that no test pair carries says | |
| nothing about the submission either way. | |
| - A benchmark whose primary metric is NaN shows blank on the board and counts as chance | |
| (0) in the PLUG Score, as a benchmark left out of the bundle does, with `Benchmarks` | |
| showing the reduced count. A small Lo-Hi test split (55 PASSerRank proteins, 139 SHS27k | |
| pairs) makes this likelier in the supervised track than the unsupervised one. | |
| ### CAFA Fmax | |
| `cafa5` is the one benchmark with a variable-length submission: one row per | |
| `(protein, branch, term)` you predict, with a confidence in `[0, 1]`. | |
| Fmax sweeps a threshold over `[0, 1]` in steps of 0.01. At each threshold, **precision is | |
| averaged over the targets that predict at least one term** while **recall is averaged over | |
| every annotated target**. That asymmetry is CAFA's, and it is the reason declining to | |
| annotate a protein costs you recall but not precision β so a selective, confident | |
| submission is a legitimate strategy rather than an exploit. Unannotated targets are | |
| dropped from both averages. | |
| Two implementations exist and are cross-checked against each other in the tests: | |
| `metrics.fmax` is a faithful port of `plug-baselines`' dense version, and | |
| `metrics.fmax_long` computes the same thing from the long-form triples a submission | |
| actually carries. Only `fmax_long` runs in production β a dense `targets Γ terms` score | |
| matrix for CAFA5 runs to hundreds of megabytes. | |
| ## The PLUG Score | |
| ``` | |
| PLUG Score = mean over benchmarks of normalise(primary metric) | |
| normalise(v) = (v' - chance) / (1 - chance), v' = |v| for Spearman, v otherwise | |
| ``` | |
| with `chance` taken from each metric's `MetricSpec`: 0 for Spearman, 0.5 for AUROC, 0 for | |
| Fmax. The PLUG Score is therefore the **improvement over random chance**, averaged over | |
| the eleven benchmarks: 0 is chance, 1 is perfect. | |
| The mean is always over all eleven. A bundle may leave benchmarks out, and each one left | |
| out counts as 0, so a method that covers one benchmark well cannot top the overall board | |
| on it. It is ranked on that benchmark's own tab, which lists only the entries that covered | |
| it, so methods built for one task can be compared there. | |
| | Raw | Normalised | | |
| |---|---| | |
| | Ο = 1.0 | 1.0 | | |
| | Ο = 0.0 (chance) | 0.0 | | |
| | Ο = β0.99 | 0.99 | | |
| | AUROC = 1.0 | 1.0 | | |
| | AUROC = 0.75 | 0.5 | | |
| | AUROC = 0.5 (chance) | 0.0 | | |
| | AUROC = 0.3 | β0.4 | | |
| | Fmax = 0.4 | 0.4 | | |
| Two choices in that are deliberate: | |
| - **A correlation counts by its magnitude.** The sign of a Spearman Ο is a convention of | |
| which way a label was written β ΞΞG is stabilising-positive in one source and | |
| destabilising-positive in another, and a zero-shot score rarely knows which. A Ο of | |
| β0.99 is a very predictive model once reversed, so it scores 0.99. This applies to the | |
| *reported* value: for `dms`, the mean of the per-assay correlations is taken by its | |
| magnitude, not each assay's. | |
| - **Nothing is clipped.** An AUROC below 0.5 is a classifier ranking the wrong class first | |
| β the label direction is fixed there β so it normalises below 0 and pulls the PLUG Score | |
| down rather than being floored at chance. | |
| Fmax's chance level is set at 0 here, but a naive predictor that annotates every protein | |
| with the most frequent terms scores well above 0 under CAFA's Fmax, so a normalised Fmax | |
| is closer to the raw Fmax than to a true improvement over a baseline. | |
| A random submission scores about 0 overall. A perfect one scores 1.0. | |
| The PLUG Score depends **only on your own predictions**, so it does not move as other | |
| entries arrive and it is safe to quote. `Mean rank` β the mean of your per-benchmark | |
| ranks, with a benchmark you did not cover ranked last β is shown beside it as the relative | |
| view; that one does move. Each benchmark's own | |
| tab ranks by its normalised score, so a strong negative correlation ranks above a weaker | |
| positive one there too. | |
| ## Bootstrap intervals | |
| `metrics.bootstrap` resamples and reports a standard deviation per metric, with whole | |
| **groups** as the resampling unit for the grouped metrics (a per-assay mean has as many | |
| independent observations as there are assays, not as there are variants). | |
| It is **off by default** (`BOOTSTRAP_SAMPLES=0`), because scoring runs inside the | |
| submission request and 1000 resamples of eleven benchmarks is not a request-time | |
| workload. Point estimates are exact either way; with it off, the `_std` columns are 0. | |
| To compute intervals offline: | |
| ```bash | |
| plug-challenge score my_submission.zip --track supervised --ground-truth ./gt --bootstrap 1000 | |
| ``` | |
| `cafa5` never bootstraps: a resample has to redraw whole targets and recount each one's | |
| annotations, and a 101-point threshold sweep per resample is far too slow. Its `_std` is | |
| always 0 and its point estimate is exact. | |
| ## What is stored | |
| Per submission, `scores/<user>/<id>/scores.json` holds the identity fields (including the | |
| `track`), the `plug_score`, and every raw metric flattened as `<benchmark>__<metric>_mean` / | |
| `_std` plus `<benchmark>__n`. `leaderboard/entries.csv` is the same rows concatenated β | |
| derived, and rebuildable from the score files with `plug-challenge rebuild`. | |
| Ranking happens on read (`aggregate.build_leaderboard`), one track at a time: latest | |
| submission per entrant per track, each primary metric normalised into | |
| `<benchmark>__score`, the `plug_score` **recomputed** from those (the stored one is only a | |
| record of what the participant was shown), sorted by it, with a per-benchmark rank and | |
| `mean_rank` added. Because the normalisation is applied on read, changing it needs no | |
| migration of stored scores. An entry stored before tracks existed counts as supervised. | |