-
-
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] Move all DMatrix fields to function arguments #9862
Conversation
Fantastic! No doubts anymore if its "weight" or "weights" etc.! |
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.
Overall looks good! One question regarding the shape of the DMatrix.
base_margin = NULL, | ||
missing = NA, | ||
silent = FALSE, | ||
feature_names = colnames(data), |
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.
Nice, didn't know R supports this type of self-referencing parameter.
} | ||
if (name == "feature_name" || name == "feature_type") { | ||
if (name == "nrow") { |
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.
Is this useful in practice? We have dim.xgb.DMatrix
exported.
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.
Then I guess it's not really a must-have.
@@ -44,7 +71,6 @@ xgb.DMatrix <- function(data, info = list(), missing = NA, silent = FALSE, nthre | |||
handle <- .Call(XGDMatrixCreateFromFile_R, data, as.integer(silent)) | |||
} else if (is.matrix(data)) { | |||
handle <- .Call(XGDMatrixCreateFromMat_R, data, missing, as.integer(NVL(nthread, -1))) | |||
cnames <- colnames(data) |
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.
I will add this back in #9828 .
ref #9810
This PR switches the DMatrix constructor to have all the possible inputs that it accepts as parameters in the function, like the python class for DMatrix does. The docs were all copied from the python DMatrix class.
I've purposefully left out all the parameters related to categorical features as that's still a work in progress from what I understand.