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
666191b2
Commit
666191b2
authored
Aug 07, 2017
by
wxchan
Committed by
Guolin Ke
Aug 18, 2017
Browse files
[python] fix categorical_feature parameter (#792)
parent
715ee380
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+9
-2
No files found.
python-package/lightgbm/basic.py
View file @
666191b2
...
...
@@ -979,8 +979,15 @@ class Dataset(object):
if
self
.
categorical_feature
==
categorical_feature
:
return
if
self
.
data
is
not
None
:
self
.
categorical_feature
=
categorical_feature
self
.
_free_handle
()
if
self
.
categorical_feature
is
None
:
self
.
categorical_feature
=
categorical_feature
self
.
_free_handle
()
elif
categorical_feature
==
'auto'
:
warnings
.
warn
(
'Using categorical_feature in Dataset.'
)
else
:
warnings
.
warn
(
'categorical_feature in Dataset is overrided. New categorical_feature is {}'
.
format
(
sorted
(
list
(
categorical_feature
))))
self
.
categorical_feature
=
categorical_feature
self
.
_free_handle
()
else
:
raise
LightGBMError
(
"Cannot set categorical feature after freed raw data, set free_raw_data=False when construct Dataset to avoid this."
)
...
...
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