feat: add experimental median_average_precision function#124
Closed
shntnu wants to merge 1 commit into
Closed
Conversation
Add a new function to compute median (instead of mean) average precision scores for grouped profiles. This provides an alternative aggregation method that is more robust to outliers. Key changes: - Add median_average_precision() in map.py with identical signature to mean_average_precision() - Export the new function from copairs.map - Add tests for the new function The null distribution for p-value calculation uses the element-wise median of individual null distributions, following the same pattern as the mean-based approach. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Member
Author
|
Closing this PR based on experimental results: median aggregation doesn't improve retrieval overall (823 vs 875 significant groups, 25.0% vs 26.5%), with mixed results across annotation types. Given the lack of clear benefit, I'd prefer to keep the API simple rather than add another aggregation option. Details: https://github.com/broadinstitute/jump_production/issues/22#issuecomment-3764178955 |
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.
Summary
median_average_precision()as an experimental alternative tomean_average_precision()Motivation
We've observed cases where one or two outlier profiles within a group can disproportionately drag down the mean AP score, potentially masking otherwise strong phenotypic signals. Median-based aggregation may be more robust to these outliers.
Importantly, the null distribution calculation adjusts accordingly (using element-wise median of null distributions), so this should not produce optimistically biased results—the statistic is still tested in the same rigorous way as mean average precision.
This is an experimental function to explore whether median aggregation helps in these scenarios.
Details
The new function:
mean_average_precision()for easy drop-in usageTest plan
median_average_precision(with/without progress bar)Next steps
🤖 Generated with Claude Code