#' nnet with cutoff as additional tuning parameter
#' @author Max Kuhn
#' @description is used as internal function in caret's rfe and train
#' @references http://caret.r-forge.r-project.org/custom_models.html
#' @export fourStats
fourStats <- function (data, lev = levels(data$obs), model = NULL) {
## This code will get use the area under the ROC curve and the
## sensitivity and specificity values using the current candidate
## value of the probability threshold.
out <- c(twoClassSummary(data, lev = levels(data$obs), model = NULL))
## The best possible model has sensitivity of 1 and specificity of 1.
## How far are we from that value?
coords <- matrix(c(1, 1, out["Spec"], out["Sens"]),
ncol = 2,
byrow = TRUE)
colnames(coords) <- c("Spec", "Sens")
rownames(coords) <- c("Best", "Current")
c(out, Dist = dist(coords)[1])
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.