diff --git a/R/HotstartStack.R b/R/HotstartStack.R index cb46bd167..a582d70a5 100644 --- a/R/HotstartStack.R +++ b/R/HotstartStack.R @@ -138,7 +138,7 @@ HotstartStack = R6Class("HotstartStack", hotstart_id = learner$param_set$ids(tags = "hotstart") set(self$stack, j = "cost", value = NA_real_) - cost = self$stack[list(.task_hash, .learner_hash), "cost" := map_dbl(get("start_learner"), function(l) calculate_cost(l, learner, hotstart_id)) , on = c("task_hash", "learner_hash") + cost = self$stack[list(.task_hash, .learner_hash), "cost" := map_dbl(get("start_learner"), function(l) calculate_cost(l, learner, hotstart_id)), on = c("task_hash", "learner_hash") ][, get("cost")] self$stack[, "cost" := NULL] cost diff --git a/R/Learner.R b/R/Learner.R index 9a9205fec..060cfdd26 100644 --- a/R/Learner.R +++ b/R/Learner.R @@ -275,7 +275,7 @@ Learner = R6Class("Learner", pred_typs = replace(self$predict_types, self$predict_types == self$predict_type, paste0("[", self$predict_type, "]")) encapsulation = self$encapsulation[[1L]] - fallback = if (encapsulation != 'none') class(self$fallback)[[1L]] else "-" + fallback = if (encapsulation != "none") class(self$fallback)[[1L]] else "-" cat_cli({ cli_li("Predict Types: {pred_typs}") diff --git a/R/LearnerClassifDebug.R b/R/LearnerClassifDebug.R index f75b2f15f..cd3ee39cd 100644 --- a/R/LearnerClassifDebug.R +++ b/R/LearnerClassifDebug.R @@ -196,14 +196,11 @@ LearnerClassifDebug = R6Class("LearnerClassifDebug", inherit = LearnerClassif, } model = list( - response = as.character(sample(task$truth(), 1L, prob = private$.get_weights(task))), - pid = Sys.getpid(), - id = UUIDgenerate(), - random_number = sample(100000, 1), - iter = if (isTRUE(pv$early_stopping)) - sample(pv$iter %??% 1L, 1L) - else - pv$iter %??% 1L + response = as.character(sample(task$truth(), 1L, prob = private$.get_weights(task))), + pid = Sys.getpid(), + id = UUIDgenerate(), + random_number = sample(100000, 1), + iter = if (isTRUE(pv$early_stopping)) sample(pv$iter %??% 1L, 1L) else pv$iter %??% 1L ) if (!is.null(valid_truth)) { diff --git a/R/LearnerRegrDebug.R b/R/LearnerRegrDebug.R index f9a8fda1b..dbfb23de5 100644 --- a/R/LearnerRegrDebug.R +++ b/R/LearnerRegrDebug.R @@ -64,7 +64,7 @@ LearnerRegrDebug = R6Class("LearnerRegrDebug", inherit = LearnerRegr, #' @return Named `numeric()`. importance = function() { if (is.null(self$model)) { - error_input("No model stored") + error_input("No model stored") } fns = self$state$feature_names set_names(rep(0, length(fns)), fns) diff --git a/R/MeasureRegrPinball.R b/R/MeasureRegrPinball.R index 2e454a8b9..0de72b8e8 100644 --- a/R/MeasureRegrPinball.R +++ b/R/MeasureRegrPinball.R @@ -28,8 +28,8 @@ MeasureRegrPinball = R6Class("MeasureRegrPinball", inherit = MeasureRegr, public = list( - #' @description - #' Creates a new instance of this [R6][R6::R6Class] class. + #' @description + #' Creates a new instance of this [R6][R6::R6Class] class. initialize = function(alpha = 0.5) { param_set = ps(alpha = p_dbl(lower = 0, upper = 1)) param_set$set_values(alpha = alpha) diff --git a/R/MeasureRegrRQR.R b/R/MeasureRegrRQR.R index 57891b396..6895be5dc 100644 --- a/R/MeasureRegrRQR.R +++ b/R/MeasureRegrRQR.R @@ -78,7 +78,7 @@ MeasureRegrRQR = R6Class("MeasureRQR", truth = prediction$truth, response = prediction$data$quantiles[, which(probs == alpha)], alpha = alpha - ) + ) ) denominator = sum( @@ -89,8 +89,8 @@ MeasureRegrRQR = R6Class("MeasureRQR", ) ) - 1 - (numerator / denominator) - } + 1 - (numerator / denominator) + } ) ) diff --git a/R/PredictionClassif.R b/R/PredictionClassif.R index 5efaca1d4..5ab21b366 100644 --- a/R/PredictionClassif.R +++ b/R/PredictionClassif.R @@ -104,7 +104,7 @@ PredictionClassif = R6Class("PredictionClassif", inherit = Prediction, weights = NULL, check = TRUE, extra = NULL - ) { + ) { pdata = new_prediction_data( list(row_ids = row_ids, truth = truth, response = response, prob = prob, weights = weights, extra = extra), diff --git a/R/PredictionRegr.R b/R/PredictionRegr.R index 09cbb529b..e63386158 100644 --- a/R/PredictionRegr.R +++ b/R/PredictionRegr.R @@ -65,7 +65,7 @@ PredictionRegr = R6Class("PredictionRegr", inherit = Prediction, weights = NULL, check = TRUE, extra = NULL - ) { + ) { pdata = new_prediction_data( list(row_ids = row_ids, truth = truth, response = response, se = se, quantiles = quantiles, distr = distr, weights = weights, extra = extra), task_type = "regr" diff --git a/R/as_result_data.R b/R/as_result_data.R index 71e20699d..84efa083b 100644 --- a/R/as_result_data.R +++ b/R/as_result_data.R @@ -50,7 +50,7 @@ as_result_data = function( learner_states = NULL, data_extra = NULL, store_backends = TRUE - ) { +) { assert_task(task) assert_learners(learners, task = task) assert_resampling(resampling, instantiated = TRUE) diff --git a/R/worker.R b/R/worker.R index 021eb272d..71143f916 100644 --- a/R/worker.R +++ b/R/worker.R @@ -322,7 +322,7 @@ workhorse = function( is_sequential = TRUE, unmarshal = TRUE, callbacks = NULL - ) { +) { ctx = ContextResample$new(task, learner, resampling, iteration) call_back("on_resample_begin", callbacks, ctx) @@ -577,7 +577,7 @@ create_internal_valid_task = function(validate, task, test_row_ids, prev_valid, return(task) } - return(task) + return(task) } # validate is numeric