## Not run:
# # Regression example:
# nRow <- 5000
# x <- data.frame(replicate(6, rnorm(nRow)))
# y <- with(x, X1^2 + sin(X2) + X3 * X4) # courtesy of S. Welling.
#
# # Classification example:
# data(iris)
#
# # Generic invocation:
# rb <- Rborist(x, y)
#
#
# # Causes 300 trees to be trained:
# rb <- Rborist(x, y, nTree = 300)
#
#
# # Causes rows to be sampled without replacement:
# rb <- Rborist(x, y, withRepl=FALSE)
#
#
# # Causes validation census to report class probabilities:
# rb <- Rborist(iris[-5], iris[5], ctgCensus="prob")
#
#
# # Applies table-weighting to classification categories:
# rb <- Rborist(iris[-5], iris[5], classWeight = "balance")
#
#
# # Weights first category twice as heavily as remaining two:
# rb <- Rborist(iris[-5], iris[5], classWeight = c(2.0, 1.0, 1.0))
#
#
# # Does not split nodes when doing so yields less than a 2% gain in
# # information over the parent node:
# rb <- Rborist(x, y, minInfo=0.02)
#
#
# # Does not split nodes representing fewer than 10 unique samples:
# rb <- Rborist(x, y, minNode=10)
#
#
# # Trains a maximum of 20 levels:
# rb <- Rborist(x, y, nLevel = 20)
#
#
# # Trains, but does not perform subsequent validation:
# rb <- Rborist(x, y, noValidate=TRUE)
#
#
# # Chooses 500 rows (with replacement) to root each tree.
# rb <- Rborist(x, y, nSamp=500)
#
#
# # Chooses 2 predictors as splitting candidates at each node (or
# # fewer, when choices exhausted):
# rb <- Rborist(x, y, predFixed = 2)
#
#
# # Causes each predictor to be selected as a splitting candidate with
# # distribution Bernoulli(0.3):
# rb <- Rborist(x, y, predProb = 0.3)
#
#
# # Causes first three predictors to be selected as splitting candidates
# # twice as often as the other two:
# rb <- Rborist(x, y, predWeight=c(2.0, 2.0, 2.0, 1.0, 1.0))
#
#
# # Causes (default) quantiles to be computed at validation:
# rb <- Rborist(x, y, quantiles=TRUE)
# qPred <- rb$validation$qPred
#
#
# # Causes specfied quantiles (deciles) to be computed at validation:
# rb <- Rborist(x, y, quantVec = seq(0.1, 1.0, by = 0.10))
# qPred <- rb$validation$qPred
#
#
# # Causes (default) quantile computation to be approximated by a
# # small bin size of 100: fast, but not as accurate:
# rb <- Rborist(x, y, quantiles = TRUE, qBin = 100).
# qPred <- rb$validation$qPred
#
#
# # Constrains modelled response to be increasing with respect to X1
# # and decreasing with respect to X5 (both unlikely).
# rb <- Rborist(x, y, regMono=c(1.0, 0, 0, 0, -1.0, 0))
#
#
# # Causes rows to be sampled with random weighting:
# rb <- Rborist(x, y, rowWeight=runif(nRow))
#
# ## End(Not run)
Run the code above in your browser using DataLab