R/decision_tree.R

Defines functions match_split_criterion

match_split_criterion <- function(criterion = c("gini", "entropy", "mse", "mae"), mode = "classification") {
  criterion <- match.arg(criterion)

  if (identical(mode, "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 cuml4r package in your browser

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

cuml4r documentation built on July 26, 2021, 9:06 a.m.