Skip to content

Commit

Permalink
check with new paradox (#234)
Browse files Browse the repository at this point in the history
Co-authored-by: pat-s <patrick.schratz@gmail.com>
  • Loading branch information
mb706 and pat-s authored Apr 16, 2024
1 parent 11578e9 commit c6df1e2
Show file tree
Hide file tree
Showing 19 changed files with 226 additions and 138 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/r-cmd-check-old-paradox-new-other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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: r-cmd-check-paradox

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: paradox
run: 'echo -e "Remotes:\n mlr-org/mlr3spatial,\n mlr-org/mlr3pipelines,\n mlr-org/bbotk,\n mlr-org/mlr3tuning" >> DESCRIPTION'

- uses: r-lib/actions/setup-pandoc@v2

- 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
46 changes: 46 additions & 0 deletions .github/workflows/r-cmd-check-paradox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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: r-cmd-check-paradox

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: paradox
run: 'echo -e "Remotes:\n mlr-org/paradox,\n mlr-org/mlr3spatial,\n mlr-org/mlr3pipelines,\n mlr-org/bbotk,\n mlr-org/mlr3tuning" >> DESCRIPTION'

- uses: r-lib/actions/setup-pandoc@v2

- 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
28 changes: 14 additions & 14 deletions R/ResamplingRepeatedSpCVBlock.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,26 @@ ResamplingRepeatedSpCVBlock = R6Class("ResamplingRepeatedSpCVBlock",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "repeated_spcv_block") {
ps = ParamSet$new(params = list(
ParamInt$new("folds", lower = 1L, default = 10L, tags = "required"),
ParamInt$new("repeats", lower = 1, default = 1L, tags = "required"),
ParamInt$new("rows", lower = 1L),
ParamInt$new("cols", lower = 1L),
ParamInt$new("seed"),
ParamLgl$new("hexagon", default = FALSE),
ParamUty$new("range",
custom_check = function(x) checkmate::assert_integer(x)),
ParamFct$new("selection", levels = c(
ps = ps(
folds = p_int(lower = 1L, tags = "required"),
repeats = p_int(lower = 1, tags = "required"),
rows = p_int(lower = 1L),
cols = p_int(lower = 1L),
seed = p_int(),
hexagon = p_lgl(default = FALSE),
range = p_uty(
custom_check = checkmate::check_integer),
selection = p_fct(levels = c(
"random", "systematic",
"checkerboard"), default = "random"),
ParamUty$new("rasterLayer",
rasterLayer = p_uty(
default = NULL,
custom_check = function(x) {
custom_check = crate(function(x) {
checkmate::check_class(x, "SpatRaster",
null.ok = TRUE)
}
})
)
))
)

ps$values = list(folds = 10L, repeats = 1L)
super$initialize(
Expand Down
8 changes: 4 additions & 4 deletions R/ResamplingRepeatedSpCVCoords.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ ResamplingRepeatedSpCVCoords = R6Class("ResamplingRepeatedSpCVCoords",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "repeated_spcv_coords") {
ps = ParamSet$new(params = list(
ParamInt$new("folds", lower = 1L, default = 10L, tags = "required"),
ParamInt$new("repeats", lower = 1, default = 1L, tags = "required")
))
ps = ps(
folds = p_int(lower = 1L, tags = "required"),
repeats = p_int(lower = 1, tags = "required")
)
ps$values = list(folds = 10L, repeats = 1)
super$initialize(
id = id,
Expand Down
16 changes: 8 additions & 8 deletions R/ResamplingRepeatedSpCVDisc.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ ResamplingRepeatedSpCVDisc = R6Class("ResamplingRepeatedSpCVDisc",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "repeated_spcv_disc") {
ps = ParamSet$new(params = list(
ParamInt$new("folds", lower = 1L, default = 10L, tags = "required"),
ParamInt$new("radius",
ps = ps(
folds = p_int(lower = 1L, tags = "required"),
radius = p_int(
lower = 0L, tags = "required",
special_vals = list(0L)),
ParamInt$new("buffer",
buffer = p_int(
lower = 0L, default = NULL,
special_vals = list(NULL)),
ParamUty$new("prob",
prob = p_uty(
default = NULL),
ParamLgl$new("replace", default = FALSE),
ParamInt$new("repeats", lower = 1, default = 1L, tags = "required")
))
replace = p_lgl(default = FALSE),
repeats = p_int(lower = 1, tags = "required")
)
ps$values = list(folds = 10L, repeats = 1)
super$initialize(
id = id,
Expand Down
10 changes: 5 additions & 5 deletions R/ResamplingRepeatedSpCVEnv.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ ResamplingRepeatedSpCVEnv = R6Class("ResamplingRepeatedSpCVEnv",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "repeated_spcv_env") {
ps = ParamSet$new(params = list(
ParamInt$new("folds", lower = 1L, default = 10L, tags = "required"),
ParamInt$new("repeats", lower = 1, default = 10L, tags = "required"),
ParamUty$new("features")
))
ps = ps(
folds = p_int(lower = 1L, tags = "required"),
repeats = p_int(lower = 1, tags = "required"),
features = p_uty()
)
ps$values = list(folds = 10L, repeats = 1)
super$initialize(
id = id,
Expand Down
26 changes: 13 additions & 13 deletions R/ResamplingRepeatedSpCVTiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,19 @@ ResamplingRepeatedSpCVTiles = R6Class("ResamplingRepeatedSpCVTiles",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "repeated_spcv_tiles") {
ps = ParamSet$new(params = list(
ParamUty$new("dsplit", custom_check = function(x) checkmate::assert_integer(x, len = 2)),
ParamUty$new("nsplit", custom_check = function(x) checkmate::assert_integer(x, len = 2)),
ParamFct$new("rotation", levels = c("none", "random", "user"), default = "none"),
ParamUty$new("user_rotation", default = NULL),
ParamFct$new("offset", levels = c("none", "random", "user"), default = "none"),
ParamUty$new("user_offset", default = NULL),
ParamLgl$new("reassign", default = TRUE),
ParamDbl$new("min_frac", default = 0.025, lower = 0, upper = 1),
ParamInt$new("min_n", default = 5, lower = 0),
ParamInt$new("iterate", default = 1, lower = 1),
ParamInt$new("repeats", lower = 1, default = 1L, tags = "required")
))
ps = ps(
dsplit = p_uty(custom_check = crate(function(x) checkmate::check_integer(x, len = 2))),
nsplit = p_uty(custom_check = crate(function(x) checkmate::check_integer(x, len = 2))),
rotation = p_fct(levels = c("none", "random", "user"), default = "none"),
user_rotation = p_uty(default = NULL),
offset = p_fct(levels = c("none", "random", "user"), default = "none"),
user_offset = p_uty(default = NULL),
reassign = p_lgl(default = TRUE),
min_frac = p_dbl(default = 0.025, lower = 0, upper = 1),
min_n = p_int(default = 5, lower = 0),
iterate = p_int(default = 1, lower = 1),
repeats = p_int(lower = 1, tags = "required")
)
ps$values = list(repeats = 1)
super$initialize(
id = id,
Expand Down
34 changes: 17 additions & 17 deletions R/ResamplingRepeatedSpCVknndm.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,29 +45,29 @@ ResamplingRepeatedSpCVKnndm = R6Class("ResamplingRepeatedSpCVKnndm",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "repeated_spcv_knndm") {
ps = ParamSet$new(params = list(
ParamUty$new("modeldomain", default = NULL,
custom_check = function(x) {
ps = ps(
modeldomain = p_uty(default = NULL,
custom_check = crate(function(x) {
checkmate::check_class(x, "SpatRaster",
null.ok = TRUE)
}
})
),
ParamUty$new("predpoints", default = NULL,
custom_check = function(x) {
predpoints = p_uty(default = NULL,
custom_check = crate(function(x) {
checkmate::check_class(x, "sfc_POINT",
null.ok = TRUE)
}
})
),
ParamFct$new("space", levels = "geographical", default = "geographical"),
ParamInt$new("folds", default = 10, lower = 2),
ParamDbl$new("maxp", default = 0.5, lower = 0, upper = 1),
ParamFct$new("clustering", default = "hierarchical",
levels = c("hierarchical", "kmeans"), tags = "required"),
ParamUty$new("linkf", default = "ward.D2"),
ParamInt$new("samplesize"),
ParamFct$new("sampling", levels = c("random", "hexagonal", "regular", "Fibonacci")),
ParamInt$new("repeats", lower = 1, default = 1L, tags = "required")
))
space = p_fct(levels = "geographical", default = "geographical"),
folds = p_int(default = 10, lower = 2),
maxp = p_dbl(default = 0.5, lower = 0, upper = 1),
clustering = p_fct(default = "hierarchical",
levels = c("hierarchical", "kmeans")),
linkf = p_uty(default = "ward.D2"),
samplesize = p_int(),
sampling = p_fct(levels = c("random", "hexagonal", "regular", "Fibonacci")),
repeats = p_int(lower = 1, tags = "required")
)
ps$values = list(repeats = 1, folds = 10)

super$initialize(
Expand Down
10 changes: 5 additions & 5 deletions R/ResamplingRepeatedSptCVCstf.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ ResamplingRepeatedSptCVCstf = R6Class("ResamplingRepeatedSptCVCstf",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "repeated_sptcv_cstf") {
ps = ParamSet$new(params = list(
ParamInt$new("folds", lower = 1L, default = 3L, tags = "required"),
ParamInt$new("repeats", lower = 1, default = 10L, tags = "required"),
ParamLgl$new("stratify", default = FALSE)
))
ps = ps(
folds = p_int(lower = 1L, tags = "required"),
repeats = p_int(lower = 1, tags = "required"),
stratify = p_lgl(default = FALSE)
)
ps$values = list(folds = 3L, repeats = 10L, stratify = FALSE)

super$initialize(
Expand Down
24 changes: 12 additions & 12 deletions R/ResamplingSpCVBlock.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ ResamplingSpCVBlock = R6Class("ResamplingSpCVBlock",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "spcv_block") {
ps = ParamSet$new(params = list(
ParamInt$new("folds", lower = 1L, default = 10L, tags = "required"),
ParamInt$new("rows", lower = 1L),
ParamInt$new("cols", lower = 1L),
ParamInt$new("range"),
ParamInt$new("seed"),
ParamLgl$new("hexagon", default = FALSE),
ParamFct$new("selection", levels = c(
ps = ps(
folds = p_int(lower = 1L, tags = "required"),
rows = p_int(lower = 1L),
cols = p_int(lower = 1L),
range = p_int(),
seed = p_int(),
hexagon = p_lgl(default = FALSE),
selection = p_fct(levels = c(
"random", "systematic",
"checkerboard"), default = "random"),
ParamUty$new("rasterLayer",
rasterLayer = p_uty(
default = NULL,
custom_check = function(x) {
custom_check = crate(function(x) {
checkmate::check_class(x, "SpatRaster",
null.ok = TRUE)
}
})
)
))
)
ps$values = list(folds = 10L)
super$initialize(
id = id,
Expand Down
10 changes: 5 additions & 5 deletions R/ResamplingSpCVBuffer.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ ResamplingSpCVBuffer = R6Class("ResamplingSpCVBuffer",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "spcv_buffer") {
ps = ParamSet$new(params = list(
ParamInt$new("theRange", lower = 1L, tags = "required"),
ParamFct$new("spDataType", default = "PA", levels = c("PA", "PB")),
ParamLgl$new("addBG", default = TRUE)
))
ps = ps(
theRange = p_int(lower = 1L, tags = "required"),
spDataType = p_fct(default = "PA", levels = c("PA", "PB")),
addBG = p_lgl(default = TRUE)
)

super$initialize(
id = id,
Expand Down
6 changes: 3 additions & 3 deletions R/ResamplingSpCVCoords.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ ResamplingSpCVCoords = R6Class("ResamplingSpCVCoords",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "spcv_coords") {
ps = ParamSet$new(params = list(
ParamInt$new("folds", lower = 1L, default = 10L, tags = "required")
))
ps = ps(
folds = p_int(lower = 1L, tags = "required")
)
ps$values = list(folds = 10L)
super$initialize(
id = id,
Expand Down
14 changes: 7 additions & 7 deletions R/ResamplingSpCVDisc.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ ResamplingSpCVDisc = R6Class("ResamplingSpCVDisc",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "spcv_disc") {
ps = ParamSet$new(params = list(
ParamInt$new("folds", lower = 1L, default = 10L, tags = "required"),
ParamInt$new("radius",
ps = ps(
folds = p_int(lower = 1L, tags = "required"),
radius = p_int(
lower = 0L, tags = "required",
special_vals = list(0L)),
ParamInt$new("buffer",
buffer = p_int(
lower = 0L, default = NULL,
special_vals = list(NULL)),
ParamUty$new("prob",
prob = p_uty(
default = NULL),
ParamLgl$new("replace", default = FALSE)
))
replace = p_lgl(default = FALSE)
)
ps$values = list(folds = 10L)
super$initialize(
id = id,
Expand Down
8 changes: 4 additions & 4 deletions R/ResamplingSpCVEnv.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ ResamplingSpCVEnv = R6Class("ResamplingSpCVEnv",
#' @param id `character(1)`\cr
#' Identifier for the resampling strategy.
initialize = function(id = "spcv_env") {
ps = ParamSet$new(params = list(
ParamInt$new("folds", lower = 1L, default = 10L, tags = "required"),
ParamUty$new("features")
))
ps = ps(
folds = p_int(lower = 1L, tags = "required"),
features = p_uty()
)
ps$values = list(folds = 10L)
super$initialize(
id = id,
Expand Down
Loading

0 comments on commit c6df1e2

Please sign in to comment.