fftree | R Documentation |
fftree
is used to fit fast-and-frugal trees.
fftree(
data,
formula = stats::as.formula(data),
method = "greedy",
max_depth = 6,
split_function = "gini",
weights = c(1, 1),
pruning = FALSE,
cv = FALSE,
use_features_once = TRUE,
cross_entropy_parameters = cross_entropy_control()
)
## S4 method for signature 'data.frame'
fftree(
data,
formula = stats::as.formula(data.frame(data)),
method = "greedy",
max_depth = 6,
split_function = "gini",
weights = c(1, 1),
pruning = FALSE,
cv = FALSE,
use_features_once = TRUE,
cross_entropy_parameters = cross_entropy_control()
)
## S4 method for signature 'matrix'
fftree(
data,
formula = stats::as.formula(data.frame(data)),
method = "greedy",
max_depth = 6,
split_function = "gini",
weights = c(1, 1),
pruning = FALSE,
cv = FALSE,
use_features_once = TRUE,
cross_entropy_parameters = cross_entropy_control()
)
data |
An object of class |
formula |
|
method |
Type of induction method for the fast-and-frugal tree:
|
max_depth |
Maximum number of nodes of the fast-and-frugal tree (default: 6). |
split_function |
Function should be used to determine the splitting values on numeric features. This only applies to fast-and-frugal trees trained with the 'basic' or 'greedy' method. By default Gini entropy ('gini') is used. Other options are Shannon entropy ('entropy') and 'median'. |
weights |
A numeric vector of length 2 (default: |
pruning |
If the argument is set to |
cv |
If |
use_features_once |
If |
cross_entropy_parameters |
Hyperparameters for the cross-entropy method. By default the output of the function |
A fftreeModel object.
data(liver)
model <- fftree(data = liver, formula = diagnosis~., method = "greedy")
plot(model)
model
# weight instances by the inverse of the prior
# in this way both classes contribute equally when training the model
prior <- mean(ifelse(liver$diagnosis == "Liver disease", 1, 0))
weights <- c("No liver disease" = prior, "Liver disease" = 1-prior)
mod <- fftree(data = liver, formula = diagnosis~., weights = weights, method = "greedy")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.