Commit a0a117aa authored by Nikita Titov's avatar Nikita Titov Committed by Guolin Ke
Browse files

[python] make dump_text() private (#2434)

* make dump_text() private

* updated test
parent 2bf9a0f1
...@@ -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.
......
...@@ -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:
......
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