Skip to content
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

Merged
merged 2 commits into from
Dec 9, 2023

Conversation

david-cortes
Copy link
Contributor

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.

@mayer79
Copy link
Contributor

mayer79 commented Dec 8, 2023

Fantastic! No doubts anymore if its "weight" or "weights" etc.!

Copy link
Member

@trivialfis trivialfis left a 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),
Copy link
Member

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") {
Copy link
Member

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.

Copy link
Contributor Author

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.

@trivialfis trivialfis merged commit 5623521 into dmlc:master Dec 9, 2023
29 of 31 checks passed
@@ -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)
Copy link
Member

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 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants