Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AmenRa committed Jul 1, 2024
1 parent 008271e commit f60b1ac
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 47 deletions.
18 changes: 9 additions & 9 deletions ranx/statistical_tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ def compute_statistical_significance(
treatment_metric_scores = metric_scores[treatment]

# Compute statistical significance
comparisons[
frozenset([control, treatment])
] = _compute_statistical_significance(
control_metric_scores,
treatment_metric_scores,
stat_test,
n_permutations,
max_p,
random_seed,
comparisons[frozenset([control, treatment])] = (
_compute_statistical_significance(
control_metric_scores,
treatment_metric_scores,
stat_test,
n_permutations,
max_p,
random_seed,
)
)

return comparisons
Expand Down
24 changes: 6 additions & 18 deletions tests/unit/ranx/fusion/logn_isr_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,9 @@ def test_logn_isr(run_1, run_2, run_3):
assert len(combined_run["q1"]) == 3
assert len(combined_run["q2"]) == 3

assert combined_run["q1"]["d1"] == ((1 / (3**2)) + (1 / (1**2))) * np.log(
2 + sigma
)
assert combined_run["q1"]["d2"] == ((1 / (2**2)) + (1 / (2**2))) * np.log(
2 + sigma
)
assert combined_run["q1"]["d3"] == ((1 / (1**2)) + (1 / (1**2))) * np.log(
2 + sigma
)
assert combined_run["q2"]["d1"] == ((1 / (2**2)) + (1 / (2**2))) * np.log(
2 + sigma
)
assert combined_run["q2"]["d2"] == ((1 / (1**2)) + (1 / (2**2))) * np.log(
2 + sigma
)
assert combined_run["q2"]["d3"] == ((1 / (1**2)) + (1 / (1**2))) * np.log(
2 + sigma
)
assert combined_run["q1"]["d1"] == ((1 / (3**2)) + (1 / (1**2))) * np.log(2 + sigma)
assert combined_run["q1"]["d2"] == ((1 / (2**2)) + (1 / (2**2))) * np.log(2 + sigma)
assert combined_run["q1"]["d3"] == ((1 / (1**2)) + (1 / (1**2))) * np.log(2 + sigma)
assert combined_run["q2"]["d1"] == ((1 / (2**2)) + (1 / (2**2))) * np.log(2 + sigma)
assert combined_run["q2"]["d2"] == ((1 / (1**2)) + (1 / (2**2))) * np.log(2 + sigma)
assert combined_run["q2"]["d3"] == ((1 / (1**2)) + (1 / (1**2))) * np.log(2 + sigma)
12 changes: 2 additions & 10 deletions tests/unit/ranx/meta/evaluate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,7 @@ def test_dcg_burges():

assert np.allclose(
evaluate(y_true, y_pred_1, f"dcg_burges@{k}"),
(
(2**5 - 1) / np.log2(3)
+ (2**4 - 1) / np.log2(5)
+ (2**3 - 1) / np.log2(6)
),
((2**5 - 1) / np.log2(3) + (2**4 - 1) / np.log2(5) + (2**3 - 1) / np.log2(6)),
)

assert np.allclose(
Expand Down Expand Up @@ -343,11 +339,7 @@ def test_ndcg_burges():

assert np.allclose(
evaluate(y_true, y_pred_1, f"ndcg_burges@{k}"),
(
(2**5 - 1) / np.log2(3)
+ (2**4 - 1) / np.log2(5)
+ (2**3 - 1) / np.log2(6)
)
((2**5 - 1) / np.log2(3) + (2**4 - 1) / np.log2(5) + (2**3 - 1) / np.log2(6))
/ idcg,
)

Expand Down
12 changes: 2 additions & 10 deletions tests/unit/ranx/metrics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,7 @@ def test_dcg_burges():

assert np.allclose(
rm.dcg_burges(y_true, y_pred_1, k)[0],
(
(2**5 - 1) / np.log2(3)
+ (2**4 - 1) / np.log2(5)
+ (2**3 - 1) / np.log2(6)
),
((2**5 - 1) / np.log2(3) + (2**4 - 1) / np.log2(5) + (2**3 - 1) / np.log2(6)),
)

assert np.allclose(
Expand Down Expand Up @@ -301,11 +297,7 @@ def test_ndcg_burges():

assert np.allclose(
rm.ndcg_burges(y_true, y_pred_1, k)[0],
(
(2**5 - 1) / np.log2(3)
+ (2**4 - 1) / np.log2(5)
+ (2**3 - 1) / np.log2(6)
)
((2**5 - 1) / np.log2(3) + (2**4 - 1) / np.log2(5) + (2**3 - 1) / np.log2(6))
/ idcg,
)

Expand Down

0 comments on commit f60b1ac

Please sign in to comment.