hyperparameters <- setup_CART(cp = tune_over(0.001, 0.01, 0.05), maxdepth = tune_over(2L, 4L))
tuning_grid(hyperparameters) cp maxdepth
1 0.001 2
2 0.010 2
3 0.050 2
4 0.001 4
5 0.010 4
6 0.050 4
Tuning selects a configuration using inner resampling. The tuner_config argument to train() specifies the selection procedure. Outer resampling or an independent test set assesses the selected procedure.
tune_over() explicitly marks candidate values. A bare vector retains its meaning as one value; a scalar property rejects a vector of alternatives.
cp maxdepth
1 0.001 2
2 0.010 2
3 0.050 2
4 0.001 4
5 0.010 4
6 0.050 4
tuning_grid() returns the combinations the search considers. Applicability rules remove irrelevant settings and duplicate combinations.
Pass a configuration from setup_GridSearch() as tuner_config to train(). Its arguments control the selection procedure:
| Argument | Purpose |
|---|---|
resampler_config |
Internal resampling method and its settings, including fold count, repetitions, and seed where applicable. |
search_type |
Exhaustive evaluation or randomized sampling of candidate combinations. |
randomize_p |
Proportion of combinations evaluated in a randomized search. |
metric |
Performance metric used to compare candidates. |
maximize |
Whether selection maximizes or minimizes the metric. |
metrics_aggregate_fn |
Function used to aggregate the metric across resamples. |
For example, resampler_config = setup_KFold(n_resamples = 5L) requests 5-fold cross-validation. Other resampling designs and their controls are introduced in partitions and resampling.
2026-10-08 03:42:39 Checking data is ready for training... ✔ [check_supervised]
2026-10-08 03:42:39 ▶ [train]
2026-10-08 03:42:39 Training set: 150 cases x 4 features. [summarize_supervised]
2026-10-08 03:42:39 Tuning parallelization enabled. [get_n_workers]
2026-10-08 03:42:39 // CPU | serial | 1 worker: algorithm 1 thread, tuning 1, outer resampling 1 [msg_resources]
2026-10-08 03:42:39 Shared memory (auto): not sharing training data (7.3 kB) -- this run transfers nothing to workers. [report_shared_memory]
2026-10-08 03:42:39 <> Training CART Classification using 3 independent folds... [train]
2026-10-08 03:42:39 <> Tuning CART by exhaustive grid search with 3 independent folds... [tuning_intro]
2026-10-08 03:42:39 6 parameter combinations x 3 resamples: 18 models total (aarch64-apple-darwin23). [tuning_intro]
⠋ Outer resamples 1/3
⠙ Outer resamples 1/3 › Tuning 1/18
⠹ Outer resamples 1/3 › Tuning 2/18 ETA 0:04
⠸ Outer resamples 1/3 › Tuning 6/18 ETA 0:01
⠼ Outer resamples 1/3 › Tuning 10/18 ETA 0:00
⠴ Outer resamples 1/3 › Tuning 14/18 ETA 0:00
⠦ Outer resamples 1/3 › Tuning 18/18 ETA 0:00
⠧ Outer resamples 1/3 › Tuning 18/18
⠇ Outer resamples 1/3
⠏ Outer resamples 2/3 › Tuning 1/18
⠋ Outer resamples 2/3 › Tuning 5/18 ETA 0:00
⠙ Outer resamples 2/3 › Tuning 9/18 ETA 0:00
⠹ Outer resamples 2/3 › Tuning 13/18 ETA 0:00
⠸ Outer resamples 2/3 › Tuning 17/18 ETA 0:00
⠼ Outer resamples 2/3 › Tuning 18/18
⠴ Outer resamples 2/3 ETA 0:03
⠦ Outer resamples 3/3 › Tuning 1/18
⠧ Outer resamples 3/3 › Tuning 5/18 ETA 0:00
⠇ Outer resamples 3/3 › Tuning 9/18 ETA 0:00
⠏ Outer resamples 3/3 › Tuning 13/18 ETA 0:00
⠋ Outer resamples 3/3 › Tuning 17/18 ETA 0:00
⠙ Outer resamples 3/3 › Tuning 18/18
⠹ Outer resamples 3/3 ETA 0:01
⠸ Outer resamples 3/3
2026-10-08 03:42:41 ✔ Outer resamples 3/3 × Tuning 18/18 done in 0:02
2026-10-08 03:42:41 </> Outer resampling done. [train]
<Resampled Classification Model>
CART (CART decision tree (rpart))
⚙ Tuned using exhaustive grid search.
⟳ Tested using 3 independent folds.
<Resampled Classification Training Metrics>
Aggregate Confusion Matrix across resamples.
Predicted
Reference setosa versicolor virginica
setosa 100 0 0
versicolor 0 97 3
virginica 0 1 99
Showing mean (sd) across resamples.
Balanced Accuracy: 0.987 (0.015)
F1: 0.987 (0.015)
Accuracy: 0.987 (0.015)
<Resampled Classification Test Metrics>
Aggregate Confusion Matrix across resamples.
Predicted
Reference setosa versicolor virginica
setosa 50 0 0
versicolor 0 43 7
virginica 0 3 47
Showing mean (sd) across resamples.
Balanced Accuracy: 0.933 (0.010)
F1: 0.933 (0.010)
Accuracy: 0.933 (0.010)
2026-10-08 03:42:41 Done in 2.54 seconds. [train]
<SupervisedReview>
CART decision tree (rpart) was used for classification. Hyperparameter tuning was performed using exhaustive grid search. Mean balanced accuracy was 0.99 in the training set and 0.93 in the test set across 3 independent folds.
3 resamples: 150 out-of-sample predictions of 150 cases, at least 99 training cases per resample; 4 predictors (8.2 minority-class training cases per predictor).
Performance, mean (SD) over 3 resamples
Training Test Training - test
Balanced Accuracy 0.987 (0.015) 0.933 (0.010) 0.053
F1 0.987 (0.015) 0.933 (0.010) 0.053
Accuracy 0.987 (0.015) 0.933 (0.010) 0.053
Baseline comparisons, mean over resamples
Accuracy 0.933 vs 0.333 (most common training class); better in 3 of 3 resamples compared
Balanced Accuracy 0.933 vs 0.333 (chance level); better in 3 of 3 resamples compared
Tuning
cp: searched 0.001 to 0.05 (3 values), 3 of 3 resamples at an extendable edge
Findings
* FOLD_VARIATION (note): Test balanced accuracy ranged from 0.922 to 0.941 across 3 resamples (mean 0.933, SD 0.010); 3 of 3 resamples in which the metric is defined outperformed their baseline. Resamples share training cases, so their results are not independent, and no confidence interval or test is computed from them.
* FEW_CASES_PER_PREDICTOR (note): There are 8.250 minority-class training cases per learner column (4 columns), fewer than 10. This is a rule of thumb from logistic regression (events per variable), not a validated sample-size requirement for every algorithm.
Suggestion: Judge the model by held-out performance. Consider a regularized or sparse algorithm, or a decomposition step in train(), which is fitted on training cases only.
* PRESELECTION_RISK (note): With few cases per predictor, predictors are often selected before modeling. Selection or filtering of predictors done on all the data before it was passed to train() biases evaluation; this review cannot determine whether that happened. Preprocessing, decomposition and tuning within train() use training cases only.
Suggestion: Avoid selecting predictors on all the data before train(). To reduce the predictors, use a sparse algorithm or a decomposition step in train(); any selection done outside rtemis must use only the training cases of each split.
* TUNING_GRID_EDGE (note): 3 of 3 resamples selected cp at the edge of the values searched (0.001 to 0.050); the best value may lie beyond it.
Suggestion: Extend the search range of cp past that edge.
Limitations
- Whether the model is useful depends on the question it addresses, the costs of different errors, and how its predictions will be used; performance metrics cannot establish this.
- Preprocessing, decomposition and tuning done by rtemis are fitted on the training cases of each split and only applied to its test cases. Steps taken before the data was passed to rtemis -- selecting or filtering predictors, transforming or removing cases using all the data, or choosing among models by their test performance -- can bias evaluation; this review cannot determine whether that happened.
- Performance estimates apply to cases from the population the data was drawn from; performance on a different population or setting may differ.
Each outer training set undergoes its own inner search. The selected configuration is refitted on that outer training set and assessed on its held-out fold. The tuner controls the selection metric, its direction, and aggregation across inner resamples.
setup_GridSearch(search_type = "randomized", randomize_p = ...) samples a proportion of the grid. Search size, inner resampling, outer resampling, and learner complexity jointly determine computational cost.
A named list represents alternative configurations of the same algorithm. Each entry can carry its own candidate values.
$shallow
cp
1 0.01
2 0.05
$deeper
cp
1 0.001
2 0.010
Pass this list as hyperparameters to train(). The selected fitted configuration records its variant.
2026-10-08 03:42:43 Checking data is ready for training... ✔ [check_supervised]
2026-10-08 03:42:43 ▶ [train]
2026-10-08 03:42:43 Training set: 150 cases x 4 features. [summarize_supervised]
2026-10-08 03:42:43 // CPU | serial | 1 worker: algorithm 1 thread, tuning 1, outer resampling 1 [msg_resources]
2026-10-08 03:42:43 Shared memory (auto): not sharing training data (7.3 kB) -- this run transfers nothing to workers. [report_shared_memory]
2026-10-08 03:42:43 <> Tuning CART by exhaustive grid search with 3 independent folds... [tuning_intro]
2026-10-08 03:42:43 2 variants, 4 parameter combinations x 3 resamples: 12 models total (aarch64-apple-darwin23). [tuning_intro]
⠼ Tuning 1/12
⠴ Tuning 5/12 ETA 0:00
⠦ Tuning 9/12 ETA 0:00
⠧ Tuning 12/12
2026-10-08 03:42:43 ✔ Tuning 12/12 done in 0:00
2026-10-08 03:42:43 Best config to maximize balanced_accuracy (deeper): [tune_GridSearch]
cp: {0.001, 0.01} => 0.001
2026-10-08 03:42:43 </> Tuning done. [tune_GridSearch]
2026-10-08 03:42:43 Training CART Classification with tuned hyperparameters... [train]
2026-10-08 03:42:43 Checking data is ready for training... ✔ [check_supervised]
<Classification>
CART (CART decision tree (rpart))
⚙ Tuned using exhaustive grid search.
<Training Classification Metrics>
Predicted
Reference setosa versicolor virginica
setosa 50 0 0
versicolor 0 50 0
virginica 0 0 50
Overall
Balanced Accuracy 1.000
F1 1.000
Accuracy 1.000
Setosa Versicolor Virginica
Sensitivity 1.000 1.000 1.000
Specificity 1.000 1.000 1.000
Balanced Accuracy 1.000 1.000 1.000
PPV 1.000 1.000 1.000
NPV 1.000 1.000 1.000
F1 1.000 1.000 1.000
2026-10-08 03:42:43 Done in 0.51 seconds. [train]
[1] "deeper"
A run record retains selection results for each fitted outer fold.
Selection at the edge of a search range is reported by review(). Expanding the search uses training information; repeated selection by held-out test performance also uses that test set for model selection.
Vector-valued settings can also be candidates. For example, setup_MLP(hidden_units = tune_over(c(16L, 8L), c(32L, 16L))) searches over two complete network architectures. Serialized search spaces use a candidates object; named configuration alternatives use a variants map.