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
a0a117aa
Commit
a0a117aa
authored
Sep 26, 2019
by
Nikita Titov
Committed by
Guolin Ke
Sep 26, 2019
Browse files
[python] make dump_text() private (#2434)
* make dump_text() private * updated test
parent
2bf9a0f1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
python-package/lightgbm/basic.py
python-package/lightgbm/basic.py
+1
-1
tests/python_package_test/test_basic.py
tests/python_package_test/test_basic.py
+2
-2
No files found.
python-package/lightgbm/basic.py
View file @
a0a117aa
...
@@ -1588,7 +1588,7 @@ class Dataset(object):
...
@@ -1588,7 +1588,7 @@ class Dataset(object):
_safe_call
(
_LIB
.
LGBM_DatasetAddFeaturesFrom
(
self
.
handle
,
other
.
handle
))
_safe_call
(
_LIB
.
LGBM_DatasetAddFeaturesFrom
(
self
.
handle
,
other
.
handle
))
return
self
return
self
def
dump_text
(
self
,
filename
):
def
_
dump_text
(
self
,
filename
):
"""Save Dataset to a text file.
"""Save Dataset to a text file.
This format cannot be loaded back in by LightGBM, but is useful for debugging purposes.
This format cannot be loaded back in by LightGBM, but is useful for debugging purposes.
...
...
tests/python_package_test/test_basic.py
View file @
a0a117aa
...
@@ -127,11 +127,11 @@ class TestBasic(unittest.TestCase):
...
@@ -127,11 +127,11 @@ class TestBasic(unittest.TestCase):
d1
.
add_features_from
(
d2
)
d1
.
add_features_from
(
d2
)
with
tempfile
.
NamedTemporaryFile
()
as
f
:
with
tempfile
.
NamedTemporaryFile
()
as
f
:
d1name
=
f
.
name
d1name
=
f
.
name
d1
.
dump_text
(
d1name
)
d1
.
_
dump_text
(
d1name
)
d
=
lgb
.
Dataset
(
X
,
feature_name
=
names
).
construct
()
d
=
lgb
.
Dataset
(
X
,
feature_name
=
names
).
construct
()
with
tempfile
.
NamedTemporaryFile
()
as
f
:
with
tempfile
.
NamedTemporaryFile
()
as
f
:
dname
=
f
.
name
dname
=
f
.
name
d
.
dump_text
(
dname
)
d
.
_
dump_text
(
dname
)
with
open
(
d1name
,
'rt'
)
as
d1f
:
with
open
(
d1name
,
'rt'
)
as
d1f
:
d1txt
=
d1f
.
read
()
d1txt
=
d1f
.
read
()
with
open
(
dname
,
'rt'
)
as
df
:
with
open
(
dname
,
'rt'
)
as
df
:
...
...
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