Learn R Programming

RStoolbox (version 0.1.10)

getValidation: Extract validation results from superClass objects

Description

Extract validation results from superClass objects

Usage

getValidation(x, from = "testset", metrics = "overall")

Arguments

x

superClass object or caret::confusionMatrix

from

Character. 'testset' extracts the results from independent validation with testset. 'cv' extracts cross-validation results.

metrics

Character. Only relevant in classification mode (ignored for regression models). Select 'overall' for overall accuracy metrics, 'classwise' for classwise metrics, 'confmat' for the confusion matrix itself and 'caret' to return the whole caret::confusionMatrix object.

Value

Returns a data.frame with validation results. If metrics = 'confmat' or 'caret' will return a table or the full caret::confusionMatrix object, respectively.

Examples

Run this code
# NOT RUN {
library(pls)
## Fit classifier (splitting training into 70\% training data, 30\% validation data)
train <- readRDS(system.file("external/trainingPoints.rds", package="RStoolbox"))
SC   <- superClass(rlogo, trainData = train, responseCol = "class", 
                    model="pls", trainPartition = 0.7)
## Independent testset-validation
getValidation(SC)
getValidation(SC, metrics = "classwise")
## Cross-validation based 
getValidation(SC, from = "cv")
# }

Run the code above in your browser using DataLab