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-package] introduce Dataset methods set_field() and get_field() #4571

Merged
merged 11 commits into from
Sep 25, 2021

Conversation

jameslamb
Copy link
Collaborator

Contributes to #4543, as part of #4310.

This PR proposes the following changes in the R package:

  • deprecates Dataset$getinfo() (with a warning its name will be changed to get_field())
  • deprecates Dataset$setinfo() (with a warning its name will be changed to set_field())
  • adds method Dataset$get_field(field_name) to Dataset, matching the Python package
  • adds method Dataset$set_field(field_name, data) should be added to Dataset, matching the Python package

Notes for Reviewers

I only added new tests, but left existing tests with getinfo() and setinfo() in place, so that those methods are still tested as long as they exist in the package.

@jameslamb jameslamb changed the title [R-package] introduce Dataset methods set_field() and get_field()[R-package] [R-package] introduce Dataset methods set_field() and get_field() Aug 29, 2021
Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether we should update here
https://github.com/microsoft/LightGBM/blob/master/docs/FAQ.rst#i-used-setinfo-tried-to-print-my-lgb-dataset-and-now-the-r-console-froze. WDYT?

Update Dataset$setinfo() here

, "To modify attributes like 'init_score', use Dataset$setinfo(). "

R-package/R/lgb.Dataset.R Outdated Show resolved Hide resolved
R-package/R/lgb.Dataset.R Outdated Show resolved Hide resolved
R-package/R/lgb.Dataset.R Outdated Show resolved Hide resolved
R-package/R/lgb.Dataset.R Outdated Show resolved Hide resolved
R-package/R/lgb.Dataset.R Outdated Show resolved Hide resolved
R-package/R/lgb.Dataset.R Outdated Show resolved Hide resolved
@jameslamb
Copy link
Collaborator Author

Update Dataset$setinfo() here

Done in a745987

Not sure whether we should update here
https://github.com/microsoft/LightGBM/blob/master/docs/FAQ.rst#i-used-setinfo-tried-to-print-my-lgb-dataset-and-now-the-r-console-froze. WDYT?

I think it's ok to leave that alone for now, since the functions are being deprecated but not removed yet. That entire FAQ section probably deserves some updates and revisions, to check if the issues listed there still exist in recent versions. But that could be done in a separate PR.

@jameslamb
Copy link
Collaborator Author

iiinteresting, I see this error on the lint job

Some R documentation files have changed. Please re-generate them and commit those changes.

I did re-generate the docs before pushing. Maybe there was a new release of {roxygen2} or something. I'll investigate this later today!

@jameslamb
Copy link
Collaborator Author

Maybe there was a new release of {roxygen2} or something

Yes, there was a new release (7.1.2) a few days ago: https://cran.r-project.org/web/packages/roxygen2/index.html.

But it also looks like there are a few local changes I forgot to git add 😆

Regenerated the docs with {roxygen} 7.1.2 and added the requested changes in e92a28e

@shiyu1994
Copy link
Collaborator

Shall we also update here in the FAQ documentation? Will set_field encounter the same problem?
setinfo

@shiyu1994
Copy link
Collaborator

Other modifications LGTM. They seem to be simple renaming. And thanks @StrikerRUS for detecting the minor mistakes.

@jameslamb
Copy link
Collaborator Author

Shall we also update here in the FAQ documentation? Will set_field encounter the same problem?
setinfo

ah! I answered this in #4571 (comment) actually. I don't think we need to worry about it for this PR. That particular question was added in #976 (4 years ago), so it might not even be relevant any more. I'd prefer to take updating the FAQ as a separate task.

Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks a lot for working on this!

@shiyu1994 shiyu1994 merged commit d462972 into master Sep 25, 2021
@StrikerRUS StrikerRUS deleted the r/info-setter-getter branch September 26, 2021 00:01
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants