Divide {lazy.tree} | R Documentation |
This function divides a given set of objects into two subsets
so that the weighted sum of the impurity measures of the subsets
are minimized using a greedy algorithm with Depth-First Search (DFS).
Japanese help file: Divide_JPH
Divide(
ys,
Xs,
Ys = NULL,
impfunc,
S,
method = 1,
ncatx = 0,
app = 0,
maxapp = 10,
maxncut = 50,
levelsy = NULL,
levelsX = NULL
)
ys |
Criterion variable vector |
Xs |
Regressor matrix |
Ys |
The dichotomized criterion matrix for |
impfunc |
impurity function |
S |
Index vector indicating the original location of
the rows of ys and X. |
method |
Treatment of the categorical regressor variable. |
ncatx |
Vector consisting of the # of cagegories of the regressors |
app |
= 0 not to use app (all possible partitions) |
maxapp |
Maximum # of categories of the regressor variables for which app is used. |
maxncut |
Maximum # of cut point (threshold) candidate |
levelsy |
# of levels of the criterion |
levelsx |
a list of the # of levels of the regressors |
ncat=0
or ncat=1
means the variable is continuous,
ncat=2
means the variable is binary,
ncat >= 3
means the variable is polytomous.
A list consisting of the following:
j: the variable number used to divide the set threshold: the threshold of variable j when it is continuous, or NA. valxj: the set of values of nominal variable j to be classified as left valxjR: the set of values of nominal variable j to be classified as right Note that these are numeric variables, not factors. k: quantified variable number used or 0 nqx: # of unique quantified variables locLL and locRR: the location of obs in 1:nrow(Xs) to be classficed left: the set of observations classified as left right: the set of observations classified as right left.score: The nobs weighted impurity measure of left set right.score: The nobs weighted impurity measure of right set score: The sum of the above two.
Xc <- data.frame(x1=as.factor(square$x1),x2=as.factor(square$x2))
Divide( square$Class4, Xc, impfunc=gini, S=1:nrow(Xc), method=1
, ncatx=c(7,5), app=0 )
Divide( square$Class4, Xc, impfunc=gini, S=1:nrow(Xc), app=9
, ncatx=c(7,5) )