R/predictClass.R

Defines functions `predictClass`

`predictClass` <-
function(scores) {
  cll <- factor(colnames(scores))
  f1 <- function(x) {
    return(cll[which(x == max(x))])
  }
  f2 <- function(x) {
    return(x[which(x == max(x))])
  }
  cl.pred <- apply(scores, 1, f1)
  cl.pred <- factor(cl.pred, levels=levels(cll))
  cl.sc <- apply(scores, 1, f2)
  list(class=cl.pred, score=cl.sc)
}

Try the dualKS package in your browser

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

dualKS documentation built on Nov. 8, 2020, 8:30 p.m.