[mlpack] Python binding
Ming Tu
tuming90 at gmail.com
Thu Jan 28 16:10:06 EST 2016
Hi Ryan,
Thank you very much for providing some sample codes. I will try to do it
using the first method you mentioned since I can't afford the extra time of
loading files.
On Thu, Jan 28, 2016 at 1:57 PM, Ryan Curtin <ryan at ratml.org> wrote:
> On Thu, Jan 28, 2016 at 11:59:21AM -0700, Ming Tu wrote:
> > Hi everyone,
> >
> > I'm working on a project using Theano (a Python library) which needs a
> > faster MST implementation. I found mlpack. But, after reading the posts
> on
> > python binding it seems to be a hard work. Do you have any suggestions
> if I
> > only want to compile DualTreeBoruvka MST into python library?
>
> Hi Ming,
>
> Unfortunately at the moment there hasn't been any progress on Python
> bindings. I have written some experimental Python bindings before
> though, and it should not be too hard to get what you need.
>
> What you'll need to do is write a Cython binding that has a cdef that
> defines the DualTreeBoruvka class and the functions that you need
> (probably just ComputeMST() and the constructor). You'll also need
> bindings for the Armadillo types, but someone has already written some
> Cython bindings for Armadillo:
>
> https://github.com/andrewcron/cy_armadillo
>
> Then you can convert your data from numpy arrays to Armadillo objects
> without copying the memory, and from there you can call the Cython
> binding for the DualTreeBoruvka class.
>
> It'll take more than a couple minutes to get all that set up and put
> together, but if you want a Python binding that's you're best bet.
> Another idea might be to use subprocess() to call the 'mlpack_emst'
> program and then use numpy.genfromtxt() or something to load in the
> results. But then you'll have some extra overhead. I don't know if
> that matters in your situation.
>
> Hope this is helpful. :)
>
> Ryan
>
> --
> Ryan Curtin | "He's a peculiar man. You could even say that he
> ryan at ratml.org | has principles." - Carson Wells
>
--
Graduate Research Assistant
Signal Analysis, Representation and Perception Lab
Arizona State University, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack/attachments/20160128/e18bc3ed/attachment.html>
More information about the mlpack
mailing list