Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
guolinke committed Nov 26, 2019
1 parent a477564 commit f50d6c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion R-package/R/lgb.Dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,9 @@ Dataset <- R6::R6Class(

# Update parameters
update_params = function(params) {
private$params <- modifyList(private$params, params)
if (lgb.is.null.handle(private$handle)) {
private$params <- modifyList(private$params, params)
}
return(invisible(self))

},
Expand Down
18 changes: 9 additions & 9 deletions python-package/lightgbm/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1165,18 +1165,18 @@ def save_binary(self, filename):
return self

def _update_params(self, params):
if not self.params:
self.params = copy.deepcopy(params)
else:
self.params_back_up = copy.deepcopy(self.params)
self.params.update(params)
if self.handle is None:
if not self.params:
self.params = copy.deepcopy(params)
else:
self.params_back_up = copy.deepcopy(self.params)
self.params.update(params)
return self

def _reverse_update_params(self):
self.params = copy.deepcopy(self.params_back_up)
self.params_back_up = None
if self.handle is not None and self.params is not None:
_safe_call(_LIB.LGBM_DatasetUpdateParam(self.handle, c_str(param_dict_to_str(self.params))))
if self.handle is None:
self.params = copy.deepcopy(self.params_back_up)
self.params_back_up = None
return self

def set_field(self, field_name, data):
Expand Down

0 comments on commit f50d6c4

Please sign in to comment.