R/KS_Function.R

KS <- function (pred, obs) {
  require("ROCR")
  p <- prediction(as.numeric(pred), obs)
  perf <- ROCR::performance(p, "tpr", "fpr")
  ks <- max(attr(perf, "y.values")[[1]] - (attr(perf, "x.values")[[1]]))
  return(ks)
}
Ehsan-F/R-Mixtape documentation built on June 24, 2020, 12:22 a.m.