Skip to content

Commit

Permalink
compare defaults to paired Student's t-test
Browse files Browse the repository at this point in the history
  • Loading branch information
AmenRa committed Aug 2, 2022
1 parent 9a9d5d5 commit 0dc8d9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
5 changes: 2 additions & 3 deletions ranx/meta/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def compare(
qrels: Qrels,
runs: List[Run],
metrics: Union[List[str], str],
stat_test: str = "fisher",
stat_test: str = "student",
n_permutations: int = 1000,
max_p: float = 0.01,
random_seed: int = 42,
Expand All @@ -25,7 +25,7 @@ def compare(
Usage example:
```python
from ranx import compare
# Compare different runs and perform statistical tests
report = compare(
qrels=qrels,
Expand Down Expand Up @@ -128,4 +128,3 @@ def compare(
show_percentages=show_percentages,
stat_test=stat_test,
)

16 changes: 8 additions & 8 deletions tests/unit/ranx/data_structures/report_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,26 +127,26 @@ def test_to_dict(qrels, runs, metrics):

def test_stat_test(qrels, runs, metrics):
report = compare(qrels, runs, metrics)
assert report.stat_test == "fisher"
assert report.stat_test == "student"
assert (
report.get_stat_test_label(report.stat_test)
== "Fisher's randomization test"
== "paired Student's t-test"
)
assert report.get_stat_test_label(report.stat_test) in report.to_latex()

report = compare(qrels, runs, metrics, stat_test="fisher")
assert report.stat_test == "fisher"
report = compare(qrels, runs, metrics, stat_test="student")
assert report.stat_test == "student"
assert (
report.get_stat_test_label(report.stat_test)
== "Fisher's randomization test"
== "paired Student's t-test"
)
assert report.get_stat_test_label(report.stat_test) in report.to_latex()

report = compare(qrels, runs, metrics, stat_test="student")
assert report.stat_test == "student"
report = compare(qrels, runs, metrics, stat_test="fisher")
assert report.stat_test == "fisher"
assert (
report.get_stat_test_label(report.stat_test)
== "paired Student's t-test"
== "Fisher's randomization test"
)
assert report.get_stat_test_label(report.stat_test) in report.to_latex()

Expand Down

0 comments on commit 0dc8d9c

Please sign in to comment.