Learn R Programming

ModelMetrics (version 1.2.2.2)

mauc: Multiclass Area Under the Curve

Description

Calculates the area under the curve for a binary classifcation model

Usage

mauc(actual, predicted)

Arguments

actual

A vector of the labels. Can be numeric, character, or factor

predicted

A data.frame of predicted values. Can be matrix, data.frame

Examples

Run this code
# NOT RUN {
setosa <- glm(I(Species == 'setosa') ~ Sepal.Length, data = iris, family = 'binomial')
versicolor <- glm(I(Species == 'versicolor') ~ Sepal.Length, data = iris, family = 'binomial')
virginica <- glm(I(Species == 'virginica') ~ Sepal.Length, data = iris, family = 'binomial')

Pred <-
  data.frame(
    setosa = predict(setosa, type = 'response')
    ,versicolor = predict(versicolor, type = 'response')
    ,virginica = predict(virginica, type = 'response')
  )

Predicted = Pred/rowSums(Pred)
Actual = iris$Species

mauc(Actual, Predicted)

# }

Run the code above in your browser using DataLab