# NOT RUN {
model <- br(toyml, "KNN")
predictions <- list(
predict(model, toyml[1:10], k=1),
predict(model, toyml[1:10], k=3),
predict(model, toyml[1:10], k=5)
)
result <- compute_multilabel_predictions(predictions, "maj")
## Random choice
random_choice <- function (bipartition, probability) {
cols <- sample(seq(ncol(bipartition)), nrow(bipartition), replace = TRUE)
list(
bipartition = bipartition[cbind(seq(nrow(bipartition)), cols)],
probability = probability[cbind(seq(nrow(probability)), cols)]
)
}
result <- compute_multilabel_predictions(predictions, "random_choice")
# }
Run the code above in your browser using DataLab