Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/HotstartStack.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion R/Learner.R
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
13 changes: 5 additions & 8 deletions R/LearnerClassifDebug.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion R/LearnerRegrDebug.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions R/MeasureRegrPinball.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions R/MeasureRegrRQR.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ MeasureRegrRQR = R6Class("MeasureRQR",
truth = prediction$truth,
response = prediction$data$quantiles[, which(probs == alpha)],
alpha = alpha
)
)
)

denominator = sum(
Expand All @@ -89,8 +89,8 @@ MeasureRegrRQR = R6Class("MeasureRQR",
)
)

1 - (numerator / denominator)
}
1 - (numerator / denominator)
}
)
)

Expand Down
2 changes: 1 addition & 1 deletion R/PredictionClassif.R
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion R/PredictionRegr.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion R/as_result_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions R/worker.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down