Skip to content

Commit

Permalink
Add unit tests for the rmse function.
Browse files Browse the repository at this point in the history
This function was introduced in a recent commit but was not covered by
unit tests. This diff fixes that.
  • Loading branch information
lucasmaystre committed Aug 8, 2018
1 parent 4c964b0 commit 05a57a1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ def test_kendalltau_dist_default():
assert kendalltau_dist(params3) == 0


def test_rmse_error():
params1 = np.array([+1.0, -1.2, +0.0, -0.3])
params2 = params1 - 10.0
assert np.allclose(rmse(params1, params2), 0)
params3 = params1 + np.array([+0.1, -0.1, -0.1, +0.1])
assert np.allclose(rmse(params1, params3), 0.1)


def test_rmse_simple_cases():
params1 = np.arange(3, dtype=float)
params2 = np.arange(4, dtype=float)
with pytest.raises(AssertionError):
rmse(params1, params2)


def test_log_likelihood_pairwise():
data1 = ((0,1),)
data2 = ((0,1), (1,0))
Expand Down

0 comments on commit 05a57a1

Please sign in to comment.