Skip to content

Commit

Permalink
Add new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jteijema committed Oct 30, 2024
1 parent 7b69304 commit 9ccf0cd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_loss():
Path(TEST_ASREVIEW_FILES, "sim_van_de_schoot_2017_stop_if_min.asreview")
) as s:
loss_value = loss(s)
assert_almost_equal(loss_value, 0.011590940352087164, decimal=6)
assert_almost_equal(loss_value, 0.011592855205548452, decimal=6)

def test_loss_value_function():
labels = [1, 0]
Expand All @@ -132,11 +132,15 @@ def test_loss_value_function():

labels = [1, 1, 0, 0, 0]
loss_value = _loss_value(labels)
assert_almost_equal(loss_value, 0, decimal=6)
assert_almost_equal(loss_value, 0, decimal=6), f"{loss_value} is {int(loss_value)}"

labels = [0, 0, 0, 1, 1]
loss_value = _loss_value(labels)
assert_almost_equal(loss_value, 1, decimal=6)
assert_almost_equal(loss_value, 1, decimal=6)

labels = [1, 0, 1]
loss_value = _loss_value(labels)
assert_almost_equal(loss_value, 0.5, decimal=6)

import random
for i in range(100):
Expand Down

0 comments on commit 9ccf0cd

Please sign in to comment.