On 11/09/2011 10:06 PM, David Warde-Farley wrote:
> On 2011-11-09, at 3:01 PM, Mathieu Blondel wrote:
>
>> On Thu, Nov 10, 2011 at 2:31 AM, Olivier Grisel
>> <[email protected]>  wrote:
>>
>>> Maybe it would be better to have a dedicated method for this use case
>>> rather that using complex kwargs in the `fit` method. What about using
>>> a `fit_from_kernel` or `fit_from_affinity` method (if you find a
>>> better name)?
>> For me the main problem of precomputed kernels is more the data
>> representation than the method names.
>>
>> 1) storing a symmetric matrix in a 2d dense array is inefficient memory-wise
> Yes, but often it is still the most straightforward, so absolutely requiring 
> a packed triangle may be an annoyance. Also, many LAPACK routines still 
> expect a square matrix even if they only look at the (upper, lower) triangle 
> ({ds}posv for solving symmetric positive systems with the Cholesky 
> factorization comes to mind).
I agree. Imho a factor of two is not that much. How often will that 
prevent a user from applying the algorithm?
>> User-defined kernel functions could be an answer to all 1), 2) and 3)
>> if the function was called on-demand but I think the current
>> implementation just pre-computes the entire Gram matrix.
> Indeed... I wonder: if, from Python, you pass a reference to a cpdef'd 
> function to another cpdef'd function as an argument, is Cython smart enough 
> to run the passed function at C speed? Or can it only do that at compile time?
>

I'm not so familiar with Cython so I think this sounds complicated. Also 
I don't think it'll work ;)
Do you really think that computing the whole Gram matrix at training 
time is such a waste?
As in the other thread, usually one has to scan for parameters any way. 
Computing every value
just once and then storing it seems ok to me.
For example, for the chi2 kernel, there is very efficient code available 
by Christoph Lampert using SSE2 instructions.
I used precomputed kernel matrices for multi instance kernels. I could 
easily implement them
on the GPU using batches and then store them one and for all.
If I had to do memory transfers for every single example that I need the 
kernel for, it would be very slow.

Maybe these are special use cases but I think they are valid ones.

just my 2 cent.

Cheers,
Andy

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to