compute_multilabel_predictions {utiml} | R Documentation |
Compute the multi-label ensemble predictions based on some vote schema
Description
Compute the multi-label ensemble predictions based on some vote schema
Usage
compute_multilabel_predictions(
predictions,
vote.schema = "maj",
probability = getOption("utiml.use.probs", TRUE)
)
Arguments
predictions |
A list of multi-label predictions (mlresult). |
vote.schema |
Define the way that ensemble must compute the predictions. The default valid options are:
. (Default: 'maj') |
probability |
A logical value. If |
Value
A mlresult with computed predictions.
Note
You can create your own vote schema, just create a method that receive two matrix (bipartitions and probabilities) and return a list with the final bipartitions and probabilities.
Remember that this method will compute the ensemble votes for each label. Thus the bipartition and probability matrix passed as argument for this method is related with the bipartitions and probabilities for a single label.
Examples
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")