R/mod_model_tree_utils.R

Defines functions tree_rules tree_plot

tree_plot <- function(modelo, n) {
  prp(modelo, type = 2, extra = 104, nn = T, varlen = 0, faclen = 0,
      fallen.leaves = TRUE, branch.lty = 6, shadow.col = 'gray82',
      box.col = gg_color_hue(n)[modelo$frame$yval], roundint = FALSE)
}

tree_rules <- function(modelo, varpred) {
  rpart.plot::rpart.rules(
    modelo, cover = TRUE, nn = TRUE, roundint = FALSE, style = "tall",
    digits = 3, response.name = paste0("Rule Number - ", varpred))
}

Try the predictoR package in your browser

Any scripts or data that you put into this service are public.

predictoR documentation built on Nov. 1, 2024, 1:08 a.m.