R/algorithms.R

Defines functions available_algorithms engine_glm engine_tree

Documented in available_algorithms

engine_tree = function(type) {
  return(parsnip::set_engine(parsnip::decision_tree(), "rpart"))
}

engine_glm = function(type) {
  if (type == 'regression') {
    return(parsnip::set_engine(parsnip::linear_reg(), "lm"))
  } else if (type == 'classification') {
    return(parsnip::set_engine(parsnip::logistic_reg(), "glm"))
  }
}

#' Lists all algorithms currently supported
#'
#' @return a list of all available parsnip engines
#' @export
#'
#' @examples
#' available_algorithms()
available_algorithms = function() {
  return(list(
    'tree' = engine_tree,
    'glm' = engine_glm
  ))
}

Try the ppsr package in your browser

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

ppsr documentation built on June 22, 2024, 7:15 p.m.