blind-contours / CVtreeMLE

:deciduous_tree: :dart: Cross Validated Decision Trees with Targeted Maximum Likelihood Estimation
MIT License
5 stars 1 forks source link

Issue with unit test #20

Closed GaryBAYLOR closed 1 year ago

GaryBAYLOR commented 2 years ago

Please check unit test functions as when I run devtools::test() it returns the following error and warnings:

> devtools::test()
ℹ Testing CVtreeMLE
✔ | F W S  OK | Context
✖ | 1 3     0 | CVtreeMLE_breastcancer [7.0s]                                          
───────────────────────────────────────────────────────────────────────────────────────
Warning (test_CVtreeMLE_breastcancer.R:10:3): (code run outside of `test_that()`)
Strategy 'multiprocess' is deprecated in future (>= 1.20.0) [2020-10-30]. Instead, explicitly specify either 'multisession' (recommended) or 'multicore'. In the current R session, 'multiprocess' equals 'multisession'.
Backtrace:
 1. future::plan("multiprocess", workers = 2)
      at test_CVtreeMLE_breastcancer.R:10:2
 2. future (local) plan_set(newStack, skip = .skip, cleanup = .cleanup, init = .init)
 3. future (local) warn_about_multiprocess(newStack)
 4. future (local) warn_about_deprecated(...)
 5. base (local) dfcn(msg = msg, package = .packageName)

Warning (test_CVtreeMLE_breastcancer.R:10:3): (code run outside of `test_that()`)
[ONE-TIME WARNING] Forked processing ('multicore') is not supported when running R from RStudio because it is considered unstable. For more details, how to control forked processing or not, and how to silence this warning in future R sessions, see ?parallelly::supportsMulticore
Backtrace:
 1. future::plan("multiprocess", workers = 2)
      at test_CVtreeMLE_breastcancer.R:10:2
 2. future (local) plan_set(newStack, skip = .skip, cleanup = .cleanup, init = .init)
 3. future (local) plan_init()
 4. future (local) evaluator(NA, label = "future-plan-test", globals = FALSE, lazy = FALSE)
 5. future (local) strategy(..., workers = workers, envir = envir)
 6. parallelly::supportsMulticore(warn = TRUE)
 7. parallelly:::supportsMulticoreAndRStudio(...)

Warning (test_CVtreeMLE_breastcancer.R:30:1): (code run outside of `test_that()`)
NAs introduced by coercion
Backtrace:
 1. base::data.frame(lapply(data, function(x) as.numeric(as.character(x))))
      at test_CVtreeMLE_breastcancer.R:30:0
 2. base::lapply(data, function(x) as.numeric(as.character(x)))
 3. CVtreeMLE (local) FUN(X[[i]], ...)

Error (test_CVtreeMLE_breastcancer.R:39:1): (code run outside of `test_that()`)
Error in `make_sl3_Task(data = at, covariates = w, outcome = "y_scaled", 
    outcome_type = "continuous")`: could not find function "make_sl3_Task"
Backtrace:
  1. CVtreeMLE::CVtreeMLE(...)
       at test_CVtreeMLE_breastcancer.R:39:0
  2. furrr::future_map_dfr(...)
       at CVtreeMLE-main-2/R/CVtreeMLE.R:305:2
  3. furrr::future_map(...)
  4. furrr:::furrr_map_template(...)
  5. furrr:::furrr_template(...)
  7. future:::value.list(futures)
  9. future:::resolve.list(...)
 10. future (local) signalConditionsASAP(obj, resignal = FALSE, pos = ii)
 11. future:::signalConditions(...)
───────────────────────────────────────────────────────────────────────────────────────
✖ | 1       0 | CVtreeMLE_inputs                                                       
───────────────────────────────────────────────────────────────────────────────────────
Error (test_CVtreeMLE_inputs.R:69:1): (code run outside of `test_that()`)
Error in `eval(code, test_env)`: object 'na' not found
───────────────────────────────────────────────────────────────────────────────────────
✖ | 1       0 | marginal_thresholds_exclusion [500.5s]                                 
───────────────────────────────────────────────────────────────────────────────────────
Error (test_marginal_thresholds_exclusion.R:34:1): (code run outside of `test_that()`)
Error in `example_output[example_output$target_m == "M4", ]`: incorrect number of dimensions
Backtrace:
 1. testthat::expect_true(...)
      at test_marginal_thresholds_exclusion.R:34:0
 2. testthat::quasi_label(enquo(object), label, arg = "object")
 3. rlang::eval_bare(expr, quo_get_env(quo))
───────────────────────────────────────────────────────────────────────────────────────
✖ | 1       0 | mixture_thresholds_eight_beta [73.4s]                                  
───────────────────────────────────────────────────────────────────────────────────────
Failure (test_mixture_thresholds_eight_beta.R:30:1): (code run outside of `test_that()`)
... == "M3 > 2.50969709970333 & M1 > 0.947419263385584 & M2 > 1.99541667300285" is not TRUE

`actual`:   FALSE
`expected`: TRUE 
───────────────────────────────────────────────────────────────────────────────────────
✔ |         1 | mixture_thresholds_one_beta [81.7s]                                    
✔ |         2 | simulations [0.1s]                                                     

══ Results ════════════════════════════════════════════════════════════════════════════
Duration: 663.0 s

[ FAIL 4 | WARN 3 | SKIP 0 | PASS 3 ]
blind-contours commented 2 years ago

@GaryBAYLOR - sorry about this. I believe this is because I removed sl3 and the other algorithm packages from the namespace and forgot to include these as libraries in the test scripts. I'll update and check.

blind-contours commented 2 years ago

@GaryBAYLOR - Running check now should return only 3 warnings that I'm trying to resolve. But there should be notes or errors now.