View source: R/getValidation.R
getValidation | R Documentation |
Extract validation results from superClass objects
getValidation(x, from = "testset", metrics = "overall")
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. |
Returns a data.frame with validation results. If metrics = 'confmat' or 'caret' will return a table or the full caret::confusionMatrix object, respectively.
library(pls)
## Fit classifier (splitting training into 70\% training data, 30\% validation data)
train <- readRDS(system.file("external/trainingPoints_rlogo.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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.