Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes exception when using predict_proba on fitted Pipeline object with a ColumnTransformer step #4774

Merged
merged 11 commits into from
Jun 29, 2022
4 changes: 4 additions & 0 deletions python/cuml/tests/test_adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ def test_check_array():
with pytest.raises(ValueError):
check_array(arr, ensure_2d=True)

# ensure_2d
arr = cp.array([[1, 2, 3], [4, 5, 6]], dtype=cp.float32)
check_array(arr, ensure_2d=True)

# ensure_min_samples
arr = cp.array([[1, 2]], dtype=cp.float32)
check_array(arr, ensure_min_samples=1)
Expand Down
2 changes: 1 addition & 1 deletion python/cuml/tests/test_nearest_neighbors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#
# Copyright (c) 2019-2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
5 changes: 3 additions & 2 deletions python/cuml/thirdparty_adapters/adapters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2020-2021, NVIDIA CORPORATION.
#
# Copyright (c) 2020-2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -247,7 +248,7 @@ def check_array(array, accept_sparse=False, accept_large_sparse=True,
if array.shape[0] < ensure_min_samples:
raise ValueError("Not enough samples")

if ensure_min_features > 0 and hasshape and array.ndim == 2:
if ensure_min_features > 0 and hasshape and len(array.shape) == 2:
n_features = array.shape[1]
if n_features < ensure_min_features:
raise ValueError("Found array with %d feature(s) (shape=%s) while"
Expand Down