8000 check_array 'accept_sparse' parameter quirk since 0.17 · Issue #7880 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
check_array 'accept_sparse' parameter quirk since 0.17 #7880
Closed
@lesteve

Description

@lesteve

Description

Since 0.17 accept_sparse can be any type without any exception being raised. It would be great to add a test like this and make sure that we get an exception. Also I am not sure whether we accept accept_sparse=True. Looking at the code we do handle the specific case of accept_sparse=False. If we accept booleans at the very least the docstring should be amended.

Steps/Code to Reproduce

from scipy import sparse
from sklearn.utils import check_array

class MyClass(object): pass

garbage_parameter = MyClass()
check_array(sparse.csr_matrix([1, 2]), accept_sparse=garbage_parameter)

Expected Results

Some exception being raised because the input parameter does not mean anything

Actual Results

No exception raised

Metadata

Metadata

Assignees

No one assigned

    Labels

    EasyWell-defined and straightforward way to resolve

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0