Added ranking prior to permutation testing#10
Merged
sarthakpati merged 9 commits intomainfrom Jul 31, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issue #9 by adding ranking functionality prior to permutation testing and improves the CLI default value. The changes ensure that data is properly sorted by cumulative rank before performing permutation tests, and provides a better default for the metrics-for-reversal CLI parameter.
- Sorts ranks_per_metric by cumulative_rank before sanitization in permutation testing
- Resets the dataframe index after sorting to maintain proper ordering
- Changes CLI default for metrics-for-reversal from None to empty string
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pyranker/ranker.py | Adds sorting by cumulative_rank and index reset before permutation test sanitization |
| pyranker/cli/run.py | Changes default value for metrics-for-reversal parameter from None to empty string |
Comments suppressed due to low confidence (1)
pyranker/ranker.py:129
- [nitpick] The variable name 'ranks_per_metric_sorted' is verbose and inconsistent with the existing naming pattern. Consider renaming to 'sorted_ranks' or 'ranks_sorted' to be more concise and align with the existing 'ranks_per_metric_sanitized' naming pattern.
ranks_per_metric_sorted = self.ranks_per_metric.sort_values(by="cumulative_rank")
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
Author
|
Here are the results on the sample data:
method,m1,m2,m3,m4
m1,0.0,0.913,0.906,0.548
m2,0.0,0.0,0.434,0.112
m3,0.0,0.0,0.0,0.112
m4,0.0,0.0,0.0,0.0
method,m1,m2,m3,m4
m1,0.0,0.429,0.091,0.08
m2,0.0,0.0,0.101,0.057
m3,0.0,0.0,0.0,0.384
m4,0.0,0.0,0.0,0.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.
Fixes #9
Also adds a better default for CLI