Skip to content

Commit

Permalink
Add crate to custom_check in PipeOpVtreat.R
Browse files Browse the repository at this point in the history
  • Loading branch information
advieser committed Aug 8, 2024
1 parent 37b7781 commit 65bef55
Showing 1 changed file with 40 additions and 11 deletions.
51 changes: 40 additions & 11 deletions R/PipeOpVtreat.R
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,55 @@ PipeOpVtreat = R6Class("PipeOpVtreat",
rareSig = p_dbl(lower = 0, upper = 1, special_vals = list(NULL), tags = c("train", "regression", "classification", "multinomial")), # default NULL for regression, classification, 1 for multinomial
collarProb = p_dbl(lower = 0, upper = 1, default = 0, tags = c("train", "regression", "classification", "multinomial"), depends = quote(doCollar == TRUE)),
doCollar = p_lgl(default = FALSE, tags = c("train", "regression", "classification", "multinomial")),
codeRestriction = p_uty(default = NULL, custom_check = function(x) checkmate::check_character(x, any.missing = FALSE, null.ok = TRUE),
tags = c("train", "regression", "classification", "multinomial")),
customCoders = p_uty(default = NULL, custom_check = function(x) checkmate::check_list(x, null.ok = TRUE), tags = c("train", "regression", "classification", "multinomial")),
splitFunction = p_uty(default = NULL, custom_check = function(x) checkmate::check_function(x, args = c("nSplits", "nRows", "dframe", "y"), null.ok = TRUE),
tags = c("train", "regression", "classification", "multinomial")),
codeRestriction = p_uty(
default = NULL,
custom_check = crate(function(x) checkmate::check_character(x, any.missing = FALSE, null.ok = TRUE), .parent = topenv()),
tags = c("train", "regression", "classification", "multinomial")
),
customCoders = p_uty(
default = NULL,
custom_check = crate(function(x) checkmate::check_list(x, null.ok = TRUE), .parent = topenv()),
tags = c("train", "regression", "classification", "multinomial")
),
splitFunction = p_uty(
default = NULL,
custom_check = crate(function(x) checkmate::check_function(x, args = c("nSplits", "nRows", "dframe", "y"), null.ok = TRUE), .parent = topenv()),
tags = c("train", "regression", "classification", "multinomial")
),
ncross = p_int(lower = 2L, upper = Inf, default = 3L, tags = c("train", "regression", "classification", "multinomial")),
forceSplit = p_lgl(default = FALSE, tags = c("train", "regression", "classification", "multinomial")),
catScaling = p_lgl(tags = c("train", "regression", "classification", "multinomial")), # default TRUE for regression, classification, FALSE for multinomial
verbose = p_lgl(default = FALSE, tags = c("train", "regression", "classification", "multinomial")),
use_paralell = p_lgl(default = TRUE, tags = c("train", "regression", "classification", "multinomial")),
missingness_imputation = p_uty(default = NULL, custom_check = function(x) checkmate::check_function(x, args = c("values", "weights"), null.ok = TRUE),
tags = c("train", "regression", "classification", "multinomial")),
missingness_imputation = p_uty(
default = NULL,
custom_check = crate(function(x) checkmate::check_function(x, args = c("values", "weights"), null.ok = TRUE), .parent = topenv()),
tags = c("train", "regression", "classification", "multinomial")
),
pruneSig = p_dbl(lower = 0, upper = 1, special_vals = list(NULL), default = NULL, tags = c("train", "regression", "classification")),
scale = p_lgl(default = FALSE, tags = c("train", "regression", "classification", "multinomial")),
varRestriction = p_uty(default = NULL, custom_check = function(x) checkmate::check_list(x, null.ok = TRUE), tags = c("train", "regression", "classification")),
trackedValues = p_uty(default = NULL, custom_check = function(x) checkmate::check_list(x, null.ok = TRUE), tags = c("train", "regression", "classification")),
varRestriction = p_uty(
default = NULL,
custom_check = crate(function(x) checkmate::check_list(x, null.ok = TRUE), .parent = topenv()),
tags = c("train", "regression", "classification")
),
trackedValues = p_uty(
default = NULL,
custom_check = crate(function(x) checkmate::check_list(x, null.ok = TRUE), .parent = topenv()),
tags = c("train", "regression", "classification")
),
# NOTE: check_for_duplicate_frames not needed
y_dependent_treatments = p_uty(default = "catB", custom_check = function(x) checkmate::check_character(x, any.missing = FALSE), tags = c("train", "multinomial")),
y_dependent_treatments = p_uty(
default = "catB",
custom_check = crate(function(x) checkmate::check_character(x, any.missing = FALSE), .parent = topenv()),
tags = c("train", "multinomial")
),
# NOTE: imputation_map is also in multinomial_parameters(); this is redundant so only include it here
imputation_map = p_uty(default = NULL, custom_check = function(x) checkmate::check_list(x, null.ok = TRUE), tags = c("train", "predict"))
imputation_map = p_uty(
default = NULL,
custom_check = crate(function(x) checkmate::check_list(x, null.ok = TRUE), .parent = topenv()),
tags = c("train", "predict")
)
# NOTE: parallelCluster missing intentionally and will be set to NULL
)
ps$values = list(recommended = TRUE, cols_to_copy = selector_none())
Expand Down

0 comments on commit 65bef55

Please sign in to comment.