Skip to content

Commit 087d6a6

Browse files
committed
Updated DIDI to only alphas > 0
1 parent 3dc39b4 commit 087d6a6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

prefsampling/ordinal/didi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ def didi(
5050
"Incorrect length of alphas vector. Should be equal to num_candidates."
5151
)
5252

53-
if not all(a >= 0 for a in alphas):
54-
raise ValueError("The values of the alpha vector should all be positive.")
53+
if not all(a > 0 for a in alphas):
54+
raise ValueError("The values of the alpha vector should all be strictly positive.")
5555

5656
rng = np.random.default_rng(seed)
5757

tests/test_samplers/ordinal/test_ordinal_didi.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ def test_ordinal_did(self):
99
didi(4, 5, alphas=[0.4, 0.4])
1010
with self.assertRaises(ValueError):
1111
didi(4, 5, alphas=[0.4, 0.4, 0.4, 0.4, -0.4])
12-
didi(4, 5, alphas=[0, 0, 0, 0, 0])
12+
with self.assertRaises(ValueError):
13+
didi(4, 5, alphas=[0, 0, 0, 0, 0])
14+
didi(4, 5, alphas=[0.1, 0.4, 0.8, 0.9, 1])

0 commit comments

Comments
 (0)