Lrnr_prob_known.Rd
This learner predicts a binary outcome with a known probability, provided by the user as input.
An R6Class
object inheriting from
Lrnr_base
.
A learner object inheriting from Lrnr_base
with
methods for training and prediction. For a full list of learner
functionality, see the complete documentation of Lrnr_base
.
prob
: The probability of the binary outcome. When not provided,
this defaults to the mean proportion of observed ones.
library(sl3) data(cpp_imputed) covs <- c("apgar1", "apgar5", "parity", "gagebrth", "mage", "meducyrs") task <- sl3_Task$new(cpp_imputed, covariates = covs, outcome = "smoked") # known probability, as in an RCT lrnr_rct <- Lrnr_prob_known$new(0.5) rct_fit <- lrnr_rct$train(task) rct_preds <- rct_fit$predict()