2012/1/5 Gael Varoquaux <[email protected]>:
> On Thu, Jan 05, 2012 at 10:40:20PM +0100, Gael Varoquaux wrote:
>> Right now, when a sparse matrix is given at the validation utility
>> 'as_float_array', it crashes with the following incomprehensible error
>> message:
>
> Alright, it's not what I thought. Forget this message, apparently this
> incomprehensible error message is raised for another reason.

But I'm still surprised at the behavior:

In [1]: from sklearn.utils import as_float_array

In [2]: from scipy.sparse import lil_matrix

In [3]: as_float_array(lil_matrix(arange(12).reshape(3,4)))
Out[3]:
<3x4 sparse matrix of type '<type 'numpy.float64'>'
        with 11 stored elements in LInked List format>

I thought (but maybe I'm wrong) that as_float_array was only used to
validate dense input. In any case, if we want it to pass through
sparse matrices, we might want to rename it; sparse matrices aren't
arrays in the isinstance sense.

-- 
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to