Description Usage Arguments Value Examples
The sgb_fit
function is a wrapper for
xgboost designed to implement survival
analyses.
1 2 3 4 5 | sgb_fit(sgb_df, nrounds = NULL, eval_time_quants = c(0.1, 0.9),
missing = NA, weight = NULL, params = sgb_params(), verbose = 1,
print_every_n = max(c(1, round(nrounds/5))),
early_stopping_rounds = NULL, maximize = NULL, save_period = NULL,
save_name = "sgboost.model", xgb_model = NULL, callbacks = list())
|
sgb_df |
An object of class 'sgb_data' (see sgb_data). |
nrounds |
max number of boosting iterations. |
eval_time_quants |
To evaluate risk prediction models, a set of
evaluation times are created using the observed event times in |
missing |
by default is set to NA, which means that NA values should be considered as 'missing' by the algorithm. Sometimes, 0 or other extreme value might be used to represent missing values. This parameter is only used when input is a dense matrix. |
weight |
a vector indicating the weight for each row of the input. |
params |
the list of parameters. The complete list of parameters is available at http://xgboost.readthedocs.io/en/latest/parameter.html. Below is a shorter summary: 1. General Parameters
2. Booster Parameters 2.1. Parameter for Tree Booster
2.2. Parameter for Linear Booster
3. Task Parameters
|
verbose |
If 0, xgboost will stay silent. If 1, it will print information about performance.
If 2, some additional information will be printed out.
Note that setting |
print_every_n |
Print each n-th iteration evaluation messages when |
early_stopping_rounds |
If |
maximize |
If |
save_period |
when it is non-NULL, model is saved to disk after every |
save_name |
the name or path for periodically saved model file. |
xgb_model |
a previously built model to continue the training from.
Could be either an object of class |
callbacks |
a list of callback functions to perform various task during boosting.
See |
An sgb_booster
object containing:
fit
: An xgb.booster
object (see xgboost).
label
: A numeric vector with time-to-event values, where
censored observations have negative times and uncensored
observations have positive times (see sgb_label).
predictions
Predicted values from fit
for the training
data. These predictions are saved as they are required to
estimate the baseline hazard function of fit
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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 = NULL,
verbose = TRUE,
print_every_n = 10
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.