Skip to content

Commit

Permalink
[python] Deep copy params in _update_params of DataSet (#2310)
Browse files Browse the repository at this point in the history
Otherwise, it would print `basic.py:762: UserWarning: categorical_feature in param dict is overridden.`. Because when updating the params for a validation test, the updated params for the train test was used which contains `'categorical_column'`.
  • Loading branch information
maitbayev authored and StrikerRUS committed Aug 7, 2019
1 parent a8d8b07 commit 5cff4e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python-package/lightgbm/basic.py
Expand Up @@ -1115,7 +1115,7 @@ def _update_params(self, params):
if self.handle is not None and params is not None:
_safe_call(_LIB.LGBM_DatasetUpdateParam(self.handle, c_str(param_dict_to_str(params))))
if not self.params:
self.params = params
self.params = copy.deepcopy(params)
else:
self.params_back_up = copy.deepcopy(self.params)
self.params.update(params)
Expand Down

0 comments on commit 5cff4e8

Please sign in to comment.