R/train_it.R

Defines functions train_it

Documented in train_it

#' @title
#' Generate Prediction Model
#'
#' @description
#' Function to develop prediction model based on user's preferences.
#'
#' @param target A vector of target data.
#' @param input A vector, matrix, or dataframe of input data.
#' @param sl_lib_internal The internal library to be used by SuperLearner
#' @param ... Model related parameters should be provided.
#'
#' @return
#' prediction model
#'
#' @keywords internal
#'
train_it <- function(target,
                     input,
                     sl_lib_internal = NULL,
                     ...) {

  # Passing packaging check() ----------------------------
  sl_lib <- NULL
  # ------------------------------------------------------

  dot_args <- list(...)
  arg_names <- names(dot_args)

  for (i in arg_names){
    assign(i, unlist(dot_args[i], use.names = FALSE))
  }

  platform_os <- .Platform$OS.type

  pr_mdl <- SuperLearner::SuperLearner(Y = target,
                                       X = data.frame(input),
                                       SL.library = sl_lib_internal)
  return(pr_mdl)
}

Try the CausalGPS package in your browser

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

CausalGPS documentation built on Sept. 30, 2023, 1:06 a.m.