Skip to content

Commit 5d01fa9

Browse files
committed
update filters
1 parent e61ac00 commit 5d01fa9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

prefsampling/filters/approval_filters.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def rename_approval_candidates(
5656

5757

5858
def resampling_filter(
59-
votes: list[set[int]], phi: float, seed: int = None
59+
votes: list[set[int]], num_candidates, phi: float, p, seed: int = None
6060
) -> list[set[int]]:
6161
"""
6262
Returns votes with added resampling filter.
@@ -65,8 +65,12 @@ def resampling_filter(
6565
----------
6666
votes : list[set[int]]
6767
Approval votes.
68+
num_candidates : int
69+
Number of Candidates.
6870
phi : float
6971
Noise parameter.
72+
p : float
73+
Resampling model parameter, denoting the average vote length.
7074
seed : int
7175
Seed for numpy random number generator.
7276
@@ -76,8 +80,8 @@ def resampling_filter(
7680
Approval votes.
7781
"""
7882

79-
return [_resampling_filter_vote(votes[i], phi, seed) for i in range(len(votes))]
83+
return [_resampling_filter_vote(votes[i], num_candidates, phi, p, seed) for i in range(len(votes))]
8084

8185

82-
def _resampling_filter_vote(vote, phi: float, seed: int = None):
83-
return resampling(1, len(vote), phi, seed, central_vote=vote)[0]
86+
def _resampling_filter_vote(vote, num_candidates, phi: float, p, seed: int = None):
87+
return resampling(1, num_candidates, phi, p, seed, central_vote=vote)[0]

0 commit comments

Comments
 (0)