File: logLoss.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 (50 lines) | stat: -rw-r--r-- 1,242 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logLoss.R
\name{logLoss}
\alias{logLoss}
\alias{logLoss.default}
\alias{logLoss.glm}
\alias{logLoss.randomForest}
\alias{logLoss.glmerMod}
\alias{logLoss.gbm}
\alias{logLoss.rpart}
\title{Log Loss}
\usage{
logLoss(...)

\method{logLoss}{default}(actual, predicted, distribution = "binomial", ...)

\method{logLoss}{glm}(modelObject, ...)

\method{logLoss}{randomForest}(modelObject, ...)

\method{logLoss}{glmerMod}(modelObject, ...)

\method{logLoss}{gbm}(modelObject, ...)

\method{logLoss}{rpart}(modelObject, ...)
}
\arguments{
\item{\dots}{additional parameters to be passed the the s3 methods}

\item{actual}{a binary vector of the labels}

\item{predicted}{a vector of predicted values}

\item{distribution}{the distribution of the loss function needed \code{binomial, poisson}}

\item{modelObject}{the model object. Currently supported \code{glm, randomForest, glmerMod, gbm}}
}
\description{
Calculates the log loss or entropy loss for a binary outcome
}
\examples{
data(testDF)
glmModel <- glm(y ~ ., data = testDF, family="binomial")
Preds <- predict(glmModel, type = 'response')

logLoss(testDF$y, Preds)
# using s3 method for glm
logLoss(glmModel)

}