I created a XGboost Accelerated Failure Time model, code below, that outputs the estimated survival time for each individual in the data set. Is there a way to output the survival probabilities for a range of different time points. The docs are fairly sparse on this. I have used the XGBSE package to create the probabilities in a slightly different model format but I would like to do it with the base package as well.
https://xgboost.readthedocs.io/en/latest/tutorials/aft_survival_analysis.html
Code snippet here
PARAMS_XGB_AFT = {
'objective': 'survival:aft',
'eval_metric': 'aft-nloglik',
'aft_loss_distribution': 'normal',
'aft_loss_distribution_scale': 1.5,
'tree_method': 'hist',
'learning_rate': 5e-2,
'max_depth': 8,
'booster':'dart',
'subsample':0.5,
'min_child_weight': 50,
'colsample_bynode':0.5
}
# training model
bst = xgb.train(
PARAMS_XGB_AFT,
dtrain,
num_boost_round=1000,
early_stopping_rounds=10,
evals=[(dval, 'val')],
verbose_eval=0
)
# predicting and evaluating
preds = bst.predict(dval)
cind = concordance_index(y_valid, -preds, risk_strategy='precomputed')
print(f"C-index: {cind:.3f}")
# outputs the estimated survival time for each individual in data set
preds