Commit 5cff4e8e authored by Madiyar's avatar Madiyar Committed by Nikita Titov
Browse files

[python] Deep copy params in _update_params of DataSet (#2310)

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'`.
parent a8d8b07d
...@@ -1115,7 +1115,7 @@ class Dataset(object): ...@@ -1115,7 +1115,7 @@ class Dataset(object):
if self.handle is not None and params is not None: 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)))) _safe_call(_LIB.LGBM_DatasetUpdateParam(self.handle, c_str(param_dict_to_str(params))))
if not self.params: if not self.params:
self.params = params self.params = copy.deepcopy(params)
else: else:
self.params_back_up = copy.deepcopy(self.params) self.params_back_up = copy.deepcopy(self.params)
self.params.update(params) self.params.update(params)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment