CART tree via rpart::rpart, returning the root split structure
and feature importances.
Value
Named list: estimate, train_accuracy, root_feature, root_threshold, root_impurity, n_leaves, feature_importances, criterion, n, method.
Examples
if (requireNamespace("rpart", quietly = TRUE)) {
set.seed(1)
x <- matrix(rnorm(120), 60, 2)
y <- factor(ifelse(x[, 1] > 0, "pos", "neg"))
morie_decision_tree_split(x, y)
}
#> $estimate
#> [1] 1
#>
#> $train_accuracy
#> [1] 1
#>
#> $root_feature
#> [1] 0
#>
#> $root_threshold
#> [1] 0.02918736
#>
#> $root_impurity
#> [1] 0.4994444
#>
#> $n_leaves
#> [1] 2
#>
#> $feature_importances
#> [1] 0.8787879 0.1212121
#>
#> $criterion
#> [1] "gini"
#>
#> $n
#> [1] 60
#>
#> $method
#> [1] "Decision tree (CART, gini)"
#>
