[SciPy-user] Slow medians ?

pgmdevlist@mailcan.com pgmdevlist at mailcan.com
Sun Feb 26 23:29:46 CST 2006


Folks,
I'm trying to implement by brute force some median-based linear regression 
techinques, requiring a lot of median computations (for n elements, I have 
about n*n medians to compute). And as I have a lot of data to process that 
way, I'm a bit pecky about optimization.

I've noticed that for 1D and 2D arrays, the basic numpy version of median is 
far faster than the nD version of scipy.stats (you can still choose to 
compute along any of the 2 axes with numpy.median by playing with transpose). 
Would it be useful to modify the scipy.stats version, or should it be left to 
the user ? 

And on related matter, numpy based this time: the numpy.median version seems a 
bit strange: what's the idea behind using `msort` twice (around line 810 in 
the 0.9.5 version) ?

Thanks for you feedback in advance

-- 
Pierre GM



More information about the SciPy-user mailing list