Re: [Scikit-learn-general] Optimize code

2014-08-05 Thread Ronnie Ghose
it looks like you want convolutions... we have things for that everyone has super optimized things for that On Tue, Aug 5, 2014 at 10:57 AM, Bao Thien wrote: > Thank you very much Yogesh :) > > > On Tue, Aug 5, 2014 at 4:42 PM, Yogesh Karpate > wrote: > >> Actually this question will b

Re: [Scikit-learn-general] Optimize code

2014-08-05 Thread Bao Thien
Thank you very much Yogesh :) On Tue, Aug 5, 2014 at 4:42 PM, Yogesh Karpate wrote: > Actually this question will be paid very less attention here because its > ML forum . But anyways, you can try to > vectorize your code using numpy or can use the same code snippet infused > with > numba (JI

Re: [Scikit-learn-general] Optimize code

2014-08-05 Thread Yogesh Karpate
Actually this question will be paid very less attention here because its ML forum . But anyways, you can try to vectorize your code using numpy or can use the same code snippet infused with numba (JIT Compiler). See this http://nbviewer.ipython.org/github/aterrel/HPCPythonSC2012/blob/master/02_Sp

Re: [Scikit-learn-general] Optimize code

2014-08-05 Thread Bao Thien
sorry, A is also array of (size1, size2) On Tue, Aug 5, 2014 at 4:28 PM, Bao Thien wrote: > Hi all scikit-learn users, > > Suppose that we have the code like: > > > for i in np.arange(size1): > for j in np.arange(size1): > if j!=i: > t = 0. >

[Scikit-learn-general] Optimize code

2014-08-05 Thread Bao Thien
Hi all scikit-learn users, Suppose that we have the code like: for i in np.arange(size1): for j in np.arange(size1): if j!=i: t = 0. for k in np.arange(size2): for l in np.arange(size2): t = t + np.sum