rstudio / reticulate

R Interface to Python
https://rstudio.github.io/reticulate
Apache License 2.0
1.68k stars 328 forks source link

Wrappers for python packages? #14

Closed dfalbel closed 7 years ago

dfalbel commented 7 years ago

Hi

It may be not the best channel to ask this, but... Do you think it makes sense a package likes this: https://github.com/dfalbel/rsk Importing all functions from scikit-learn using reticulate and using R functional style?

Thanks

jjallaire commented 7 years ago

I think in general R users are better off when using packages within the R ecosystem. This is mostly because CRAN works so well and as soon as you start bringing in Python packages you need to procure and manage those dependencies as well.

Traditionally there hasn't been much need for R to call Python since the depth and breadth of R packages is so strong, and because most libraries are implemented at their core in C/C++ so it's straightforward to write R and Python bindings directly against the C/C++ code. The motivation for reticulate was specifically R interfaces for deep learning / tensorflow, since in that case much of the code we need to invoke is actually written in Python rather than C/C++.

So I think R to Python bindings make sense for domains where there are no equivalent C/C++ libraries to bind to, but make less sense when we have the option of creating native R interfaces.

dfalbel commented 7 years ago

Thanks very much for your answer @jjallaire! reticulate is a great package and there are great packages in python that I would like to see similar in R. scikit-learn is one of those for me, while R has many, many, algorithms, they are not as well organized as sklearn, with great documentation and all of that. But I agree with you, managing all the hard dependencies that come with python is not a great idea!

Thanks again!

jjallaire commented 7 years ago

Okay, if you do decide to write wrappers for Python packages please see the guidelines here for ensuring that your package can still pass tests on CRAN (even if Python and/or dependent packages are not available on the CRAN servers): https://github.com/rstudio/reticulate#using-in-a-package

Note that the issue of the meta-organization of algorithms is something that clearly needs work in R, and we hope to be addressing that with some other projects soon!

kevinykuo commented 7 years ago

@jjallaire I hope they look pretty with pipes and work with real big data problems (h2o/sparklyr and not just randomForest toy examples...)!