Skip to content
Open
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
^\.gemini$
^\.github$
^\.lintr$
^\.rtms-instructions\.md$
^\.vscode$
^cran-comments\.md$
^LICENSE\.md$
Expand All @@ -23,3 +22,4 @@
^pkgdown$
^Makefile$
^SKILL\.md$
^.*\.pdf$
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rtemis
Version: 1.2.0
Version: 1.2.1
Title: Machine Learning and Visualization
Date: 2026-05-12
Date: 2026-05-16
Authors@R: person(given = "E.D.", family = "Gennatas", role = c("aut", "cre", "cph"),
email = "gennatas@gmail.com", comment = c(ORCID = "0000-0001-9280-3609"))
Description: Machine learning and visualization package with an 'S7' backend
Expand All @@ -28,7 +28,8 @@ Imports:
data.table,
future,
htmltools,
cli
cli,
rtemis.core
Suggests:
arrow,
bit64,
Expand Down Expand Up @@ -74,7 +75,6 @@ Suggests:
parallelly,
partykit,
plotly,
plumber,
pROC,
progressr,
psych,
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ RSCRIPT ?= Rscript
CHECK_DIR := $(PKG).Rcheck
TARBALL_GLOB := $(PKG)_*.tar.gz

msg = @printf '\033[38;2;108;163;160m[%s] %s\033[0m\n' "$$(date -u '+%Y-%m-%d %H:%M:%SZ')" "$(1)"
msg = @printf '\033[38;2;108;163;160m[%s] %s\033[0m\n' "$$(date '+%Y-%m-%d %H:%M:%S')" "$(1)"

.DEFAULT_GOAL := help

Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export(get_factor_names)
export(get_mode)
export(get_msg_sink)
export(get_palette)
export(get_varimp)
export(getcharacternames)
export(getdatenames)
export(getfactornames)
Expand Down
17 changes: 17 additions & 0 deletions R/00_S7init.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ class_tabnet_fit <- new_S3_class("tabnet_fit")
repr <- new_generic("repr", "x")


# %% get_varimp ----
#' Get variable importance
#'
#' @param x `Supervised` or `SupervisedRes` object.
#' @param ... Additional arguments passed to methods.
#'
#' @return `VariableImportance` object or list of `VariableImportance` objects.
#'
#' @author EDG
#' @export
#'
#' @examples
#' mod <- train(iris, algorithm = "LightRF")
#' get_varimp(mod)
get_varimp <- new_generic("get_varimp", "x")


