Description Usage Arguments Value Note Examples
Compute the multi-label ensemble predictions based on some vote schema
1 2 3 4 5 | compute_multilabel_predictions(
predictions,
vote.schema = "maj",
probability = getOption("utiml.use.probs", TRUE)
)
|
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 |
A mlresult with computed predictions.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.