acc.eval {gcl} | R Documentation |
This function evaluates a classifier function on a data set. Returns the accuracy.
acc.eval(cf, df, ...)
cf |
Classifier function, must accept df as an argument and
return a matrix with class labels as column names and entry (i,j)
containing the classifiers belief that case i is of class j. |
df |
Data set (frame), last column must be outcome and encoded as numeric |
... |
Not used. |
Accuracy is computed as fraction of correct classifications to the number of cases.
Returns the accuracy of the classifier on the data set.
Part of the gcl package.
Staal A. Vinterbo staal@dsg.harvard.edu
ci.eval ci.eval
## Not run: ## The function is currently defined as function (cf, df, ...) { cs <- cf(df) if (is.null(cs)) return(NA) return(sum(apply(paired.call(cf(df), df), 1, function(v) (v[1] == v[2]) + 0), na.rm = T)/nrow(df)) } ## End(Not run)