* Add a first attempt at explicitly using Jenkinsfiles. * A first attempt... * Put code in a script block. * Add first attempt at link check job pipeline. * Hopefully correct shell block. * Install git. * Install packages as root. * Use custom image that already has dependencies installed. * Try processing the JUnit results. * Fix syntax (hopefully). * Try to get the build to set its status on Github. * Try and see if I can get the snippet build to run too. * A first attempt at reviving the static code analysis build. * Refactor style check job a bit. * Try to clean up other files and have them set statuses. * Set status in script blocks. * Fix directory (this may not fix my problem). * Should I load in the script step? * Maybe I can just load it without a name. * Maybe I have my path wrong. * Will this work? Just a test... * Try using a plugin instead. * And if I define the function manually at the top? * Maybe this will fix the load. * Try to turn unstable into failed. * Hopefully fix documentation builds. * Fix script blocks. * Maybe fix static code analysis job. * Try to adapt PR number variable. * First attempt at cross-compilation job. * Try to fix some syntax. * Clean workspaces after build. * Try to put the matrix in the right place. * Another attempt at the matrix configuration. * Maybe I have to nest it deeper. * Maybe I have to clean always? * What we need is more tabbing. * Use try/catch to handle failed junit processing. * Better handling of environment variables. * Try a differernt approach than try/catch. * Try to get some more information about ccache. * Is it possible we could store the ccache at a higher level? * Maybe I have the variable name wrong. * Clean the cross-compilation workspace. * Try mounting the ccache so it can be shared across multiple jobs. * Always pull images. * We need to run on the same node. * Run on only one core. * Try building in the Docker container in a different way. * Do I have the order backwards? * Can I run anything at all in the container? * The static code analysis job isn't helpful. * Try to set the user of the docker container. * Rebuild the Docker container instead. * Always pull an updated image. * Download any necessary dependencies too. * Oops, use the correct CMake options. * Fix line break in the wrong place. * Make sure to use the correct architecture. * We can't use MATCHES, that is a regex. * Oops, we need to use STREQUAL. * Bump to an older version since newer versions don't have gfortran. * Try to run the tests on the target. * Correct syntax. * Okay, I'm not allowed to generate a stage name. * Try cleaning the workspace at the start of the build. * Okay, so I just can't depend on the workspace cleaning job, wonderful. * Try and add the passphrase correctly. * Fix path for memory checks. * Fix path to test. * Fix PR number variable. * Try to fix path for test copying. * Try to get the PR number correct. * Try and centralize where the link cache is stored. * Why is it being printed strangely? * Is there some weird restriction where this all has to be on one line? * Always publish the HTML, and fix a link. * Try to fix SSH host key check. * Make the reports directory. * Try to fix file parsing. * Try to enable ccache. * Try to set ccache directory correctly. * Try to get the full pipeline set up correctly for cross-compilation. * Fix path to test data. * Allow debug builds when cross-compiling. * Remember to unpack all the test data! * Fail tests when the data isn't there. * Maybe I can use find instead. * Double escape for backslash? * What if we just run the test? * Port Catch2 improvement for junit runner. See https://github.com/catchorg/Catch2/commit/c29e198eab0ccdb190495397854b937677385e2e. * Re-enable junit testing (hopefully it will work now). * Output directly to the xml file. * Try to clean up regex. * Try to set IN PROGRESS status. * Could it be called RUNNING? * I guess I don't get access to set jobs in progress through this API. * Fix regex for test name extraction. * Try to clean up Jenkinsfiles. * Fix parameter name. * Maybe fix syntax? * Does it work without keyword arguments? * Correctly accept named parameters. * Abort previous builds to reduce load on Jenkins. * Use optimization when compiling. * Fix syntax for abortPrevious. * Fix missing closing brace... * Update links in CI documentation and try to fix memory check job. * Add Docker deployment page. * Fix link. * Fix missing link in pipeline. * Apply suggestions from code review Co-authored-by: Dirk Eddelbuettel <edd@debian.org> * Try to get some more information on the build failure. * Fix link that now redirects. * Try to get some more information about why we are not linking against OpenBLAS. * I think the variable name was wrong, we will see... * Clean things up since the build should work now. --------- Co-authored-by: Dirk Eddelbuettel <edd@debian.org>
a fast, header-only machine learning library
Home | Download | Documentation | Help |
Download: current stable version (4.5.1)
mlpack is an intuitive, fast, and flexible header-only C++ machine learning library with bindings to other languages. It is meant to be a machine learning analog to LAPACK, and aims to implement a wide array of machine learning methods and functions as a "swiss army knife" for machine learning researchers.
mlpack's lightweight C++ implementation makes it ideal for deployment, and it can also be used for interactive prototyping via C++ notebooks (these can be seen in action on mlpack's homepage).
In addition to its powerful C++ interface, mlpack also provides command-line programs, Python bindings, Julia bindings, Go bindings and R bindings.
Quick links:
- Quickstart guides: C++, CLI, Python, R, Julia, Go
- mlpack homepage
- mlpack documentation
- Examples repository
- Tutorials
- Development Site (Github)
mlpack uses an open governance model and is fiscally sponsored by NumFOCUS. Consider making a tax-deductible donation to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.
0. Contents
- Citation details
- Dependencies
- Installation
- Usage from C++
- Building mlpack's test suite
- Further resources
1. Citation details
If you use mlpack in your research or software, please cite mlpack using the citation below (given in BibTeX format):
@article{mlpack2023,
title = {mlpack 4: a fast, header-only C++ machine learning library},
author = {Ryan R. Curtin and Marcus Edel and Omar Shrit and
Shubham Agrawal and Suryoday Basak and James J. Balamuta and
Ryan Birmingham and Kartik Dutt and Dirk Eddelbuettel and
Rishabh Garg and Shikhar Jaiswal and Aakash Kaushik and
Sangyeon Kim and Anjishnu Mukherjee and Nanubala Gnana Sai and
Nippun Sharma and Yashwant Singh Parihar and Roshan Swain and
Conrad Sanderson},
journal = {Journal of Open Source Software},
volume = {8},
number = {82},
pages = {5026},
year = {2023},
doi = {10.21105/joss.05026},
url = {https://doi.org/10.21105/joss.05026}
}
Citations are beneficial for the growth and improvement of mlpack.
2. Dependencies
mlpack requires the following additional dependencies:
If the STB library headers are available, image loading support will be available.
If you are compiling Armadillo by hand, ensure that LAPACK and BLAS are enabled.
3. Installation
Detailed installation instructions can be found on the Installing mlpack page.
4. Usage from C++
Once headers are installed with make install, using mlpack in an application
consists only of including it. So, your program should include mlpack:
#include <mlpack.hpp>
and when you link, be sure to link against Armadillo. If your example program
is my_program.cpp, your compiler is GCC, and you would like to compile with
OpenMP support (recommended) and optimizations, compile like this:
g++ -O3 -std=c++17 -o my_program my_program.cpp -larmadillo -fopenmp
Note that if you want to serialize (save or load) neural networks, you should
add #define MLPACK_ENABLE_ANN_SERIALIZATION before including <mlpack.hpp>.
If you don't define MLPACK_ENABLE_ANN_SERIALIZATION and your code serializes a
neural network, a compilation error will occur.
Warning: older versions of OpenBLAS (0.3.26 and older) compiled to use pthreads may use too many threads for computation, causing significant slowdown. OpenBLAS versions compiled with OpenMP do not suffer from this issue. See the test build guide for more details and simple workarounds.
See also:
- the test program compilation section of the installation documentation,
- the C++ quickstart, and
- the examples repository repository for
some examples of mlpack applications in C++, with corresponding
Makefiles.
4.1. Reducing compile time
mlpack is a template-heavy library, and if care is not used, compilation time of a project can be very high. Fortunately, there are a number of ways to reduce compilation time:
-
Include individual headers, like
<mlpack/methods/decision_tree.hpp>, if you are only using one component, instead of<mlpack.hpp>. This reduces the amount of work the compiler has to do. -
Only use the
MLPACK_ENABLE_ANN_SERIALIZATIONdefinition if you are serializing neural networks in your code. When this define is enabled, compilation time will increase significantly, as the compiler must generate code for every possible type of layer. (The large amount of extra compilation overhead is why this is not enabled by default.) -
If you are using mlpack in multiple .cpp files, consider using
extern templatesso that the compiler only instantiates each template once; add an explicit template instantiation for each mlpack template type you want to use in a .cpp file, and then useexterndefinitions elsewhere to let the compiler know it exists in a different file.
Other strategies exist too, such as precompiled headers, compiler options,
ccache, and others.
5. Building mlpack's test suite
See the installation instruction section.
6. Further Resources
More documentation is available for both users and developers.
To learn about the development goals of mlpack in the short- and medium-term future, see the vision document.
If you have problems, find a bug, or need help, you can try visiting
the mlpack help page, or mlpack on
Github. Alternately, mlpack help can be
found on Matrix at #mlpack; see also the
community page.