Description Usage Arguments Value Examples
Decision tree algorithm uses information gain (entropy) as a division criterium, works both for categorical and numerical attributes. Based on Zaki, Meira Jr., Data Mining and Analysis, p.481-496.
1 | decisionTree(d, eta = 10, purity = 0.95, minsplit = 10)
|
d |
data.frame, dependant variable must be in the first column and must be a character |
eta |
stop criterium, size of a leaf |
purity |
stop criterium, purity of a leaf |
minsplit |
do not split nodes that are smaller than minsplit |
A DecisionTreeObject
consists of two slots: resultDF and nodeChoices.
1 2 3 4 5 6 7 8 9 10 | d <- iris[, c("Species", "Sepal.Length", "Sepal.Width")]
d$Species <- as.character(d$Species)
d$Species[d$Species != "setosa"] <- "non-setosa"
x <- d$Sepal.Length
x[d$Sepal.Length <= 5.2] <- "Very Short"
x[d$Sepal.Length > 5.2 & d$Sepal.Length <= 6.1] <- "Short"
x[d$Sepal.Length > 6.1 & d$Sepal.Length <= 7.0] <- "Long"
x[d$Sepal.Length > 7.0] <- "Very Long"
d$Sepal.Length <- x
decisionTree(d, eta = 5, purity=0.95, minsplit=0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.