From 6792a5c2f63783f9321acfa127e6b41b8284d2d5 Mon Sep 17 00:00:00 2001 From: pat-s Date: Thu, 2 Jun 2022 12:17:36 +0200 Subject: [PATCH] - cstf: print info log message which column roles are used for partitioning --- R/ResamplingSptCVCstf.R | 11 +++++++++++ R/autoplot_spcv_cstf.R | 1 + R/zzz.R | 1 + 3 files changed, 13 insertions(+) diff --git a/R/ResamplingSptCVCstf.R b/R/ResamplingSptCVCstf.R index 69ba9e432..97f32d3cb 100644 --- a/R/ResamplingSptCVCstf.R +++ b/R/ResamplingSptCVCstf.R @@ -104,6 +104,17 @@ ResamplingSptCVCstf = R6Class("ResamplingSptCVCstf", ) sample_cast = function(task, stratify = FALSE, folds) { + + if (length(task$col_roles$time) && length(task$col_roles$space)) { + lg$info(sprintf("Using column roles 'space' (var. '%s') and 'time' (var. '%s') for partitioning", task$col_roles$space, task$col_roles$time)) + + } else if (length(task$col_roles$time)) { + lg$info(sprintf("Using column role 'time' (var. '%s') for partitioning", task$col_roles$time)) + } + else if (length(task$col_roles$space)) { + lg$info(sprintf("Using column role 'space' (var. '%s') for partitioning", task$col_roles$space)) + } + target = if (stratify) task$target_names else NULL space = task$col_roles$space time = task$col_roles$time diff --git a/R/autoplot_spcv_cstf.R b/R/autoplot_spcv_cstf.R index 9b3a1f41c..f849e5500 100644 --- a/R/autoplot_spcv_cstf.R +++ b/R/autoplot_spcv_cstf.R @@ -118,6 +118,7 @@ autoplot.ResamplingSptCVCstf = function( # nolint resampling_sub$instance = resampling_sub$instance[[repeats_id]] } + # FIXME: check space and time var from column roles! # check if we are in a 2D or 3D scenario if (is.null(plot3D)) { if (!is.null(resampling_sub$space_var) && diff --git a/R/zzz.R b/R/zzz.R index f848f5875..148e06eaa 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -102,6 +102,7 @@ register_mlr3 = function() { # nocov start .onLoad = function(libname, pkgname) { # nolint register_mlr3() + assign("lg", lgr::get_logger("mlr3spatiotempcv"), envir = parent.env(environment())) setHook(packageEvent("mlr3", "onLoad"), function(...) register_mlr3(), action = "append") }