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] Checking whether DMatrix has field implies making full data copies of said field #9865

Closed
david-cortes opened this issue Dec 10, 2023 · 1 comment · Fixed by #9901
Closed

Comments

@david-cortes
Copy link
Contributor

Follow up from #9863
ref #9810

In methods such as print.xgb.DMatrix:

if (length(getinfo(x, 'label')) > 0) infos <- 'label'

The code checks whether a DMatrix has a given field by retrieving it.

This causes a full (maybe even two?) data copy of the underlying field being retrieved, but the data there is not used: it's only being checked that it exists.

Would be more efficient to use some way of checking that the DMatrix has a field taht would not involve copying all of the data in that field.

@trivialfis
Copy link
Member

We don't have this method yet. For the print method you referenced, I think it's easy to just get all meta info and filter it by null values. We need all the available fields anyway.

As for the AFT PR, I think we can merge it for now, but wouldn't it be better for the long term that we can avoid processing the DMatrix and move toward the high-level interface? If so, we can just get the label/bounds from user inputs instead of the DMatrix.

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 a pull request may close this issue.

2 participants