Description Usage Arguments Value Note References See Also Examples
View source: R/buildEnsembleStack.R
Generates an ensemble of surrogate models with stacking (stacked generalization).
1 | buildEnsembleStack(x, y, control = list())
|
x |
design matrix (sample locations), rows for each sample, columns for each variable. |
y |
vector of observations at |
control |
(list), with the options for the model building procedure: |
returns an object of class ensembleStack
.
Loosely based on the code by Emanuele Olivetti https://github.com/emanuele/kaggle_pbr/blob/master/blend.py
Bartz-Beielstein, Thomas. Stacked Generalization of Surrogate Models-A Practical Approach. Technical Report 5/2016, TH Koeln, Koeln, 2016.
David H Wolpert. Stacked generalization. Neural Networks, 5(2):241-259, January 1992.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Create a test function: branin
braninFunction <- function (x) {
(x[2] - 5.1/(4 * pi^2) * (x[1] ^2) + 5/pi * x[1] - 6)^2 +
10 * (1 - 1/(8 * pi)) * cos(x[1] ) + 10
}
## Create design points
x <- cbind(runif(20)*15-5,runif(20)*15)
## Compute observations at design points
y <- as.matrix(apply(x,1,braninFunction))
## Create model with default settings
fit <- buildEnsembleStack(x,y)
## Predict new point
predict(fit,cbind(1,2))
## True value at location
braninFunction(c(1,2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.