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

Function test_model_compatibility

tests/python/test_model_compatibility.py:142–166  ·  view source on GitHub ↗

Test model compatibility.

()

Source from the content-addressed store, hash-verified

140
141@pytest.mark.skipif(**tm.no_sklearn())
142def test_model_compatibility() -> None:
143 """Test model compatibility."""
144 path = os.path.dirname(os.path.abspath(__file__))
145 path = os.path.join(path, "models")
146
147 if not os.path.exists(path):
148 download(path)
149
150 models = [
151 os.path.join(root, f) for root, subdir, files in os.walk(path) for f in files
152 ]
153 assert len(models) == 54
154
155 for path in models:
156 name = os.path.basename(path)
157 if name.startswith("xgboost-"):
158 booster = xgboost.Booster(model_file=path)
159 run_booster_check(booster, name)
160 # Do full serialization.
161 booster = copy.copy(booster)
162 run_booster_check(booster, name)
163 elif name.startswith("xgboost_scikit"):
164 run_scikit_model_check(name, path)
165 else:
166 assert False

Callers

nothing calls this directly

Calls 5

run_booster_checkFunction · 0.85
run_scikit_model_checkFunction · 0.85
BoosterMethod · 0.80
copyMethod · 0.80
downloadFunction · 0.70

Tested by

no test coverage detected