MCPcopy Create free account
hub / github.com/dmlc/xgboost / test_save_binary

Method test_save_binary

tests/python/test_dmatrix.py:198–208  ·  view source on GitHub ↗
(self, tmp_path: Path)

Source from the content-addressed store, hash-verified

196
197 @pytest.mark.skipif(**tm.no_pandas())
198 def test_save_binary(self, tmp_path: Path) -> None:
199 import pandas as pd
200
201 path = tmp_path / "m.dmatrix"
202 data = pd.DataFrame({"a": [0, 1], "b": [2, 3], "c": [4, 5]})
203 m0 = xgb.DMatrix(data.loc[:, ["a", "b"]], data["c"])
204 assert m0.feature_names == ["a", "b"]
205 m0.save_binary(path)
206 m1 = xgb.DMatrix(path)
207 assert m0.feature_names == m1.feature_names
208 assert m0.feature_types == m1.feature_types
209
210 def test_get_info(self):
211 dtrain, _ = tm.load_agaricus(__file__)

Callers

nothing calls this directly

Calls 2

save_binaryMethod · 0.95
DMatrixMethod · 0.45

Tested by

no test coverage detected