cv | R Documentation |
Runs a cross validation for train and prediction function.
cv(x, y, FUN, nfolds = 5, ...)
x |
|
y |
|
FUN |
|
nfolds |
|
... |
further arguments passed to |
double(1)
median AUC across all cross validation splits
The function to optimize has to accept five arguments: xtrain, ytrain, xtest, ytest and ....
.rusranger <- function(xtrain, ytrain, xtest, ytest, ...) { rngr <- rusranger(x = xtrain, y = ytrain, ...) pred <- as.numeric(predict(rngr, xtest)$predictions[, 2L]) performance(prediction(pred, ytest), measure = "auc")@y.values[[1L]] } cv(iris[-5], as.numeric(iris$Species == "versicolor"), .rusranger, nfolds = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.