Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Avoid np.asarray call in check_array for duck-typed arrays #11447

Closed
@mrocklin

Description

@mrocklin

Would it be reasonable to avoid np.asarray calls in check_array if the input is array-like?

My guess is that the general answer is "No. The np.asarray call is important to guarantee consistency within scikit-learn's estimators. We strongly value consistency."

The context here is that after the recently merged #11308 , some scikit-learn transformers like RobustScalar that used to work on dask arrays no longer work because they auto-coerce their inputs into numpy arrays. This likely comes up in other situations as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions