Description Usage Arguments Details Value Examples
Calculation of accuracy for specified thresholds.
evaluate
is called to perform the calculations.
1 2 3 |
x |
an object of class |
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 |
modParam |
data frame with the parameters of the model to be evaluated |
modRow |
the row of the model in the |
modRank |
the rank of the model after sorting by |
by |
character. must be a metric available in the |
decreasing |
only when |
verbose |
|
... |
arguments passed to |
By defalut, only the final model is evaluated when allModels
is FALSE
and non of the arguments modParam
,modRow
, or modRank
given.
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.