Skip to contents

Plurality vote with deterministic smallest-label tie-breaking (which.max takes the first maximum, matching np.argmax). Majority voting only helps when the members err on DIFFERENT rows.

Usage

morie_geron_voting_hard(models, X, y_true = NULL)

Arguments

models

List of functions mapping X to a label vector.

X

Design matrix.

y_true

Optional gold labels.

Value

List with predicted, votes, classes, member_predictions, member_accuracy, accuracy, agreement, estimate, n.

Examples

models <- list(function(X) c(0, 1, 1, 0), function(X) c(0, 1,
    0, 0), function(X) c(1, 1, 0, 1))
morie_geron_voting_hard(models, matrix(c(0, 1, 2, 3), ncol = 1),
    y_true = c(0, 1, 0, 0))
#> $predicted
#> [1] 0 1 0 0
#> 
#> $votes
#>      [,1] [,2]
#> [1,]    2    1
#> [2,]    0    3
#> [3,]    2    1
#> [4,]    2    1
#> 
#> $classes
#> [1] 0 1
#> 
#> $member_predictions
#>      [,1] [,2] [,3] [,4]
#> [1,]    0    1    1    0
#> [2,]    0    1    0    0
#> [3,]    1    1    0    1
#> 
#> $member_accuracy
#> [1] 0.75 1.00 0.50
#> 
#> $accuracy
#> [1] 1
#> 
#> $agreement
#> [1] 0.75 1.00 0.50
#> 
#> $estimate
#> [1] 1
#> 
#> $n
#> [1] 4
#> 
#> $method
#> [1] "Hard (plurality) voting with deterministic smallest-label tie-breaking"
#>