acc.eval {gcl}R Documentation

Function that evaluates the accuracy of a classifier function on a data frame

Description

This function evaluates a classifier function on a data set. Returns the accuracy.

Usage

acc.eval(cf, df, ...)

Arguments

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.

Details

Accuracy is computed as fraction of correct classifications to the number of cases.

Value

Returns the accuracy of the classifier on the data set.

Note

Part of the gcl package.

Author(s)

Staal A. Vinterbo staal@dsg.harvard.edu

See Also

ci.eval ci.eval

Examples

## 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)

[Package gcl version 1.06.5 Index]