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

[python] [R-package] Use the same address when updated label/weight/query #2662

Merged
merged 3 commits into from
Jan 14, 2020

Conversation

guolinke
Copy link
Collaborator

@guolinke guolinke commented Jan 3, 2020

No description provided.

@guolinke guolinke requested a review from chivee as a code owner January 3, 2020 13:18
@guolinke
Copy link
Collaborator Author

guolinke commented Jan 3, 2020

better fix (todo): use metadata.label/weight in objective and metric.

Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

Added a few comments for the R package.

@@ -207,6 +208,12 @@ Booster <- R6::R6Class(
# Perform boosting update iteration
update = function(train_set = NULL, fobj = NULL) {

if (is.null(train_set)) {
if (private$train_set$.__enclos_env__$private$version != private$train_set_version) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of x != y, could you use !identical(x, y) here? The issue is that having a NULLL` on either side of a logical like this in R will cause an error.

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

given there are two integers, do we still need to use identical?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wasn't sure if they were guaranteed to always be non-null. You can use != if they will always be integers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, if there is a NULL, it means there are bugs in the code.

@@ -55,6 +55,7 @@ Booster <- R6::R6Class(

# Create private booster information
private$train_set <- train_set
private$train_set_version <- train_set$.__enclos_env__$private$version
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe a naive question, but what does it mean to have a new "version" of the training set? Is it mainly updating weights as part of boosting? I think I am missing some context, so I don't understand what problem this patch solves.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

currently, Dataset is allowed to update label/weight/... (field data) during training, but the booster cannot capture these changes. And ideally, we should update related classes, such as the cached label/weight/.. in Objective/Metric. So I add a version number to indicate the changes of these fields.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah I see ok, makes sense. Thanks!

@jameslamb jameslamb changed the title Use the same address when updated label/weight/query [python] [R-package] Use the same address when updated label/weight/query Jan 6, 2020
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 for Python code.

Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

R side looks good to me

@guolinke guolinke merged commit 82886ba into master Jan 14, 2020
@StrikerRUS StrikerRUS deleted the guolinke-patch-1 branch January 14, 2020 12:52
@guolinke guolinke added the fix label Mar 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Mar 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants