2013/10/19 Thomas Unterthiner <[email protected]>:
> I've noticed that sklearn uses numpy.linalg instead of scipy.linalg for its
> linear algebra implementations (e.g. dot or svd). However I found that
> scipy.linalg consistently performs better on my machines. Since sklearn
> requires scipy anyways, I was wondering what the reason is for sticking with
> the numpy.linalg versions in sklearn?
Not always: in performance-critical code, we use our own
sklearn.utils.extmath.{norm,row_norms,randomized_svd} or even
specialized implementations. But there are indeed some places where
np.linalg is still used.
dot is not replaced by SciPy, btw., and the test you ran seems to
actually measure inv's performance, not dot's.
> It seems to be that the scipy.linalg variants are consistently faster than
> the numpy.linalg variants (~5 - 10% difference). This is across 3 different
> BLAS libraries (MKL, ACML and OpenBLAS) and two different machines (AMD
> FX-8150 and mobile Intel i5), using both the numpy/scipy versions from the
> ubuntu repository as well as binaries I compiled on my own.
Yes, SciPy is usually faster than NumPy. Attempts are underway to
alleviate the slowness of NumPy, but SciPy should generally be
preferred.
https://github.com/numpy/numpy/pull/3895
https://github.com/numpy/numpy/pull/3896
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general