stanfordmlgroup / ngboost

Natural Gradient Boosting for Probabilistic Prediction
Apache License 2.0
1.63k stars 214 forks source link

How extract survival functions from NGBSurvival.pred_dist #255

Closed CoteDave closed 3 years ago

CoteDave commented 3 years ago

Hi,

Is there an easy way to extract the survival functions from each individual instance with the NGBSurvival.pred_dist ?

Thanks!

CoteDave commented 3 years ago

I think this can do the job:

survival_func_list = [] for i in range(0, np.max(y_train['DUREE_MOIS'])): survival_func_list.append(y_dists.sf(i)) survival_func_matrix = pd.DataFrame(survival_func_list)

alejandroschuler commented 3 years ago

@CoteDave, also see this discussion: https://github.com/stanfordmlgroup/ngboost/discussions/224