Description Usage Arguments Value See Also Examples
View source: R/binaryClassification.R
Evaluate the performance of a model with two outcomes, 0 and 1.
Given a vector of estimated probabilities of success and a vector of actual successes and failures, this function
creates some standardised graphs and summaries and returns them as a list that can be consumed by other
functions such as binaryClassifierEmailReport
or a shiny
app.
The result contains a histogram of estimated probabilities, the ROC plot with the calculated area under the curve, two density plots, one violin, one standard, two loss curves as a function of deciles of the calculated probabilies, and a plot of cumulative It contains some stats such as Area under the ROC curve, Root Mean Square Error and the confusion matrix. It does not require the actual model. If the model is supplied, a summary of the model is also included in the output.
1 2 |
probs |
A vector of estimated probabilities, from 0 to 1. |
actuals |
A vector of actual outcomes, 0 or 1. |
thresholdConfusion |
a threshold to convert probabilities to 0's or 1's. Takes the median of the |
model |
Optional, the model used to estimate |
config |
A list containing details of the call to the function, such as lenght of vectors or time of completion. This is simply printed and attached to the email. |
A list with an additional class binaryModelEvaluation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | set.seed(123)
probs <- pnorm(rnorm(100,-1,1))
hist(probs)
actuals <- rbinom(100,1,probs)
plot(as.factor(actuals),probs)
binaryClassifierEvaluation(probs, actuals)
my.data<-data.frame(actuals,probs)
mod.fit <- glm(actuals ~ probs , data=my.data, family=binomial)
binaryClassifierEvaluation(probs, actuals
, model = mod.fit
, config = list(
finish = Sys.time()
,n.text = length(probs)
)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.