scut_threshold: SCut Score-based method

Description Usage Arguments Details Value Methods (by class) Note References See Also Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
scut_threshold(
  prediction,
  expected,
  loss.function = NA,
  cores = getOption("utiml.cores", 1)
)

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

## S3 method for class '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))

Details

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

Value

A numeric vector with the threshold values for each label

Methods (by class)

Note

The loss function is a R method that receive two vectors, the expected values of the label and the predicted values, respectively. Positive values are represented by the 1 and the negative by the 0.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)


# 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)

utiml documentation built on May 31, 2021, 9:09 a.m.