Learn R Programming

utiml (version 0.1.7)

scut_threshold: SCut Score-based method

Description

This is a label-wise method that adjusts the threshold for each label to achieve a specific loss function using a validation set or cross validation.

Usage

scut_threshold(
  prediction,
  expected,
  loss.function = NA,
  cores = getOption("utiml.cores", 1)
)

# S3 method for default scut_threshold( prediction, expected, loss.function = NA, cores = getOption("utiml.cores", 1) )

# S3 method for mlresult scut_threshold( prediction, expected, loss.function = NA, cores = getOption("utiml.cores", 1) )

Arguments

prediction

A matrix or mlresult.

expected

The expected labels for the prediction. May be a matrix with the label values or a mldr object.

loss.function

A loss function to be optimized. If you want to use your own error function see the notes and example. (Default: Mean Squared Error)

cores

The number of cores to parallelize the computation Values higher than 1 require the parallel package. (Default: options("utiml.cores", 1))

Value

A numeric vector with the threshold values for each label

Methods (by class)

  • default: Default scut_threshold

  • mlresult: Mlresult scut_threshold

Details

Different from the others threshold methods instead of return the bipartition results, it returns the threshold values for each label.

References

Fan, R.-E., & Lin, C.-J. (2007). A study on threshold selection for multi-label classification. Department of Computer Science, National Taiwan University.

Al-Otaibi, R., Flach, P., & Kull, M. (2014). Multi-label Classification: A Comparative Study on Threshold Selection Methods. In First International Workshop on Learning over Multiple Contexts (LMCE) at ECML-PKDD 2014.

See Also

Other threshold: fixed_threshold(), lcard_threshold(), mcut_threshold(), pcut_threshold(), rcut_threshold(), subset_correction()

Examples

Run this code
# NOT RUN {
names <- list(1:10, c("a", "b", "c"))
prediction <- matrix(runif(30), ncol = 3, dimnames = names)
classes <- matrix(sample(0:1, 30, rep = TRUE), ncol = 3, dimnames = names)
thresholds <- scut_threshold(prediction, classes)
fixed_threshold(prediction, thresholds)

# }
# NOT RUN {
# Penalizes only FP predictions
mylossfunc <- function (real, predicted) {
   mean(predicted - real * predicted)
}
prediction <- predict(br(toyml, "RANDOM"), toyml)
scut_threshold(prediction, toyml, loss.function = mylossfunc, cores = 2)
# }

Run the code above in your browser using DataLab