Skip to content
This repository was archived by the owner on Jul 16, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dask_xgboost/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ def predict(client, model, data):
result = data.map_blocks(_predict_part, model=model,
dtype=np.float32,
**kwargs)
else:
raise TypeError(
"Got unexpected input type %s, expected Dask array or dataframe"
% str(data)
)

return result

Expand Down
7 changes: 7 additions & 0 deletions dask_xgboost/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,10 @@ def f(part):
yield dxgb.train(c, param, df, df.x)

assert 'foo' in str(info.value)


def test_predict_type_error():
with pytest.raises(TypeError) as info:
dxgb.predict(None, None, 'foo')
assert 'foo' in str(info.value)
assert 'dask array' in str(info.value).lower()