Convenience wrapper: returns the 2x2 integer training confusion matrix for a
binary oda_cta_fit result directly, without the intermediate
tidy long-format step required by cta_confusion_table and
as_confusion_matrix.
Arguments
- tree
A
cta_treefromoda_cta_fit.
Details
Rows are actual class (0/1), columns are predicted class (0/1).
Returns NULL invisibly when tree$no_tree is TRUE.
Examples
data(mtcars)
X <- mtcars[, c("cyl", "disp", "hp", "wt")]
y <- as.integer(mtcars$am)
tree <- oda_cta_fit(X, y, mindenom = 5L, mc_iter = 500L, mc_seed = 42L)
if (!isTRUE(tree$no_tree)) cta_confusion_matrix(tree)
#> predicted
#> actual 0 1
#> 0 17 2
#> 1 1 12