[mlpack] MLPack bindings

Ryan Curtin ryan at ratml.org
Wed Feb 28 12:29:57 EST 2018


On Tue, Feb 27, 2018 at 10:14:50PM +0000, Kevin Avignon wrote:
> Awesome, thanks for the info!
> 
> As far from the documentation, I took a quick peek at it and I think I
> should managed on my own otherwise I'll send you emails to clarify stuff
> that aren't clear on my end.

Absolutely---just let me know if I can clarify anything.  I think the
system is pretty cool (although admittedly I have some bias there) but I
am not sure if I have fully documented it in an easy-to-understand way,
and if it can be improved I am happy to.

> Concerning invoking C++ from C#, there's a straightforward approach to it I
> haven't used in the past. This project will let me get more knowledge about
> C# and ML and I'm loving it already.
> 
> Link 1:  https://msdn.microsoft.com/en-us/library/ms235282.aspx
> 
> Link 2:
> https://www.codeproject.com/tips/695387/calling-csharp-net-methods-from-unmanaged-c-cplusp

Looks good to me.  I guess for this one the important one would be the
first link, for calling C++ from C#.  I'll try and read more about this
when I have a chance so I can understand from a high level.

> From what you said and what I found in C#, I think what I'll be building
> will somehow look closer to what you did as a binding for the command line!
> Basically, what you'd like in the end would be a library, right? A dll that
> will compile the C++ project and provide the necessary wrappers so C# devs
> are available to use mlpack as if it was native C#?

I guess, what I had in mind was that it could roughly be the equivalent
of what's provided for Python.  In Python a user might write something
like

>>> from mlpack import logistic_regression
>>> outputs = logistic_regression(train=x, labels=y, verbose=True, ...)

and then they can access the outputs (which include a trained model,
possibly predictions, and other things) and use them in the rest of
their work.

I imagine that something similar is possible for C#, where essentially
we would be providing top-level stateless functions from mlpack that
users can call, train models with, or evaluate models with (or whatever
other functionality is available from the command line).  However, I am
not a C# expert and am not familiar with how things are typically put
together in C#, so I can't give any input on what the best way to
structure the interface might be.  Let me know what you think.

The other thing to figure out would be the typical data representation
that is used in C#---I have never looked into that.  In Python matrices
are generally represented with numpy, so we had to build some
infrastructure to convert from numpy matrices to Armadillo matrices
without copying and vice versa.

> What should we agree on to define to determine if the project is complete?

Up to you---it depends on your goals. :)  Are you looking to fully
implement support for C# bindings, or prototype an interface and try to
find a GSoC student to mentor/co-mentor to do it, or something else?

-- 
Ryan Curtin    | "None of your mailman friends can hear you."
ryan at ratml.org |   - Alpha


More information about the mlpack mailing list