lossMatrix: Build a loss matrix

Description Usage Arguments Details Value Author(s) Examples

Description

Build an arbitrary loss matrix for discrete classification

Usage

1
2
3
4
lossMatrix(truthLabels, predLabels, lossValues)

## S3 method for class 'lossMat'
print(x, ...)

Arguments

truthLabels

character vector of truth labels

predLabels

character vector of corresponding predicted labels, which must be the same length as truthLabels

lossValues

numeric vector of corresponding loss values, which must be the same length as truthLabels and predLabels.

x

An object of class lossMat

...

Additional arguments to print.default

Details

This function checks the inputs and binds the three arguments columnwise into a dataframe.

Value

An object of class lossMat: a dataframe that contains all the information of the loss matrix to be used by in calculating the loss.

Author(s)

Landon Sego

Examples

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

pnnl/glmnetLRC documentation built on May 25, 2019, 10:22 a.m.