hi,

indeed we could stick to indices and use np.take whenever possible.

In [33]: A = np.random.randn(500, 500)
In [34]: idx = np.unique(np.random.randint(0, 499, 400))
In [35]: mask = np.zeros(500, dtype=np.bool)
In [36]: mask[idx] = True
In [37]: %timeit A[idx]
1000 loops, best of 3: 1.79 ms per loop
In [38]: %timeit A[mask]
1000 loops, best of 3: 1.77 ms per loop
In [39]: %timeit A.take(idx, axis=0)
10000 loops, best of 3: 103 us per loop

Alex

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to