decisionTree: decisionTree

Description Usage Arguments Value Examples

View source: R/decisionTree.R

Description

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.

Usage

1
decisionTree(d, eta = 10, purity = 0.95, minsplit = 10)

Arguments

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

Value

A DecisionTreeObject consists of two slots: resultDF and nodeChoices.

Examples

 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)

tomis9/decisionTree documentation built on May 29, 2019, 9:55 a.m.