Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
check_array 'accept_sparse' parameter quirk since 0.17 #7880
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)
Some exception being raised because the input parameter does not mean anything
No exception raised
Not sure to be honest,
At the moment I am guessing that the code path that handles
For reference, the commit that introduced the changes in 0.17: 89c1018
Hm there are some weird issues with the current code-paths.
I guess in
if accept_sparse in [None, False]: raise TypeError(...) elif isinstance(accept_sparse, (list, tuple)): ... else: raise ValueError("invalid parameter")
The question is whether we want to ensure that all elements of a list that is passed are sensible.
Same feeling here.