diff --git a/DESCRIPTION b/DESCRIPTION index 9ea7ec70..81bd5ef0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: rtemis Version: 0.98.0 Title: Machine Learning and Visualization -Date: 2024-09-30 +Date: 2024-10-08 Authors@R: person(given = "E.D.", family = "Gennatas", role = c("aut", "cre"), email = "gennatas@gmail.com", comment = c(ORCID = "0000-0001-9280-3609")) Description: Advanced Machine Learning and Visualization. Unsupervised Learning (Clustering, Decomposition), Supervised Learning (Classification, Regression), Cross-Decomposition, Bagging, Boosting, Meta-models. Static and interactive graphics. License: GPL (>= 3) diff --git a/NAMESPACE b/NAMESPACE index 05796514..3f4e2fe3 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -77,7 +77,6 @@ export(as.data.tree.rpart) export(auc) export(auc_pairs) export(bacc) -export(bag) export(betas.lihad) export(bias_variance) export(binmat2vec) @@ -306,6 +305,7 @@ export(prune.addtree) export(psd) export(qstat) export(read) +export(read_config) export(recycle) export(relu) export(resample) diff --git a/R/msg.R b/R/msg.R index 18eddd8d..3fc35e56 100644 --- a/R/msg.R +++ b/R/msg.R @@ -248,7 +248,7 @@ msg2 <- function(..., } cat(paste(txt, collapse = sep)) if (!is.null(caller) && !is.na(caller)) { - cat(gray(" [", caller, "]\n", sep = ""), sep = "") + cat(gray(" :", caller, "\n", sep = ""), sep = "") } else if (newline) { cat("\n") } @@ -287,14 +287,12 @@ msg20 <- function(..., } txt <- Filter(Negate(is.null), list(...)) - # .dt <- if (date) paste0(as.character(Sys.time())) else NULL .dt <- format(Sys.time(), "%m-%d-%y %H:%M:%S") if (newline.pre) cat("\n") cat(gray(paste0(.dt, gray(" ")))) cat(paste(txt, collapse = sep)) - # cat(gray(" [", caller, "]\n", sep = ""), sep = "") if (!is.null(caller) && !is.na(caller)) { - cat(gray(" [", caller, "]\n", sep = ""), sep = "") + cat(gray(" :", caller, "\n", sep = ""), sep = "") } else if (newline) { cat("\n") } diff --git a/R/resample.R b/R/resample.R index 1f7dba4f..0616ff7e 100644 --- a/R/resample.R +++ b/R/resample.R @@ -52,7 +52,7 @@ #' res <- resample(y, 25, "strat.sub") #' # 100 stratified bootstraps #' res <- resample(y, 100, "strat.boot") -#' + resample <- function(y, n.resamples = 10, resampler = c("strat.sub", "strat.boot", "kfold", diff --git a/R/s_LightGBM.R b/R/s_LightGBM.R index 9e0ade4f..8abe1ea4 100644 --- a/R/s_LightGBM.R +++ b/R/s_LightGBM.R @@ -443,7 +443,7 @@ s_LightGBM <- function(x, y = NULL, rt } # rtemis::s_LightGBM -#' Random Forest with LightGBM +#' Random Forest using LightGBM #' #' @inheritParams s_LightGBM #' @param nrounds Integer: Number of trees to grow diff --git a/R/setup.R b/R/setup.R index feb3188b..9915f60d 100644 --- a/R/setup.R +++ b/R/setup.R @@ -14,12 +14,11 @@ NULL #' Set [resample] settings #' -#' #' @inheritParams resample #' @export setup.resample <- function( - resampler = "strat.sub", + resampler = c("strat.sub", "strat.boot", "kfold", "bootstrap", "loocv"), n.resamples = 10, stratify.var = NULL, train.p = .8, @@ -28,7 +27,7 @@ setup.resample <- function( id.strat = NULL, seed = NULL) { list( - resampler = resampler, + resampler = match.arg(resampler), n.resamples = n.resamples, stratify.var = stratify.var, train.p = train.p, diff --git a/R/type_check.R b/R/type_check.R index 3e87521e..a723527b 100644 --- a/R/type_check.R +++ b/R/type_check.R @@ -89,11 +89,11 @@ inherits_check <- function(x, cl) { #' Function that returns object if it is of a certain class -#' +#' #' @param object Object to check and return #' @param class Character vector: class(es) to check against #' @param allow_null Logical: if TRUE, allows NULL objects -#' +#' #' @return Object #' @author EDG #' @keywords internal @@ -102,6 +102,7 @@ inherits_check <- function(x, cl) { #' strict("papaya", "character") # "papaya" #' strict(c(1, 2.5, 3.2), "integer") # Error #' strict(iris, "list") # Error +#' } strict <- function(object, class, allow_null = TRUE) { if (allow_null && is.null(object)) { return(NULL) diff --git a/man/massGAM.Rd b/man/massGAM.Rd index 5b0f02b7..acc7e8e6 100644 --- a/man/massGAM.Rd +++ b/man/massGAM.Rd @@ -24,6 +24,8 @@ massGAM( ) } \arguments{ +\item{x}{Numeric vector or matrix / data frame of features i.e. independent variables} + \item{y}{Numeric matrix / data frame: Outcomes} \item{covariates}{Numeric matrix / data.frame of additional covariates} diff --git a/man/resample.Rd b/man/resample.Rd index 0020a55d..38bd8de3 100644 --- a/man/resample.Rd +++ b/man/resample.Rd @@ -80,7 +80,6 @@ res <- resample(y, 10, "kfold") res <- resample(y, 25, "strat.sub") # 100 stratified bootstraps res <- resample(y, 100, "strat.boot") - } \seealso{ \link{train_cv} diff --git a/man/strict.Rd b/man/strict.Rd index 7697af1d..eea263f1 100644 --- a/man/strict.Rd +++ b/man/strict.Rd @@ -29,6 +29,13 @@ Object \description{ Allow assignment only if input is of correct class and/or type } +\examples{ +\dontrun{ +strict("papaya", "character") # "papaya" +strict(c(1, 2.5, 3.2), "integer") # Error +strict(iris, "list") # Error +} +} \author{ E.D. Gennatas