Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: anticipate row roles change in mlr3 #412

Closed
wants to merge 5 commits into from
Closed
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
44 changes: 44 additions & 0 deletions .github/workflows/test-task-1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# r cmd check workflow of the mlr3 ecosystem v0.1.0
# https://github.com/mlr-org/actions
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main

name: mlr3 change

jobs:
r-cmd-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'devel'}
- {os: ubuntu-latest, r: 'release'}

steps:
- uses: actions/checkout@v3

- name: mlr3
run: 'echo -e "Remotes:\n mlr-org/mlr3@feat/train-predict" >> DESCRIPTION'

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- uses: r-lib/actions/check-r-package@v2
44 changes: 44 additions & 0 deletions .github/workflows/test-task-2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# r cmd check workflow of the mlr3 ecosystem v0.1.0
# https://github.com/mlr-org/actions
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main

name: mlr3 & mlr3pipelines change

jobs:
r-cmd-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'devel'}
- {os: ubuntu-latest, r: 'release'}

steps:
- uses: actions/checkout@v3

- name: mlr3
run: 'echo -e "Remotes:\n mlr-org/mlr3@feat/train-predict,\n mlr-org/mlr3pipelines@feat/test-rows" >> DESCRIPTION'

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- uses: r-lib/actions/check-r-package@v2
6 changes: 6 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,10 @@ import(mlr3)
import(mlr3misc)
import(paradox)
importFrom(R6,R6Class)
importFrom(bbotk,mlr_terminators)
importFrom(bbotk,trm)
importFrom(bbotk,trms)
importFrom(mlr3misc,clbk)
importFrom(mlr3misc,clbks)
importFrom(mlr3misc,mlr_callbacks)
importFrom(utils,bibentry)
2 changes: 1 addition & 1 deletion R/TunerIrace.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ target_runner_tuning = function(experiment, exec.target.runner, scenario, target
configuration
})
# fix logicals
lgl_params = as.data.table(tuning_instance$search_space)[class == "ParamLgl", id]
lgl_params = as.data.table(tuning_instance$search_space)[class == "ParamLgl", get("id")]
if (length(lgl_params)) xdt[, (lgl_params) := lapply(.SD, as.logical), .SDcols = lgl_params]

# provide experiment instances to objective
Expand Down
7 changes: 1 addition & 6 deletions R/mlr_callbacks.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,9 @@ load_callback_backup = function() {
#' callbacks = clbk("mlr3tuning.measures", measures = msr("classif.acc"))
#' )
#'
#' # score the configurations on the holdout set
#' task = tsk("pima")
#' splits = partition(task, ratio = 0.8)
#' task$row_roles$use = splits$train
#' task$row_roles$holdout = splits$test
#'
#' learner = lrn("classif.rpart", cp = to_tune(1e-04, 1e-1, logscale = TRUE))
#' learner$predict_sets = c("test", "holdout")
#'
#' instance = tune(
#' tuner = tnr("random_search", batch_size = 2),
Expand All @@ -168,7 +163,7 @@ load_callback_backup = function() {
#' measures = msr("classif.ce"),
#' term_evals = 4,
#' callbacks = clbk("mlr3tuning.measures", measures = msr("classif.ce",
#' predict_sets = "holdout", id = "classif.ce_holdout"))
#' predict_sets = "test", id = "classif.ce_holdout"))
#' )
NULL

Expand Down
6 changes: 5 additions & 1 deletion inst/testthat/helper_misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,9 @@ MAKE_GL = function() {
g$add_pipeop(op_ds)
g$add_pipeop(op_lrn)
g$add_edge("subsample", "classif.rpart")
GraphLearner$new(g)
gl = GraphLearner$new(g)
# FIXME: this is needed because graphlearner sets its properties to all available properties,
# which will be fixed in the next pipelines release
gl$properties = setdiff(gl$properties, "uses_test_task")
gl
}
7 changes: 1 addition & 6 deletions man/mlr3tuning.measures.Rd

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

4 changes: 2 additions & 2 deletions man/mlr_tuners_cmaes.Rd

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

4 changes: 2 additions & 2 deletions man/mlr_tuners_design_points.Rd

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

4 changes: 2 additions & 2 deletions man/mlr_tuners_gensa.Rd

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

4 changes: 2 additions & 2 deletions man/mlr_tuners_grid_search.Rd

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

4 changes: 2 additions & 2 deletions man/mlr_tuners_irace.Rd

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

4 changes: 2 additions & 2 deletions man/mlr_tuners_nloptr.Rd

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

4 changes: 2 additions & 2 deletions man/mlr_tuners_random_search.Rd

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

3 changes: 3 additions & 0 deletions tests/testthat/test_AutoTuner.R
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ test_that("AutoTuner get_base_learner method works", {
learner = as_learner(pipeline_robustify() %>>% lrn("classif.rpart"))
learner$param_set$values$classif.rpart.cp = to_tune(1e-04, 1e-1, logscale = TRUE)
learner$id = "graphlearner.classif.rpart"
# FIXME: this is needed because graphlearner sets its properties to all available properties,
# which will be fixed in the next pipelines release
learner$properties = setdiff(learner$properties, "uses_test_task")

at = auto_tuner(
tuner = tnr("random_search"),
Expand Down
Loading