This learner implements BART algorithm in C++, using the dbarts package.
BART is a Bayesian sum-of-trees model in which each tree is constrained
by a prior to be a weak learner.
R6Class object.
Learner object with methods for training and prediction. See
Lrnr_base for documentation on learners.
x.testExplanatory variables for test (out of sample) data.
bart will generate draws of \(f(x)\) for each \(x\) which is a
row of x.test.
sigestFor continuous response models, an estimate of the
error variance, \(\sigma^2\), used to calibrate an inverse-chi-squared
prior used on that parameter. If not supplied, the least-squares estimate
is derived instead. See sigquant for more information. Not
applicable when \(y\) is binary.
sigdfDegrees of freedom for error variance prior. Not applicable when \(y\) is binary.
sigquantThe quantile of the error variance prior that the
rough estimate (sigest) is placed at. The closer the quantile is
to 1, the more aggresive the fit will be as you are putting more prior
weight on error standard deviations (\(\sigma\)) less than the rough
estimate. Not applicable when \(y\) is binary.
kFor numeric \(y\), k is the number of prior
standard deviations \(E(Y|x) = f(x)\) is away from \(\pm 0.5\). The response (y.train) is internally scaled to range from
\(-0.5\) to \(0.5\). For binary \(y\), k is the number of
prior standard deviations \(f(x)\) is away from \(\pm 3\). In
both cases, the bigger \(k\) is, the more conservative the fitting will
be.
powerPower parameter for tree prior.
baseBase parameter for tree prior.
binaryOffsetsed for binary \(y\). When present, the model is \(P(Y = 1 \mid x) = \Phi(f(x) + \mathrm{binaryOffset})\), allowing fits with probabilities shrunk towards values other than \(0.5\).
weightsAn optional vector of weights to be used in the fitting process. When present, BART fits a model with observations \(y \mid x \sim N(f(x), \sigma^2 / w)\), where \(f(x)\) is the unknown function.
ntreeThe number of trees in the sum-of-trees formulation.
ndpostThe number of posterior draws after burn in,
ndpost / keepevery will actually be returned.
nskipNumber of MCMC iterations to be treated as burn in.
printeveryAs the MCMC runs, a message is printed every
printevery draws.
keepeveryEvery keepevery draw is kept to be returned
to the user. Useful for “thinning” samples.
keeptrainfitsIf TRUE the draws of \(f(x)\) for
\(x\) corresponding to the rows of x.train are returned.
usequantsWhen TRUE, determine tree decision rules
using estimated quantiles derived from the x.train variables. When
FALSE, splits are determined using values equally spaced across
the range of a variable. See details for more information.
numcutThe maximum number of possible values used in decision
rules (see usequants, details). If a single number, it is recycled
for all variables; otherwise must be a vector of length equal to
ncol(x.train). Fewer rules may be used if a covariate lacks enough
unique values.
printcutoffsThe number of cutoff rules to printed to screen before the MCMC is run. Given a single integer, the same value will be used for all variables. If 0, nothing is printed.
verboseLogical; if FALSE supress printing.
nchainInteger specifying how many independent tree sets and fits should be calculated.
nthreadInteger specifying how many threads to use. Depending on the CPU architecture, using more than the number of chains can degrade performance for small/medium data sets. As such some calculations may be executed single threaded regardless.
combinechainsLogical; if TRUE, samples will be
returned in arrays of dimensions equal to nchain \(\times\)
ndpost \(\times\) number of observations.
keeptreesLogical; must be TRUE in order to use
predict with the result of a bart fit.
keepcallLogical; if FALSE, returned object will have
call set to call("NULL"), otherwise the call used to
instantiate BART.
serializeableLogical; if TRUE, loads the trees into R memory
so the fit object can be saved and loaded. See the section on "Saving"
in bart NB: This is not currently working
Individual learners have their own sets of parameters. Below is a list of shared parameters, implemented by Lrnr_base, and shared
by all learners.
covariatesA character vector of covariates. The learner will use this to subset the covariates for any specified task
outcome_typeA variable_type object used to control the outcome_type used by the learner. Overrides the task outcome_type if specified
...All other parameters should be handled by the invidual learner classes. See the documentation for the learner class you're instantiating
Other Learners:
Custom_chain,
Lrnr_HarmonicReg,
Lrnr_arima,
Lrnr_bartMachine,
Lrnr_base,
Lrnr_bayesglm,
Lrnr_bilstm,
Lrnr_caret,
Lrnr_cv_selector,
Lrnr_cv,
Lrnr_define_interactions,
Lrnr_density_discretize,
Lrnr_density_hse,
Lrnr_density_semiparametric,
Lrnr_earth,
Lrnr_expSmooth,
Lrnr_gam,
Lrnr_ga,
Lrnr_gbm,
Lrnr_glm_fast,
Lrnr_glmnet,
Lrnr_glm,
Lrnr_grf,
Lrnr_gru_keras,
Lrnr_gts,
Lrnr_h2o_grid,
Lrnr_hal9001,
Lrnr_haldensify,
Lrnr_hts,
Lrnr_independent_binomial,
Lrnr_lightgbm,
Lrnr_lstm_keras,
Lrnr_mean,
Lrnr_multiple_ts,
Lrnr_multivariate,
Lrnr_nnet,
Lrnr_nnls,
Lrnr_optim,
Lrnr_pca,
Lrnr_pkg_SuperLearner,
Lrnr_polspline,
Lrnr_pooled_hazards,
Lrnr_randomForest,
Lrnr_ranger,
Lrnr_revere_task,
Lrnr_rpart,
Lrnr_rugarch,
Lrnr_screener_augment,
Lrnr_screener_coefs,
Lrnr_screener_correlation,
Lrnr_screener_importance,
Lrnr_sl,
Lrnr_solnp_density,
Lrnr_solnp,
Lrnr_stratified,
Lrnr_subset_covariates,
Lrnr_svm,
Lrnr_tsDyn,
Lrnr_ts_weights,
Lrnr_xgboost,
Pipeline,
Stack,
define_h2o_X(),
undocumented_learner