diff --git a/man/Lrnr_haldensify.Rd b/man/Lrnr_haldensify.Rd index 2358e816..5b636244 100644 --- a/man/Lrnr_haldensify.Rd +++ b/man/Lrnr_haldensify.Rd @@ -33,6 +33,15 @@ to be divided into. sequence of values of the regulariztion parameter of the Lasso regression, to be passed to to \code{\link[hal9001]{fit_hal}}. } +\item{\code{trim_dens = 1/sqrt(n)}}{A \code{numeric} giving the minimum +allowed value of the resultant density predictions. Any predicted +density values below this tolerance threshold are set to the indicated +minimum. The default is to use the inverse of the square root of the +sample size of the prediction set, i.e., 1/sqrt(n); another notable +choice is 1/sqrt(n)/log(n). If there are observations in the prediction +set with values of \code{new_A} outside of the support of the training +set, their predictions are similarly truncated. +} \item{\code{...}}{ Other parameters passed directly to \code{\link[haldensify]{haldensify}}. See its documentation for details. } diff --git a/tests/testthat/test-lightgbm.R b/tests/testthat/test-lightgbm.R index 5c7a91e9..9493c1e6 100644 --- a/tests/testthat/test-lightgbm.R +++ b/tests/testthat/test-lightgbm.R @@ -24,6 +24,7 @@ test_learner <- function(learner, task, ...) { # test learner prediction test_that("Learner can generate training set predictions", { skip_on_os("windows") + fit_obj <- learner_obj$train(task) train_preds <- fit_obj$predict() expect_equal( sl3:::safe_dim(train_preds)[1], length(task$Y) @@ -33,11 +34,15 @@ test_learner <- function(learner, task, ...) { # test learner chaining test_that("Chaining returns a task", { skip_on_os("windows") + fit_obj <- learner_obj$train(task) chained_task <- fit_obj$chain() expect_true(is(chained_task, "sl3_Task")) }) + test_that("Chaining returns the correct number of rows", { skip_on_os("windows") + fit_obj <- learner_obj$train(task) + chained_task <- fit_obj$chain() expect_equal(nrow(chained_task$X), nrow(task$X)) }) }