R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("classPP-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('classPP') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "PP.Tree" > > ### * PP.Tree > > flush(stderr()); flush(stdout()) > > ### Name: PP.Tree > ### Title: Find PP tree structure > ### Aliases: PP.Tree > ### Keywords: tree > > ### ** Examples > > > 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 <- PP.Tree("LDA",iris[train,5],iris[train,1:4]) Warning in return(index.best, proj.best) : multi-argument returns are deprecated Warning in return(index.best, proj.best) : multi-argument returns are deprecated Warning in if (LR.name != n.name) { : the condition has length > 1 and only the first element will be used Warning in return(Alpha, C, IOindexL, IOindexR) : multi-argument returns are deprecated Warning in return(index.best, proj.best) : multi-argument returns are deprecated Warning in if (LR.name != n.name) { : the condition has length > 1 and only the first element will be used Warning in return(Alpha, C, IOindexL, IOindexR) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep, rep, rep1, rep2) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep, rep, rep1, rep2) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep, rep, rep1, rep2) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep, rep, rep1, rep2) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep, rep, rep1, rep2) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep) : multi-argument returns are deprecated > Tree.result $Tree.Struct [,1] [,2] [,3] [,4] [1,] 1 2 3 1 [2,] 2 4 5 2 [3,] 3 0 1 0 [4,] 4 0 2 0 [5,] 5 0 3 0 $Alpha.Keep [,1] [,2] [,3] [,4] [1,] 0.1552834 0.1393853 -0.845888 -0.4908486 [2,] -0.2519178 -0.2257442 0.611986 0.7148776 $C.Keep 1 1 2 [1,] -1.845246 -2.399620 -1.211638 -1.442739 [2,] 1.971591 1.965632 2.059098 2.060051 > > > > cleanEx(); ..nameEx <- "PP.classify" > > ### * PP.classify > > flush(stderr()); flush(stdout()) > > ### Name: PP.classify > ### Title: Predict class for the test set and calculate prediction error > ### Aliases: PP.classify > ### Keywords: tree > > ### ** Examples > > > 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 <- PP.Tree("LDA",iris[train,5],iris[train,1:4]) Warning in return(index.best, proj.best) : multi-argument returns are deprecated Warning in return(index.best, proj.best) : multi-argument returns are deprecated Warning in if (LR.name != n.name) { : the condition has length > 1 and only the first element will be used Warning in return(Alpha, C, IOindexL, IOindexR) : multi-argument returns are deprecated Warning in return(index.best, proj.best) : multi-argument returns are deprecated Warning in if (LR.name != n.name) { : the condition has length > 1 and only the first element will be used Warning in return(Alpha, C, IOindexL, IOindexR) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep, rep, rep1, rep2) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep, rep, rep1, rep2) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep, rep, rep1, rep2) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep, rep, rep1, rep2) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep, rep, rep1, rep2) : multi-argument returns are deprecated Warning in return(Tree.Struct, Alpha.Keep, C.Keep) : multi-argument returns are deprecated > > tree.train <- PP.classify(iris[train,1:4],iris[train,5],Tree.result,Rule=1) Warning in return(test.class.index, class.temp) : multi-argument returns are deprecated Warning in return(test.class.index, class.temp) : multi-argument returns are deprecated Warning in return(test.class.index, class.temp) : multi-argument returns are deprecated Warning in return(test.class.index, class.temp) : multi-argument returns are deprecated Warning in return(test.class.index, class.temp) : multi-argument returns are deprecated Warning in return(test.class, rep) : multi-argument returns are deprecated Warning in return(test.class, rep) : multi-argument returns are deprecated Warning in return(test.class, rep) : multi-argument returns are deprecated Warning in return(test.class, rep) : multi-argument returns are deprecated Warning in return(test.class, rep) : multi-argument returns are deprecated Warning in return(predict.error, predict.class) : multi-argument returns are deprecated > tree.train $predict.error [1] 2 $predict.class [1] 1 2 2 3 1 3 3 2 2 1 1 1 3 2 3 2 2 3 2 3 3 1 3 1 1 1 1 1 3 1 2 2 2 1 2 2 2 [38] 1 2 1 3 3 3 2 2 2 1 1 2 2 3 2 1 1 1 1 3 3 2 1 3 1 1 3 3 3 2 2 3 3 3 2 2 1 [75] 1 2 3 2 2 2 1 3 2 3 2 1 3 1 3 3 1 1 3 2 1 3 3 3 2 3 1 1 3 1 2 3 1 1 1 2 3 [112] 2 2 2 2 1 3 3 3 1 2 1 3 1 3 1 2 2 1 3 3 3 1 1 3 > > tree.test <- PP.classify(iris[test,1:4],iris[test,5],Tree.result,Rule=1) Warning in return(test.class.index, class.temp) : multi-argument returns are deprecated Warning in return(test.class.index, class.temp) : multi-argument returns are deprecated Warning in return(test.class.index, class.temp) : multi-argument returns are deprecated Warning in return(test.class.index, class.temp) : multi-argument returns are deprecated Warning in return(test.class.index, class.temp) : multi-argument returns are deprecated Warning in return(test.class, rep) : multi-argument returns are deprecated Warning in return(test.class, rep) : multi-argument returns are deprecated Warning in return(test.class, rep) : multi-argument returns are deprecated Warning in return(test.class, rep) : multi-argument returns are deprecated Warning in return(test.class, rep) : multi-argument returns are deprecated Warning in return(predict.error, predict.class) : multi-argument returns are deprecated > tree.test $predict.error [1] 0 $predict.class [1] 1 1 1 1 2 2 2 2 2 3 3 3 3 3 3 > > > > > cleanEx(); ..nameEx <- "PP.optimize" > > ### * PP.optimize > > flush(stderr()); flush(stdout()) > > ### Name: PP.optimize > ### Title: Find optimal Projection by maximizing selected PPindex > ### Aliases: PP.optimize.random PP.optimize.anneal PP.optimize.Huber > ### PP.optimize.plot > ### Keywords: optimize > > ### ** Examples > > data(iris) > > PP.opt<-PP.optimize.random("LDA",1,iris[,1:4],iris[,5],cooling=0.999,temp=1) Warning in return(index.best, proj.best) : multi-argument returns are deprecated > > PP.opt$index.best [1] 0.969672 > PP.optimize.plot(PP.opt,iris[,1:4],iris[,5]) > > PP.opt<-PP.optimize.anneal("LDA",1,iris[,1:4],iris[,5],cooling=0.999,temp=1,energy=0.01) Warning in return(index.best, proj.best) : multi-argument returns are deprecated > PP.opt$index.best [1] 0.969872 > > PP.optimize.plot(PP.opt,iris[,1:4],iris[,5]) > > PP.opt<-PP.optimize.Huber("LDA",2,iris[,1:4],iris[,5],cooling=0.999,r=1) Warning in return(index.best, proj.best) : multi-argument returns are deprecated > PP.opt$index.best [1] 0.9763808 > PP.optimize.plot(PP.opt,iris[,1:4],iris[,5]) > > > > > cleanEx(); ..nameEx <- "PPindex.class" > > ### * PPindex.class > > flush(stderr()); flush(stdout()) > > ### Name: PPindex.class > ### Title: Calculate Projection Pursuit index > ### Aliases: PPindex.class PPindex.LDA PPindex.Lp PPindex.PDA > ### Keywords: multivariate > > ### ** Examples > > data(iris) > > PPindex.class("LDA",iris[,1:2],iris[,5]) [1] 0.8334565 > PPindex.class("LDA",iris[,1:2],iris[,5],weight=FALSE) [1] 0.8334565 > PPindex.class("Lp",iris[,1:2],iris[,5],r=1) [1] 1.220794 > PPindex.class("PDA",iris[,1:2],iris[,5],lambda=0.1) [1] 0.6823908 > > > > > ### *