R/decision_tree.R

Defines functions decision_tree_match_split_criterion

decision_tree_match_split_criterion <- function(criterion = c("gini", "entropy", "mse", "mae"),
                                                classification = TRUE) {
  criterion <- criterion %||% ifelse(classification, "gini", "mse")
  criterion <- match.arg(criterion)

  if (classification && criterion %in% c("mse", "mae")) {
    stop("'", criterion, "' is not a valid criterion for classification.")
  }

  switch(criterion,
    gini = 0L,
    entropy = 1L,
    mse = 2L,
    mae = 3L
  )
}

Try the cuml package in your browser

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

cuml documentation built on Sept. 21, 2021, 1:06 a.m.