From 8dd9ea23ef64fc5ec635fcab64df6613f0d23dc7 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 21 Aug 2023 11:11:17 +0200 Subject: [PATCH 01/17] docs: correct usage of default / initial value --- R/learner_LiblineaR_regr_liblinear.R | 4 +-- R/learner_dbarts_regr_bart.R | 9 ++---- R/learner_flexsurv_surv_flexible.R | 4 +-- R/learner_gbm_classif_gbm.R | 13 ++------ R/learner_glmnet_surv_cv_glmnet.R | 4 +-- R/learner_glmnet_surv_glmnet.R | 4 +-- R/learner_lightgbm_classif_lightgbm.R | 20 ++++++------ R/learner_lightgbm_regr_lightgbm.R | 13 ++++---- R/learner_obliqueRSF_surv_obliqueRSF.R | 9 ++---- ...randomForestSRC_classif_imbalanced_rfsrc.R | 9 ++---- R/learner_randomForestSRC_classif_rfsrc.R | 13 +++----- R/learner_randomForestSRC_regr_rfsrc.R | 3 +- R/learner_randomForestSRC_surv_rfsrc.R | 3 +- R/learner_ranger_surv_ranger.R | 7 ++-- R/learner_survivalmodels_surv_dnnsurv.R | 7 ++-- R/learner_xgboost_surv_xgboost.R | 24 +++----------- inst/templates/learner_template.R | 6 ++-- man/mlr_learners_classif.AdaBoostM1.Rd | 2 +- man/mlr_learners_classif.C50.Rd | 2 +- man/mlr_learners_classif.IBk.Rd | 2 +- man/mlr_learners_classif.J48.Rd | 2 +- man/mlr_learners_classif.JRip.Rd | 2 +- man/mlr_learners_classif.LMT.Rd | 2 +- man/mlr_learners_classif.OneR.Rd | 2 +- man/mlr_learners_classif.PART.Rd | 2 +- man/mlr_learners_classif.abess.Rd | 2 +- man/mlr_learners_classif.gbm.Rd | 17 ++-------- man/mlr_learners_classif.imbalanced_rfsrc.Rd | 9 ++---- man/mlr_learners_classif.lightgbm.Rd | 30 ++++++++--------- man/mlr_learners_classif.rfsrc.Rd | 11 ++----- man/mlr_learners_dens.mixed.Rd | 2 +- man/mlr_learners_regr.IBk.Rd | 2 +- man/mlr_learners_regr.M5Rules.Rd | 2 +- man/mlr_learners_regr.abess.Rd | 2 +- man/mlr_learners_regr.bart.Rd | 11 ++----- man/mlr_learners_regr.cubist.Rd | 2 +- man/mlr_learners_regr.liblinear.Rd | 4 +-- man/mlr_learners_regr.lightgbm.Rd | 18 ++++------- man/mlr_learners_regr.rfsrc.Rd | 13 +------- man/mlr_learners_surv.cv_glmnet.Rd | 4 +-- man/mlr_learners_surv.dnnsurv.Rd | 9 ++---- man/mlr_learners_surv.flexible.Rd | 4 +-- man/mlr_learners_surv.gamboost.Rd | 2 +- man/mlr_learners_surv.glmboost.Rd | 2 +- man/mlr_learners_surv.glmnet.Rd | 10 ++---- man/mlr_learners_surv.mboost.Rd | 4 +-- man/mlr_learners_surv.obliqueRSF.Rd | 11 ++----- man/mlr_learners_surv.ranger.Rd | 9 +----- man/mlr_learners_surv.rfsrc.Rd | 13 +------- man/mlr_learners_surv.xgboost.Rd | 32 +++---------------- 50 files changed, 129 insertions(+), 264 deletions(-) diff --git a/R/learner_LiblineaR_regr_liblinear.R b/R/learner_LiblineaR_regr_liblinear.R index 6dd51debd..8a68f8ecb 100644 --- a/R/learner_LiblineaR_regr_liblinear.R +++ b/R/learner_LiblineaR_regr_liblinear.R @@ -15,10 +15,10 @@ #' * `type = 12` – L2-regularized L2-loss support vector regression (dual) #' * `type = 13` – L2-regularized L1-loss support vector regression (dual) #' -#' @section Custom mlr3 defaults: +#' @section Initial parameter values: #' - `svr_eps`: #' - Actual default: `NULL` -#' - Adjusted default: 0.001 +#' - Initial value: 0.001 #' - Reason for change: `svr_eps` is type dependent and the "type" is handled #' by the mlr3learner. The default value is set to th default of the respective #' "type". diff --git a/R/learner_dbarts_regr_bart.R b/R/learner_dbarts_regr_bart.R index e36bc8f8a..5b56a221b 100644 --- a/R/learner_dbarts_regr_bart.R +++ b/R/learner_dbarts_regr_bart.R @@ -9,7 +9,7 @@ #' @template learner #' @templateVar id regr.bart #' -#' @section Initial parameter values: +#' @section Custom mlr3 parameters: #' * Parameter: offset #' * The parameter is removed, because only `dbarts::bart2` allows an offset during training, #' and therefore the offset parameter in `dbarts:::predict.bart` is irrelevant for @@ -17,11 +17,8 @@ #' * Parameter: nchain, combineChains, combinechains #' * The parameters are removed as parallelization of multiple models is handled by future. #' -#' @section Custom mlr3 defaults: -#' * Parameter: keeptrees -#' * Original: FALSE -#' * New: TRUE -#' * Reason: Required for prediction +#' @section Initial parameter values: +#' * `keeptrees` is initialized to `TRUE` because it is required for prediction. #' #' @references #' `r format_bib("sparapani2021nonparametric", "chipman2010bart")` diff --git a/R/learner_flexsurv_surv_flexible.R b/R/learner_flexsurv_surv_flexible.R index fa87ce3a6..a51527fe1 100644 --- a/R/learner_flexsurv_surv_flexible.R +++ b/R/learner_flexsurv_surv_flexible.R @@ -21,10 +21,10 @@ #' and covariates \eqn{X^T = (X_0,...,X_P)^T}{X^T = (X0,...,XP)^T}, where \eqn{X_0}{X0} is a column #' of \eqn{1}s: \eqn{lp = \beta X}{lp = \betaX}. #' -#' @section Custom mlr3 defaults: +#' @section Initial parameter values: #' - `k`: #' - Actual default: `0` -#' - Adjusted default: `1` +#' - Initial value: `1` #' - Reason for change: The default value of `0` is equivalent to, and a much less efficient #' implementation of, [LearnerSurvParametric]. #' diff --git a/R/learner_gbm_classif_gbm.R b/R/learner_gbm_classif_gbm.R index 22ee96138..9a53482ee 100644 --- a/R/learner_gbm_classif_gbm.R +++ b/R/learner_gbm_classif_gbm.R @@ -9,16 +9,9 @@ #' @template learner #' @templateVar id classif.gbm #' -#' @section Custom mlr3 defaults: -#' - `keep.data`: -#' - Actual default: TRUE -#' - Adjusted default: FALSE -#' - Reason for change: `keep.data = FALSE` saves memory during model fitting. -#' - `n.cores`: -#' - Actual default: NULL -#' - Adjusted default: 1 -#' - Reason for change: Suppressing the automatic internal parallelization if -#' `cv.folds` > 0. +#' @section Initial parameter values: +#' - `keep.data` is initialized to `FALSE` to save memory. +#' - `n.cores` is initialized to 1 to avoid conflicts with parallelization through future. #' #' @references #' `r format_bib("friedman2002stochastic")` diff --git a/R/learner_glmnet_surv_cv_glmnet.R b/R/learner_glmnet_surv_cv_glmnet.R index ce7b27b04..84b9fdbdb 100644 --- a/R/learner_glmnet_surv_cv_glmnet.R +++ b/R/learner_glmnet_surv_cv_glmnet.R @@ -6,8 +6,8 @@ #' Generalized linear models with elastic net regularization. #' Calls [glmnet::cv.glmnet()] from package \CRANpkg{glmnet}. #' -#' @section Custom mlr3 defaults: -#' - `family` The default is set to `"cox"`. +#' @section Custom mlr3 parameters: +#' - `family` is set to `"cox"` and cannot be changed. #' #' @templateVar id surv.cv_glmnet #' @template learner diff --git a/R/learner_glmnet_surv_glmnet.R b/R/learner_glmnet_surv_glmnet.R index c3e84baa0..cd4c8bf18 100644 --- a/R/learner_glmnet_surv_glmnet.R +++ b/R/learner_glmnet_surv_glmnet.R @@ -6,8 +6,8 @@ #' Generalized linear models with elastic net regularization. #' Calls [glmnet::glmnet()] from package \CRANpkg{glmnet}. #' -#' @section Custom mlr3 defaults: -#' - `family` The default is set to `"cox"`. +# @section Custom mlr3 parameters: +#' - `family` is set to `"cox"` and cannot be changed. #' #' @details #' Caution: This learner is different to learners calling [glmnet::cv.glmnet()] diff --git a/R/learner_lightgbm_classif_lightgbm.R b/R/learner_lightgbm_classif_lightgbm.R index 4be4bc777..db6e7e9f7 100644 --- a/R/learner_lightgbm_classif_lightgbm.R +++ b/R/learner_lightgbm_classif_lightgbm.R @@ -14,27 +14,27 @@ #' @templateVar id classif.lightgbm #' #' @section Initial parameter values: -#' * `convert_categorical`: -#' Additional parameter. If this parameter is set to `TRUE` (default), all factor and logical -#' columns are converted to integers and the parameter categorical_feature of lightgbm is set to -#' those columns. -#' * `num_class`: -#' This parameter is automatically inferred for multiclass tasks and does not have to be set. -#' @section Custom mlr3 defaults: #' * `num_threads`: #' * Actual default: 0L -#' * Adjusted default: 1L +#' * Initial value: 1L #' * Reason for change: Prevents accidental conflicts with `future`. #' * `verbose`: #' * Actual default: 1L -#' * Adjusted default: -1L +#' * Initial value: -1L #' * Reason for change: Prevents accidental conflicts with mlr messaging system. +#' @section Custom mlr3 defaults: #' * `objective`: -#' Depending if the task is binary / multiclass, the default is set to `"binary"` or +#' Depending if the task is binary / multiclass, the default is `"binary"` or #' `"multiclasss"`. #' @section Custom mlr3 parameters: #' * `early_stopping` #' Whether to use the test set for early stopping. Default is `FALSE`. +#' * `convert_categorical`: +#' Additional parameter. If this parameter is set to `TRUE` (default), all factor and logical +#' columns are converted to integers and the parameter categorical_feature of lightgbm is set to +#' those columns. +#' * `num_class`: +#' This parameter is automatically inferred for multiclass tasks and does not have to be set. #' #' @references #' `r format_bib("ke2017lightgbm")` diff --git a/R/learner_lightgbm_regr_lightgbm.R b/R/learner_lightgbm_regr_lightgbm.R index 9d17e343b..a6ccf04d0 100644 --- a/R/learner_lightgbm_regr_lightgbm.R +++ b/R/learner_lightgbm_regr_lightgbm.R @@ -14,23 +14,22 @@ #' @templateVar id regr.lightgbm #' #' @section Initial parameter values: -#' * `convert_categorical`: -#' Additional parameter. If this parameter is set to `TRUE` (default), all factor and logical -#' columns are converted to integers and the parameter categorical_feature of lightgbm is set to -#' those columns. -#' @section Custom mlr3 defaults: #' * `num_threads`: #' * Actual default: 0L -#' * Adjusted default: 1L +#' * Iniital value: 1L #' * Reason for change: Prevents accidental conflicts with `future`. #' * `verbose`: #' * Actual default: 1L -#' * Adjusted default: -1L +#' * Initial value: -1L #' * Reason for change: Prevents accidental conflicts with mlr messaging system. #' #' @section Custom mlr3 parameters: #' * `early_stopping` #' Whether to use the test set for early stopping. Default is `FALSE`. +#' * `convert_categorical`: +#' Additional parameter. If this parameter is set to `TRUE` (default), all factor and logical +#' columns are converted to integers and the parameter categorical_feature of lightgbm is set to +#' those columns. #' #' @references #' `r format_bib("ke2017lightgbm")` diff --git a/R/learner_obliqueRSF_surv_obliqueRSF.R b/R/learner_obliqueRSF_surv_obliqueRSF.R index 55656fa84..74d5fb474 100644 --- a/R/learner_obliqueRSF_surv_obliqueRSF.R +++ b/R/learner_obliqueRSF_surv_obliqueRSF.R @@ -10,17 +10,14 @@ #' @template learner #' @templateVar id surv.obliqueRSF #' -#' @section Initial parameter values: +#' @section Custom mlr3 parameters: #' - `mtry`: #' - This hyperparameter can alternatively be set via the added hyperparameter `mtry_ratio` #' as `mtry = max(ceiling(mtry_ratio * n_features), 1)`. #' Note that `mtry` and `mtry_ratio` are mutually exclusive. #' -#' @section Custom mlr3 defaults: -#' - `verbose`: -#' - Actual default: `TRUE` -#' - Adjusted default: `FALSE` -#' - Reason for change: mlr3 already has it's own verbose set to `TRUE` by default +#' @section Initial parameter values: +#' - `verbose` is initialized to `FALSE` #' #' @references #' `r format_bib("jaeger_2019")` diff --git a/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R b/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R index 64dc11634..620f61ffe 100644 --- a/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R +++ b/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R @@ -16,11 +16,8 @@ #' as `sampsize = max(ceiling(sampsize.ratio * n_obs), 1)`. #' Note that `sampsize` and `sampsize.ratio` are mutually exclusive. #' -#' @section Custom mlr3 defaults: -#' - `cores`: -#' - Actual default: Auto-detecting the number of cores -#' - Adjusted default: 1 -#' - Reason for change: Threading conflicts with explicit parallelization via \CRANpkg{future}. +#' @section Initial parameter values: +#' - `cores` is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. #' #' @templateVar id classif.imbalanced_rfsrc #' @template learner @@ -109,6 +106,7 @@ LearnerClassifImbalancedRandomForestSRC = R6Class("LearnerClassifImbalancedRando save.memory = p_lgl(default = FALSE, tags = "train"), perf.type = p_fct(levels = c("gmean", "misclass", "brier", "none"), tags = "train") # nolint ) + ps$values = list(cores = 1L) super$initialize( id = "classif.imbalanced_rfsrc", @@ -154,7 +152,6 @@ LearnerClassifImbalancedRandomForestSRC = R6Class("LearnerClassifImbalancedRando pv = self$param_set$get_values(tags = "train") pv = convert_ratio(pv, "mtry", "mtry.ratio", length(task$feature_names)) pv = convert_ratio(pv, "sampsize", "sampsize.ratio", task$nrow) - cores = pv$cores %??% 1L if ("weights" %in% task$properties) { pv$case.wt = as.numeric(task$weights$weight) # nolint diff --git a/R/learner_randomForestSRC_classif_rfsrc.R b/R/learner_randomForestSRC_classif_rfsrc.R index 399e2b13e..41eb1c710 100644 --- a/R/learner_randomForestSRC_classif_rfsrc.R +++ b/R/learner_randomForestSRC_classif_rfsrc.R @@ -9,7 +9,7 @@ #' @template learner #' @templateVar id classif.rfsrc #' -#' @section Initial parameter values: +#' @section Custom mlr3 parameters: #' - `mtry`: #' - This hyperparameter can alternatively be set via the added hyperparameter `mtry.ratio` #' as `mtry = max(ceiling(mtry.ratio * n_features), 1)`. @@ -18,12 +18,8 @@ #' - This hyperparameter can alternatively be set via the added hyperparameter `sampsize.ratio` #' as `sampsize = max(ceiling(sampsize.ratio * n_obs), 1)`. #' Note that `sampsize` and `sampsize.ratio` are mutually exclusive. -#' -#' @section Custom mlr3 defaults: -#' - `cores`: -#' - Actual default: Auto-detecting the number of cores -#' - Adjusted default: 1 -#' - Reason for change: Threading conflicts with explicit parallelization via \CRANpkg{future}. +#' @section Initial parameter values: +#' - `cores` is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. #' #' @references #' `r format_bib("breiman_2001")` @@ -103,6 +99,8 @@ LearnerClassifRandomForestSRC = R6Class("LearnerClassifRandomForestSRC", perf.type = p_fct(levels = c("gmean", "misclass", "brier", "none"), tags = "train") # nolint ) + ps$values = list(cores = 1) + super$initialize( id = "classif.rfsrc", packages = c("mlr3extralearners", "randomForestSRC"), @@ -156,7 +154,6 @@ LearnerClassifRandomForestSRC = R6Class("LearnerClassifRandomForestSRC", pv = self$param_set$get_values(tags = "train") pv = convert_ratio(pv, "mtry", "mtry.ratio", length(task$feature_names)) pv = convert_ratio(pv, "sampsize", "sampsize.ratio", task$nrow) - cores = pv$cores %??% 1L if ("weights" %in% task$properties) { pv$case.wt = as.numeric(task$weights$weight) # nolint diff --git a/R/learner_randomForestSRC_regr_rfsrc.R b/R/learner_randomForestSRC_regr_rfsrc.R index 3945e506b..a136b5ead 100644 --- a/R/learner_randomForestSRC_regr_rfsrc.R +++ b/R/learner_randomForestSRC_regr_rfsrc.R @@ -89,6 +89,8 @@ LearnerRegrRandomForestSRC = R6Class("LearnerRegrRandomForestSRC", perf.type = p_fct(levels = "none", tags = "train") ) + ps$values = list(cores = 1) + super$initialize( id = "regr.rfsrc", packages = c("mlr3extralearners", "randomForestSRC"), @@ -139,7 +141,6 @@ LearnerRegrRandomForestSRC = R6Class("LearnerRegrRandomForestSRC", pv = self$param_set$get_values(tags = "train") pv = convert_ratio(pv, "mtry", "mtry.ratio", length(task$feature_names)) pv = convert_ratio(pv, "sampsize", "sampsize.ratio", task$nrow) - cores = pv$cores %??% 1L if ("weights" %in% task$properties) { pv$case.wt = as.numeric(task$weights$weight) # nolint diff --git a/R/learner_randomForestSRC_surv_rfsrc.R b/R/learner_randomForestSRC_surv_rfsrc.R index e72b1002e..e46309b99 100644 --- a/R/learner_randomForestSRC_surv_rfsrc.R +++ b/R/learner_randomForestSRC_surv_rfsrc.R @@ -100,6 +100,8 @@ delayedAssign( perf.type = p_fct(levels = "none", tags = "train") ) + ps$values = list(cores = 1) + super$initialize( id = "surv.rfsrc", packages = c("mlr3extralearners", "randomForestSRC", "pracma"), @@ -149,7 +151,6 @@ delayedAssign( pv = self$param_set$get_values(tags = "train") pv = convert_ratio(pv, "mtry", "mtry.ratio", length(task$feature_names)) pv = convert_ratio(pv, "sampsize", "sampsize.ratio", task$nrow) - cores = pv$cores %??% 1L if ("weights" %in% task$properties) { pv$case.wt = as.numeric(task$weights$weight) # nolint diff --git a/R/learner_ranger_surv_ranger.R b/R/learner_ranger_surv_ranger.R index 7694317d9..7f68e6fcf 100644 --- a/R/learner_ranger_surv_ranger.R +++ b/R/learner_ranger_surv_ranger.R @@ -12,11 +12,8 @@ #' as `mtry = max(ceiling(mtry.ratio * n_features), 1)`. #' Note that `mtry` and `mtry.ratio` are mutually exclusive. #' -#' @section Custom mlr3 defaults: -#' - `num.threads`: -#' - Actual default: `NULL`, triggering auto-detection of the number of CPUs. -#' - Adjusted value: 1. -#' - Reason for change: Conflicting with parallelization via \CRANpkg{future}. +#' @section Initial parameter values: +#' - `num.threads` is initialized to 1 to avoid conflicts with parallelization via \CRANpkg{future}. #' #' @templateVar id surv.ranger #' @template learner diff --git a/R/learner_survivalmodels_surv_dnnsurv.R b/R/learner_survivalmodels_surv_dnnsurv.R index 949ebfa06..131902689 100644 --- a/R/learner_survivalmodels_surv_dnnsurv.R +++ b/R/learner_survivalmodels_surv_dnnsurv.R @@ -17,11 +17,8 @@ #' The number of output channels should be of length `1` and number of input channels is #' the number of features plus number of cuts. #' -#' @section Custom mlr3 defaults: -#' - `verbose`: -#' - Actual default: `1L` -#' - Adjusted default: `0L` -#' - Reason for change: Prevents plotting. +#' @section Initial parameter values: +#' - `verbose` is initialized to 0. #' #' @references #' `r format_bib("zhao2019dnnsurv")` diff --git a/R/learner_xgboost_surv_xgboost.R b/R/learner_xgboost_surv_xgboost.R index 25680c02e..4a3d0687a 100644 --- a/R/learner_xgboost_surv_xgboost.R +++ b/R/learner_xgboost_surv_xgboost.R @@ -8,25 +8,11 @@ #' #' @template note_xgboost #' -#' @section Custom mlr3 defaults: -#' - `nrounds`: -#' - Actual default: no default. -#' - Adjusted default: 1. -#' - Reason for change: Without a default construction of the learner -#' would error. Just setting a nonsense default to workaround this. -#' `nrounds` needs to be tuned by the user. -#' - `nthread`: -#' - Actual value: Undefined, triggering auto-detection of the number of CPUs. -#' - Adjusted value: 1. -#' - Reason for change: Conflicting with parallelization via \CRANpkg{future}. -#' - `verbose`: -#' - Actual default: 1. -#' - Adjusted default: 0. -#' - Reason for change: Reduce verbosity. -#' - `objective`: -#' - Actual default: `reg:squarederror`. -#' - Adjusted default: `survival:cox`. -#' - Reason for change: Changed to a survival objective. +#' @section Initial parameter values: +#' - `nrounds` is initialized to 1. +#' - `nthread` is initialized to 1 to avoid conflicts with parallelization via \CRANpkg{future}. +#' - `verbose` is initialized to 0. +#' - `objective` is initialized to `survival:cox` for survival analysis. #' @section Early stopping: #' Early stopping can be used to find the optimal number of boosting rounds. #' The `early_stopping_set` parameter controls which set is used to monitor the performance. diff --git a/inst/templates/learner_template.R b/inst/templates/learner_template.R index 8b3f59435..b14561e01 100644 --- a/inst/templates/learner_template.R +++ b/inst/templates/learner_template.R @@ -9,11 +9,11 @@ #' @section Initial parameter values: #' FIXME: DEVIATIONS FROM UPSTREAM PARAMETERS. DELETE IF NOT APPLICABLE. #' -#' @section Custom mlr3 defaults: +#' @section Custom mlr3 parameters: #' FIXME: DEVIATIONS FROM UPSTREAM DEFAULTS. DELETE IF NOT APPLICABLE. #' -#' @section Installation: -#' FIXME: CUSTOM INSTALLATION INSTRUCTIONS. DELETE IF NOT APPLICABLE. +#' @section Custom mlr3 parameters: +#' FIXME: INITIAL VALUES FOR PARAMETERS. DELETE IF NOT APPLICABLE. #' #' @templateVar id . #' @template learner diff --git a/man/mlr_learners_classif.AdaBoostM1.Rd b/man/mlr_learners_classif.AdaBoostM1.Rd index 6ef337e1f..a2c5ddbfb 100644 --- a/man/mlr_learners_classif.AdaBoostM1.Rd +++ b/man/mlr_learners_classif.AdaBoostM1.Rd @@ -6,7 +6,7 @@ \title{Classification AdaBoostM1 Learner} \description{ Adaptive boosting algorithm for classification. -Calls \code{\link[RWeka:Weka_classifier_meta]{RWeka::AdaBoostM1()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:AdaBoostM1]{RWeka::AdaBoostM1()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.C50.Rd b/man/mlr_learners_classif.C50.Rd index 42c0dc525..043e04e45 100644 --- a/man/mlr_learners_classif.C50.Rd +++ b/man/mlr_learners_classif.C50.Rd @@ -6,7 +6,7 @@ \title{Classification C5.0 Learner} \description{ Decision Tree Algorithm. -Calls \code{\link[C50:C5.0.formula]{C50::C5.0.formula()}} from \CRANpkg{C50}. +Calls \code{\link[C50:C5.0]{C50::C5.0.formula()}} from \CRANpkg{C50}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.IBk.Rd b/man/mlr_learners_classif.IBk.Rd index 653c838db..85b51e776 100644 --- a/man/mlr_learners_classif.IBk.Rd +++ b/man/mlr_learners_classif.IBk.Rd @@ -6,7 +6,7 @@ \title{Classification IBk Learner} \description{ Instance based algorithm: K-nearest neighbours regression. -Calls \code{\link[RWeka:Weka_classifier_lazy]{RWeka::IBk()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:IBk]{RWeka::IBk()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.J48.Rd b/man/mlr_learners_classif.J48.Rd index fc6152932..6c830fd7d 100644 --- a/man/mlr_learners_classif.J48.Rd +++ b/man/mlr_learners_classif.J48.Rd @@ -6,7 +6,7 @@ \title{Classification J48 Learner} \description{ Decision tree algorithm. -Calls \code{\link[RWeka:Weka_classifier_lazy]{RWeka::IBk()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:IBk]{RWeka::IBk()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.JRip.Rd b/man/mlr_learners_classif.JRip.Rd index 0f66d459b..122e7539e 100644 --- a/man/mlr_learners_classif.JRip.Rd +++ b/man/mlr_learners_classif.JRip.Rd @@ -6,7 +6,7 @@ \title{Classification JRip Learner} \description{ Repeated Incremental Pruning to Produce Error Reduction. -Calls \code{\link[RWeka:Weka_classifier_rules]{RWeka::JRip()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:JRip]{RWeka::JRip()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.LMT.Rd b/man/mlr_learners_classif.LMT.Rd index 521efa587..18d152502 100644 --- a/man/mlr_learners_classif.LMT.Rd +++ b/man/mlr_learners_classif.LMT.Rd @@ -6,7 +6,7 @@ \title{Classification Logistic Model Trees Learner} \description{ Classification tree with logistic regression models at the leaves. -Calls \code{\link[RWeka:Weka_classifier_trees]{RWeka::LMT()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:LMT]{RWeka::LMT()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.OneR.Rd b/man/mlr_learners_classif.OneR.Rd index 28ef298ea..82931e024 100644 --- a/man/mlr_learners_classif.OneR.Rd +++ b/man/mlr_learners_classif.OneR.Rd @@ -6,7 +6,7 @@ \title{Classification OneR Learner} \description{ One Rule classification algorithm that yields an extremely simple model. -Calls \code{\link[RWeka:Weka_classifier_rules]{RWeka::OneR()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:OneR]{RWeka::OneR()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.PART.Rd b/man/mlr_learners_classif.PART.Rd index efa791776..03692d2da 100644 --- a/man/mlr_learners_classif.PART.Rd +++ b/man/mlr_learners_classif.PART.Rd @@ -6,7 +6,7 @@ \title{Classification PART Learner} \description{ Regression partition tree. -Calls \code{\link[RWeka:Weka_classifier_rules]{RWeka::PART()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:PART]{RWeka::PART()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.abess.Rd b/man/mlr_learners_classif.abess.Rd index 793ddc370..411d25103 100644 --- a/man/mlr_learners_classif.abess.Rd +++ b/man/mlr_learners_classif.abess.Rd @@ -134,7 +134,7 @@ Creates a new instance of this \link[R6:R6Class]{R6} class. \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-LearnerClassifAbess-selected_features}{}}} \subsection{Method \code{selected_features()}}{ -Extract the name of selected features from the model by \code{\link[abess:extract]{abess::extract()}}. +Extract the name of selected features from the model by \code{\link[abess:extract.abess]{abess::extract()}}. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{LearnerClassifAbess$selected_features()}\if{html}{\out{
}} } diff --git a/man/mlr_learners_classif.gbm.Rd b/man/mlr_learners_classif.gbm.Rd index 7525167ee..b8e12ae65 100644 --- a/man/mlr_learners_classif.gbm.Rd +++ b/man/mlr_learners_classif.gbm.Rd @@ -45,22 +45,11 @@ lrn("classif.gbm") } } -\section{Custom mlr3 defaults}{ +\section{Initial parameter values}{ \itemize{ -\item \code{keep.data}: -\itemize{ -\item Actual default: TRUE -\item Adjusted default: FALSE -\item Reason for change: \code{keep.data = FALSE} saves memory during model fitting. -} -\item \code{n.cores}: -\itemize{ -\item Actual default: NULL -\item Adjusted default: 1 -\item Reason for change: Suppressing the automatic internal parallelization if -\code{cv.folds} > 0. -} +\item \code{keep.data} is initialized to \code{FALSE} to save memory. +\item \code{n.cores} is initialized to 1 to avoid conflicts with parallelization through future. } } diff --git a/man/mlr_learners_classif.imbalanced_rfsrc.Rd b/man/mlr_learners_classif.imbalanced_rfsrc.Rd index 02c1ea9c8..ed61e1b89 100644 --- a/man/mlr_learners_classif.imbalanced_rfsrc.Rd +++ b/man/mlr_learners_classif.imbalanced_rfsrc.Rd @@ -27,15 +27,10 @@ Note that \code{sampsize} and \code{sampsize.ratio} are mutually exclusive. } } -\section{Custom mlr3 defaults}{ +\section{Initial parameter values}{ \itemize{ -\item \code{cores}: -\itemize{ -\item Actual default: Auto-detecting the number of cores -\item Adjusted default: 1 -\item Reason for change: Threading conflicts with explicit parallelization via \CRANpkg{future}. -} +\item \code{cores} is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. } } diff --git a/man/mlr_learners_classif.lightgbm.Rd b/man/mlr_learners_classif.lightgbm.Rd index ff7d02281..1ecf1cd81 100644 --- a/man/mlr_learners_classif.lightgbm.Rd +++ b/man/mlr_learners_classif.lightgbm.Rd @@ -146,33 +146,27 @@ lrn("classif.lightgbm") \section{Initial parameter values}{ -\itemize{ -\item \code{convert_categorical}: -Additional parameter. If this parameter is set to \code{TRUE} (default), all factor and logical -columns are converted to integers and the parameter categorical_feature of lightgbm is set to -those columns. -\item \code{num_class}: -This parameter is automatically inferred for multiclass tasks and does not have to be set. -} -} - -\section{Custom mlr3 defaults}{ - \itemize{ \item \code{num_threads}: \itemize{ \item Actual default: 0L -\item Adjusted default: 1L +\item Initial value: 1L \item Reason for change: Prevents accidental conflicts with \code{future}. } \item \code{verbose}: \itemize{ \item Actual default: 1L -\item Adjusted default: -1L +\item Initial value: -1L \item Reason for change: Prevents accidental conflicts with mlr messaging system. } +} +} + +\section{Custom mlr3 defaults}{ + +\itemize{ \item \code{objective}: -Depending if the task is binary / multiclass, the default is set to \code{"binary"} or +Depending if the task is binary / multiclass, the default is \code{"binary"} or \code{"multiclasss"}. } } @@ -182,6 +176,12 @@ Depending if the task is binary / multiclass, the default is set to \code{"binar \itemize{ \item \code{early_stopping} Whether to use the test set for early stopping. Default is \code{FALSE}. +\item \code{convert_categorical}: +Additional parameter. If this parameter is set to \code{TRUE} (default), all factor and logical +columns are converted to integers and the parameter categorical_feature of lightgbm is set to +those columns. +\item \code{num_class}: +This parameter is automatically inferred for multiclass tasks and does not have to be set. } } diff --git a/man/mlr_learners_classif.rfsrc.Rd b/man/mlr_learners_classif.rfsrc.Rd index 042d8e287..24ba3430f 100644 --- a/man/mlr_learners_classif.rfsrc.Rd +++ b/man/mlr_learners_classif.rfsrc.Rd @@ -69,7 +69,7 @@ lrn("classif.rfsrc") } } -\section{Initial parameter values}{ +\section{Custom mlr3 parameters}{ \itemize{ \item \code{mtry}: @@ -87,15 +87,10 @@ Note that \code{sampsize} and \code{sampsize.ratio} are mutually exclusive. } } -\section{Custom mlr3 defaults}{ +\section{Initial parameter values}{ \itemize{ -\item \code{cores}: -\itemize{ -\item Actual default: Auto-detecting the number of cores -\item Adjusted default: 1 -\item Reason for change: Threading conflicts with explicit parallelization via \CRANpkg{future}. -} +\item \code{cores} is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. } } diff --git a/man/mlr_learners_dens.mixed.Rd b/man/mlr_learners_dens.mixed.Rd index 3d1d65a7d..a1e1db3d5 100644 --- a/man/mlr_learners_dens.mixed.Rd +++ b/man/mlr_learners_dens.mixed.Rd @@ -6,7 +6,7 @@ \title{Density Mixed Data Kernel Learner} \description{ Density estimator for discrete and continuous variables. -Calls \code{\link[np:npudens]{np::npudens()}} from \CRANpkg{np}. +Calls \code{\link[np:np.density]{np::npudens()}} from \CRANpkg{np}. } \section{Dictionary}{ diff --git a/man/mlr_learners_regr.IBk.Rd b/man/mlr_learners_regr.IBk.Rd index f69e16c73..812712172 100644 --- a/man/mlr_learners_regr.IBk.Rd +++ b/man/mlr_learners_regr.IBk.Rd @@ -6,7 +6,7 @@ \title{Regression IBk Learner} \description{ Instance based algorithm: K-nearest neighbours regression. -Calls \code{\link[RWeka:Weka_classifier_lazy]{RWeka::IBk()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:IBk]{RWeka::IBk()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_regr.M5Rules.Rd b/man/mlr_learners_regr.M5Rules.Rd index c2ce92e42..53cb28ae2 100644 --- a/man/mlr_learners_regr.M5Rules.Rd +++ b/man/mlr_learners_regr.M5Rules.Rd @@ -7,7 +7,7 @@ \description{ Algorithm for inducing \href{https://en.wikipedia.org/wiki/Decision_list}{decision lists} from model trees. -Calls \code{\link[RWeka:Weka_classifier_rules]{RWeka::M5Rules()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:M5Rules]{RWeka::M5Rules()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_regr.abess.Rd b/man/mlr_learners_regr.abess.Rd index 188c1dae9..5bab35838 100644 --- a/man/mlr_learners_regr.abess.Rd +++ b/man/mlr_learners_regr.abess.Rd @@ -126,7 +126,7 @@ Creates a new instance of this \link[R6:R6Class]{R6} class. \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-LearnerRegrAbess-selected_features}{}}} \subsection{Method \code{selected_features()}}{ -Extract the name of selected features from the model by \code{\link[abess:extract]{abess::extract()}}. +Extract the name of selected features from the model by \code{\link[abess:extract.abess]{abess::extract()}}. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{LearnerRegrAbess$selected_features()}\if{html}{\out{
}} } diff --git a/man/mlr_learners_regr.bart.Rd b/man/mlr_learners_regr.bart.Rd index d9377748a..e267f7cb6 100644 --- a/man/mlr_learners_regr.bart.Rd +++ b/man/mlr_learners_regr.bart.Rd @@ -57,7 +57,7 @@ lrn("regr.bart") } } -\section{Initial parameter values}{ +\section{Custom mlr3 parameters}{ \itemize{ \item Parameter: offset @@ -73,15 +73,10 @@ and therefore the offset parameter in \code{dbarts:::predict.bart} is irrelevant } } -\section{Custom mlr3 defaults}{ +\section{Initial parameter values}{ \itemize{ -\item Parameter: keeptrees -\itemize{ -\item Original: FALSE -\item New: TRUE -\item Reason: Required for prediction -} +\item \code{keeptrees} is initialized to \code{TRUE} because it is required for prediction. } } diff --git a/man/mlr_learners_regr.cubist.Rd b/man/mlr_learners_regr.cubist.Rd index c25c3a794..3aa475fd1 100644 --- a/man/mlr_learners_regr.cubist.Rd +++ b/man/mlr_learners_regr.cubist.Rd @@ -7,7 +7,7 @@ \description{ Rule-based model that is an extension of Quinlan's M5 model tree. Each tree contains linear regression models at the terminal leaves. -Calls \code{\link[Cubist:cubist]{Cubist::cubist()}} from \CRANpkg{Cubist}. +Calls \code{\link[Cubist:cubist.default]{Cubist::cubist()}} from \CRANpkg{Cubist}. } \section{Dictionary}{ diff --git a/man/mlr_learners_regr.liblinear.Rd b/man/mlr_learners_regr.liblinear.Rd index 27f7760b9..06b926ac0 100644 --- a/man/mlr_learners_regr.liblinear.Rd +++ b/man/mlr_learners_regr.liblinear.Rd @@ -49,13 +49,13 @@ lrn("regr.liblinear") } } -\section{Custom mlr3 defaults}{ +\section{Initial parameter values}{ \itemize{ \item \code{svr_eps}: \itemize{ \item Actual default: \code{NULL} -\item Adjusted default: 0.001 +\item Initial value: 0.001 \item Reason for change: \code{svr_eps} is type dependent and the "type" is handled by the mlr3learner. The default value is set to th default of the respective "type". diff --git a/man/mlr_learners_regr.lightgbm.Rd b/man/mlr_learners_regr.lightgbm.Rd index a5b42ff0f..0839423f8 100644 --- a/man/mlr_learners_regr.lightgbm.Rd +++ b/man/mlr_learners_regr.lightgbm.Rd @@ -144,27 +144,17 @@ lrn("regr.lightgbm") \section{Initial parameter values}{ -\itemize{ -\item \code{convert_categorical}: -Additional parameter. If this parameter is set to \code{TRUE} (default), all factor and logical -columns are converted to integers and the parameter categorical_feature of lightgbm is set to -those columns. -} -} - -\section{Custom mlr3 defaults}{ - \itemize{ \item \code{num_threads}: \itemize{ \item Actual default: 0L -\item Adjusted default: 1L +\item Iniital value: 1L \item Reason for change: Prevents accidental conflicts with \code{future}. } \item \code{verbose}: \itemize{ \item Actual default: 1L -\item Adjusted default: -1L +\item Initial value: -1L \item Reason for change: Prevents accidental conflicts with mlr messaging system. } } @@ -175,6 +165,10 @@ those columns. \itemize{ \item \code{early_stopping} Whether to use the test set for early stopping. Default is \code{FALSE}. +\item \code{convert_categorical}: +Additional parameter. If this parameter is set to \code{TRUE} (default), all factor and logical +columns are converted to integers and the parameter categorical_feature of lightgbm is set to +those columns. } } diff --git a/man/mlr_learners_regr.rfsrc.Rd b/man/mlr_learners_regr.rfsrc.Rd index da969843e..7a5b2692b 100644 --- a/man/mlr_learners_regr.rfsrc.Rd +++ b/man/mlr_learners_regr.rfsrc.Rd @@ -72,18 +72,7 @@ lrn("regr.rfsrc") \section{Initial parameter values}{ \itemize{ -\item \code{mtry}: -\itemize{ -\item This hyperparameter can alternatively be set via the added hyperparameter \code{mtry.ratio} -as \code{mtry = max(ceiling(mtry.ratio * n_features), 1)}. -Note that \code{mtry} and \code{mtry.ratio} are mutually exclusive. -} -\item \code{sampsize}: -\itemize{ -\item This hyperparameter can alternatively be set via the added hyperparameter \code{sampsize.ratio} -as \code{sampsize = max(ceiling(sampsize.ratio * n_obs), 1)}. -Note that \code{sampsize} and \code{sampsize.ratio} are mutually exclusive. -} +\item \code{cores} is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. } } diff --git a/man/mlr_learners_surv.cv_glmnet.Rd b/man/mlr_learners_surv.cv_glmnet.Rd index 9f4ec5814..8e8b2857e 100644 --- a/man/mlr_learners_surv.cv_glmnet.Rd +++ b/man/mlr_learners_surv.cv_glmnet.Rd @@ -8,10 +8,10 @@ Generalized linear models with elastic net regularization. Calls \code{\link[glmnet:cv.glmnet]{glmnet::cv.glmnet()}} from package \CRANpkg{glmnet}. } -\section{Custom mlr3 defaults}{ +\section{Custom mlr3 parameters}{ \itemize{ -\item \code{family} The default is set to \code{"cox"}. +\item \code{family} is set to \code{"cox"} and cannot be changed. } } diff --git a/man/mlr_learners_surv.dnnsurv.Rd b/man/mlr_learners_surv.dnnsurv.Rd index d17065603..b4905d870 100644 --- a/man/mlr_learners_surv.dnnsurv.Rd +++ b/man/mlr_learners_surv.dnnsurv.Rd @@ -90,15 +90,10 @@ Package 'survivalmodels' is not on CRAN and has to be install from GitHub via \code{remotes::install_github("RaphaelS1/survivalmodels")}. } -\section{Custom mlr3 defaults}{ +\section{Initial parameter values}{ \itemize{ -\item \code{verbose}: -\itemize{ -\item Actual default: \code{1L} -\item Adjusted default: \code{0L} -\item Reason for change: Prevents plotting. -} +\item \code{verbose} is initialized to 0. } } diff --git a/man/mlr_learners_surv.flexible.Rd b/man/mlr_learners_surv.flexible.Rd index 068a9b373..eeedf3a9e 100644 --- a/man/mlr_learners_surv.flexible.Rd +++ b/man/mlr_learners_surv.flexible.Rd @@ -60,13 +60,13 @@ lrn("surv.flexible") } } -\section{Custom mlr3 defaults}{ +\section{Initial parameter values}{ \itemize{ \item \code{k}: \itemize{ \item Actual default: \code{0} -\item Adjusted default: \code{1} +\item Initial value: \code{1} \item Reason for change: The default value of \code{0} is equivalent to, and a much less efficient implementation of, \link{LearnerSurvParametric}. } diff --git a/man/mlr_learners_surv.gamboost.Rd b/man/mlr_learners_surv.gamboost.Rd index 7ee93b37d..9fb239c2f 100644 --- a/man/mlr_learners_surv.gamboost.Rd +++ b/man/mlr_learners_surv.gamboost.Rd @@ -133,7 +133,7 @@ Named \code{numeric()}. \if{latex}{\out{\hypertarget{method-LearnerSurvGAMBoost-selected_features}{}}} \subsection{Method \code{selected_features()}}{ Selected features are extracted with the function -\code{\link[mboost:variable.names.mboost]{mboost::variable.names.mboost()}}, with +\code{\link[mboost:methods]{mboost::variable.names.mboost()}}, with \code{used.only = TRUE}. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{LearnerSurvGAMBoost$selected_features()}\if{html}{\out{
}} diff --git a/man/mlr_learners_surv.glmboost.Rd b/man/mlr_learners_surv.glmboost.Rd index eef4c6703..e07654fed 100644 --- a/man/mlr_learners_surv.glmboost.Rd +++ b/man/mlr_learners_surv.glmboost.Rd @@ -116,7 +116,7 @@ matrix and original names can't be recovered. description Selected features are extracted with the function -\code{\link[mboost:variable.names.mboost]{mboost::variable.names.mboost()}}, with +\code{\link[mboost:methods]{mboost::variable.names.mboost()}}, with \code{used.only = TRUE}. return \code{character()}. \subsection{Usage}{ diff --git a/man/mlr_learners_surv.glmnet.Rd b/man/mlr_learners_surv.glmnet.Rd index 35b579b44..4504e4416 100644 --- a/man/mlr_learners_surv.glmnet.Rd +++ b/man/mlr_learners_surv.glmnet.Rd @@ -7,6 +7,9 @@ \description{ Generalized linear models with elastic net regularization. Calls \code{\link[glmnet:glmnet]{glmnet::glmnet()}} from package \CRANpkg{glmnet}. +\itemize{ +\item \code{family} is set to \code{"cox"} and cannot be changed. +} } \details{ Caution: This learner is different to learners calling \code{\link[glmnet:cv.glmnet]{glmnet::cv.glmnet()}} @@ -25,13 +28,6 @@ However, in some situations this is not applicable, usually when data are imbalanced or not i.i.d. (longitudinal, time-series) and tuning requires custom resampling strategies (blocked design, stratification). } -\section{Custom mlr3 defaults}{ - -\itemize{ -\item \code{family} The default is set to \code{"cox"}. -} -} - \section{Dictionary}{ This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_learners} or with the associated sugar function \code{\link[=lrn]{lrn()}}: diff --git a/man/mlr_learners_surv.mboost.Rd b/man/mlr_learners_surv.mboost.Rd index e5f1e6410..fc0b9c1ac 100644 --- a/man/mlr_learners_surv.mboost.Rd +++ b/man/mlr_learners_surv.mboost.Rd @@ -6,7 +6,7 @@ \title{Boosted Generalized Additive Survival Learner} \description{ Model-based boosting for survival analysis. -Calls \code{\link[mboost:mboost]{mboost::mboost()}} from \CRANpkg{mboost}. +Calls \code{\link[mboost:gamboost]{mboost::mboost()}} from \CRANpkg{mboost}. } \details{ \code{distr} prediction made by \code{\link[mboost:survFit]{mboost::survFit()}}. @@ -131,7 +131,7 @@ Named \code{numeric()}. \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-LearnerSurvMBoost-selected_features}{}}} \subsection{Method \code{selected_features()}}{ -Selected features are extracted with the function \code{\link[mboost:variable.names.mboost]{mboost::variable.names.mboost()}}, with +Selected features are extracted with the function \code{\link[mboost:methods]{mboost::variable.names.mboost()}}, with \code{used.only = TRUE}. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{LearnerSurvMBoost$selected_features()}\if{html}{\out{
}} diff --git a/man/mlr_learners_surv.obliqueRSF.Rd b/man/mlr_learners_surv.obliqueRSF.Rd index ea974c7b1..24c45e68e 100644 --- a/man/mlr_learners_surv.obliqueRSF.Rd +++ b/man/mlr_learners_surv.obliqueRSF.Rd @@ -52,7 +52,7 @@ lrn("surv.obliqueRSF") } } -\section{Initial parameter values}{ +\section{Custom mlr3 parameters}{ \itemize{ \item \code{mtry}: @@ -64,15 +64,10 @@ Note that \code{mtry} and \code{mtry_ratio} are mutually exclusive. } } -\section{Custom mlr3 defaults}{ +\section{Initial parameter values}{ \itemize{ -\item \code{verbose}: -\itemize{ -\item Actual default: \code{TRUE} -\item Adjusted default: \code{FALSE} -\item Reason for change: mlr3 already has it's own verbose set to \code{TRUE} by default -} +\item \code{verbose} is initialized to \code{FALSE} } } diff --git a/man/mlr_learners_surv.ranger.Rd b/man/mlr_learners_surv.ranger.Rd index 84a941e35..91392bc16 100644 --- a/man/mlr_learners_surv.ranger.Rd +++ b/man/mlr_learners_surv.ranger.Rd @@ -18,17 +18,10 @@ as \code{mtry = max(ceiling(mtry.ratio * n_features), 1)}. Note that \code{mtry} and \code{mtry.ratio} are mutually exclusive. } } -} -\section{Custom mlr3 defaults}{ \itemize{ -\item \code{num.threads}: -\itemize{ -\item Actual default: \code{NULL}, triggering auto-detection of the number of CPUs. -\item Adjusted value: 1. -\item Reason for change: Conflicting with parallelization via \CRANpkg{future}. -} +\item \code{num.threads} is initialized to 1 to avoid conflicts with parallelization via \CRANpkg{future}. } } diff --git a/man/mlr_learners_surv.rfsrc.Rd b/man/mlr_learners_surv.rfsrc.Rd index 2f093af16..a378ce453 100644 --- a/man/mlr_learners_surv.rfsrc.Rd +++ b/man/mlr_learners_surv.rfsrc.Rd @@ -80,18 +80,7 @@ lrn("surv.rfsrc") \section{Initial parameter values}{ \itemize{ -\item \code{mtry}: -\itemize{ -\item This hyperparameter can alternatively be set via the added hyperparameter \code{mtry.ratio} -as \code{mtry = max(ceiling(mtry.ratio * n_features), 1)}. -Note that \code{mtry} and \code{mtry.ratio} are mutually exclusive. -} -\item \code{sampsize}: -\itemize{ -\item This hyperparameter can alternatively be set via the added hyperparameter \code{sampsize.ratio} -as \code{sampsize = max(ceiling(sampsize.ratio * n_obs), 1)}. -Note that \code{sampsize} and \code{sampsize.ratio} are mutually exclusive. -} +\item \code{cores} is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. } } diff --git a/man/mlr_learners_surv.xgboost.Rd b/man/mlr_learners_surv.xgboost.Rd index 2d845e640..1953e93d4 100644 --- a/man/mlr_learners_surv.xgboost.Rd +++ b/man/mlr_learners_surv.xgboost.Rd @@ -13,35 +13,13 @@ To compute on GPUs, you first need to compile \CRANpkg{xgboost} yourself and lin against CUDA. See \url{https://xgboost.readthedocs.io/en/stable/build.html#building-with-gpu-support}. } -\section{Custom mlr3 defaults}{ +\section{Initial parameter values}{ \itemize{ -\item \code{nrounds}: -\itemize{ -\item Actual default: no default. -\item Adjusted default: 1. -\item Reason for change: Without a default construction of the learner -would error. Just setting a nonsense default to workaround this. -\code{nrounds} needs to be tuned by the user. -} -\item \code{nthread}: -\itemize{ -\item Actual value: Undefined, triggering auto-detection of the number of CPUs. -\item Adjusted value: 1. -\item Reason for change: Conflicting with parallelization via \CRANpkg{future}. -} -\item \code{verbose}: -\itemize{ -\item Actual default: 1. -\item Adjusted default: 0. -\item Reason for change: Reduce verbosity. -} -\item \code{objective}: -\itemize{ -\item Actual default: \code{reg:squarederror}. -\item Adjusted default: \code{survival:cox}. -\item Reason for change: Changed to a survival objective. -} +\item \code{nrounds} is initialized to 1. +\item \code{nthread} is initialized to 1 to avoid conflicts with parallelization via \CRANpkg{future}. +\item \code{verbose} is initialized to 0. +\item \code{objective} is initialized to \code{survival:cox} for survival analysis. } } From 3f8e2d079e70880db569c3dbd30b943c0b8bea2f Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 21 Aug 2023 13:54:28 +0200 Subject: [PATCH 02/17] fix workflow --- .github/workflows/rcmdcheck.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/rcmdcheck.yml b/.github/workflows/rcmdcheck.yml index 429596ee6..b373e8a71 100644 --- a/.github/workflows/rcmdcheck.yml +++ b/.github/workflows/rcmdcheck.yml @@ -54,6 +54,9 @@ jobs: with: limit-access-to-actor: true + - name: Install venv + run: sudo apt-get install python3-venv + - name: Install Python run: | pak::pkg_install('rstudio/reticulate') From 757ddab7c7e561b79e359b407f93ec775d2592dc Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 21 Aug 2023 17:24:43 +0200 Subject: [PATCH 03/17] fix gh actions --- .github/workflows/rcmdcheck.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rcmdcheck.yml b/.github/workflows/rcmdcheck.yml index b373e8a71..35482a2e2 100644 --- a/.github/workflows/rcmdcheck.yml +++ b/.github/workflows/rcmdcheck.yml @@ -54,13 +54,12 @@ jobs: with: limit-access-to-actor: true - - name: Install venv - run: sudo apt-get install python3-venv - - name: Install Python run: | pak::pkg_install('rstudio/reticulate') + reticulate:: reticulate::install_miniconda() + reticulate::py_install('venv') install.packages('keras') keras::install_keras(extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-hub', 'tabnet')) reticulate::py_install(c('torch', 'pycox'), pip = TRUE) From 05e67ea531461c336c7b05d514bc861043bf4c5d Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Tue, 22 Aug 2023 10:41:26 +0200 Subject: [PATCH 04/17] typo --- .github/workflows/rcmdcheck.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/rcmdcheck.yml b/.github/workflows/rcmdcheck.yml index 35482a2e2..03b078740 100644 --- a/.github/workflows/rcmdcheck.yml +++ b/.github/workflows/rcmdcheck.yml @@ -57,7 +57,6 @@ jobs: - name: Install Python run: | pak::pkg_install('rstudio/reticulate') - reticulate:: reticulate::install_miniconda() reticulate::py_install('venv') install.packages('keras') From 150e08b2513ec3139113c8a5c2147b025a12e572 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Thu, 24 Aug 2023 13:28:34 +0200 Subject: [PATCH 05/17] ... --- .github/workflows/rcmdcheck.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/rcmdcheck.yml b/.github/workflows/rcmdcheck.yml index 03b078740..429596ee6 100644 --- a/.github/workflows/rcmdcheck.yml +++ b/.github/workflows/rcmdcheck.yml @@ -58,7 +58,6 @@ jobs: run: | pak::pkg_install('rstudio/reticulate') reticulate::install_miniconda() - reticulate::py_install('venv') install.packages('keras') keras::install_keras(extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-hub', 'tabnet')) reticulate::py_install(c('torch', 'pycox'), pip = TRUE) From 0a0d56619ba57405238d08f9f447038a722a0184 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Fri, 25 Aug 2023 12:51:22 +0200 Subject: [PATCH 06/17] try and fix workflow --- .github/workflows/rcmdcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rcmdcheck.yml b/.github/workflows/rcmdcheck.yml index 429596ee6..3c96f9672 100644 --- a/.github/workflows/rcmdcheck.yml +++ b/.github/workflows/rcmdcheck.yml @@ -59,7 +59,7 @@ jobs: pak::pkg_install('rstudio/reticulate') reticulate::install_miniconda() install.packages('keras') - keras::install_keras(extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-hub', 'tabnet')) + keras::install_keras(extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-hub', 'tabnet'), method = "auto", conda = "auto")) reticulate::py_install(c('torch', 'pycox'), pip = TRUE) shell: Rscript {0} From f4732e8d91b4ef78f87c37f9dd7225f190e88221 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Fri, 25 Aug 2023 15:16:29 +0200 Subject: [PATCH 07/17] typo --- .github/workflows/rcmdcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rcmdcheck.yml b/.github/workflows/rcmdcheck.yml index 3c96f9672..bc9357011 100644 --- a/.github/workflows/rcmdcheck.yml +++ b/.github/workflows/rcmdcheck.yml @@ -59,7 +59,7 @@ jobs: pak::pkg_install('rstudio/reticulate') reticulate::install_miniconda() install.packages('keras') - keras::install_keras(extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-hub', 'tabnet'), method = "auto", conda = "auto")) + keras::install_keras(extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-hub', 'tabnet'), method = "auto", conda = "auto") reticulate::py_install(c('torch', 'pycox'), pip = TRUE) shell: Rscript {0} From c27f4c6c385f95f01e6b73e43fbe898ad1504f39 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Tue, 29 Aug 2023 10:07:26 +0200 Subject: [PATCH 08/17] try to fix ci --- .github/workflows/rcmdcheck.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rcmdcheck.yml b/.github/workflows/rcmdcheck.yml index bc9357011..7e48b457a 100644 --- a/.github/workflows/rcmdcheck.yml +++ b/.github/workflows/rcmdcheck.yml @@ -56,10 +56,11 @@ jobs: - name: Install Python run: | - pak::pkg_install('rstudio/reticulate') + pak::pkg_install('reticulate') reticulate::install_miniconda() + reticulate::use_condaenv('r-reticulate') install.packages('keras') - keras::install_keras(extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-hub', 'tabnet'), method = "auto", conda = "auto") + keras::install_keras(extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-hub', 'tabnet'), method = "conda") reticulate::py_install(c('torch', 'pycox'), pip = TRUE) shell: Rscript {0} From 5832cbfd6643247cf67db97da9d41538f71d08ad Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Tue, 29 Aug 2023 11:50:22 +0200 Subject: [PATCH 09/17] don't use pip --- .github/workflows/rcmdcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rcmdcheck.yml b/.github/workflows/rcmdcheck.yml index 7e48b457a..d0f0b83e4 100644 --- a/.github/workflows/rcmdcheck.yml +++ b/.github/workflows/rcmdcheck.yml @@ -61,7 +61,7 @@ jobs: reticulate::use_condaenv('r-reticulate') install.packages('keras') keras::install_keras(extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-hub', 'tabnet'), method = "conda") - reticulate::py_install(c('torch', 'pycox'), pip = TRUE) + reticulate::py_install(c('torch', 'pycox'), method = "conda") shell: Rscript {0} - uses: r-lib/actions/check-r-package@v2 From efa5052988253f9b987eb75013e93e6eff6cd81c Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Tue, 29 Aug 2023 13:26:59 +0200 Subject: [PATCH 10/17] ... --- .github/workflows/rcmdcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rcmdcheck.yml b/.github/workflows/rcmdcheck.yml index d0f0b83e4..cbb46c094 100644 --- a/.github/workflows/rcmdcheck.yml +++ b/.github/workflows/rcmdcheck.yml @@ -61,7 +61,7 @@ jobs: reticulate::use_condaenv('r-reticulate') install.packages('keras') keras::install_keras(extra_packages = c('IPython', 'requests', 'certifi', 'urllib3', 'tensorflow-hub', 'tabnet'), method = "conda") - reticulate::py_install(c('torch', 'pycox'), method = "conda") + reticulate::py_install(c('pytorch', 'pycox'), method = "conda") shell: Rscript {0} - uses: r-lib/actions/check-r-package@v2 From e0af16e21ba4a707bc894c69292d684e0c4f730b Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Tue, 29 Aug 2023 16:13:24 +0200 Subject: [PATCH 11/17] fix rfsrc learners --- ...randomForestSRC_classif_imbalanced_rfsrc.R | 30 +++++-------- R/learner_randomForestSRC_classif_rfsrc.R | 10 +++-- R/learner_randomForestSRC_regr_rfsrc.R | 7 +-- R/learner_randomForestSRC_surv_rfsrc.R | 4 +- man/mlr_learners_classif.imbalanced_rfsrc.Rd | 45 +++++++++---------- man/mlr_learners_classif.rfsrc.Rd | 9 +--- man/mlr_learners_regr.rfsrc.Rd | 17 ++++++- man/mlr_learners_surv.rfsrc.Rd | 17 ++++++- 8 files changed, 74 insertions(+), 65 deletions(-) diff --git a/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R b/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R index 620f61ffe..6039a71cc 100644 --- a/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R +++ b/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R @@ -6,18 +6,8 @@ #' Imbalanced Random forest for classification between two classes. #' Calls [randomForestSRC::imbalanced.rfsrc()] from from \CRANpkg{randomForestSRC}. #' -#' @section Custom mlr3 parameters: -#' - `mtry`: -#' - This hyperparameter can alternatively be set via the added hyperparameter `mtry.ratio` -#' as `mtry = max(ceiling(mtry.ratio * n_features), 1)`. -#' Note that `mtry` and `mtry.ratio` are mutually exclusive. -#' - `sampsize`: -#' - This hyperparameter can alternatively be set via the added hyperparameter `sampsize.ratio` -#' as `sampsize = max(ceiling(sampsize.ratio * n_obs), 1)`. -#' Note that `sampsize` and `sampsize.ratio` are mutually exclusive. #' -#' @section Initial parameter values: -#' - `cores` is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. +#' @inheritSection mlr_learners_classif.rfsrc Custom mlr3 parameters #' #' @templateVar id classif.imbalanced_rfsrc #' @template learner @@ -98,15 +88,14 @@ LearnerClassifImbalancedRandomForestSRC = R6Class("LearnerClassifImbalancedRando do.trace = p_lgl(default = FALSE, tags = c("train", "predict")), statistics = p_lgl(default = FALSE, tags = c("train", "predict")), get.tree = p_uty(tags = "predict"), - outcome = p_fct( - default = "train", levels = c("train", "test"), - tags = "predict"), - ptn.count = p_int(default = 0L, lower = 0L, tags = "predict"), - cores = p_int(default = 1L, lower = 1L, tags = c("train", "predict", "threads")), - save.memory = p_lgl(default = FALSE, tags = "train"), + outcome = p_fct( + default = "train", levels = c("train", "test"), + tags = "predict"), + ptn.count = p_int(default = 0L, lower = 0L, tags = "predict"), + cores = p_int(default = 1L, lower = 1L, tags = c("train", "predict", "threads")), + save.memory = p_lgl(default = FALSE, tags = "train"), perf.type = p_fct(levels = c("gmean", "misclass", "brier", "none"), tags = "train") # nolint ) - ps$values = list(cores = 1L) super$initialize( id = "classif.imbalanced_rfsrc", @@ -134,7 +123,7 @@ LearnerClassifImbalancedRandomForestSRC = R6Class("LearnerClassifImbalancedRando #' @return `character()`. selected_features = function() { if (is.null(self$model$var.used) & !is.null(self$model)) { - stopf("Set 'var.used' to one of: {'all.trees', 'by.tree'}.") + sndtopf("Set 'var.used' to one of: {'all.trees', 'by.tree'}.") } names(self$model$var.used) @@ -152,6 +141,8 @@ LearnerClassifImbalancedRandomForestSRC = R6Class("LearnerClassifImbalancedRando pv = self$param_set$get_values(tags = "train") pv = convert_ratio(pv, "mtry", "mtry.ratio", length(task$feature_names)) pv = convert_ratio(pv, "sampsize", "sampsize.ratio", task$nrow) + cores = pv$cores %??% 1L + pv$cores = NULL if ("weights" %in% task$properties) { pv$case.wt = as.numeric(task$weights$weight) # nolint @@ -165,6 +156,7 @@ LearnerClassifImbalancedRandomForestSRC = R6Class("LearnerClassifImbalancedRando newdata = data.table::setDF(ordered_features(task, self)) pars = self$param_set$get_values(tags = "predict") cores = pars$cores %??% 1L + pars$cores = NULL pred = invoke(predict, object = self$model, newdata = newdata, diff --git a/R/learner_randomForestSRC_classif_rfsrc.R b/R/learner_randomForestSRC_classif_rfsrc.R index 41eb1c710..7ca052c2d 100644 --- a/R/learner_randomForestSRC_classif_rfsrc.R +++ b/R/learner_randomForestSRC_classif_rfsrc.R @@ -18,8 +18,8 @@ #' - This hyperparameter can alternatively be set via the added hyperparameter `sampsize.ratio` #' as `sampsize = max(ceiling(sampsize.ratio * n_obs), 1)`. #' Note that `sampsize` and `sampsize.ratio` are mutually exclusive. -#' @section Initial parameter values: -#' - `cores` is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. +#' - `cores`: +#' This value is set as the option `rf.cores` during training and is set to 1 by default. #' #' @references #' `r format_bib("breiman_2001")` @@ -99,8 +99,6 @@ LearnerClassifRandomForestSRC = R6Class("LearnerClassifRandomForestSRC", perf.type = p_fct(levels = c("gmean", "misclass", "brier", "none"), tags = "train") # nolint ) - ps$values = list(cores = 1) - super$initialize( id = "classif.rfsrc", packages = c("mlr3extralearners", "randomForestSRC"), @@ -154,6 +152,8 @@ LearnerClassifRandomForestSRC = R6Class("LearnerClassifRandomForestSRC", pv = self$param_set$get_values(tags = "train") pv = convert_ratio(pv, "mtry", "mtry.ratio", length(task$feature_names)) pv = convert_ratio(pv, "sampsize", "sampsize.ratio", task$nrow) + cores = pv$cores %??% 1L + pv$cores = NULL if ("weights" %in% task$properties) { pv$case.wt = as.numeric(task$weights$weight) # nolint @@ -168,6 +168,8 @@ LearnerClassifRandomForestSRC = R6Class("LearnerClassifRandomForestSRC", newdata = data.table::setDF(ordered_features(task, self)) pars = self$param_set$get_values(tags = "predict") cores = pars$cores %??% 1L + pars$cores = NULL + pred = invoke(predict, object = self$model, newdata = newdata, diff --git a/R/learner_randomForestSRC_regr_rfsrc.R b/R/learner_randomForestSRC_regr_rfsrc.R index a136b5ead..14b178f4c 100644 --- a/R/learner_randomForestSRC_regr_rfsrc.R +++ b/R/learner_randomForestSRC_regr_rfsrc.R @@ -9,7 +9,7 @@ #' @template learner #' @templateVar id regr.rfsrc #' -#' @inheritSection mlr_learners_classif.rfsrc Initial parameter values +#' @inheritSection mlr_learners_classif.rfsrc Custom mlr3 parameters #' #' @references #' `r format_bib("breiman_2001")` @@ -89,8 +89,6 @@ LearnerRegrRandomForestSRC = R6Class("LearnerRegrRandomForestSRC", perf.type = p_fct(levels = "none", tags = "train") ) - ps$values = list(cores = 1) - super$initialize( id = "regr.rfsrc", packages = c("mlr3extralearners", "randomForestSRC"), @@ -141,6 +139,8 @@ LearnerRegrRandomForestSRC = R6Class("LearnerRegrRandomForestSRC", pv = self$param_set$get_values(tags = "train") pv = convert_ratio(pv, "mtry", "mtry.ratio", length(task$feature_names)) pv = convert_ratio(pv, "sampsize", "sampsize.ratio", task$nrow) + cores = pv$cores %??% 1L + pv$cores = NULL if ("weights" %in% task$properties) { pv$case.wt = as.numeric(task$weights$weight) # nolint @@ -155,6 +155,7 @@ LearnerRegrRandomForestSRC = R6Class("LearnerRegrRandomForestSRC", newdata = ordered_features(task, self) pars = self$param_set$get_values(tags = "predict") cores = pars$cores %??% 1L + pars$cores = NULL list( response = invoke(predict, diff --git a/R/learner_randomForestSRC_surv_rfsrc.R b/R/learner_randomForestSRC_surv_rfsrc.R index e46309b99..1a7643bf9 100644 --- a/R/learner_randomForestSRC_surv_rfsrc.R +++ b/R/learner_randomForestSRC_surv_rfsrc.R @@ -9,7 +9,7 @@ #' @template learner #' @templateVar id surv.rfsrc #' -#' @inheritSection mlr_learners_classif.rfsrc Initial parameter values +#' @inheritSection mlr_learners_classif.rfsrc Custom mlr3 parameters #' #' @details #' [randomForestSRC::predict.rfsrc()] returns both cumulative hazard function (chf) and @@ -100,8 +100,6 @@ delayedAssign( perf.type = p_fct(levels = "none", tags = "train") ) - ps$values = list(cores = 1) - super$initialize( id = "surv.rfsrc", packages = c("mlr3extralearners", "randomForestSRC", "pracma"), diff --git a/man/mlr_learners_classif.imbalanced_rfsrc.Rd b/man/mlr_learners_classif.imbalanced_rfsrc.Rd index ed61e1b89..5ec107b29 100644 --- a/man/mlr_learners_classif.imbalanced_rfsrc.Rd +++ b/man/mlr_learners_classif.imbalanced_rfsrc.Rd @@ -9,31 +9,6 @@ Imbalanced Random forest for classification between two classes. Calls \code{\link[randomForestSRC:imbalanced.rfsrc]{randomForestSRC::imbalanced.rfsrc()}} from from \CRANpkg{randomForestSRC}. } -\section{Custom mlr3 parameters}{ - -\itemize{ -\item \code{mtry}: -\itemize{ -\item This hyperparameter can alternatively be set via the added hyperparameter \code{mtry.ratio} -as \code{mtry = max(ceiling(mtry.ratio * n_features), 1)}. -Note that \code{mtry} and \code{mtry.ratio} are mutually exclusive. -} -\item \code{sampsize}: -\itemize{ -\item This hyperparameter can alternatively be set via the added hyperparameter \code{sampsize.ratio} -as \code{sampsize = max(ceiling(sampsize.ratio * n_obs), 1)}. -Note that \code{sampsize} and \code{sampsize.ratio} are mutually exclusive. -} -} -} - -\section{Initial parameter values}{ - -\itemize{ -\item \code{cores} is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. -} -} - \section{Dictionary}{ This \link{Learner} can be instantiated via the \link[mlr3misc:Dictionary]{dictionary} \link{mlr_learners} or with the associated sugar function \code{\link[=lrn]{lrn()}}: @@ -98,6 +73,26 @@ lrn("classif.imbalanced_rfsrc") } } +\section{Custom mlr3 parameters}{ + +\itemize{ +\item \code{mtry}: +\itemize{ +\item This hyperparameter can alternatively be set via the added hyperparameter \code{mtry.ratio} +as \code{mtry = max(ceiling(mtry.ratio * n_features), 1)}. +Note that \code{mtry} and \code{mtry.ratio} are mutually exclusive. +} +\item \code{sampsize}: +\itemize{ +\item This hyperparameter can alternatively be set via the added hyperparameter \code{sampsize.ratio} +as \code{sampsize = max(ceiling(sampsize.ratio * n_obs), 1)}. +Note that \code{sampsize} and \code{sampsize.ratio} are mutually exclusive. +} +\item \code{cores}: +This value is set as the option \code{rf.cores} during training and is set to 1 by default. +} +} + \examples{ learner = mlr3::lrn("classif.imbalanced_rfsrc") print(learner) diff --git a/man/mlr_learners_classif.rfsrc.Rd b/man/mlr_learners_classif.rfsrc.Rd index 24ba3430f..cec2d7808 100644 --- a/man/mlr_learners_classif.rfsrc.Rd +++ b/man/mlr_learners_classif.rfsrc.Rd @@ -84,13 +84,8 @@ Note that \code{mtry} and \code{mtry.ratio} are mutually exclusive. as \code{sampsize = max(ceiling(sampsize.ratio * n_obs), 1)}. Note that \code{sampsize} and \code{sampsize.ratio} are mutually exclusive. } -} -} - -\section{Initial parameter values}{ - -\itemize{ -\item \code{cores} is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. +\item \code{cores}: +This value is set as the option \code{rf.cores} during training and is set to 1 by default. } } diff --git a/man/mlr_learners_regr.rfsrc.Rd b/man/mlr_learners_regr.rfsrc.Rd index 7a5b2692b..e82f785bb 100644 --- a/man/mlr_learners_regr.rfsrc.Rd +++ b/man/mlr_learners_regr.rfsrc.Rd @@ -69,10 +69,23 @@ lrn("regr.rfsrc") } } -\section{Initial parameter values}{ +\section{Custom mlr3 parameters}{ \itemize{ -\item \code{cores} is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. +\item \code{mtry}: +\itemize{ +\item This hyperparameter can alternatively be set via the added hyperparameter \code{mtry.ratio} +as \code{mtry = max(ceiling(mtry.ratio * n_features), 1)}. +Note that \code{mtry} and \code{mtry.ratio} are mutually exclusive. +} +\item \code{sampsize}: +\itemize{ +\item This hyperparameter can alternatively be set via the added hyperparameter \code{sampsize.ratio} +as \code{sampsize = max(ceiling(sampsize.ratio * n_obs), 1)}. +Note that \code{sampsize} and \code{sampsize.ratio} are mutually exclusive. +} +\item \code{cores}: +This value is set as the option \code{rf.cores} during training and is set to 1 by default. } } diff --git a/man/mlr_learners_surv.rfsrc.Rd b/man/mlr_learners_surv.rfsrc.Rd index a378ce453..6223aa554 100644 --- a/man/mlr_learners_surv.rfsrc.Rd +++ b/man/mlr_learners_surv.rfsrc.Rd @@ -77,10 +77,23 @@ lrn("surv.rfsrc") } } -\section{Initial parameter values}{ +\section{Custom mlr3 parameters}{ \itemize{ -\item \code{cores} is initialized to 1 to avoid threading conflicts with explicit parallelization via \CRANpkg{future}. +\item \code{mtry}: +\itemize{ +\item This hyperparameter can alternatively be set via the added hyperparameter \code{mtry.ratio} +as \code{mtry = max(ceiling(mtry.ratio * n_features), 1)}. +Note that \code{mtry} and \code{mtry.ratio} are mutually exclusive. +} +\item \code{sampsize}: +\itemize{ +\item This hyperparameter can alternatively be set via the added hyperparameter \code{sampsize.ratio} +as \code{sampsize = max(ceiling(sampsize.ratio * n_obs), 1)}. +Note that \code{sampsize} and \code{sampsize.ratio} are mutually exclusive. +} +\item \code{cores}: +This value is set as the option \code{rf.cores} during training and is set to 1 by default. } } From 9e5801a1e0ad9972a4ec09ad08ca1b5a811ae0a5 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Tue, 29 Aug 2023 17:50:44 +0200 Subject: [PATCH 12/17] typo --- R/learner_randomForestSRC_classif_imbalanced_rfsrc.R | 2 +- R/learner_randomForestSRC_surv_rfsrc.R | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R b/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R index 6039a71cc..e2816f73b 100644 --- a/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R +++ b/R/learner_randomForestSRC_classif_imbalanced_rfsrc.R @@ -123,7 +123,7 @@ LearnerClassifImbalancedRandomForestSRC = R6Class("LearnerClassifImbalancedRando #' @return `character()`. selected_features = function() { if (is.null(self$model$var.used) & !is.null(self$model)) { - sndtopf("Set 'var.used' to one of: {'all.trees', 'by.tree'}.") + stopf("Set 'var.used' to one of: {'all.trees', 'by.tree'}.") } names(self$model$var.used) diff --git a/R/learner_randomForestSRC_surv_rfsrc.R b/R/learner_randomForestSRC_surv_rfsrc.R index 1a7643bf9..cc02d99ee 100644 --- a/R/learner_randomForestSRC_surv_rfsrc.R +++ b/R/learner_randomForestSRC_surv_rfsrc.R @@ -149,6 +149,8 @@ delayedAssign( pv = self$param_set$get_values(tags = "train") pv = convert_ratio(pv, "mtry", "mtry.ratio", length(task$feature_names)) pv = convert_ratio(pv, "sampsize", "sampsize.ratio", task$nrow) + cores = pv$cores %??% 1L + pv$cores = NULL if ("weights" %in% task$properties) { pv$case.wt = as.numeric(task$weights$weight) # nolint From e6cce608a93810a75dfbdf08b24be8355a4be24f Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Wed, 6 Sep 2023 12:57:26 +0200 Subject: [PATCH 13/17] fix typos --- R/learner_randomForestSRC_surv_rfsrc.R | 1 + inst/templates/learner_template.R | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/R/learner_randomForestSRC_surv_rfsrc.R b/R/learner_randomForestSRC_surv_rfsrc.R index cc02d99ee..9044eb5bd 100644 --- a/R/learner_randomForestSRC_surv_rfsrc.R +++ b/R/learner_randomForestSRC_surv_rfsrc.R @@ -169,6 +169,7 @@ delayedAssign( pars_predict$estimator = NULL pars_predict$var.used = "FALSE" cores = pars_predict$cores %??% 1L # additionaly implemented by author + pars_predict$cores = NULL p = invoke(predict, object = self$model, newdata = newdata, .args = pars_predict, .opts = list(rf.cores = cores)) diff --git a/inst/templates/learner_template.R b/inst/templates/learner_template.R index b14561e01..9a04cde40 100644 --- a/inst/templates/learner_template.R +++ b/inst/templates/learner_template.R @@ -12,9 +12,6 @@ #' @section Custom mlr3 parameters: #' FIXME: DEVIATIONS FROM UPSTREAM DEFAULTS. DELETE IF NOT APPLICABLE. #' -#' @section Custom mlr3 parameters: -#' FIXME: INITIAL VALUES FOR PARAMETERS. DELETE IF NOT APPLICABLE. -#' #' @templateVar id . #' @template learner #' From 38ab1b9d7c5af452474a0a5410976455cc893136 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Wed, 6 Sep 2023 12:57:40 +0200 Subject: [PATCH 14/17] Update R/learner_lightgbm_regr_lightgbm.R --- R/learner_lightgbm_regr_lightgbm.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/learner_lightgbm_regr_lightgbm.R b/R/learner_lightgbm_regr_lightgbm.R index a6ccf04d0..732c21137 100644 --- a/R/learner_lightgbm_regr_lightgbm.R +++ b/R/learner_lightgbm_regr_lightgbm.R @@ -16,7 +16,7 @@ #' @section Initial parameter values: #' * `num_threads`: #' * Actual default: 0L -#' * Iniital value: 1L +#' * Initital value: 1L #' * Reason for change: Prevents accidental conflicts with `future`. #' * `verbose`: #' * Actual default: 1L From 5e4287ccc77379c944b1147735452f57dd865903 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Wed, 6 Sep 2023 12:59:39 +0200 Subject: [PATCH 15/17] document --- man/mlr_learners_classif.AdaBoostM1.Rd | 2 +- man/mlr_learners_classif.IBk.Rd | 2 +- man/mlr_learners_classif.J48.Rd | 2 +- man/mlr_learners_classif.JRip.Rd | 2 +- man/mlr_learners_classif.LMT.Rd | 2 +- man/mlr_learners_classif.OneR.Rd | 2 +- man/mlr_learners_classif.PART.Rd | 2 +- man/mlr_learners_regr.IBk.Rd | 2 +- man/mlr_learners_regr.M5Rules.Rd | 2 +- man/mlr_learners_regr.lightgbm.Rd | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/man/mlr_learners_classif.AdaBoostM1.Rd b/man/mlr_learners_classif.AdaBoostM1.Rd index a2c5ddbfb..6ef337e1f 100644 --- a/man/mlr_learners_classif.AdaBoostM1.Rd +++ b/man/mlr_learners_classif.AdaBoostM1.Rd @@ -6,7 +6,7 @@ \title{Classification AdaBoostM1 Learner} \description{ Adaptive boosting algorithm for classification. -Calls \code{\link[RWeka:AdaBoostM1]{RWeka::AdaBoostM1()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:Weka_classifier_meta]{RWeka::AdaBoostM1()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.IBk.Rd b/man/mlr_learners_classif.IBk.Rd index 85b51e776..653c838db 100644 --- a/man/mlr_learners_classif.IBk.Rd +++ b/man/mlr_learners_classif.IBk.Rd @@ -6,7 +6,7 @@ \title{Classification IBk Learner} \description{ Instance based algorithm: K-nearest neighbours regression. -Calls \code{\link[RWeka:IBk]{RWeka::IBk()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:Weka_classifier_lazy]{RWeka::IBk()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.J48.Rd b/man/mlr_learners_classif.J48.Rd index 6c830fd7d..fc6152932 100644 --- a/man/mlr_learners_classif.J48.Rd +++ b/man/mlr_learners_classif.J48.Rd @@ -6,7 +6,7 @@ \title{Classification J48 Learner} \description{ Decision tree algorithm. -Calls \code{\link[RWeka:IBk]{RWeka::IBk()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:Weka_classifier_lazy]{RWeka::IBk()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.JRip.Rd b/man/mlr_learners_classif.JRip.Rd index 122e7539e..0f66d459b 100644 --- a/man/mlr_learners_classif.JRip.Rd +++ b/man/mlr_learners_classif.JRip.Rd @@ -6,7 +6,7 @@ \title{Classification JRip Learner} \description{ Repeated Incremental Pruning to Produce Error Reduction. -Calls \code{\link[RWeka:JRip]{RWeka::JRip()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:Weka_classifier_rules]{RWeka::JRip()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.LMT.Rd b/man/mlr_learners_classif.LMT.Rd index 18d152502..521efa587 100644 --- a/man/mlr_learners_classif.LMT.Rd +++ b/man/mlr_learners_classif.LMT.Rd @@ -6,7 +6,7 @@ \title{Classification Logistic Model Trees Learner} \description{ Classification tree with logistic regression models at the leaves. -Calls \code{\link[RWeka:LMT]{RWeka::LMT()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:Weka_classifier_trees]{RWeka::LMT()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.OneR.Rd b/man/mlr_learners_classif.OneR.Rd index 82931e024..28ef298ea 100644 --- a/man/mlr_learners_classif.OneR.Rd +++ b/man/mlr_learners_classif.OneR.Rd @@ -6,7 +6,7 @@ \title{Classification OneR Learner} \description{ One Rule classification algorithm that yields an extremely simple model. -Calls \code{\link[RWeka:OneR]{RWeka::OneR()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:Weka_classifier_rules]{RWeka::OneR()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_classif.PART.Rd b/man/mlr_learners_classif.PART.Rd index 03692d2da..efa791776 100644 --- a/man/mlr_learners_classif.PART.Rd +++ b/man/mlr_learners_classif.PART.Rd @@ -6,7 +6,7 @@ \title{Classification PART Learner} \description{ Regression partition tree. -Calls \code{\link[RWeka:PART]{RWeka::PART()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:Weka_classifier_rules]{RWeka::PART()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_regr.IBk.Rd b/man/mlr_learners_regr.IBk.Rd index 812712172..f69e16c73 100644 --- a/man/mlr_learners_regr.IBk.Rd +++ b/man/mlr_learners_regr.IBk.Rd @@ -6,7 +6,7 @@ \title{Regression IBk Learner} \description{ Instance based algorithm: K-nearest neighbours regression. -Calls \code{\link[RWeka:IBk]{RWeka::IBk()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:Weka_classifier_lazy]{RWeka::IBk()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_regr.M5Rules.Rd b/man/mlr_learners_regr.M5Rules.Rd index 53cb28ae2..c2ce92e42 100644 --- a/man/mlr_learners_regr.M5Rules.Rd +++ b/man/mlr_learners_regr.M5Rules.Rd @@ -7,7 +7,7 @@ \description{ Algorithm for inducing \href{https://en.wikipedia.org/wiki/Decision_list}{decision lists} from model trees. -Calls \code{\link[RWeka:M5Rules]{RWeka::M5Rules()}} from \CRANpkg{RWeka}. +Calls \code{\link[RWeka:Weka_classifier_rules]{RWeka::M5Rules()}} from \CRANpkg{RWeka}. } \section{Dictionary}{ diff --git a/man/mlr_learners_regr.lightgbm.Rd b/man/mlr_learners_regr.lightgbm.Rd index 0839423f8..adda315f0 100644 --- a/man/mlr_learners_regr.lightgbm.Rd +++ b/man/mlr_learners_regr.lightgbm.Rd @@ -148,7 +148,7 @@ lrn("regr.lightgbm") \item \code{num_threads}: \itemize{ \item Actual default: 0L -\item Iniital value: 1L +\item Initital value: 1L \item Reason for change: Prevents accidental conflicts with \code{future}. } \item \code{verbose}: From d1ae50f9ea82c832b94998c1dfaf7752a42227f9 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Wed, 6 Sep 2023 14:11:02 +0200 Subject: [PATCH 16/17] fix parameter tests --- tests/testthat/test_paramtest_lightgbm_classif_lightgbm.R | 5 ++++- tests/testthat/test_paramtest_lightgbm_regr_lightgbm.R | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test_paramtest_lightgbm_classif_lightgbm.R b/tests/testthat/test_paramtest_lightgbm_classif_lightgbm.R index 0b41a4aa1..35e8dc43c 100644 --- a/tests/testthat/test_paramtest_lightgbm_classif_lightgbm.R +++ b/tests/testthat/test_paramtest_lightgbm_classif_lightgbm.R @@ -80,7 +80,10 @@ test_that("paramtest classif.lightgbm train", { "valids", # handled internally "obj", # alias for objective "colnames", # we don't want to allow overwriting any names - "init_model" # handled internally via hotstarting + "init_model", # handled internally via hotstarting + + + "lambdarank_position_bias_regularization" # only for lambdarank ) diff --git a/tests/testthat/test_paramtest_lightgbm_regr_lightgbm.R b/tests/testthat/test_paramtest_lightgbm_regr_lightgbm.R index 8d6987717..16855f199 100644 --- a/tests/testthat/test_paramtest_lightgbm_regr_lightgbm.R +++ b/tests/testthat/test_paramtest_lightgbm_regr_lightgbm.R @@ -85,7 +85,9 @@ test_that("paramtest regr.lightgbm train", { "valids", # handled internally "obj", # alias for objective "colnames", # we don't want to allow overwriting any names - "init_model" # handled internally via hotstarting + "init_model", # handled internally via hotstarting + + "lambdarank_position_bias_regularization" # only for lambdarank ) From 618626d71a95391f2fd4f60b1c25306a71be7dad Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Mon, 11 Sep 2023 16:41:18 +0200 Subject: [PATCH 17/17] style --- R/learner_dbarts_regr_bart.R | 2 +- R/learner_lightgbm_regr_lightgbm.R | 2 +- R/learner_mboost_regr_gamboost.R | 2 +- R/learner_mboost_regr_glmboost.R | 2 +- R/learner_randomForest_regr_randomForest.R | 2 +- R/learner_rsm_regr_rsm.R | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/learner_dbarts_regr_bart.R b/R/learner_dbarts_regr_bart.R index 5b56a221b..748be7083 100644 --- a/R/learner_dbarts_regr_bart.R +++ b/R/learner_dbarts_regr_bart.R @@ -68,7 +68,7 @@ LearnerRegrBart = R6Class("LearnerRegrBart", packages = c("mlr3extralearners", "dbarts"), feature_types = c("integer", "numeric", "factor", "ordered"), # TODO: add "se" to the list of predict types. - predict_types = c("response"), + predict_types = "response", param_set = ps, properties = c("weights"), man = "mlr3extralearners::mlr_learners_regr.bart", diff --git a/R/learner_lightgbm_regr_lightgbm.R b/R/learner_lightgbm_regr_lightgbm.R index 732c21137..ad865dccc 100644 --- a/R/learner_lightgbm_regr_lightgbm.R +++ b/R/learner_lightgbm_regr_lightgbm.R @@ -198,7 +198,7 @@ LearnerRegrLightGBM = R6Class("LearnerRegrLightGBM", id = "regr.lightgbm", packages = c("mlr3extralearners", "lightgbm"), feature_types = c("numeric", "integer", "logical", "factor"), - predict_types = c("response"), + predict_types = "response", param_set = ps, properties = c("weights", "missings", "importance", "hotstart_forward"), man = "mlr3extralearners::mlr_learners_regr.lightgbm", diff --git a/R/learner_mboost_regr_gamboost.R b/R/learner_mboost_regr_gamboost.R index bbed36da6..d115f3da0 100644 --- a/R/learner_mboost_regr_gamboost.R +++ b/R/learner_mboost_regr_gamboost.R @@ -52,7 +52,7 @@ LearnerRegrGAMBoost = R6Class("LearnerRegrGAMBoost", id = "regr.gamboost", packages = c("mlr3extralearners", "mboost"), feature_types = c("integer", "numeric", "factor", "ordered"), - predict_types = c("response"), + predict_types = "response", param_set = ps, properties = "weights", man = "mlr3extralearners::mlr_learners_regr.gamboost", diff --git a/R/learner_mboost_regr_glmboost.R b/R/learner_mboost_regr_glmboost.R index a67b02c20..3e3ff725d 100644 --- a/R/learner_mboost_regr_glmboost.R +++ b/R/learner_mboost_regr_glmboost.R @@ -50,7 +50,7 @@ LearnerRegrGLMBoost = R6Class("LearnerRegrGLMBoost", id = "regr.glmboost", packages = c("mlr3extralearners", "mboost"), feature_types = c("integer", "numeric", "factor", "ordered"), - predict_types = c("response"), + predict_types = "response", param_set = ps, properties = "weights", man = "mlr3extralearners::mlr_learners_regr.glmboost", diff --git a/R/learner_randomForest_regr_randomForest.R b/R/learner_randomForest_regr_randomForest.R index 558043ab3..d6fa2455e 100644 --- a/R/learner_randomForest_regr_randomForest.R +++ b/R/learner_randomForest_regr_randomForest.R @@ -52,7 +52,7 @@ LearnerRegrRandomForest = R6Class("LearnerRegrRandomForest", id = "regr.randomForest", packages = c("mlr3extralearners", "randomForest"), feature_types = c("integer", "numeric", "factor", "ordered", "logical"), - predict_types = c("response"), + predict_types = "response", param_set = ps, properties = c("weights", "importance", "oob_error"), man = "mlr3extralearners::mlr_learners_regr.randomForest", diff --git a/R/learner_rsm_regr_rsm.R b/R/learner_rsm_regr_rsm.R index 6f9e7d5a3..cd7f5898b 100644 --- a/R/learner_rsm_regr_rsm.R +++ b/R/learner_rsm_regr_rsm.R @@ -36,7 +36,7 @@ LearnerRegrRSM = R6Class("LearnerRegrRSM", id = "regr.rsm", packages = "rsm", feature_types = c("integer", "numeric", "factor", "ordered"), - predict_types = c("response"), + predict_types = "response", param_set = param_set, properties = character(0), man = "mlr3extralearners::mlr_learners_regr.rsm",