tally | R Documentation |
tally
is used to fit a tallying model.tally
is used to fit a tallying model.
tally(
data,
formula = stats::as.formula(data.frame(data)),
method = "basic",
max_size = 6,
split_function = "gini",
weights = c(1, 1),
cv = FALSE,
cross_entropy_parameters = cross_entropy_control()
)
## S4 method for signature 'data.frame'
tally(
data,
formula = stats::as.formula(data.frame(data)),
method = "basic",
max_size = 6,
split_function = "gini",
weights = c(1, 1),
cv = FALSE,
cross_entropy_parameters = cross_entropy_control()
)
## S4 method for signature 'matrix'
tally(
data,
formula = stats::as.formula(data.frame(data)),
method = "basic",
max_size = 6,
split_function = "gini",
weights = c(1, 1),
cv = FALSE,
cross_entropy_parameters = cross_entropy_control()
)
data |
An object of class |
formula |
|
method |
Type of induction method for the fast-and-frugal tree:
|
max_size |
Maximum number of features that contribute to the tallying model (default: 6) |
split_function |
Function should be used to determine the splitting values on numeric features. This only applies to tallying models trained with the 'basic' method. By default Gini entropy ('gini') is used. Other options are Shannono entropy ('entropy') and 'median'. |
weights |
A numeric vector of length 2 (default: |
cv |
If |
cross_entropy_parameters |
Hyperparameters for the cross-entropy method. By default the output of the function |
A tallyModel object.
data(liver)
model <- tally(data = liver, formula = diagnosis~.)
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 <- tally(data = liver, formula = diagnosis~., weights = weights)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.