#' General Interface for Mixture Models
#'
#' @param mode A single character string for the type of model.
#' The only possible value for this model is "regression".
#' @param components The number of components of the mixture model.
#'
#' @export
#'
#' @examples
#' data(faithful)
#' \dontrun{
#' mixture_model(components = 2) %>%
#' set_engine("flexmix") %>%
#' fit(eruptions ~ waiting, data = faithful, engine = "flexmix") %>%
#' predict(new_data = faithful, type = "numeric")
#' }
mixture_model <- function(mode = "regression", components = NULL) {
# Check for correct mode
if (mode != "regression") {
stop("`mode` should be 'regression'", call. = FALSE)
}
# Capture the arguments in quosures
args <- list(components = rlang::enquo(components))
# Save some empty slots for future parts of the specification
out <- list(args = args, eng_args = NULL,
mode = mode, method = NULL, engine = NULL)
# set classes in the correct order
class(out) <- parsnip::make_classes("mixture_model")
out
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.