Learn R Programming

agtboost (version 0.9.3)

gbt.convergence: Convergence of agtboost model.

Description

gbt.convergence calculates loss of data over iterations in the model

Usage

gbt.convergence(object, y, x)

Arguments

object

Object or pointer to object of class ENSEMBLE

y

response vector

x

design matrix for training. Must be of type matrix.

Value

vector with $K+1$ elements with loss at each boosting iteration and at the first constant prediction

Details

Computes the loss on supplied data at each boosting iterations of the model passed as object. This may be used to visually test for overfitting on test data, or the converce, to check for underfitting or non-convergence.

Examples

Run this code
# NOT RUN {
## Gaussian regression:
x_tr <- as.matrix(runif(500, 0, 4))
y_tr <- rnorm(500, x_tr, 1)
x_te <- as.matrix(runif(500, 0, 4))
y_te <- rnorm(500, x_te, 1)
mod <- gbt.train(y_tr, x_tr)
convergence <- gbt.convergence(mod, y_te, x_te)
which.min(convergence) # Should be fairly similar to boosting iterations + 1
mod$get_num_trees() +1 # num_trees does not include initial prediction

# }

Run the code above in your browser using DataLab