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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@
^.cursor$
^local_attic$
^tests/testthat/_object_snapshots$
^.claude$
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: mlr3
Title: Machine Learning in R - Next Generation
Version: 1.3.0.9000
Version: 1.4.0
Authors@R:
c(
person("Michel", "Lang", , "michellang@gmail.com", role = "aut",
Expand Down
9 changes: 8 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# mlr3 (development version)
# mlr3 1.4.0

* feat: Add `$native_model` active binding to `Learner` to access the model from the upstream package.
* feat: Learner store the condition of warnings and errors in the `log` field.
* feat: No supervised tasks with missing target values are allowed anymore.
* refactor: Validate the input of fields.
* fix: Assert list input in `assert_learners`, `assert_tasks`, `assert_measures` and `assert_resamplings`.
* fix: `convert_task` converts the internal validation task now.
* fix: disable printing of class ratios for large tasks.
* fix: Make quantiles resettable.

# mlr3 1.3.0

Expand Down
3 changes: 2 additions & 1 deletion R/as_task_classif.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ as_task_classif.data.frame = function(x, target, id = deparse1(substitute(x)), p
}

if (anyMissing(x[[target]])) {
error_input("Target column '%s' must not contain missing values", target)
messagef("Target column '%s' contains missing values. This will be an error in the future.", target)
# error_input("Target column '%s' must not contain missing values", target)
}

y = x[[target]]
Expand Down
3 changes: 2 additions & 1 deletion R/as_task_regr.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ as_task_regr.data.frame = function(x, target, id = deparse1(substitute(x)), labe
}

if (anyMissing(x[[target]])) {
error_input("Target column '%s' must not contain missing values", target)
messagef("Target column '%s' contains missing values. This will be an error in the future.", target)
# error_input("Target column '%s' must not contain missing values", target)
}

TaskRegr$new(id = id, backend = x, target = target, label = label)
Expand Down
2 changes: 1 addition & 1 deletion R/mlr_reflections.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @format [environment].
#' @description
#' Environment which stores various information to allow objects to examine and introspect their structure and properties
#' (c.f. [Reflections](https://www.wikiwand.com/en/Reflection_(computer_programming))).
#' (c.f. [Reflections](https://en.wikipedia.org/wiki/Reflective_programming)).
#'
#' This environment be modified by third-party packages, e.g. by adding information about new task types
#' or by extending the set of allowed feature types.
Expand Down
2 changes: 1 addition & 1 deletion man/mlr_reflections.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified tests/testthat/_object_snapshots/bmr.rds
Binary file not shown.
Binary file modified tests/testthat/_object_snapshots/rr.rds
Binary file not shown.
8 changes: 4 additions & 4 deletions tests/testthat/_object_snapshots/snapshot.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
task_classif = tsk("pima") # mlr3 1.2.0
task_classif = tsk("pima") # mlr3 1.4.0
saveRDS(task_classif, "tests/testthat/_object_snapshots/task_classif.rds")

task_regr = tsk("mtcars") # mlr3 1.2.0
task_regr = tsk("mtcars") # mlr3 1.4.0
saveRDS(task_regr, "tests/testthat/_object_snapshots/task_regr.rds")

learner_classif = lrn("classif.rpart") # mlr3 1.0.0
Expand All @@ -16,7 +16,7 @@ resampling = rsmp("cv", folds = 3) # mlr3 1.0.0
resampling$instantiate(task_classif)
saveRDS(resampling, "tests/testthat/_object_snapshots/resampling.rds")

rr = resample(task_classif, learner_classif, resampling) # mlr3 1.2.0
rr = resample(task_classif, learner_classif, resampling) # mlr3 1.4.0
saveRDS(rr, "tests/testthat/_object_snapshots/rr.rds")

design = benchmark_grid(
Expand All @@ -25,7 +25,7 @@ design = benchmark_grid(
resamplings = list(resampling)
)

bmr = benchmark(design) # mlr3 1.2.0
bmr = benchmark(design) # mlr3 1.4.0
saveRDS(bmr, "tests/testthat/_object_snapshots/bmr.rds")

measure = msr("classif.ce") # mlr3 1.0.0
Expand Down
Binary file modified tests/testthat/_object_snapshots/task_classif.rds
Binary file not shown.
Binary file modified tests/testthat/_object_snapshots/task_regr.rds
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/testthat/test_TaskClassif.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test_that("Target is character/factor", {

test_that("TaskClassif rejects NAs in target", {
dt = data.table::data.table(x = 1:10, y = factor(c(NA, letters[1:9])))
expect_error(as_task_classif(dt, target = "y"), "contain missing")
expect_message(as_task_classif(dt, target = "y"), "contains missing")
})

test_that("0 feature task", {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_TaskRegr.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_that("Target is numeric", {

test_that("TaskRegr rejects NAs in target", {
dt = data.table::data.table(x = 1:10, y = c(NA_real_, 2:10))
expect_error(as_task_regr(dt, target = "y"), "contain missing")
expect_message(as_task_regr(dt, target = "y"), "contains missing")
})

test_that("TaskRegr: 0 feature task", {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test_backward_compatibility.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test_that("learner classif backward compatibility", {
expect_learner(learner_classif)

task = tsk("pima")
pred = learner_classif$predict(task)
suppressWarnings({pred = learner_classif$predict(task)})
expect_prediction_classif(pred, task)

learner_classif$train(task)
Expand All @@ -29,7 +29,7 @@ test_that("learner regr backward compatibility", {
expect_learner(learner_regr)

task = tsk("mtcars")
pred = learner_regr$predict(task)
suppressWarnings({pred = learner_regr$predict(task)})
expect_prediction_regr(pred)

learner_regr$train(task)
Expand Down
Loading