fixed_threshold {utiml} | R Documentation |
Apply a fixed threshold in the results
Description
Transform a prediction matrix with scores/probabilities in a mlresult applying a fixed threshold. A global fixed threshold can be used of all labels or different fixed thresholds, one for each label.
Usage
fixed_threshold(prediction, threshold = 0.5, probability = FALSE)
## Default S3 method:
fixed_threshold(prediction, threshold = 0.5, probability = FALSE)
## S3 method for class 'mlresult'
fixed_threshold(prediction, threshold = 0.5, probability = FALSE)
Arguments
prediction |
A matrix with scores/probabilities where the columns are the labels and the rows are the instances. |
threshold |
A single value between 0 and 1 or a list with threshold values contained one value per label. |
probability |
A logical value. If |
Value
A mlresult object.
Methods (by class)
-
default
: Fixed Threshold for matrix or data.frame -
mlresult
: Fixed Threshold for mlresult
References
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:
lcard_threshold()
,
mcut_threshold()
,
pcut_threshold()
,
rcut_threshold()
,
scut_threshold()
,
subset_correction()
Examples
# Create a prediction matrix with scores
result <- matrix(
data = rnorm(9, 0.5, 0.2),
ncol = 3,
dimnames = list(NULL, c('lbl1', 'lb2', 'lb3'))
)
# Use 0.5 as threshold
fixed_threshold(result)
# Use an threshold for each label
fixed_threshold(result, c(0.4, 0.6, 0.7))