Skip to contents

Models are created with 10-fold CV 3 x repeated in caret (see also the source section of this documentation). The output is saved as .rda file. This is to prevent the necessity of including the caret package as an additional dependency to the datscience package

Usage

data(models)

Format

An object of class "list";

Source

# Create Example Classifiers in the Iris Dataset
set.seed(7)
data(iris)
# Settings for the Cross-Validation
control <- caret::trainControl(method="repeatedcv", number=10, repeats=3, summaryFunction = caret::multiClassSummary)
# Train Decision Tree
decision_tree <- caret::train(Species~., data=iris, method="rpart",
trControl=control, tuneLength=5)
# Train k-Nearest Neighbors
knn <- caret::train(Species~., data=iris, method="knn", trControl=control, tuneLength=5)

# Create a list of objects
models <- list("Decision Tree" = decision_tree$resample, "KNN" = knn$resample)

Examples

data(models)
flex_resample_metrics(models, table_caption = NA)
#> a flextable object.
#> col_keys: `Algorithm`, `Tune`, `Accuracy`, `Kappa`, `Mean Bal. Acc.`, `Mean Sens.`, `Mean Spec.` 
#> header has 1 row(s) 
#> body has 6 row(s) 
#> original dataset sample: 
#>       Algorithm Tune Accuracy Kappa Mean Bal. Acc. Mean Sens. Mean Spec.
#> 1 Decision Tree  min    0.800 0.700          0.850      0.800      0.900
#> 2 Decision Tree mean    0.933 0.900          0.950      0.933      0.967
#> 3 Decision Tree  max    1.000 1.000          1.000      1.000      1.000
#> 4           KNN  min    0.867 0.800          0.900      0.867      0.933
#> 5           KNN mean    0.978 0.967          0.983      0.978      0.989