Open eddelbuettel opened 6 years ago
I would absolutely love to help with this, and then the bindings are automatically kept up-to-date upstream (and also they will be in sync with all other bindings).
We have a GSoC student working this year on making Go bindings, and I'm likely to try and find some time to also do Java bindings. If you'd like to also use the system to make R bindings, I'm sure it can be done, but basically the effort will look a bit like this:
Figure out R glue code to pass matrices back and forth between C++ and R (you guys know that part, I don't).
Hand-write an R wrapper for some simple mlpack binding, like PCA. (Example: http://mlpack.org/docs/mlpack-git/python/pca.html --- so, not too many input options, and they're all matrix/string/int.)
Write some code so that that handwritten R wrapper code can actually be generated.
Plug it all in to CMake so that we can go from, e.g., 'pca_main.cpp' -> usable R binding. For Python at least, that required a separate step: we have to go 'pca_main.cpp' -> 'pca.pyx' -> 'pca.so' and then also have an init.py that imports it right. On the other hand, for the command-line bindings we can just compile directly from 'pca_main.cpp' -> 'mlpack_pca'. Maybe it is a little easier in R.
Anyway, that's a lot of words, but the short of it is, I'd love to see it happen and would be happy to help. Just let me know! :+1:
First bullet is done -- these templated conversions are the very core of Rcpp and RcppArmadillo.
Second bullet is doable. That is where we are at. Still has the issue of requiring an external build of libmlpack
due its dependencies on serialization and all that (you and I talked about that in the past).
Third bullet is the big unknown.
Fourth bullet is ... well, we don't really speak CMake around here but we can figure this out.
And yes, I'd love to see it happen too!
I can help with the CMake when it comes to that---basically from the mlpack side, once you can hand-generate a binding, it's just a matter of writing the code that would print that hand-generated binding. There are some intricacies there but, definitely doable, I think.
mlpack 3.0.* brings new auto-generated Python bindings, and there is fairly extensive documentation for bindings to other languages.
May need a few assists from @rcurtin though as the docs are somewhat dense and Python-centric.