R/methods_disc.R

Defines functions contr.ltfr simple_roc summary.glmdisc print.glmdisc

Documented in contr.ltfr

methods::setMethod(
  "show",
  methods::signature(object = "glmdisc"),
  function(object) {
    methods::show(object@best.disc[[1]])
  }
)


print.glmdisc <- function(object) {
  print(object@best.disc[[1]])
}


summary.glmdisc <- function(object) {
  summary(object@best.disc[[1]])
}


simple_roc <- function(labels, scores) {
  labels <- labels[order(scores, decreasing = TRUE)]
  labels <- as.numeric(as.character(labels))
  data.frame(TPR = cumsum(labels) / sum(labels), FPR = cumsum(!labels) / sum(!labels), labels)
}



#' Wrapper for \code{\link[caret]{contr.ltfr}}
#'
#' Simply redirects the call to \code{\link[caret]{contr.ltfr}}, this is done
#' to avoid errors when the caret namespace is not attached.
#'
#' @param ... \code{\link[caret]{contr.ltfr}} parameters.
#' @export
#' @keywords internal
#' @examples
#' contr.ltfr(2)
contr.ltfr <- function(...) {
  caret::contr.ltfr(...)
}

Try the glmdisc package in your browser

Any scripts or data that you put into this service are public.

glmdisc documentation built on Oct. 23, 2020, 7:12 p.m.