This repository has been archived by the owner on Oct 4, 2020. It is now read-only.
generated from mlr-org/mlr3learners.template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Parameter test and missing parameters (#3)
- Loading branch information
Showing
11 changed files
with
241 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
on: | ||
push: | ||
pull_request: | ||
# for now, CRON jobs only run on the default branch of the repo (i.e. usually on master) | ||
schedule: | ||
# * is a special character in YAML so you have to quote this string | ||
- cron: "0 4 * * *" | ||
|
||
name: Parameter Check | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- { os: ubuntu-latest, r: "release" } | ||
|
||
env: | ||
# otherwise remotes::fun() errors cause the build to fail. Example: Unavailability of binaries | ||
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | ||
CRAN: ${{ matrix.config.cran }} | ||
# we are not allowed to write to ~/.ccache on GH Actions | ||
# setting some ccache options | ||
CCACHE_BASEDIR: ${{ GITHUB.WORKSPACE }} | ||
CCACHE_DIR: ${{ GITHUB.WORKSPACE }}/.ccache | ||
CCACHE_NOHASHDIR: true | ||
CCACHE_SLOPPINESS: include_file_ctime | ||
# make sure to run `tic::use_ghactions_deploy()` to set up deployment | ||
id_rsa: ${{ secrets.id_rsa }} | ||
# prevent rgl issues because no X11 display is available | ||
RGL_USE_NULL: true | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: r-lib/actions/setup-r@master | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
Ncpus: 4 | ||
|
||
# set date/week for use in cache creation | ||
# https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970 | ||
# - cache R packages daily | ||
# - cache ccache weekly -> 'ccache' helps rebuilding the package cache faster | ||
- name: "[Cache] Prepare daily timestamp for cache" | ||
if: runner.os != 'Windows' | ||
id: date | ||
run: echo "::set-output name=date::$(date '+%d-%m')" | ||
|
||
- name: "[Cache] Prepare weekly timestamp for cache" | ||
if: runner.os != 'Windows' | ||
id: datew | ||
run: echo "::set-output name=datew::$(date '+%Y-%V')" | ||
|
||
- name: "[Cache] Cache R packages" | ||
if: runner.os != 'Windows' | ||
uses: pat-s/[email protected] | ||
with: | ||
path: ${{ env.R_LIBS_USER }} | ||
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}-1 | ||
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}-1 | ||
|
||
- name: "[Cache] Cache ccache" | ||
if: runner.os != 'Windows' | ||
uses: pat-s/[email protected] | ||
with: | ||
path: ${{ env.CCACHE_DIR}} | ||
key: ${{ runner.os }}-r-${{ matrix.config.r }}-ccache-${{steps.datew.outputs.datew}} | ||
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-ccache-${{steps.datew.outputs.datew}} | ||
|
||
# install ccache and write config file | ||
- name: "[Linux] ccache" | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt install ccache libcurl4-openssl-dev | ||
mkdir -p ~/.R && echo -e 'CXX_STD = CXX14\n\nCC=ccache gcc -std=gnu99\nCXX=ccache g++\nCXX11=ccache g++ -std=gnu99\nCXX14=ccache g++ -std=gnu99\nC11=ccache g++\nC14=ccache g++\nFC=ccache gfortran\nF77=ccache gfortran' > $HOME/.R/Makevars | ||
# for some strange Windows reason this step and the next one need to be decoupled | ||
- name: "[Stage] Prepare" | ||
run: | | ||
Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'source')" | ||
Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')" | ||
- name: "[Stage] Install" | ||
if: matrix.config.os != 'macOS-latest' || matrix.config.r != 'devel' | ||
run: Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()" | ||
|
||
- name: "[Stage] Parameter test" | ||
run: | | ||
R CMD INSTALL . | ||
Rscript -e "remotes::install_github('mlr-org/mlr3@paramtest')" | ||
Rscript -e "testthat::test_dir(system.file('paramtest', package = 'mlr3learners.mboost'))" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
library(mlr3) | ||
lapply(list.files(system.file("testthat", package = "mlr3"), | ||
pattern = "helper_autotest", full.names = TRUE), source) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
library(mlr3learners.mboost) | ||
|
||
test_that("classif.gamboost", { | ||
learner = lrn("classif.gamboost") | ||
fun = mboost::gamboost | ||
exclude = c( | ||
"formula", # handled via mlr3 | ||
"data", # handled via mlr3 | ||
"weights", # handled via mlr3 | ||
"control", # handled to mboost::boost_control | ||
"..." # not used | ||
) | ||
|
||
ParamTest = run_paramtest(learner, fun, exclude) | ||
expect_true(ParamTest, info = paste0("\nMissing parameters:\n", | ||
paste0("- '", ParamTestresult$missing,"'", collapse = "\n"))) | ||
}) | ||
|
||
test_that("classif.gamboost_boost_control", { | ||
learner = lrn("classif.gamboost") | ||
fun = mboost::boost_control | ||
exclude = c( | ||
"center" # deprecated | ||
) | ||
|
||
ParamTest = run_paramtest(learner, fun, exclude) | ||
expect_true(ParamTest, info = paste0("\nMissing parameters:\n", | ||
paste0("- '", ParamTest$missing,"'", collapse = "\n"))) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
library(mlr3learners.mboost) | ||
|
||
test_that("classif.glmboost", { | ||
learner = lrn("classif.glmboost") | ||
fun = mboost:::glmboost.formula | ||
exclude = c( | ||
"formula", # handled via mlr3 | ||
"data", # handled via mlr3 | ||
"weights", # handled via mlr3 | ||
"control", # handled to mboost::boost_control | ||
"..." # not used | ||
) | ||
|
||
ParamTest = run_paramtest(learner, fun, exclude) | ||
expect_true(ParamTest, info = paste0("\nMissing parameters:\n", | ||
paste0("- '", ParamTest$missing, "'", collapse = "\n"))) | ||
}) | ||
|
||
test_that("classif.glmboost_boost_control", { | ||
learner = lrn("classif.glmboost") | ||
fun = mboost::boost_control | ||
exclude = c( | ||
"center" # deprecated | ||
) | ||
|
||
ParamTest = run_paramtest(learner, fun, exclude) | ||
expect_true(ParamTest, info = paste0("\nMissing parameters:\n", | ||
paste0("- '", ParamTest$missing, "'", collapse = "\n"))) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
library(mlr3learners.mboost) | ||
|
||
test_that("regr.gamboost", { | ||
learner = lrn("regr.gamboost") | ||
fun = mboost::gamboost | ||
exclude = c( | ||
"formula", # handled via mlr3 | ||
"data", # handled via mlr3 | ||
"weights", # handled via mlr3 | ||
"control", # handled to mboost::boost_control | ||
"..." # not used | ||
) | ||
|
||
ParamTest = run_paramtest(learner, fun, exclude) | ||
expect_true(ParamTest, info = paste0("\nMissing parameters:\n", | ||
paste0("- '", ParamTest$missing, "'", collapse = "\n"))) | ||
}) | ||
|
||
test_that("regr.gamboost_boost_control", { | ||
learner = lrn("regr.gamboost") | ||
fun = mboost::boost_control | ||
exclude = c( | ||
"center" # deprecated | ||
) | ||
|
||
ParamTest = run_paramtest(learner, fun, exclude) | ||
expect_true(ParamTest, info = paste0("\nMissing parameters:\n", | ||
paste0("- '", ParamTest$missing, "'", collapse = "\n"))) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
library(mlr3learners.mboost) | ||
|
||
test_that("regr.glmboost", { | ||
learner = lrn("regr.glmboost") | ||
fun = mboost:::glmboost.formula | ||
exclude = c( | ||
"formula", # handled via mlr3 | ||
"data", # handled via mlr3 | ||
"weights", # handled via mlr3 | ||
"control", # handled to mboost::boost_control | ||
"..." # not used | ||
) | ||
|
||
ParamTest = run_paramtest(learner, fun, exclude) | ||
expect_true(ParamTest, info = paste0("\nMissing parameters:\n", | ||
paste0("- '", ParamTest$missing, "'", collapse = "\n"))) | ||
}) | ||
|
||
test_that("regr.glmboost_boost_control", { | ||
learner = lrn("regr.glmboost") | ||
fun = mboost::boost_control | ||
exclude = c( | ||
"center" # deprecated | ||
) | ||
|
||
ParamTest = run_paramtest(learner, fun, exclude) | ||
expect_true(ParamTest, info = paste0("\nMissing parameters:\n", | ||
paste0("- '", ParamTest$missing, "'", collapse = "\n"))) | ||
}) |