evaluateOcc: Model evaluation / accuracy assessment for 'trainOcc'...

Description Usage Arguments Details Value Examples

Description

Calculation of accuracy for specified thresholds. evaluate is called to perform the calculations.

Usage

1
2
3
evaluateOcc(x, te.u, te.y, positive = NULL, th = NULL, allModels = FALSE,
  modParam = NULL, modRow = NULL, modRank = NULL, by = NULL,
  decreasing = TRUE, verbose = FALSE, ...)

Arguments

x

an object of class trainOcc

te.u

the data to predict on.

te.y

a vector of observed positive/negative (presence/absence) values

positive

the positive label in te.y. if this is not given, the class with the lower frequency is assumed to be the positive class.

th

a vector of thresholds at which the model is evaluated

allModels

logical, default is FALSE. Set to TRUE if all models should be evaluated.

modParam

data frame with the parameters of the model to be evaluated

modRow

the row of the model in the x$results table.

modRank

the rank of the model after sorting by by.

by

character. must be a metric available in the x$results table by which to sort. If NULL the performance metric is taken from the train object. see also sort.train

decreasing

only when modRank is used. TRUE (default) to sort in decreasing order. Can be a vector if by is a vector.

verbose

FALSE, set to TRUE if you want to see the progress

...

arguments passed to evaluate from the dismo package.

Details

By defalut, only the final model is evaluated when allModels is FALSE and non of the arguments modParam,modRow, or modRank given.

Value

an object of class ModelEvaluation (see ModelEvaluation-class)) or ModelSelectionEvaluation. The latter is a list with two elements, the first containing the model sleetion table and the second a list with the evaluation results, each of whith a ModelEvaluation object. The rows in model selection table correspond to the evaluation list elements.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
# get training and test data
data(bananas)
seed <- 123456
tr.x <- bananas$tr[, -1]
tr.y <- bananas$tr[, 1]
set.seed (seed)
te.i <- sample ( ncell (bananas$y), 1000 )
te.x <- extract (bananas$x, te.i)
te.y <- extract (bananas$y, te.i)
# run trainOcc 
oc <- trainOcc(x=tr.x, y=puFactor(tr.y), 
               tuneGrid=expand.grid(sigma=c(0.1,1), ### not so large grid
                                    cNeg=2^seq(-5, 10, 3), 
                                    cMultiplier=2^seq(4, 15, 2)))
# evaluate the final model
ev <- evaluateOcc(oc, y=te.y, te.u=te.x)
# besides the thresholds used, this is identical to: 
te.pred <- predict(oc, te.x)
ev <- evaluate(p=te.pred[te.y==1], a=te.pred[te.y!=1])
# evaluate several models
# e.g. evaluate models with a true positive rate (tpr) higher than 0.8 and a 
# positive prediction probability (ppp) small than 0.4
modRows <- which(oc$results$tpr>=0.8 & oc$results$ppp<0.4)
ev <- evaluateOcc(oc, y=te.y, te.u=te.x, modRow=modRows)
# plot the pu-performance metric versus the maximum kappa 
evList <- print(ev)
plot(evList$puF, evList$mxK.K, xlab="puF", ylab="max. Kappa")

## End(Not run)

benmack/oneClass documentation built on Dec. 15, 2020, 7:38 p.m.