accosmin-org / libnano

C++ numerical optimization and machine learning utilities using Eigen3
MIT License
4 stars 1 forks source link
cmake cpp cpp14 cpp17 eigen3 machine-learning numerical-optimization

libnano

License: MIT ubuntu-builds macos-builds windows-builds

clang-format clang-tidy cppcheck memcheck docs

sanitizers coverage SonarCloud codecov

Description

Libnano implements parameter-free and flexible machine learning algorithms complemented by an extensive collection of numerical optimization algorithms. The implementation is cross-platform (tested on recent versions of Linux, macOS and Windows) with minimal dependencies (standard library and Eigen3) and it follows recent C++ standards and core guidelines. The library uses modern CMake and as such it is easy to install and to package.

Numerical optimization module

The library implements state-of-the-art algorithms for both unconstrained and constrained numerical optimization problems. Additionally builtin test functions of varying number of dimensions are provided for benchmarking these algorithms. Some of these test functions are specific to ML applications like logistic regression or multivariate linear regression with various loss functions and synthetic data.

Examples:

Algorithm Application
L-BFGS unconstrained smooth nonlinear optimization
quasi-Newton methods (e.g. BFGS) unconstrained smooth nonlinear optimization
non-linear conjugate gradient descent (CGD) methods unconstrained smooth nonlinear optimization
optimal sub-gradient algorithm (OSGA) unconstrained smooth/non-smooth nonlinear optimization
proximal bundle methods (e.g. RQB) unconstrained smooth/non-smooth nonlinear optimization
primal-dual interior-point method linear and quadratic programs
penalty methods constrained nonlinear optimization
augmented lagrangian method constrained nonlinear optimization

Machine learning module

The machine learning (ML) module is designed to as generic and as customizable as possible. As such various important ML concepts (e.g. loss function, hyper-parameter tuning strategy, numerical optimization solver, dataset splitting strategy, feature generation, weak learner) are modelled using appropriate orthogonal interfaces which can be extended by the user to particular machine learning applications. Additionally the implementation follows strictly the scientific principles of statistical learning to properly tune and evaluate the ML models.

In particular the following requirements were considered when designing the API:

Note that the library makes heavy use of its own implementation of tensors of arbitrary rank and scalar type designed for machine learning applications. This uses Eigen3 as backend and as such fast and easy-to-use linear algebra operations are readily available.

Examples:

Interface Description Examples of builtin implementations
loss_t loss function hinge, logistic, mse
datasource_t in-memory collection of potentially heterogenous features missing feature values, continuous or categorical features
generator_t feature generation 2D gradient, pairwise product
splitter_t dataset splitting bootstrapping, k-fold cross-validation, random splitting
tuner_t hyper-parameter tuning local search, quadratic model
wlearner_t weak learner look-up table, decision stump, decision tree
linear_t linear model lasso, ridge regression, elastic net

Documentation

  1. Introduction

  2. Tensor module

  3. Nonlinear unconstrained optimization

  4. Linear and quadratic programming

  5. Constrained optimization module - TODO

  6. Machine learning module

  7. Linear models - TODO

  8. Gradient boosting models - TODO