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

Function check_predt

tests/python-gpu/test_gpu_with_sklearn.py:119–131  ·  view source on GitHub ↗
(X: Any, y: List[float])

Source from the content-addressed store, hash-verified

117 np.testing.assert_allclose(categories_sizes, 1)
118
119 def check_predt(X: Any, y: List[float]) -> None:
120 reg = xgb.XGBRegressor(tree_method="hist", n_estimators=64, device="cuda")
121 reg.fit(X, y)
122 predts = reg.predict(X)
123 booster = reg.get_booster()
124 feature_types = booster.feature_types
125 assert feature_types is not None
126 assert "c" in feature_types
127 assert len(feature_types) == 1
128 inp_predts = booster.inplace_predict(X)
129 if isinstance(inp_predts, cp.ndarray):
130 inp_predts = cp.asnumpy(inp_predts)
131 np.testing.assert_allclose(predts, inp_predts)
132
133 y = [1, 2, 3]
134 X = pd.DataFrame({"f0": ["a", "b", "c"]})

Callers 1

test_categoricalFunction · 0.85

Calls 4

fitMethod · 0.45
predictMethod · 0.45
get_boosterMethod · 0.45
inplace_predictMethod · 0.45

Tested by

no test coverage detected