Skip to content
Snippets Groups Projects
Commit 1cb67b8c authored by Raimon Tolosana-Delgado's avatar Raimon Tolosana-Delgado
Browse files

bugs in accuracy, precision and goodness corrected

parent b9d96035
No related branches found
No related tags found
No related merge requests found
......@@ -210,7 +210,8 @@ accuracy.DataFrameStack <- function(x, observed,
#' @family accuracy functions
mean.accuracy = function(x, ...){
aux = x$accuracy - x$p
mean(ifelse(aux>0,1,0),...)
n = nrow(x)
n/(n-1)*mean(ifelse(aux>0,1,0),...)
}
......@@ -250,8 +251,9 @@ precision <- function(x,...) UseMethod("precision",x)
#' @export
precision.accuracy <- function(x, ...){
aux = x$accuracy - x$p
erg = c(precision=1-2* x$accuracy %*% ifelse(aux>0,aux,0),
goodness = 1-(3*x$accuracy-2) %*% aux)/nrow(x)
a = ifelse(aux>0,1,0)
erg = c(precision=1-2*(a %*% aux)/(nrow(x)-1),
goodness = 1-((3*a-2) %*% aux)/(nrow(x)-1))
return(erg)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment