Learn R Programming

agtboost (version 0.9.3)

predict.Rcpp_ENSEMBLE: aGTBoost Prediction

Description

predict is an interface for predicting from a agtboost model.

Usage

# S3 method for Rcpp_ENSEMBLE
predict(object, newdata, ...)

Arguments

object

Object or pointer to object of class ENSEMBLE

newdata

Design matrix of data to be predicted. Type matrix

...

additional parameters passed. Currently not in use.

Value

For regression or binary classification, it returns a vector of length nrows(newdata).

Details

The prediction function for agtboost. Using the generic predict function in R is also possible, using the same arguments.

References

Berent <U+00C5>nund Str<U+00F8>mnes Lunde, Tore Selland Kleppe and Hans Julius Skaug, "An Information Criterion for Automatic Gradient Tree Boosting", 2020, https://arxiv.org/abs/2008.05926

See Also

gbt.train

Examples

Run this code
# NOT RUN {
## A simple gtb.train example with linear regression:
x <- runif(500, 0, 4)
y <- rnorm(500, x, 1)
x.test <- runif(500, 0, 4)
y.test <- rnorm(500, x.test, 1)

mod <- gbt.train(y, as.matrix(x))

## predict is overloaded
y.pred <- predict( mod, as.matrix( x.test ) )

plot(x.test, y.test)
points(x.test, y.pred, col="red")


# }

Run the code above in your browser using DataLab