# %% inspect ----
#' Inspect rtemis object
#'
Expand Down
1 change: 1 addition & 0 deletions R/01_ExecutionConfig.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#' @noRd
ExecutionConfig <- new_class(
name = "ExecutionConfig",
package = "rtemis",
properties = list(
backend = class_character,
n_workers = class_integer,
Expand Down
40 changes: 21 additions & 19 deletions R/02_Hyperparameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ TUNED_STATUS_TUNED <- 1L
# 1: Running on resampled training sets.

# %% Hyperparameters ----
#' @title Hyperparameters
#' Hyperparameters
#'
#' @description
#' Superclass for hyperparameters.
Expand All @@ -41,9 +41,11 @@ TUNED_STATUS_TUNED <- 1L
#' @field n_workers Integer: Number of workers to use for tuning.
#'
#' @author EDG
#' @keywords internal
#' @noRd
Hyperparameters <- new_class(
name = "Hyperparameters",
package = "rtemis",
properties = list(
algorithm = class_character,
hyperparameters = class_list,
Expand Down Expand Up @@ -542,19 +544,19 @@ setup_CART <- function(
cost = NULL,
ifw = FALSE
) {
check_inherits(cp, "numeric")
rtemis.core::check_numeric(cp)
maxdepth <- clean_int(maxdepth)
minsplit <- clean_int(minsplit)
minbucket <- clean_int(minbucket)
check_inherits(prune_cp, "numeric")
rtemis.core::check_numeric(prune_cp)
check_inherits(method, "character")
check_inherits(model, "logical")
maxcompete <- clean_int(maxcompete)
maxsurrogate <- clean_int(maxsurrogate)
usesurrogate <- clean_int(usesurrogate)
surrogatestyle <- clean_int(surrogatestyle)
xval <- clean_int(xval)
check_inherits(cost, "numeric")
rtemis.core::check_numeric(cost)
CARTHyperparameters(
cp = cp,
maxdepth = maxdepth,
Expand Down Expand Up @@ -615,7 +617,7 @@ GLMNETHyperparameters <- new_class(
check_float01inc(alpha)
check_inherits(which_lambda_cv, "character")
nlambda <- clean_posint(nlambda)
check_inherits(penalty_factor, "numeric")
rtemis.core::check_numeric(penalty_factor)
check_inherits(standardize, "logical")
new_object(
Hyperparameters(
Expand Down Expand Up @@ -682,7 +684,7 @@ setup_GLMNET <- function(
check_float01inc(alpha)
check_inherits(which_lambda_cv, "character")
nlambda <- clean_posint(nlambda)
check_inherits(penalty_factor, "numeric")
rtemis.core::check_numeric(penalty_factor)
check_logical(standardize)
check_logical(ifw)
GLMNETHyperparameters(
Expand Down Expand Up @@ -1395,10 +1397,10 @@ setup_LightRuleFit <- function(
check_floatpos1(learning_rate)
check_floatpos1(subsample)
subsample_freq <- clean_posint(subsample_freq)
check_inherits(lambda_l1, "numeric")
check_inherits(lambda_l2, "numeric")
rtemis.core::check_numeric(lambda_l1)
rtemis.core::check_numeric(lambda_l2)
check_float01inc(alpha)
check_inherits(lambda, "numeric")
rtemis.core::check_numeric(lambda)
check_logical(ifw_lightgbm)
check_logical(ifw_glmnet)
check_logical(ifw)
Expand Down Expand Up @@ -1563,7 +1565,7 @@ setup_LinearSVM <- function(
cost = 1,
ifw = FALSE
) {
check_inherits(cost, "numeric")
rtemis.core::check_numeric(cost)
check_logical(ifw)
LinearSVMHyperparameters(
cost = cost,
Expand Down Expand Up @@ -1634,8 +1636,8 @@ setup_RadialSVM <- function(
gamma = 0.01,
ifw = FALSE
) {
check_inherits(cost, "numeric")
check_inherits(gamma, "numeric")
rtemis.core::check_numeric(cost)
rtemis.core::check_numeric(gamma)
check_logical(ifw)
RadialSVMHyperparameters(
cost = cost,
Expand Down Expand Up @@ -2170,30 +2172,30 @@ setup_Ranger <- function(
max_depth <- clean_posint(max_depth)
check_inherits(replace, "logical")
check_float01inc(sample_fraction)
check_inherits(case_weights, "numeric")
check_inherits(class_weights, "numeric")
rtemis.core::check_numeric(case_weights)
rtemis.core::check_numeric(class_weights)
check_inherits(splitrule, "character")
num_random_splits <- clean_posint(num_random_splits)
check_float01inc(alpha)
check_float01inc(minprop)
check_inherits(poisson_tau, "numeric")
check_inherits(split_select_weights, "numeric")
rtemis.core::check_numeric(poisson_tau)
rtemis.core::check_numeric(split_select_weights)
check_inherits(always_split_variables, "character")
check_inherits(respect_unordered_factors, "logical")
check_inherits(scale_permutation_importance, "logical")
check_inherits(local_importance, "logical")
check_inherits(regularization_factor, "numeric")
rtemis.core::check_numeric(regularization_factor)
check_inherits(regularization_usedepth, "logical")
check_inherits(keep_inbag, "logical")
check_inherits(inbag, "list")
check_inherits(holdout, "logical")
check_inherits(quantreg, "logical")
check_inherits(time_interest, "numeric")
rtemis.core::check_numeric(time_interest)
check_inherits(oob_error, "logical")
check_inherits(save_memory, "logical")
check_inherits(verbose, "logical")
check_inherits(node_stats, "logical")
check_inherits(seed, "numeric")
rtemis.core::check_numeric(seed)
check_inherits(na_action, "character")
check_logical(ifw)
RangerHyperparameters(
Expand Down
4 changes: 3 additions & 1 deletion R/03_Metrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# 2025- EDG rtemis.org

# %% Metrics ----
#' @title Metrics
#' Metrics
#'
#' @description
#' Superclass for Metrics metrics.
Expand All @@ -12,9 +12,11 @@
#' @field metrics List or data.frame: Metrics.
#'
#' @author EDG
#' @keywords internal
#' @noRd
Comment thread
egenn marked this conversation as resolved.
Metrics <- new_class(
name = "Metrics",
package = "rtemis",
properties = list(
sample = class_character | NULL,
metrics = class_list | class_data.frame
Expand Down
6 changes: 4 additions & 2 deletions R/04_Preprocessor.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# https://rconsortium.github.io/S7

# %% PreprocessorConfig ----
#' @title PreprocessorConfig
#' PreprocessorConfig
#'
#' @description
#' PreprocessorConfig class.
Expand All @@ -16,6 +16,7 @@
#' @noRd
PreprocessorConfig <- new_class(
name = "PreprocessorConfig",
package = "rtemis",
properties = list(
complete_cases = class_logical,
remove_features_thres = class_numeric | NULL,
Expand Down Expand Up @@ -335,7 +336,7 @@ setup_Preprocessor <- function(
# )

# %% Preprocessor ----
#' @title Preprocessor
#' Preprocessor
#'
#' @description
#' Class to hold output of preprocessing values after applying `PreprocessorConfig` to
Expand All @@ -353,6 +354,7 @@ setup_Preprocessor <- function(
#' @noRd
Preprocessor <- new_class(
name = "Preprocessor",
package = "rtemis",
properties = list(
config = PreprocessorConfig,
preprocessed = class_data.frame | class_list,
Expand Down
6 changes: 4 additions & 2 deletions R/05_Resampler.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Note: `id_strat` is used by `resample()`, not individual resamplers

# %% ResamplerConfig ----
#' @title ResamplerConfig
#' ResamplerConfig
#'
#' @description
#' Superclass for resampler configuration.
Expand All @@ -28,6 +28,7 @@
#' @noRd
ResamplerConfig <- new_class(
name = "ResamplerConfig",
package = "rtemis",
properties = list(
type = class_character,
n = class_integer # scalar_int_pos
Expand Down Expand Up @@ -401,7 +402,7 @@ setup_Resampler <- function(


# %% Resampler ----
#' @title Resampler
#' Resampler
#'
#' @description
#' Class for resampling objects.
Expand All @@ -410,6 +411,7 @@ setup_Resampler <- function(
#' @noRd
Resampler <- new_class(
Comment thread
egenn marked this conversation as resolved.
name = "Resampler",
package = "rtemis",
properties = list(
type = class_character,
resamples = class_list,
Expand Down
7 changes: 6 additions & 1 deletion R/06_Tuner.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@
#' @field config Named list of tuner config.
#'
#' @author EDG
#' @keywords internal
#' @noRd
TunerConfig <- new_class(
name = "TunerConfig",
package = "rtemis",
properties = list(
type = class_character,
config = class_list
Expand Down Expand Up @@ -94,7 +96,7 @@ method(`[[`, TunerConfig) <- function(x, name) {


# %% GridSearchConfig ----
#' @title GridSearchConfig
#' GridSearchConfig
#'
#' @description
#' TunerConfig subclass for grid search config.
Expand All @@ -104,6 +106,7 @@ method(`[[`, TunerConfig) <- function(x, name) {
GridSearchConfig <- new_class(
name = "GridSearchConfig",
parent = TunerConfig,
package = "rtemis",
constructor = function(
resampler_config = NULL,
search_type = NULL,
Expand Down Expand Up @@ -209,6 +212,7 @@ setup_GridSearch <- function(
#' @noRd
Tuner <- new_class(
name = "Tuner",
package = "rtemis",
properties = list(
type = class_character,
hyperparameters = Hyperparameters,
Expand Down Expand Up @@ -237,6 +241,7 @@ method(desc, Tuner) <- function(x) {
GridSearch <- new_class(
name = "GridSearch",
parent = Tuner,
package = "rtemis",
constructor = function(
hyperparameters,
tuner_config,
Expand Down
Loading
Loading