[SciPy-user] array vs matrix, converting code from matlab

Albert Strasheim fullung at gmail.com
Fri Apr 21 20:26:53 CDT 2006

Hello all


Just thought I'd throw in my 2 cents. I recently started with my masters
thesis, which will probably focus on the application of Gaussian Mixture
Models and Support Vector Machines to the problem of speaker verification. I
would be very interested in cooperating on any effort to implement or wrap
GMM and SVM code for SciPy.


As far as SVM libraries go, I quite like SVM-Light and libsvm, which both
have Python wrappers. Unfortunately these don't integrate with NumPy at the





I'm also interested in implementing some feature extraction algorithms and
compensation techniques, such as Mel-Frequency Cepstral Coefficients (MFCC),
RASTA filtering and others. There's some very nice MATLAB code that can
serve as a starting point for these efforts:




Anybody else doing speech recognition/speaker verification/etc. with NumPy
and SciPy?







From: scipy-user-bounces at scipy.net [mailto:scipy-user-bounces at scipy.net] On
Behalf Of Bill Baxter
Sent: 21 April 2006 09:28
To: SciPy Users List
Subject: Re: [SciPy-user] array vs matrix, converting code from matlab


Torch does look pretty nice.  Yeh, providing wrappers for torch may be
easier (and result in faster code) as long as their data format is
relatively sane.  I'm not really sure how one goes about interfacing
numpy.arrays with external code, but it's certainly possible, since that's
how the bulk of SciPy was written (by calling on external fortran or C code,
not sure about C++).  [info about NumPy and SWIG here if you haven't seen it
already: http://www.scipy.org/Cookbook/SWIG_and_NumPy]

The other problem with my estimate on time to port Matlab code is that a
figure like 4200 lines doesn't reveal the real cost if one of those lines
happens to be a call to something like Matlab's nonlinear optimization
routines or something else for which there is currently no numpy equivalent.

I don't think there are /many/ of those gotchas in Netlab, but eigs() is one
of them.  As far as I know SciPy has no function to get just a few
eigenvalues without having to find them all.  Nothing prevents it from being
added to SciPy (matlab's eigs is just a wrapper for the freely available
ARPACK) it just hasn't been done yet. 

Anyway if you're just wrapping existing C++, you know you're not going to
run into rats' nests like that.


On 4/21/06, David Cournapeau <david at ar.media.kyoto-u.ac.jp> wrote:

Bill Baxter wrote:
> One thing...  I'm not sure why you think porting Netlab to SciPy would
> be such a huge task.  It's a big task, sure.  Porting to C++ would
> definitely be a huge task.
Well, the nice thing with C++ is that you can plug it directly to python 
using swig and hand-coded wrapping code. It is actually one reason why I
want to go on python: wrapping C code for matlab is awful (there is no
way to control the memory handler, for example), and things like swig or 
python::boost are much better (without even taking into account that C
and python have the same convention for indexing and row major
ordering). As the code is BSD, I think the licenses are compatible with
scipy. I think in a summer internship, you could write good swig or 
boost::python extension to have the wrapping mostly automated.

Porting from matlab to scipy involve porting/testing all the code,
whereas using C++ code involve mostly glue-code. But maybe I am
underestimating the difficulty... 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scipy.net/pipermail/scipy-user/attachments/20060422/6502267d/attachment.htm

More information about the SciPy-user mailing list