Learn R Programming

utiml (version 0.1.4)

compute_multilabel_predictions: 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:

'avg'

Compute the mean of probabilities and the bipartitions

'maj'

Compute the majority of votes

'max'

Compute the higher probability for each instance/label

'min'

Compute the lower probability for each instance/label

. (Default: 'maj')

probability

A logical value. If TRUE the predicted values are the score between 0 and 1, otherwise the values are bipartition 0 or 1.

Value

A mlresult with computed predictions.

Examples

Run this code
# 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