classAcc: Generates basic error statistics for a model

Description Usage Arguments Details Value See Also Examples

Description

A reasonable question is: what is the accuracy of the model we have created; this function aims to provide information towards answering that question. There are a number of different metrics used depending primarily on whether the model encodes categorical or continuous data—see below for details.

Usage

1
classAcc(pred, valid, weights = NULL, classNames = NULL, ...)

Arguments

pred

the predicted classes.

valid

the validation classes.

weights

(optional) sampling weights for each point; if provided, the confusion matrix will be the sum of sample weights in each bin rather than the sum of the points—the latter case really signifying where weights are all one.

classNames

(optional) a character vector of class names (strings). It is necessary because in grouped models, there are no meaningful classnames stored internal to the model. classNames will be subsetted to include only the levels that are actually present in the model. See ecoGroup for more information on how to garner and store useful grouping labels.

...

any extra parameters; not currently used.

Details

The metrics returned for categorical models are:

The metrics returned for continuous models are:

Value

Note: this function returns different data depending on the whether the model is categorical or continuous:

See Also

generateModels for creating models; isCat, isCont for how categorical/continuous type is evaluated.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data ('siteData')
modelRun <- generateModels (data = siteData,
                            modelTypes = suppModels,
                            x = c('brtns','grnns','wetns','dem','slp','asp','hsd'),
                            y = 'ecoType',
                            grouping = ecoGroup[['domSpecies','transform']])
model <- modelRun$randomForest
mAcc <- classAcc (getFitted(model),getData(model)[['ecoType']],
                  classNames=ecoGroup[['domSpecies','labels']])
str (mAcc,1)

modelRun <- generateModels (data = siteData,
                            modelTypes = contModels,
                            x = c('brtns','grnns','wetns','dem','slp','asp','hsd'),
                            y = 'easting')
model <- modelRun$randomForest
mAcc <- classAcc (getFitted(model),getData(model)[['easting']])
str (mAcc,1)

henkelstone/NPEL.Classification documentation built on May 17, 2019, 3:42 p.m.