| buildRanger | R Documentation |
This is a simple wrapper for the ranger
function from the ranger package.
The purpose of this function is to provide an interface as required by SPOT, to enable
modeling and model-based optimization with ranger.
buildRanger(x, y, control = list())
x |
matrix of input parameters. Rows for each point, columns for each parameter. |
y |
one column matrix of observations to be modeled. |
control |
list of control parameters. These are all configuration parameters
of the |
an object of class spotRanger, with a predict method and a print method.
#'
## Create a simple training data set
testfun <- function (x) x[1]^2
x <- cbind(sort(runif(30)*2-1))
y <- as.matrix(apply(x,1,testfun))
## test data:
xt <- cbind(sort(runif(3000)*2-1))
## Example with default model (standard randomforest)
fit <- buildRanger(x,y)
yt <- predict(fit,data.frame(x=xt))
plot(xt,yt$y,type="l")
points(x,y,col="red",pch=20)
## Example with extra trees, an interpolating model
fit <- buildRanger(x,y,
control=list(rangerArguments =
list(replace = FALSE,
sample.fraction=1,
min.node.size = 1,
splitrule = "extratrees")))
yt <- predict(fit,data.frame(x=xt))
plot(xt,yt$y,type="l")
points(x,y,col="red",pch=20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.