Skip to content

Commit

Permalink
remove revseq-PAV method, use optimized seqPAV
Browse files Browse the repository at this point in the history
  • Loading branch information
bblodfon committed Aug 21, 2024
1 parent 58ab928 commit 61c0907
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
6 changes: 1 addition & 5 deletions R/EnsembleFSResult.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ EnsembleFSResult = R6Class("EnsembleFSResult",
#' Voters who approve more candidates contribute a lesser score to the individual approved candidates.
#' - `"seq_pav"|"seq_pav_weighted"` (sequential proportional approval voting) sequentially builds a committee by iteratively selecting the candidate that maximizes the PAV score when added, ensuring proportional representation.
#' The **PAV score** (Proportional Approval Voting score) is a metric that calculates the weighted sum of harmonic numbers corresponding to the number of elected candidates supported by each voter, reflecting the overall satisfaction of voters in a committee selection process.
#' - `"revseq_pav"|"revseq_pav_weighted"` (reverse sequential proportional approval voting) sequentially removes candidates from a full committee, selecting the candidate whose removal minimizes the reduction in the PAV score, then reverses the order to determine the final committee.
#'
#' @param method (`character(1)`)\cr
#' The method to calculate the feature ranking.
Expand All @@ -154,8 +153,7 @@ EnsembleFSResult = R6Class("EnsembleFSResult",
#'
feature_ranking = function(method = "av", committee_size = NULL) {
assert_choice(method, choices = c("av", "av_weighted", "sav", "sav_weighted",
"seq_pav", "seq_pav_weighted", "revseq_pav",
"revseq_pav_weighted"))
"seq_pav", "seq_pav_weighted"))
assert_int(committee_size, lower = 1, null.ok = TRUE)

# cached results
Expand Down Expand Up @@ -185,8 +183,6 @@ EnsembleFSResult = R6Class("EnsembleFSResult",
res = satisfaction_approval_voting(voters, candidates, weights)
} else if (startsWith(method, "seq_pav")) {
res = seq_proportional_approval_voting(voters, candidates, weights, committee_size)
} else if (startsWith(method, "revseq_pav")) {
res = revseq_proportional_approval_voting(voters, candidates, weights)
}

private$.feature_ranking[[method]] = res
Expand Down
9 changes: 1 addition & 8 deletions R/voting_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,7 @@ seq_proportional_approval_voting = function(voters, candidates, weights, committ
}

# returns ranked features from best to worst (up to committee_size)
res = as.data.table(seq_PAV_rcpp(voters, candidates, weights, committee_size))

add_borda_score(res)
}

revseq_proportional_approval_voting = function(voters, candidates, weights) {
# returns ranked features from best to worst
res = as.data.table(revseq_PAV_rcpp(voters, candidates, weights))
res = as.data.table(seq_PAV_rcpp2(voters, candidates, weights, committee_size))

add_borda_score(res)
}
Expand Down

0 comments on commit 61c0907

Please sign in to comment.