Open
Description
The scikit-learn preprocessing/plot_target_encoder_cross_val.py
example fails when running with the cuML accelerator due to a TypeError when trying to create a pandas Series from the model coefficients. The error occurs because cuML's accelerator is returning GPU arrays that cannot be implicitly converted to NumPy arrays.
Error Message
TypeError: Implicit conversion to a host NumPy array via __array__ is not allowed, To explicitly construct a GPU matrix, consider using .to_cupy()
To explicitly construct a host matrix, consider using .to_numpy().
Steps to Reproduce
Run the example with cuML accelerator:
python -m cuml.accel preprocessing/plot_target_encoder_cross_val.py
Expected Behavior
The example should run successfully.
Actual Behavior
The example fails when trying to create a pandas Series from the model coefficients. The error occurs because cuML's accelerator is returning GPU arrays that need explicit conversion to NumPy arrays before being used with pandas.
Environment
- Python 3.12.9
- cuML 25.04 (nightly)
- scikit-learn 1.5.2