# NOT RUN {
## example: iris dataset
## load the forestRK package
library(forestRK)
x.train <- x.organizer(iris[,1:4], encoding = "num")[c(1:25,51:75,101:125),]
x.test <- x.organizer(iris[,1:4], encoding = "num")[c(26:50,76:100,126:150),]
y.train <- y.organizer(iris[c(1:25,51:75,101:125),5])$y.new
y.factor.levels <- y.organizer(iris[c(1:25,51:75,101:125),5])$y.factor.levels
# min.num.obs.end.node.tree is set to 5 by default;
# entropy is set to TRUE by default
# typically the nbags and samp.size has to be much larger than 30 and 50
pred.forest.rk <- pred.forestRK(x.test = x.test,
x.training = x.train, y.training = y.train,
nbags = 30, samp.size = 50,
y.factor.levels = y.factor.levels)
# generate a classical mds plot of test observations
# and colour code them by the predicted class
mds.plot.forestRK(pred.forest.rk)
# }
Run the code above in your browser using DataLab