Skip to content

Commit

Permalink
Fix prior not included when priors=True (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
J535D165 authored Jun 15, 2022
1 parent dcf834c commit 725cdfc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions asreviewcontrib/insights/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def recall(state_obj,
x_absolute=False,
y_absolute=False):

labels = get_labels(state_obj)
labels = get_labels(state_obj, priors=priors)

return _recall(labels,
intercept,
Expand All @@ -64,7 +64,7 @@ def wss(state_obj,
x_absolute=False,
y_absolute=False):

labels = get_labels(state_obj)
labels = get_labels(state_obj, priors=priors)

return _wss(labels,
intercept,
Expand All @@ -85,7 +85,7 @@ def erf(state_obj,
x_absolute=False,
y_absolute=False):

labels = get_labels(state_obj)
labels = get_labels(state_obj, priors=priors)

return _erf(labels,
intercept,
Expand Down
13 changes: 13 additions & 0 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from pathlib import Path

from asreview import open_state
from numpy import array_equal
from numpy.testing import assert_almost_equal

from asreviewcontrib.insights.metrics import _recall
Expand Down Expand Up @@ -84,3 +85,15 @@ def test_metric_recall():
"sim_van_de_schoot_2017_1.asreview")) as s:

assert_almost_equal(recall(s, 0.25), 1)


def test_metric_priors():

with open_state(
Path(TEST_ASREVIEW_FILES,
"sim_van_de_schoot_2017_1.asreview")) as s:

r_priors = recall(s, 0.01, priors=True)
r_no_priors = recall(s, 0.01, priors=False)

assert not array_equal(r_priors, r_no_priors)

0 comments on commit 725cdfc

Please sign in to comment.