Description Usage Arguments Details Value Author(s) Examples
Build an arbitrary loss matrix for discrete classification
1 2 3 4 | lossMatrix(truthLabels, predLabels, lossValues)
## S3 method for class 'lossMat'
print(x, ...)
|
truthLabels |
character vector of truth labels |
predLabels |
character vector of corresponding predicted labels,
which must be the same length as |
lossValues |
numeric vector of corresponding loss values, which must
be the same length as |
x |
An object of class |
... |
Additional arguments to |
This function checks the inputs and binds the three arguments columnwise into a dataframe.
An object of class lossMat
: a dataframe that contains
all the information of the loss matrix to be used by in calculating the loss.
Landon Sego
1 2 3 4 5 6 7 8 9 10 | # A 2x2 symmetric loss matrix
lossMatrix(c("a","a","b","b"), c("a","b","a","b"), c(0, 1, 5, 0))
# A 3x2 asymmetric loss matrix
lossMatrix(rep(letters[1:3], each = 2), rep(letters[4:5], 3),
c(0, 3, 2, 0, 1, 0))
# An unbalanced loss matrix with a missing element.
# Not sure why one would want to do this.
lossMatrix(c("a","a","b"), c("a","b","b"), c(0, 1, 0))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.