
Last chance! 50% off unlimited learning
Sale ends in
Make all conditional inference trees
create_ctree(
given_ind,
x_train,
mincriterion,
minsplit,
minbucket,
use_partykit = "on_error"
)
List with conditional inference tree and the variables conditioned/not conditioned on.
Numeric value. Indicates which features are conditioned on.
Numeric vector. Indicates the specific values of features for individual i.
Numeric value or vector equal to 1 - alpha where alpha is the nominal level of the conditional independence tests. Can also be a vector equal to the length of the number of features indicating which mincriterion to use when conditioning on various numbers of features.
Numeric value. Equal to the value that the sum of the left and right daughter nodes need to exceed.
Numeric value. Equal to the minimum sum of weights in a terminal node.
String. In some semi-rare cases partyk::ctree
runs into an error related to the LINPACK
used by R. To get around this problem, one may fall back to using the newer (but slower) partykit::ctree
function, which is a reimplementation of the same method. Setting this parameter to "on_error"
(default)
falls back to partykit::ctree
, if party::ctree
fails. Other options are "never"
, which always
uses party::ctree
, and "always"
, which always uses partykit::ctree
. A warning message is
created whenever partykit::ctree
is used.
Annabelle Redelmeier, Martin Jullum
if (requireNamespace("MASS", quietly = TRUE) & requireNamespace("party", quietly = TRUE)) {
m <- 10
n <- 40
n_samples <- 50
mu <- rep(1, m)
cov_mat <- cov(matrix(rnorm(n * m), n, m))
x_train <- data.table::data.table(MASS::mvrnorm(n, mu, cov_mat))
given_ind <- c(4, 7)
mincriterion <- 0.95
minsplit <- 20
minbucket <- 7
sample <- TRUE
create_ctree(
given_ind = given_ind, x_train = x_train,
mincriterion = mincriterion, minsplit = minsplit,
minbucket = minbucket, use_partykit = "on_error"
)
}
Run the code above in your browser using DataLab