You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello folks. Has anyone used Survival Analysis with AFT using xgb.cv in R? I see examples online using xgb.train, where you can set lower and upper limits on the label (response variable) within the xgb.DMatrix, but I keep getting errors in my code when trying to do this with xgb.cv. I set the lower and upper label bounds in this fashion:
But when I make the call to xgb.cv, I get an error about the label:
Error in xgb.cv(params = params, covar_train, early_stopping_rounds = 10, :
Labels must be provided for CV either through xgb.DMatrix, or through 'label=' when 'data' is matrix
covar_train is my DMatrix of model covariates. If I "getinfo" about the label of covar_train, it comes back "NULL", which isn't surprising, because I haven't set it, but how to indicate to xgb.cv to use the upper and lower label bounds in conjunction with the 'survival:aft' objective function and the 'aft-nloglik' evaluation metric? I've run very similar code using xgb.train, and that seems to work fine.
If anyone can share code that implements the Survival AFT model using xgb.cv, that'd be much appreciated!
The text was updated successfully, but these errors were encountered:
I once had the same problem. IMHO, xgb.cv does not deal with label_lower_bound and label_upper_bound. My solution was to do the cross-validation without xgb.cv.
Thanks MM. Someone else recommended writing my own cross-validation routine but I was waiting to see if there was an easier solution. Would you mind sharing your code?
Hello folks. Has anyone used Survival Analysis with AFT using xgb.cv in R? I see examples online using xgb.train, where you can set lower and upper limits on the label (response variable) within the xgb.DMatrix, but I keep getting errors in my code when trying to do this with xgb.cv. I set the lower and upper label bounds in this fashion:
y_lower_bound -> dataset[,1]
y_upper_bound -> dataset[,2]
setinfo(covar_train, 'label_lower_bound', y_lower_bound)
setinfo(covar_train, 'label_upper_bound', y_upper_bound)
But when I make the call to xgb.cv, I get an error about the label:
Error in xgb.cv(params = params, covar_train, early_stopping_rounds = 10, :
Labels must be provided for CV either through xgb.DMatrix, or through 'label=' when 'data' is matrix
covar_train is my DMatrix of model covariates. If I "getinfo" about the label of covar_train, it comes back "NULL", which isn't surprising, because I haven't set it, but how to indicate to xgb.cv to use the upper and lower label bounds in conjunction with the 'survival:aft' objective function and the 'aft-nloglik' evaluation metric? I've run very similar code using xgb.train, and that seems to work fine.
If anyone can share code that implements the Survival AFT model using xgb.cv, that'd be much appreciated!
The text was updated successfully, but these errors were encountered: