R/dal_tune.R

Defines functions select_hyper.default select_hyper dal_tune

Documented in dal_tune select_hyper

#'@title DAL Tune
#'@description Ancestor class for hyper parameter optimization
#'@param base_model base model for tuning
#'@param folds number of folds for cross-validation
#'@return a `dal_tune` object.
#'@examples
#'#See ?cla_tune for classification tuning
#'#See ?reg_tune for regression tuning
#'#See ?ts_tune for time series tuning
#'@export
dal_tune <- function(base_model, folds=10) {
  obj <- dal_base()
  obj$base_model <- base_model
  obj$folds <- folds
  class(obj) <- append("dal_tune", class(obj))
  return(obj)
}

#'@title Selection hyper parameters
#'@description Selection hyper parameters from a k-fold cross-validation execution
#'@param obj object
#'@param hyperparameters data set with hyper parameters and quality measure from execution
#'@return index of selected hyper parameter
#'@export
select_hyper <- function(obj, hyperparameters) {
  UseMethod("select_hyper")
}

#'@export
select_hyper.default <- function(obj, hyperparameters) {
  return(length(hyperparameters))
}

Try the daltoolbox package in your browser

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

daltoolbox documentation built on May 29, 2024, 1:57 a.m.