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("boost-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('boost') Loading required package: rpart > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "adaboost" > > ### * adaboost > > flush(stderr()); flush(stdout()) > > ### Name: adaboost > ### Title: adaboost > ### Aliases: adaboost > ### Keywords: classif > > ### ** Examples > > data(leukemia, package = "boost") > > ## Dividing the leukemia dataset into training and test data > xlearn <- leukemia.x[c(1:20, 34:38),] > ylearn <- leukemia.y[c(1:20, 34:38)] > xtest <- leukemia.x[21:33,] > ytest <- leukemia.y[21:33] > > ## Classification with adaboost > fit <- adaboost(xlearn, ylearn, xtest, presel=50, mfinal=20) > summarize(fit, ytest) Minimal mcr: 0 achieved after 8 boosting step(s) Fixed mcr: 0 achieved after 20 boosting step(s) > > > > cleanEx(); ..nameEx <- "bagboost" > > ### * bagboost > > flush(stderr()); flush(stdout()) > > ### Name: bagboost > ### Title: bagboost > ### Aliases: bagboost > ### Keywords: classif > > ### ** Examples > > data(leukemia, package = "boost") > > ## Dividing the leukemia dataset into training and test data > xlearn <- leukemia.x[c(1:20, 34:38),] > ylearn <- leukemia.y[c(1:20, 34:38)] > xtest <- leukemia.x[21:33,] > ytest <- leukemia.y[21:33] > > ## Classification with bagboost > fit <- bagboost(xlearn, ylearn, xtest, presel=50, mfinal=20, bag=5) > summarize(fit, ytest) Minimal mcr: 0 achieved after 2 boosting step(s) Fixed mcr: 0 achieved after 20 boosting step(s) > > > > cleanEx(); ..nameEx <- "l2boost" > > ### * l2boost > > flush(stderr()); flush(stdout()) > > ### Name: l2boost > ### Title: l2boost > ### Aliases: l2boost > ### Keywords: classif > > ### ** Examples > > data(leukemia, package = "boost") > > ## Dividing the leukemia dataset into training and test data > xlearn <- leukemia.x[c(1:20, 34:38),] > ylearn <- leukemia.y[c(1:20, 34:38)] > xtest <- leukemia.x[21:33,] > ytest <- leukemia.y[21:33] > > ## Classification with l2boost > fit <- l2boost(xlearn, ylearn, xtest, presel=50, mfinal=20) > summarize(fit, ytest) Minimal mcr: 0.0769 achieved after 4 boosting step(s) Fixed mcr: 0.0769 achieved after 20 boosting step(s) > > > > cleanEx(); ..nameEx <- "leukemia" > > ### * leukemia > > flush(stderr()); flush(stdout()) > > ### Name: leukemia > ### Title: A part of the famous AML/ALL-leukemia dataset > ### Aliases: leukemia leukemia.x leukemia.y leukemia.z > ### Keywords: datasets > > ### ** Examples > > data(leukemia) > str(leukemia.x) num [1:38, 1:250] 3.15 3.10 2.98 3.24 3.19 ... > str(leukemia.y) num [1:38] 0 0 0 0 0 0 0 0 0 0 ... > str(leukemia.z) num [1:38] 0 1 1 0 0 1 0 0 1 1 ... > par(mfrow=c(1,2)) > plot(leukemia.x[,56], leukemia.y) > plot(leukemia.x[,174],leukemia.z) > > > graphics::par(get("par.postscript", env = .CheckExEnv)) > cleanEx(); ..nameEx <- "logitboost" > > ### * logitboost > > flush(stderr()); flush(stdout()) > > ### Name: logitboost > ### Title: logitboost > ### Aliases: logitboost > ### Keywords: classif > > ### ** Examples > > data(leukemia, package = "boost") > > ## Dividing the leukemia dataset into training and test data > xlearn <- leukemia.x[c(1:20, 34:38),] > ylearn <- leukemia.y[c(1:20, 34:38)] > xtest <- leukemia.x[21:33,] > ytest <- leukemia.y[21:33] > > ## Classification with logitboost > fit <- logitboost(xlearn, ylearn, xtest, presel=50, mfinal=20) > summarize(fit, ytest) Minimal mcr: 0 achieved after 9 boosting step(s) Fixed mcr: 0 achieved after 20 boosting step(s) > > > > cleanEx(); ..nameEx <- "simulator" > > ### * simulator > > flush(stderr()); flush(stdout()) > > ### Name: simulator > ### Title: simulator > ### Aliases: simulator > ### Keywords: classif > > ### ** Examples > > set.seed(21) > data(leukemia) > > ## Simulation of gene expression data > simu <- simulator(leukemia.x, leukemia.y, nos=200) > > ## Defining training and test data > xlearn <- simu$x[1:150,] > ylearn <- simu$y[1:150] > xtest <- simu$x[151:200,] > ytest <- simu$y[151:200] > > ## Classification with logitboost > fit <- logitboost(xlearn, ylearn, xtest, mfinal=20, presel=50) > summarize(fit, ytest) Minimal mcr: 0 achieved after 3 boosting step(s) Fixed mcr: 0 achieved after 20 boosting step(s) > > > > cleanEx(); ..nameEx <- "summarize" > > ### * summarize > > flush(stderr()); flush(stdout()) > > ### Name: summarize > ### Title: Summarize the output of classification with boosting functions > ### Aliases: summarize > ### Keywords: classif > > ### ** Examples > > data(leukemia, package = "boost") > > ## Dividing the leukemia dataset into training and test data > xlearn <- leukemia.x[c(1:20, 34:38),] > ylearn <- leukemia.y[c(1:20, 34:38)] > xtest <- leukemia.x[21:33,] > ytest <- leukemia.y[21:33] > > ## Classification with logitboost > fit <- logitboost(xlearn, ylearn, xtest, presel=50, mfinal=20) > summarize(fit, ytest) Minimal mcr: 0 achieved after 9 boosting step(s) Fixed mcr: 0 achieved after 20 boosting step(s) > > > > ### *