global_validation: Evaluate 'global' cross-validation

View source: R/global_validation.R

global_validationR Documentation

Evaluate 'global' cross-validation

Description

Calculate validation metric using all held back predictions at once

Usage

global_validation(model)

Arguments

model

an object of class train

Details

Relevant when folds are not representative for the entire area of interest. In this case, metrics like R2 are not meaningful since it doesn't reflect the general ability of the model to explain the entire gradient of the response. Comparable to LOOCV, predictions from all held back folds are used here together to calculate validation statistics.

Value

regression (postResample) or classification (confusionMatrix) statistics

Author(s)

Hanna Meyer

See Also

CreateSpacetimeFolds

Examples

## Not run: 
library(caret)
data(cookfarm)
dat <- cookfarm[sample(1:nrow(cookfarm),500),]
indices <- CreateSpacetimeFolds(dat,"SOURCEID","Date")
ctrl <- caret::trainControl(method="cv",index = indices$index,savePredictions="final")
model <- caret::train(dat[,c("DEM","TWI","BLD")],dat$VW, method="rf", trControl=ctrl, ntree=10)
global_validation(model)

## End(Not run)

CAST documentation built on June 22, 2024, 10:47 a.m.