Skip to content

[BUG] TypeError when creating pandas Series from coefficients with cuml.accel in plot_target_encoder_cross_val.py #6499

Open
@csadorf

Description

@csadorf

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcuml-accelIssues related to cuml.accel

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions