In both cases, we would need to write some more lines of code to deal with a
np.matrix input (whether it is for converting it or rejecting it, we need to
test the object type). The code will be a bit more complex whatever the
adopted solution is, therefore I vote for "converting" since at least the
end user will appreciate this functionality.
Virgile
On Thu, Oct 20, 2011 at 3:17 PM, Brian Holt <[email protected]> wrote:
> > I vote for CONVERTING and in addition we should implement a common
> test suite that checks for input types/shape of our estimators (AFAIR
> this was proposed by Mathieu a while ago).
>
> +1
>
> On 20 October 2011 14:15, Peter Prettenhofer <[email protected]
> > wrote:
>
>> Thanks for raising this issue Lars.
>>
>> I vote for CONVERTING and in addition we should implement a common
>> test suite that checks for input types/shape of our estimators (AFAIR
>> this was proposed by Mathieu a while ago).
>>
>> best,
>> Peter
>>
>> 2011/10/20 Lars Buitinck <[email protected]>:
>> > Dear all,
>> >
>> > At https://github.com/scikit-learn/scikit-learn/issues/392 there's
>> > been some discussion on whether to accept data of type np.matrix or
>> > not. I'd like to take that discussion here and resolve it with a quick
>> > vote, if possible.
>> >
>> > The issue is: many modules currently fail when handed an np.matrix. We
>> > can resolve this by...
>> >
>> > CONVERTING to np.ndarray
>> > * matrices are obviously array-like
>> > * matrices may come about inadvertently, because some NumPy/SciPy
>> > routines/methods happen to return them
>> > * we loosely use the term "matrix" throughout the docs, so it would be
>> > strange to require a matrix not to be an np.matrix
>> > * we are (or should be) doing input validation anyway, with
>> > utils.{safe_asanyarray, as_float_array, atleast2d_or_csr}
>> > * we already need to handle the matrix API in all modules that accept
>> > sparse input
>> > * backwards compatibility
>> >
>> > REJECTING np.matrix by throwing a TypeError
>> > * mathematical operators may have different meanings than on array (*
>> > means dot product on matrix, Hadamard product on arrays)
>> > * matrices are always 2-d, so ravel, flatten and reshape don't behave
>> > as expected
>> > * converting to array is easy enough for the user: just call .A on every
>> matrix
>> > * explicit is better than implicit
>> > * we'd need to test every routine against matrices (but then, we
>> > should be testing input validation anyway)
>> >
>> > Please voice your opinions. I'm willing to write up some docs
>> > describing whichever option we choose.
>> >
>> > TIA,
>> >
>> > --
>> > Lars Buitinck
>> > Scientific programmer, ILPS
>> > University of Amsterdam
>> >
>> >
>> ------------------------------------------------------------------------------
>> > The demand for IT networking professionals continues to grow, and the
>> > demand for specialized networking skills is growing even more rapidly.
>> > Take a complimentary Learning@Ciosco Self-Assessment and learn
>> > about Cisco certifications, training, and career opportunities.
>> > http://p.sf.net/sfu/cisco-dev2dev
>> > _______________________________________________
>> > Scikit-learn-general mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>> >
>>
>>
>>
>> --
>> Peter Prettenhofer
>>
>>
>> ------------------------------------------------------------------------------
>> The demand for IT networking professionals continues to grow, and the
>> demand for specialized networking skills is growing even more rapidly.
>> Take a complimentary Learning@Ciosco Self-Assessment and learn
>> about Cisco certifications, training, and career opportunities.
>> http://p.sf.net/sfu/cisco-dev2dev
>> _______________________________________________
>> Scikit-learn-general mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>>
>
>
>
> --
> He is no fool who gives what he cannot keep to gain what he cannot lose.
> - Jim Elliot.
>
>
> ------------------------------------------------------------------------------
> The demand for IT networking professionals continues to grow, and the
> demand for specialized networking skills is growing even more rapidly.
> Take a complimentary Learning@Ciosco Self-Assessment and learn
> about Cisco certifications, training, and career opportunities.
> http://p.sf.net/sfu/cisco-dev2dev
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Ciosco Self-Assessment and learn
about Cisco certifications, training, and career opportunities.
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general