R/precision_calc.R

Defines functions calc_accuracy

Documented in calc_accuracy

#' Load a Matrix
#'
#' This function loads a file as a matrix. It assumes that the first column
#' contains the rownames and the subsequent columns are the sample identifiers.
#' Any rows with duplicated row names will be dropped with the first one being
#' kepted.
#'
#' @param infile Path to the input file
#' @return prediction_accuracy
#' @export
calc_accuracy <- function(actual,predicted){
  c = 0
  for(i in 1:length(actual)){
    if(actual[i] == predicted[i] )
      c = c + 1
  }

  return(c/length(actual))
}


#//TODO - find confusion matrix, precision, recall, f1 score, ROC
NAshwinKumar/summarylib documentation built on March 18, 2020, 7:35 a.m.