Repository navigation
NK/LK per-protein rows are named by the matrix rows they came from - #27
Merged
Merged
Conversation
compute_metrics drops the proteins with no truth in the terms of interest before the NK/LK kernel, as the PK path does, but handed the sink arange(n) as the row index. Every row after the first dropped protein carried its neighbour's id. PROTEA's producer refused those tables as unmappable_row_numbering: NK and LK molecular_function on window 211->227, where that filter drops 4 and 11 proteins respectively. The row index is now flatnonzero(proteins_has_gt), as in the PK branch. With nothing dropped it equals arange, so every other table is unchanged. The class docstring that stated the false premise is corrected. The two new tests fail on the old code and pass now.
frapercan
marked this pull request as ready for review
November 7, 2026 11:46
github-actions Bot
pushed a commit
to frapercan/PROTEA
that referenced
this pull request
Nov 7, 2026
Picks up [cafaeval-protea#27](frapercan/cafaeval-protea#27), merged at `203af0a28f0bb6f8cd0588c0d6d02ebf251eccce`. ## What it fixes The NK/LK branch of `compute_metrics` passed `np.arange(p.shape[0])` as `row_index` for a prediction matrix it had already filtered to the proteins carrying truth, while `ids` numbered the unfiltered ground truth. So from the first dropped protein onward every row would have worn a neighbour's accession. It now passes `np.flatnonzero(proteins_has_gt)`, which the PK branch already did. That is why two panels have had no per-protein breakdown since the grid artefact existed, with the reason on the record every time: ``` unmappable_row_numbering LK molecular_function 10 unmappable_row_numbering NK molecular_function 10 ``` NK covered 3,390 of 3,394 ground-truth proteins and LK 2,433 of 2,444, so the filter did remove rows and the numbering did not survive it. With this pin the producer stops refusing and a paired comparison reaches **eight** panels instead of six. `PK:BPO` stays refused: its weighted and unweighted branches score different populations, which one row set cannot hold, and that is structural. ## Nothing already written moves When no protein is dropped, `flatnonzero` of an all-true mask is `arange`, so every per-protein table that was written stays identical and only the two that were refused start being written. Exploration 3 is decided and all four of its arms were evaluated on `e937e0e1`, so this changes none of its numbers. That was the reason it stayed in draft until the exploration closed. ## Lock `poetry lock` changes the reference, the resolved reference and the content hash. `poetry check --lock` exits 0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In
compute_metrics, the NK/LK sparse branch now passesnp.flatnonzero(proteins_has_gt)as the sink's row index, as the PK branch already does. Before, it passednp.arange(p.shape[0]).Why
The NK/LK path drops the proteins that have no truth in the terms of interest before it calls the kernel. Its per-protein rows are therefore a subset of the matrix rows. Naming them
0..n-1gave every row after the first dropped protein the id of its neighbour.PROTEA's producer detected this and refused to write those tables (
unmappable_row_numbering). That cost NK:MFO and LK:MFO their per-protein breakdown on window 211->227, where the filter drops 4 and 11 proteins respectively. When no protein is dropped,flatnonzeroequalsarange, so every other table is unchanged.The docstring of
TestTheRowsCanBeNamedclaimed that "the NK/LK kernel sees every row". That was false, and it is corrected.Test
TestTheNkLkPathNamesTheRowsItKeepsdrops two of five proteins and checks two things: the row index names the kept rows (0, 2, 4), and each named row carries its own protein's truth count.tests/test_per_protein_sink.pypass, and so does the full suite.ruff checkis clean on both files.Deploy
Do not merge or deploy this until PROTEA exploration 3 has closed its evaluations and comparisons. All four of its arms must be evaluated with e937e0e.