Rcpp bindings for mlpack 3.*
This is a more experimental version derived off Qiang Kou's excellent RcppMLPACK package which is also on CRAN as RcppMLPACK. That version is based on mlpack 1.0.6 and embeds it, ensuring builds on all platforms CRAN cares about.
Here, we are trying to build something lighter-weight and more current. We will use external (system) libraries for mlpack instead of bundling them inside the R package. See below for more detailed installation notes.
Note that the external Boost linkage created issues with the RStudio IDE which also uses Boost threading (and then some more Boost) itself. Loading the package will crash an RStudio binary that is older than the daily build version 1.1.129. The good news is than more recent RStudio versions are not affected due to a change in how the IDE is built off Boost.
What is mlpack?
Quoting from the main page:
mlpack is a scalable machine learning library, written in C++, that aims to provide fast, extensible implementations of cutting-edge machine learning algorithms. mlpack provides these algorithms as simple command-line programs and C++ classes which can then be integrated into larger-scale machine learning solutions.
and the about page:
mlpack is a C++ machine learning library with emphasis on scalability, speed, and ease-of-use. Its aim is to make machine learning possible for novice users by means of a simple, consistent API, while simultaneously exploiting C++ language features to provide maximum performance and maximum flexibility for expert users. This is done by providing a set of command-line executables which can be used as black boxes, and a modular C++ API for expert users and researchers to easily make changes to the internals of the algorithms.
- Collaborative filtering (with many decomposition techniques)
- Decision stumps (one-level decision trees)
- Density estimation trees
- Euclidean minimum spanning tree calculation
- Gaussian mixture models
- Hidden Markov models
- Kernel Principal Components Analysis (optionally with sampling)
- k-Means clustering (with several accelerated algorithms)
- Least-angle regression (LARS/LASSO)
- Linear regression (simple least-squares)
- Local coordinate coding
- Locality-sensitive hashing for approximate nearest neighbor search
- Logistic regression
- Max-kernel search
- Naive Bayes classifier
- Nearest neighbor search with dual-tree algorithms
- Neighborhood components analysis
- Non-negative matrix factorization
- Principal components analysis (PCA)
- RADICAL (independent components analysis)
- Range search with dual-tree algorithms
- Rank-approximate nearest neighbor search
- Sparse coding with dictionary learning
As mentioned above, the official RcppMLPACK CRAN package with its GitHub repo includes the source code from the mlpack library (version 1.*). Thus users do not need to install mlpack itself in order to use RcppMLPACK.
This package, however, uses the external mlpack library (version 2.* or later), so see below for detailed instructions.
We have successfully used version 2.1.0 (with a patch, see below), version 2.1.1, version 2.2.0, and now version 3.0.1.
Thanks to Barak Pearlmutter, there is an excellent
Debian package and its versions 2.1.0 or
later will do nicely. Just do
sudo apt-get install libmlpack-dev (provided you point to
Debian sid (aka 'unstable') or stretch (aka 'testing') as these packages are not yet
in a stable Debian release).
Unofficial packages for LTS releases trusty (14.04), xenial (16.04), and bionic (18.04) are available in Dirk's PPA, and used by the Travis CI integration. We may also make versions for intermediate releases available as time permits. They are based on Barak's Debian packages. Via the standard Debian-to-Ubuntu package transition, these should also appear in upcoming Ubuntu releases.
OS X / Brew
James Balamuta has kindly prepared a pull request which has been submitted and merged to update the version of mlpack in brew. However, I hear that there are issue between the brew compiler stack and what is used for R. So this may be in flux.
You may have to install from source. Let me know how it goes.
Under mlpack 2.1.0, the
R CMD check command may complain about
this one-line change
which is also part of the mlpack 2.1.1 release. Release 2.1.1, 2.2.0 and later are fine.
James Balamuta for various builds tricks and tests, in particular on OS X.
Dirk Eddelbuettel for most of the remainder of this experiment.
GPL (>= 2)