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

Method test_unknown_data

tests/python/test_dmatrix.py:304–322  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

302 bst.predict(dtrain)
303
304 def test_unknown_data(self):
305 class Data:
306 pass
307
308 with pytest.raises(TypeError):
309 with pytest.warns(UserWarning):
310 d = Data()
311 xgb.DMatrix(d)
312
313 from scipy import sparse
314
315 rng = np.random.RandomState(1994)
316 X = rng.rand(10, 10)
317 y = rng.rand(10)
318 X = sparse.dok_matrix(X)
319 with pytest.warns(UserWarning, match="dok_matrix"):
320 Xy = xgb.DMatrix(X, y)
321 assert Xy.num_row() == 10
322 assert Xy.num_col() == 10
323
324 @pytest.mark.skipif(**tm.no_pandas())
325 def test_np_categorical(self):

Callers

nothing calls this directly

Calls 4

num_rowMethod · 0.95
num_colMethod · 0.95
DataClass · 0.85
DMatrixMethod · 0.45

Tested by

no test coverage detected