Description Usage Arguments Value Examples
Function that does prediction based on the fitted models for the new coming data
1 | prediction(x, model_train, parallel)
|
x |
- the new coming data that we want to do prediction on |
model_train |
- the list of models trained on the training data |
parallel |
- logical value, true if its results will be combined in parallel |
The multiple estimation based on the multiple weak models if in parallel, otherwise the final estimation.
1 2 3 4 5 6 7 8 9 10 11 | x = matrix(rnorm(1000), 200, 5)
y <- x %*% rnorm(5) + rnorm(200, 0, 3)
parallel <- TRUE
coef <- lm(y ~ -1 + x)$coefficients
model_train <- list()
model_train[[1]] <- function(x){
x <- matrix(x, ncol = length(coef))
x %*% coef
}
x_new <- matrix(rnorm(5), 1, 5)
prediction(x_new, model_train, parallel)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.