Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion metaquantus/helpers/configs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Estimator:
name: str
category: str
score_direction: bool
score_direction: str
init: quantus.Metric


Expand Down
7 changes: 6 additions & 1 deletion metaquantus/meta_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,11 +780,16 @@ def compute_iec_adversary(
-------
float
"""
if score_direction not in ("lower", "higher"):
raise ValueError(
f"score_direction must be 'lower' or 'higher', got {score_direction!r}."
)

U = []
for row_star, row_hat in zip(Q_star, Q_hat):
for q_star, q_hat in zip(row_star[indices], row_hat[indices]):

if score_direction:
if score_direction == "lower":
if q_star < q_hat:
U.append(1)
else:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_meta_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_meta_evaluation_mnist(
iters = 3
K = 5
metric = estimators[estimator_category][estimator_name]["init"]
score_direction = estimators[estimator_category][estimator_name]["init"]
score_direction = estimators[estimator_category][estimator_name]["score_direction"]

# Define the meta-evaluation exercise.
meta_evaluator = MetaEvaluation(
Expand Down Expand Up @@ -178,7 +178,7 @@ def test_meta_evaluation_fmnist(
iters = 3
K = 5
metric = estimators[estimator_category][estimator_name]["init"]
score_direction = estimators[estimator_category][estimator_name]["init"]
score_direction = estimators[estimator_category][estimator_name]["score_direction"]

# Define the meta-evaluation exercise.
meta_evaluator = MetaEvaluation(
Expand Down Expand Up @@ -279,7 +279,7 @@ def test_meta_evaluation_cmnist(
iters = 5
K = 10
metric = estimators[estimator_category][estimator_name]["init"]
score_direction = estimators[estimator_category][estimator_name]["init"]
score_direction = estimators[estimator_category][estimator_name]["score_direction"]

# Define the meta-evaluation exercise.
meta_evaluator = MetaEvaluation(
Expand Down Expand Up @@ -311,4 +311,4 @@ def test_meta_evaluation_cmnist(
((scores_1 >= expected["min"]) & (scores_1 <= expected["max"])
& (scores_2 >= expected["min"]) & (scores_2 <= expected["max"]))
), "Test failed."
'''
'''