Description Usage Arguments Value Examples
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
.
1 | 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
## 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 extratrees, an interpolating model
fit <- buildRanger(x,y,
control=list(rangerArguments =
list(replace = F,
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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.