Title: | Projection Pursuit Classification Tree Visualization |
---|---|
Description: | Tools for exploring projection pursuit classification tree using various projection pursuit indexes. |
Authors: | Eun-Kyung Lee |
Maintainer: | Eun-Kyung Lee <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.0.4 |
Built: | 2025-01-06 04:01:55 UTC |
Source: | https://github.com/cran/PPtreeViz |
ENTROPY projection pursuit index
ENTROPYindex1D(origclass,origdata,proj)
ENTROPYindex1D(origclass,origdata,proj)
origclass |
class information vector |
origdata |
data matrix without class information |
proj |
projection matrix |
Calculate ENTROPY projection pursuit index value
data(iris) ENTROPYindex1D(iris[,5],as.matrix(iris[,1,drop=FALSE]))
data(iris) ENTROPYindex1D(iris[,5],as.matrix(iris[,1,drop=FALSE]))
GINI projection pursuit index
GINIindex1D(origclass,origdata,proj)
GINIindex1D(origclass,origdata,proj)
origclass |
class information vector |
origdata |
data matrix without class information |
proj |
projection matrix |
Calculate GINI projection pursuit index value
data(iris) GINIindex1D(iris[,5],as.matrix(iris[,1,drop=FALSE]))
data(iris) GINIindex1D(iris[,5],as.matrix(iris[,1,drop=FALSE]))
Huber plot for 2D data
Huberplot(origdata2D,origclass,PPmethod="LDA",weight=TRUE,r=1, lambda=0.5,opt.proj=TRUE,UserDefFtn=NULL,...)
Huberplot(origdata2D,origclass,PPmethod="LDA",weight=TRUE,r=1, lambda=0.5,opt.proj=TRUE,UserDefFtn=NULL,...)
origdata2D |
2-dimensional numerical data for Huber plot |
origclass |
class information vector of data |
PPmethod |
method for projection pursuit; "LDA", "PDA", "Lr", "GINI", "ENTROPY", and "UserDef" |
weight |
weight flag in LDA, PDA and Lr index |
r |
r in Lr index |
lambda |
lambda in PDA index |
opt.proj |
flag to show the best projection in the plot |
UserDefFtn |
User defined index function when PPmethod="UserDef" |
... |
arguments to be passed to methods |
Draw Huber plot for 2-dimensional data with various PP indices and the histogram of the projected data onto the optimal projection to explore the behavior of the projection prsuit indices
Lee, EK., Cook, D., Klinke, S., and Lumley, T.(2005) Projection Pursuit for Exploratory Supervised Classification, Journal of Computational and Graphical Statistics, 14(4):831-846.
data(iris) Huberplot(iris[,1:2],iris[,5],PPmethod="LDA")
data(iris) Huberplot(iris[,1:2],iris[,5],PPmethod="LDA")
LDA projection pursuit index
LDAindex(origclass,origdata,proj,weight=TRUE)
LDAindex(origclass,origdata,proj,weight=TRUE)
origclass |
class information vector |
origdata |
data matrix without class information |
proj |
projection matrix |
weight |
weight flag in LDA |
Calculate LDA projection pursuit index value
Lee, EK., Cook, D., Klinke, S., and Lumley, T.(2005) Projection Pursuit for exploratory supervised classification, Journal of Computational and Graphical statistics, 14(4):831-846.
data(iris) LDAindex(iris[,5],as.matrix(iris[,1:4]))
data(iris) LDAindex(iris[,5],as.matrix(iris[,1:4]))
PP optimization using LDA index
LDAopt(origclass,origdata,q=1,weight=TRUE,...)
LDAopt(origclass,origdata,q=1,weight=TRUE,...)
origclass |
class information vector of data |
origdata |
data matrix without class information |
q |
dimension of projection vector |
weight |
weight flag in LDA index |
... |
arguments to be passed to methods |
Find the q-dimensional optimal projection using LDA projectin pursuit index
indexbest maximum LDA index value
projbest optimal q-dimensional projection matrix
origclass original class information vector
origdata original data matrix without class information
Lee, EK., Cook, D., Klinke, S., and Lumley, T.(2005) Projection Pursuit for Exploratory Supervised Classification, Journal of Computational and Graphical Statistics, 14(4):831-846.
data(iris) LDA.proj.result <- LDAopt(iris[,5],iris[,1:4]) LDA.proj.result$indexbest LDA.proj.result$projbest
data(iris) LDA.proj.result <- LDAopt(iris[,5],iris[,1:4]) LDA.proj.result$indexbest LDA.proj.result$projbest
Lr projection pursuit index
Lrindex(origclass,origdata,proj,weight=TRUE,r=1)
Lrindex(origclass,origdata,proj,weight=TRUE,r=1)
origclass |
class information vector |
origdata |
data matrix without class information |
proj |
projection matrix |
weight |
weight flag in Lr index |
r |
r in Lr index |
Calculate Lr projection pursuit index value
Lee, EK., Cook, D., Klinke, S., and Lumley, T.(2005) Projection Pursuit for exploratory supervised classification, Journal of Computational and Graphical statistics, 14(4):831-846.
data(iris) Lrindex(iris[,5],as.matrix(iris[,1:4]),r=1)
data(iris) Lrindex(iris[,5],as.matrix(iris[,1:4]),r=1)
PDA projection pursuit index
PDAindex(origclass,origdata,proj,weight=TRUE,lambda=0.1)
PDAindex(origclass,origdata,proj,weight=TRUE,lambda=0.1)
origclass |
class information vector |
origdata |
data matrix without class information |
proj |
projection matrix |
weight |
weight flag in PDA |
lambda |
lambda in PDA index |
Calculate PDA projection pursuit index value
Lee, EK., Cook, D.(2010) A projection pursuit index for large p small n data, Statistics and Computing, 20:381-392.
data(iris) PDAindex(iris[,5],as.matrix(iris[,1:4]),lambda=0.2)
data(iris) PDAindex(iris[,5],as.matrix(iris[,1:4]),lambda=0.2)
PP optimization using PDA index
PDAopt(origclass,origdata,q=1,weight=TRUE,lambda=0.1,...)
PDAopt(origclass,origdata,q=1,weight=TRUE,lambda=0.1,...)
origclass |
class information vector of data |
origdata |
data matrix without class information |
q |
dimension of projection vector |
weight |
weight flag in PDA index |
lambda |
lambda in PDA index |
... |
arguments to be passed to methods |
Find the q-dimensional optimal projection using PDA projectin pursuit index
indexbest maximum PDA index value
projbest optimal q-dimensional projection matrix
origclass original class information vector
origdata original data matrix without class information
Lee, EK, Cook, D.(2010) A Projection Pursuit Index for Large p Small n Data, Statistics and Computing, 20:381-392.
data(iris) PDA.proj.result <- PDAopt(iris[,5],iris[,1:4],weight=TRUE,q=2,lambda=0.1) PDA.proj.result$indexbest PDA.proj.result$projbest
data(iris) PDA.proj.result <- PDAopt(iris[,5],iris[,1:4],weight=TRUE,q=2,lambda=0.1) PDA.proj.result$indexbest PDA.proj.result$projbest
projection pursuit classification tree plot
## S3 method for class 'PPtreeclass' plot( x, font.size = 17, width.size = 1, main = "Projection Pursuit Classification Tree", sub = NULL, ... )
## S3 method for class 'PPtreeclass' plot( x, font.size = 17, width.size = 1, main = "Projection Pursuit Classification Tree", sub = NULL, ... )
x |
PPtreeclass object |
font.size |
font size of plot |
width.size |
size of eclipse in each node. |
main |
main title |
sub |
sub title |
... |
arguments to be passed to methods |
Draw projection pursuit classification tree with tree structure. It is modified from a function in party library.
Lee, EK(2017) PPtreeViz: An R Package for Visualizing Projection Pursuit Classification Trees, Journal of Statistical Software <doi:10.18637/jss.v083.i08>
data(iris) Tree.result <- PPTreeclass(Species~., data = iris,"LDA") Tree.result plot(Tree.result)
data(iris) Tree.result <- PPTreeclass(Species~., data = iris,"LDA") Tree.result plot(Tree.result)
predict projection pursuit classification tree
PPclassify(Tree.result,test.data,Rule,true.class=NULL,...)
PPclassify(Tree.result,test.data,Rule,true.class=NULL,...)
Tree.result |
PPtreeclass object |
test.data |
the test dataset |
Rule |
split rule 1: mean of two group means 2: weighted mean of two group means - weight with group size 3: weighted mean of two group means - weight with group sd 4: weighted mean of two group means - weight with group se 5: mean of two group medians 6: weighted mean of two group medians - weight with group size 7: weighted mean of two group median - weight with group IQR 8: weighted mean of two group median - weight with group IQR and size |
true.class |
true class of test dataset if available |
... |
arguments to be passed to methods |
Predict class for the test set with the fitted projection pursuit classification tree and calculate prediction error.
predict.class predicted class
predict.error number of the prediction errors
Lee, YD, Cook, D., Park JW, and Lee, EK(2013) PPtree: Projection Pursuit Classification Tree, Electronic Journal of Statistics, 7:1369-1386.
data(iris) n <- nrow(iris) tot <- c(1:n) n.train <- round(n*0.9) train <- sample(tot,n.train) test <- tot[-train] Tree.result <- PPTreeclass(Species~.,data=iris[train,],"LDA") PPclassify(Tree.result,iris[test,1:4],1,iris[test,5])
data(iris) n <- nrow(iris) tot <- c(1:n) n.train <- round(n*0.9) train <- sample(tot,n.train) test <- tot[-train] Tree.result <- PPTreeclass(Species~.,data=iris[train,],"LDA") PPclassify(Tree.result,iris[test,1:4],1,iris[test,5])
Visualization tools to explore each node of PPtree
PPclassNodeViz(PPclassOBJ,node.id,Rule,legend,std,image,diff.prop)
PPclassNodeViz(PPclassOBJ,node.id,Rule,legend,std,image,diff.prop)
PPclassOBJ |
PPregclass object |
node.id |
node ID |
Rule |
cutoff rule |
legend |
flag to represent legend in the plot. Default value is TRUE |
std |
flag to standardize data before drawing plot |
image |
flag to draw image plot of correlation matrix |
diff.prop |
percentage of number of variables with significant differences and shown in red in the bar chart style means |
For the inner node, four plots are provided - the bar chart style plot with projection pursuit coefficients of each variable, the histogram of the projected data, the bar chart style plots with means of each variables for the left and the right group, and the image plot of correlations.
Lee, YD, Cook, D., Park JW, and Lee, EK(2013) PPtree: Projection Pursuit Classification Tree, Electronic Journal of Statistics, 7:1369-1386.
data(iris) Tree.result <- PPTreeclass(Species~., data = iris,"LDA") Tree.result PPclassNodeViz(Tree.result,1,1)
data(iris) Tree.result <- PPTreeclass(Species~., data = iris,"LDA") Tree.result PPclassNodeViz(Tree.result,1,1)
PP optimization using various projection pursuit indices
PPopt(origclass,origdata,q=1,PPmethod="LDA",weight=TRUE,r=1, lambda=0.1,energy=0,cooling=0.999,TOL=0.0001,maxiter = 50000)
PPopt(origclass,origdata,q=1,PPmethod="LDA",weight=TRUE,r=1, lambda=0.1,energy=0,cooling=0.999,TOL=0.0001,maxiter = 50000)
origclass |
class information vector |
origdata |
data matrix without class information |
q |
dimension of projection matrix |
PPmethod |
method for projection pursuit; "LDA", "PDA", "Lr", "GINI", and "ENTROPY" |
weight |
weight flag in LDA, PDA and Lr index |
r |
r in Lr index |
lambda |
lambda in PDA index |
energy |
energy parameter |
cooling |
cooling parameter |
TOL |
tolerance |
maxiter |
number of maximum iteration |
Find the q-dim optimal projection using various projectin pursuit indices with class information
indexbest maximum LDA index value
projbest optimal q-dim projection matrix
origclass original class information vector
origdata original data matrix without class information
Lee, EK., Cook, D., Klinke, S., and Lumley, T.(2005) Projection Pursuit for exploratory supervised classification, Journal of Computational and Graphical statistics, 14(4):831-846.
data(iris) PP.proj.result <- PPopt(iris[,5],as.matrix(iris[,1:4])) PP.proj.result
data(iris) PP.proj.result <- PPopt(iris[,5],as.matrix(iris[,1:4])) PP.proj.result
Visualize PPopt result
PPoptViz(PPoptOBJ)
PPoptViz(PPoptOBJ)
PPoptOBJ |
PPoptim object. result from LDAopt, PDAopt, and PPopt |
Visualize the result of projection pursuit optimization
Lee, EK(2017) PPtreeViz: An R Package for Visualizing Projection Pursuit Classification Trees, Journal of Statistical Software <doi:10.18637/jss.v083.i08>
data(iris) PPoptViz(LDAopt(iris[,5],iris[,1:4],q=1)) PPoptViz(LDAopt(iris[,5],iris[,1:4],q=2))
data(iris) PPoptViz(LDAopt(iris[,5],iris[,1:4],q=1)) PPoptViz(LDAopt(iris[,5],iris[,1:4],q=2))
Construct the projection pursuit classification tree
PPTreeclass(formula,data, PPmethod="LDA",weight=TRUE, r=1,lambda=0.1,energy=0,maxiter=50000,...)
PPTreeclass(formula,data, PPmethod="LDA",weight=TRUE, r=1,lambda=0.1,energy=0,maxiter=50000,...)
formula |
an object of class "formula" |
data |
data frame |
PPmethod |
method for projection pursuit; "LDA", "PDA", "Lr", "GINI", and "ENTROPY" |
weight |
weight flag in LDA, PDA and Lr index |
r |
r in Lr index |
lambda |
lambda in PDA index |
energy |
parameter for the probability to take new projection |
maxiter |
maximum iteration number |
... |
arguments to be passed to methods |
Find tree structure using various projection pursuit indices of classification in each split.
Tree.Struct tree structure of projection pursuit classification tree
projbest.node 1 dimensional optimal projections of each node split
splitCutoff.node cutoff values of each node split
origclass original class
origdata original data
Lee, YD, Cook, D., Park JW, and Lee, EK(2013) PPtree: Projection Pursuit Classification Tree, Electronic Journal of Statistics, 7:1369-1386.
data(iris) Tree.result <- PPTreeclass(Species~.,data = iris,"LDA") Tree.result
data(iris) Tree.result <- PPTreeclass(Species~.,data = iris,"LDA") Tree.result
predict projection pursuit classification tree
## S3 method for class 'PPtreeclass' predict(object, newdata = NULL, Rule = 1, ...)
## S3 method for class 'PPtreeclass' predict(object, newdata = NULL, Rule = 1, ...)
object |
a fitted object of class inheriting from "PP.Tree.class" |
newdata |
the test dataset |
Rule |
split rule 1: mean of two group means 2: weighted mean of two group means - weight with group size 3: weighted mean of two group means - weight with group sd 4: weighted mean of two group means - weight with group se 5: mean of two group medians 6: weighted mean of two group medians - weight with group size 7: weighted mean of two group median - weight with group IQR 8: weighted mean of two group median - weight with group IQR and size |
... |
arguments to be passed to methods |
Predict class for the test set with the fitted projection pursuit classification tree and calculate prediction error.
Lee, YD, Cook, D., Park JW, and Lee, EK(2013) PPtree: Projection Pursuit Classification Tree, Electronic Journal of Statistics, 7:1369-1386.
data(iris) n <- nrow(iris) tot <- c(1:n) n.train <- round(n*0.9) train <- sample(tot,n.train) test <- tot[-train] Tree.result <- PPTreeclass(Species~., data=iris[train,],"LDA") predict(Tree.result)
data(iris) n <- nrow(iris) tot <- c(1:n) n.train <- round(n*0.9) train <- sample(tot,n.train) test <- tot[-train] Tree.result <- PPTreeclass(Species~., data=iris[train,],"LDA") predict(Tree.result)
Print PP.Tree.class result
## S3 method for class 'PPtreeclass' print(x, coef.print = FALSE, cutoff.print = FALSE, verbose = TRUE, ...)
## S3 method for class 'PPtreeclass' print(x, coef.print = FALSE, cutoff.print = FALSE, verbose = TRUE, ...)
x |
PPtreeclass object |
coef.print |
print projection coefficients in each node ifTRUE |
cutoff.print |
print cutoff values in each node if TRUE |
verbose |
print if TRUE, no output if FALSE |
... |
arguments to be passed to methods |
Print the projection pursuit classification tree result
Lee, EK(2017) PPtreeViz: An R Package for Visualizing Projection Pursuit Classification Trees, Journal of Statistical Software <doi:10.18637/jss.v083.i08>
data(iris) Tree.result <- PPTreeclass(Species~.,data = iris,"LDA") Tree.result print(Tree.result,coef.print=TRUE,cutoff.print=TRUE)
data(iris) Tree.result <- PPTreeclass(Species~.,data = iris,"LDA") Tree.result print(Tree.result,coef.print=TRUE,cutoff.print=TRUE)