Description Usage Arguments Details Value Examples
View source: R/wrapper_functions.R
Compatible learner wrappers for this package should have a specific format.
Namely they should take as input a list called train
that contains
named objects $Y
and $X
, that contain, respectively, the outcomes
and predictors in a particular training fold. Other options may be passed in
to the function as well. The function must output a list with the following
named objects: test_pred
= predictions of test$Y
based on the learner
fit using train$X
; train_pred
= prediction of train$Y
based
on the learner fit using train$X
; model
= the fitted model (only
necessary if you desire to look at this model later, not used for internal
computations); train_y
= a copy of train$Y
; test_y
= a copy
of test$Y
.
1 2 3 4 5 | dbarts_wrapper(test, train, sigest = NA, sigdf = 3, sigquant = 0.9,
k = 2, power = 2, base = 0.95, binaryOffset = 0, ntree = 200,
ndpost = 1000, nskip = 100, printevery = 100, keepevery = 1,
keeptrainfits = TRUE, usequants = FALSE, numcut = 100,
printcutoffs = 0, nthread = 1, keepcall = TRUE, verbose = FALSE)
|
test |
A list with named objects |
train |
A list with named objects |
sigest |
See dbarts |
sigdf |
See dbarts |
sigquant |
See dbarts |
k |
See dbarts |
power |
See dbarts |
base |
See dbarts |
binaryOffset |
See dbarts |
ntree |
See dbarts |
ndpost |
See dbarts |
nskip |
See dbarts |
printevery |
See dbarts |
keepevery |
See dbarts |
keeptrainfits |
See dbarts |
usequants |
See dbarts |
numcut |
See dbarts |
printcutoffs |
See dbarts |
nthread |
See dbarts |
keepcall |
See dbarts |
verbose |
See dbarts |
This particular wrapper implements Bayesian additive regression trees using dbarts. We refer readers to the original package's documentation for more details.
A list with named objects (see description).
1 2 3 4 5 6 7 8 9 10 11 12 | # simulate data
Q0 <- function(x){ plogis(x) }
# make list of training data
train_X <- data.frame(x1 = runif(50))
train_Y <- rbinom(50, 1, Q0(train_X$x1))
train <- list(Y = train_Y, X = train_X)
# make list of test data
test_X <- data.frame(x1 = runif(50))
test_Y <- rbinom(50, 1, Q0(train_X$x1))
test <- list(Y = test_Y, X = test_X)
# fit dbarts
dbarts_wrap <- dbarts_wrapper(train = train, test = test)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.