Which programming languages can I use with mlpack?
Updated
mlpack is written in C++ and ships official bindings for Python, Julia, R, Go, and the command line, so you can use it from any of those six interfaces. The C++ library is header-only, meaning you include it directly rather than linking a compiled library. If your language isn't in that list, you'd need to call the C++ library through a foreign-function interface or use the command-line bindings from a subprocess.
The core: C++
mlpack's algorithms are implemented in C++ and built on three supporting libraries: Armadillo (linear algebra), ensmallen (optimization), and cereal (serialization). Because it's header-only, you add the include path and start using it — no separate build step for the library itself. This is the reference implementation that all other bindings wrap.
Official bindings
| Language | How you use it | Notes |
|---|---|---|
| C++ | Include headers directly | Header-only; the native interface |
| Python | Import the Python bindings | Wraps the C++ algorithms |
| Julia | Use the Julia bindings | Wraps the C++ algorithms |
| R | Use the R bindings | Wraps the C++ algorithms |
| Go | Use the Go bindings | Wraps the C++ algorithms |
| Command line | Run the CLI programs | Useful for scripting and non-supported languages |
Each binding exposes the same underlying algorithms, but the calling conventions differ — argument names, data types, and how you pass matrices depend on the host language. Don't assume a Python example translates line-for-line into R or Go.
How to pick and where to look
- Already in C++? Use the C++ interface directly; it's the most complete and avoids binding overhead.
- Working in Python, Julia, R, or Go? Use the matching binding so you stay in your language's ecosystem and data structures.
- Using another language, or scripting? The command-line bindings let you invoke algorithms as separate programs, which works from any language that can run a subprocess.
Because the bindings differ, check the documentation for your specific language before writing code — the mlpack site links to per-language documentation from its Documentation page. The current release listed on the site is version 4.8.0.
Licensing and governance
mlpack is open source under the permissive 3-clause BSD license, which allows use in both open and proprietary projects. It uses an open governance model and is fiscally sponsored by NumFOCUS. If you use mlpack in published work, the project asks that you cite the 2023 Journal of Open Source Software paper describing mlpack 4.