Skip to contents

Describe object

Usage

describe(x, verbosity = 1L, ...)

Arguments

x

R object to describe. See method documentation for supported classes.

verbosity

Integer: Verbosity level.

...

Additional arguments passed to methods.

Value

Character, invisibly.

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.

Author

EDG

Examples

# --- For `Supervised` objects ---
species_cart <- train(iris, hyperparameters = setup_CART())
#> 2026-10-20 09:07:42 
#> Checking data is ready for training...
#>  
#> ✔ 
#> [check_supervised]
#> 2026-10-20 09:07:42 
#> ▶
#>  [train]
#> 2026-10-20 09:07:42 
#> Training set: 150 cases x 4 features.
#>  [summarize_supervised]
#> 2026-10-20 09:07:42 
#> // CPU | future (mirai_multisession) | 7 workers: algorithm 1 thread, tuning 1, outer resampling 1
#>  [msg_resources]
#> 2026-10-20 09:07:42 
#> Shared memory (auto): not sharing training data (7.3 kB) -- this run transfers nothing to workers.
#>  [report_shared_memory]
#> 2026-10-20 09:07:42 
#> Training CART Classification...
#>  [train]
#> 2026-10-20 09:07:42 
#> Checking data is ready for training...
#>  
#> ✔ 
#> [check_supervised]
#> 
#> <Classification>
#> CART (CART decision tree (rpart))
#> 
#>   <Training Classification Metrics>
#>                      Predicted
#>           Reference  setosa  versicolor  virginica  
#>              setosa      50           0          0
#>          versicolor       0          47          3
#>           virginica       0           1         49
#> 
#>                      Overall  
#>   Balanced Accuracy  0.973  
#>                  F1  0.973  
#>            Accuracy  0.973  
#>                      Setosa  Versicolor  Virginica  
#>         Sensitivity  1.000   0.940       0.980    
#>         Specificity  1.000   0.990       0.970    
#>   Balanced Accuracy  1.000   0.965       0.975    
#>                 PPV  1.000   0.979       0.942    
#>                 NPV  1.000   0.971       0.990    
#>                  F1  1.000   0.959       0.961    
#> 
#> 2026-10-20 09:07:42 
#> Done in 0.03 seconds.
#>  [train]
describe(species_cart)
#> CART decision tree (rpart) was used for classification. Balanced accuracy was 0.97 in the training set. 

# --- For `SupervisedRes` objects ---
mod <- train(
  iris,
  hyperparameters = setup_CART(),
  outer_resampling_config = setup_KFold(n_resamples = 3L)
)
#> 2026-10-20 09:07:42 
#> Checking data is ready for training...
#>  
#> ✔ 
#> [check_supervised]
#> 2026-10-20 09:07:42 
#> ▶
#>  [train]
#> 2026-10-20 09:07:42 
#> Training set: 150 cases x 4 features.
#>  [summarize_supervised]
#> 2026-10-20 09:07:42 
#> // CPU | future (mirai_multisession) | 7 workers: algorithm 1 thread, tuning 1, outer resampling 7
#>  [msg_resources]
#> 2026-10-20 09:07:42 
#> Started 7 workers (future) for this run.
#>  [worker_pool_start]
#> 2026-10-20 09:07:42 
#> Shared memory (auto): training data (7.3 kB) shared across 7 workers.
#>  [report_shared_memory]
#> 2026-10-20 09:07:42 
#> <> Training CART Classification using 3 independent folds...
#>  [train]
#> 2026-10-20 09:07:42 
#> Dispatching 3 tasks to 7 workers (future).
#>  [execute]
#> 2026-10-20 09:07:42 
#> Outer resamples started (total: 3)
#> 
#> 2026-10-20 09:07:44 
#> ✔ Outer resamples 3/3 done in 0:02
#> 
#> 2026-10-20 09:07:44 
#> </> Outer resampling done.
#>  [train]
#> 
#> <Resampled Classification Model>
#> CART (CART decision tree (rpart))
#> ⟳ 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          98          2
#>           virginica       0           2         98
#> 
#>   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          46          4
#>           virginica       0           5         45
#> 
#>   Showing mean (sd) across resamples.
#>   Balanced Accuracy: 0.940 (2.1e-03)
#>                  F1: 0.940 (2e-03)
#>            Accuracy: 0.940 (2.1e-03)
#> 
#> 2026-10-20 09:07:44 
#> Done in 2.52 seconds.
#>  [train]
describe(mod)
#> CART decision tree (rpart) was used for classification. Mean balanced accuracy was 0.99 in the training set and 0.94 in the test set across 3 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) i: 52; h: 51; n: 46; u: 46; w: 46"
describe(x, 3)
#> [1] "(Top 5 of 26) i: 52; h: 51; n: 46; u: 46; w: 46"
describe(x, 3, return_ordered = FALSE)
#> [1] "(First 5 of 26) a: 37; b: 41; c: 31; d: 32; e: 32"