criteria.calculator {forestRK} | R Documentation |
Calculates Entropy or Gini Index of a particular node before (or without) a split
Description
Calculates the Entropy or Gini Index of a particular node before (or without)
a split. This function is used inside the
criteria.after.split.calculator
method.
Usage
criteria.calculator(x.node = data.frame(), y.new.node = c(),
entropy = TRUE)
Arguments
x.node |
numericized data frame of covariates of a particular node
(can be obtained by applying |
y.new.node |
numericized vector of class type ( |
entropy |
|
Value
A list containing the following items:
criteria |
the value of the Entropy or the Gini Index of a particular node. |
ent.status |
logical value ( |
Author(s)
Hyunjin Cho, h56cho@uwaterloo.ca Rebecca Su, y57su@uwaterloo.ca
See Also
criteria.after.split.calculator
Examples
## example: iris dataset
library(forestRK) # load the package forestRK
# covariates of training data set
x.train <- x.organizer(iris[,1:4], encoding = "num")[c(1:25,51:75,101:125),]
# numericized class types of observations of training dataset
y.train <- y.organizer(iris[c(1:25,51:75,101:125),5])$y.new
## criteria.calculator() example
## calculate the Entropy of the original training dataset
criteria.calculator(x.node = x.train, y.new.node = y.train)
## calculate the Gini Index of the original training dataset
criteria.calculator(x.node = x.train, y.new.node = y.train, entropy = FALSE)