Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
923226b1
Unverified
Commit
923226b1
authored
Feb 15, 2020
by
Nikita Titov
Committed by
GitHub
Feb 15, 2020
Browse files
[python] in sklearn wrapper pass cat features to Dataset constructor (#2763)
parent
704e0830
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
python-package/lightgbm/sklearn.py
python-package/lightgbm/sklearn.py
+6
-4
No files found.
python-package/lightgbm/sklearn.py
View file @
923226b1
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment