File: mauc.Rd

package info (click to toggle)
r-cran-modelmetrics 1.2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 300 kB
  • sloc: cpp: 252; sh: 10; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 1,015 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ModelMetrics.R
\name{mauc}
\alias{mauc}
\title{Multiclass Area Under the Curve}
\usage{
mauc(actual, predicted)
}
\arguments{
\item{actual}{A vector of the labels. Can be \code{numeric, character, or factor}}

\item{predicted}{A data.frame of predicted values. Can be \code{matrix, data.frame}}
}
\description{
Calculates the area under the curve for a binary classifcation model
}
\examples{
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)

}