R/batchLoad.R

Defines functions Models.batchLoad

Documented in Models.batchLoad

#' @title Load the Models Generated by \code{\link{regressoR.batchLearn}} as
#'   \code{\link[dataManageR]{dataset}}s
#' @description Load all the setup results built by
#'   \code{\link{regressoR.batchLearn}} from a folder structure.
#' @param path the source folder
#' @param selector the selector for the files
#' @param featuresFolder the folder where to look for feature information,
#'   \code{NULL} if no feature information is needed
#' @param featuresLoader a function accepting two parameters,
#'   \code{featureFolder} and \code{components} and returning a named list of
#'   features, or \code{NULL} if no features are needed. see
#'   \code{\link[dataManageR]{datasets.feature.load.default}} for documentation
#' @param namer a function which receives a relativized path to the
#'   folder with the current model(s) and returns a name for the models
#' @param check.directory a function which can choose if a directory should be
#'   followed or not
#' @param cores the number of cores to be used for loading
#' @param logging should progress information be printed: either \code{TRUE} for
#'   printing to the console via \code{\link{print}}, \code{FALSE} for no
#'   logging, or a path to a file receiving logging information
#' @return a list of \code{\link[dataManageR]{dataset}} instances whose
#'   \code{data} elements correspond to models
#' @importFrom utilizeR path.batchApply path.extensionRegExp makeLogger
#' @importFrom regressoR regressoR.loadResult
#' @importFrom utilizeR path.relativize
#' @importFrom dataManageR datasets.batchLoad datasets.feature.load.default
#' @importClassesFrom dataManageR dataset
#' @export Models.batchLoad
Models.batchLoad <- function(path=getwd(),
                             selector=path.extensionRegExp(extensions="model", before.extension="_single"),
                             featuresFolder=file.path(path, "../features"),
                             featuresLoader=datasets.feature.load.default,
                             namer=identity,
                             check.directory=NULL,
                             cores=1L,
                             logging=(cores <= 1L)) {

  datasets.batchLoad(path=path, selector = selector, dataLoader=function(p) regressoR.loadResult(p),
                     featuresFolder = featuresFolder, featuresLoader = featuresLoader,
                     namer = namer, check.directory = check.directory,
                     cores=cores, logging=logging);
}
thomasWeise/processMineR.models documentation built on May 23, 2019, 9:31 a.m.