Skip to content

Commit

Permalink
Only set reference if one does not exist
Browse files Browse the repository at this point in the history
Slices of datasets already contain a reference to the base data (e.g., R/lgb.Dataset.R:562). This change only sets a reference to the base dataset if one does not already exist.
  • Loading branch information
walkerjameschris authored Feb 28, 2025
1 parent 6b624fb commit 1c3699f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R-package/R/lgb.train.R
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,14 @@ lgb.train <- function(params = list(),
next
}

# Update parameters, data
# Update parameters
valid_data$update_params(params)
valid_data$set_reference(data)

# No need to set reference if one exists (e.g., a slice)
if (is.null(valid_data$.__enclos_env__$private$reference)) {
valid_data$set_reference(data)
}

reduced_valid_sets[[key]] <- valid_data

}
Expand Down

0 comments on commit 1c3699f

Please sign in to comment.