-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[R] Fix xgb.cv() for AFT models #9863
Conversation
R-package/R/xgb.cv.R
Outdated
if (!inherits(data, 'xgb.DMatrix')) { | ||
stop("Objective 'survival:aft' requires the data to be an 'xgb.DMatrix'.") | ||
} | ||
if (is.null(getinfo(data, name = 'label_lower_bound')) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something I am wondering: most of these getinfo
used throughout the function are only checking whether the DMatrix contains that field or not, but each call involves creating a full data copy just to check that it exists. @trivialfis Is there perhaps some function that could be used to just check if the DMatrix has the field or not? Do functions like XGDMatrixGetFloatInfo
actually create a data copy when calling them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it creates a data copy.
Hmm.. my personal preference is still to try not to use the DMatrix
as a data manipulation class. Existing libraries and R builtins can do a much better job than we can ever try.
Thanks for looking into this. Left a small comment. Although I am also thinking: if it constructs a DMatrix directly from |
We could add more arguments to |
Yes, that makes sense too - then we wouldn't need to update things in two places if new parameters come out. |
cc @hcho3 for aft. |
There's now a function xgboost/R-package/R/xgb.DMatrix.R Line 223 in ff3d82c
|
Closed in favour of #10031 |
This PR fixes #7118
In order to keep the
xgb.cv()
API as it is:data
must be anxgb.DMatrix
objectAutomatic stratified splitting is deactivated with a warning. @david-cortes this is something we need to keep in mind for multioutput regressions as well.