Describe object
Details
Extra arguments for factor method:
max_n: Integer: Return counts for up to this many levels.return_ordered: Logical: If TRUE, return levels ordered by count, otherwise return in level order.verbosity: Integer: Verbosity level.
Examples
# --- For `Supervised` objects ---
species_lightrf <- train(iris, hyperparameters = setup_LightRF())
#> 2026-08-09 13:22:26
#> Checking data is ready for training...
#>
#> ✔
#> [check_supervised]
#> 2026-08-09 13:22:26
#> ▶
#> [train]
#> 2026-08-09 13:22:26
#> Training set: 150 cases x 4 features.
#> [summarize_supervised]
#> 2026-08-09 13:22:26
#> // Max workers: c(system = 7) { Algorithm: c(system = 7); Tuning: 1; Outer Resampling: 1 }
#> [get_n_workers]
#> 2026-08-09 13:22:26
#> Training LightRF Classification...
#> [train]
#> 2026-08-09 13:22:26
#> Checking data is ready for training...
#>
#> ✔
#> [check_supervised]
#> 2026-08-09 13:22:26
#> Converting 1 factor to integer...
#> [preprocess]
#> 2026-08-09 13:22:26
#> Preprocessing done.
#> [preprocess]
#>
#> <Classification>
#> LightRF (LightGBM Random Forest)
#>
#> <Training Classification Metrics>
#> Predicted
#> Reference setosa versicolor virginica
#> setosa 50 0 0
#> versicolor 1 44 5
#> virginica 0 1 49
#>
#> Overall
#> Balanced Accuracy 0.953
#> F1 0.953
#> Accuracy 0.953
#> Setosa Versicolor Virginica
#> Sensitivity 1.000 0.880 0.980
#> Specificity 0.990 0.990 0.950
#> Balanced Accuracy 0.995 0.935 0.965
#> Ppv 0.980 0.978 0.907
#> Npv 1.000 0.943 0.990
#> F1 0.990 0.926 0.942
#>
#> 2026-08-09 13:22:26
#> Done in 0.86 seconds.
#> [train]
describe(species_lightrf)
#> LightGBM Random Forest was used for classification. Balanced accuracy was 0.95 in the training set.
# --- For `SupervisedRes` objects ---
mod <- train(iris, hyperparameters = setup_CART(), outer_resampling_config = setup_Resampler())
#> 2026-08-09 13:22:26
#> Checking data is ready for training...
#>
#> ✔
#> [check_supervised]
#> 2026-08-09 13:22:26
#> ▶
#> [train]
#> 2026-08-09 13:22:26
#> Training set: 150 cases x 4 features.
#> [summarize_supervised]
#> 2026-08-09 13:22:26
#> // Max workers: c(system = 7) { Algorithm: 1; Tuning: 1; Outer Resampling: c(system = 7) }
#> [get_n_workers]
#> 2026-08-09 13:22:26
#> <> Training CART Classification using 10 independent folds...
#> [train]
#> 2026-08-09 13:22:26
#> Using max n bins possible = 3.
#> [kfold]
#> 2026-08-09 13:22:26
#> Outer resamples started (total: 10)
#>
#> 2026-08-09 13:22:27
#> ✔ Outer resamples 10/10 done in 0:01
#>
#> 2026-08-09 13:22:27
#> </> Outer resampling done.
#> [train]
#>
#> <Resampled Classification Model>
#> CART (Classification and Regression Trees)
#> ⟳ Tested using 10 independent folds.
#>
#> <Resampled Classification Training Metrics>
#> Aggregate Confusion Matrix across resamples.
#> Predicted
#> Reference setosa versicolor virginica
#> setosa 450 0 0
#> versicolor 0 439 11
#> virginica 0 3 447
#>
#> Showing mean (sd) across resamples.
#> Balanced Accuracy: 0.990 (0.006)
#> F1: 0.990 (0.006)
#> Accuracy: 0.990 (0.006)
#>
#> <Resampled Classification Test Metrics>
#> Aggregate Confusion Matrix across resamples.
#> Predicted
#> Reference setosa versicolor virginica
#> setosa 50 0 0
#> versicolor 0 45 5
#> virginica 0 6 44
#>
#> Showing mean (sd) across resamples.
#> Balanced Accuracy: 0.927 (0.066)
#> F1: 0.925 (0.068)
#> Accuracy: 0.927 (0.066)
#>
#> 2026-08-09 13:22:27
#> Done in 0.65 seconds.
#> [train]
describe(mod)
#> Classification and Regression Trees was used for classification. Mean balanced accuracy was 0.99 in the training set and 0.93 in the test set across 10 independent folds.
# --- For factors ---
# Small number of levels
describe(iris[["Species"]])
#> [1] "setosa: 50; versicolor: 50; virginica: 50"
# Large number of levels: show top n by count
x <- factor(sample(letters, 1000, TRUE))
describe(x)
#> [1] "(Top 5 of 26) p: 51; e: 50; h: 46; z: 45; i: 44"
describe(x, 3)
#> [1] "(Top 5 of 26) p: 51; e: 50; h: 46; z: 45; i: 44"
describe(x, 3, return_ordered = FALSE)
#> [1] "(First 5 of 26) a: 35; b: 32; c: 43; d: 33; e: 50"