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 cuda.ml package in your browser

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

cuda.ml documentation built on Jan. 8, 2022, 9:06 a.m.