tlverse / tmle3shift

🎯 :game_die: Targeted Learning of the Causal Effects of Stochastic Interventions
https://tlverse.org/tmle3shift
GNU General Public License v3.0
15 stars 1 forks source link

warnings in tests #32

Open MichaelChirico opened 2 years ago

MichaelChirico commented 2 years ago

I ran the test suite with options(warn = 2) and it generated some failures:

── Error (test-bound.R:61:3): bounds are being respected in submodel ───────────────────────────
Error in `max(Q_submodel)`: (converted from warning) no non-missing arguments to max; returning -Inf
Backtrace:
    ▆
 1. └─testthat::expect_lte(max(Q_submodel), 1 - Q_bound_level) at test-bound.R:61:2
 2.   └─testthat::quasi_label(enquo(object), label, arg = "object")
── Error (test-marginal_structural.R:171:1): (code run outside of `test_that()`) ───────────────────────────
Error in `learner$predict_fold(learner_task, fold_number)`: (converted from warning) Lrnr_density_semiparametric_NULL_NULL is not cv-aware: self$predict_fold reverts to self$predict
Backtrace:
     ▆
  1. └─R6 fit_tmle3(tmle_task, targeted_likelihood, msm, updater) at test-marginal_structural.R:171:0
  2.   └─tmle3 initialize(...)
  3.     └─private$.tmle_fit(max_it)
  4.       └─self$updater$update(self$likelihood, self$tmle_task)
  5.         └─base::lapply(...)
  6.           └─tmle3 FUN(X[[i]], ...)
  7.             └─tmle_param$estimates(tmle_task, update_fold)
  8.               └─self$clever_covariates(tmle_task, fold_number)
  9.                 └─self$observed_likelihood$get_likelihoods(...)
 10.                   └─self$get_likelihood(tmle_task, nodes[[1]], fold_number)
 11.                     └─self$initial_likelihood$get_likelihood(tmle_task, node, fold_number)
 12.                       └─likelihood_factor$get_likelihood(tmle_task, fold_number)
 13.                         └─self$get_density(tmle_task, fold_number)
 14.                           └─learner$predict_fold(learner_task, fold_number)
── Error (test-stratified_intevention.R:61:1): (code run outside of `test_that()`) ───────────────────────────
Error in `ED * private$.targeted_components`: (converted from warning) longer object length is not a multiple of shorter object length
Backtrace:
    ▆
 1. └─R6 fit_tmle3(tmle_task, targeted_likelihood, tmle_param, updater) at test-stratified_intevention.R:61:0
 2.   └─tmle3 initialize(...)
 3.     └─private$.tmle_fit(max_it)
 4.       └─self$updater$update(self$likelihood, self$tmle_task)

It might be best to design the tests or re-write the underlying code so as not to produce these warnings.

nhejazi commented 2 years ago

thanks for finding and noting these warnings. it's possible that the development cycle of this package is now out of sync with that of some of its dependencies, as the warnings seems to stem from both sl3 and tmle3. there's a long queue rn, but i'll try to make some time to rewrite the tests and fix any background issues contributing to this