"...git@developer.sourcefind.cn:tianlh/lightgbm-dcu.git" did not exist on "5ffd7571193f7814eb2e30a0bc648e648bad0bf3"
Unverified Commit 923226b1 authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

[python] in sklearn wrapper pass cat features to Dataset constructor (#2763)

parent 704e0830
...@@ -558,11 +558,14 @@ class LGBMModel(_LGBMModelBase): ...@@ -558,11 +558,14 @@ class LGBMModel(_LGBMModelBase):
self._n_features = _X.shape[1] self._n_features = _X.shape[1]
def _construct_dataset(X, y, sample_weight, init_score, group, params): def _construct_dataset(X, y, sample_weight, init_score, group, params,
categorical_feature='auto'):
return Dataset(X, label=y, weight=sample_weight, group=group, return Dataset(X, label=y, weight=sample_weight, group=group,
init_score=init_score, params=params) init_score=init_score, params=params,
categorical_feature=categorical_feature)
train_set = _construct_dataset(_X, _y, sample_weight, init_score, group, params) train_set = _construct_dataset(_X, _y, sample_weight, init_score, group, params,
categorical_feature=categorical_feature)
valid_sets = [] valid_sets = []
if eval_set is not None: if eval_set is not None:
...@@ -608,7 +611,6 @@ class LGBMModel(_LGBMModelBase): ...@@ -608,7 +611,6 @@ class LGBMModel(_LGBMModelBase):
early_stopping_rounds=early_stopping_rounds, early_stopping_rounds=early_stopping_rounds,
evals_result=evals_result, fobj=self._fobj, feval=feval, evals_result=evals_result, fobj=self._fobj, feval=feval,
verbose_eval=verbose, feature_name=feature_name, verbose_eval=verbose, feature_name=feature_name,
categorical_feature=categorical_feature,
callbacks=callbacks, init_model=init_model) callbacks=callbacks, init_model=init_model)
if evals_result: if evals_result:
......
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