predict.sgb_booster: Boosting Predictions

Description Usage Arguments Value Examples

View source: R/predict.R

Description

Boosting Predictions

Usage

1
2
## S3 method for class 'sgb_booster'
predict(object, new_data, eval_times = NULL, ...)

Arguments

object

a sgb_booster object

new_data

data to compute predictions for.

eval_times

numeric vector of times to compute survival probabilities.

...

Additional arguments passed to other functions.

  • smooth: if TRUE, smooth the estimated baseline hazard using Friedman's super smoother supsmu.

  • ntreelimit: limit the number of model's trees or boosting iterations used in prediction. If unspecified, all trees will be used.

Value

a matrix with number of columns equal to the number of eval_times and number of rows equal to the number of rows in new_data. Additionally, eval_times are attached to the output as an attribute.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
x1 <- rnorm(100)
x2 <- rnorm(100)
s  <- as.numeric(x1 + x2 + rnorm(100) > 0)
t  <- runif(100, min=1, max=10)

df = data.frame(time=t, status=s, x1=x1, x2=x2)

df = as_sgb_data(df, time=time, status=status)

sgb_booster <- sgb_fit(
  sgb_df = df,
  params = sgb_params(max_depth=1),
  nrounds = 10,
  verbose = FALSE
)

sgb_probs <- predict(sgb_booster, new_data = df)

bcjaeger/xgboost.surv documentation built on Nov. 18, 2019, 6:43 a.m.