albatross

A framework for statistical modelling in C++, with a focus on Gaussian processes.

Features

  • Gaussian Process Regression using composable covariance functions and works with custom data types.

  • Bayesian inferrence using an ensemble MCMC sampler based off emcee.

  • Helpful utilities for working with datasets using the split apply combine approach.

  • An interface around nlopt to make model tuning straight forward.

  • Evaluation utilities, with a focus on cross validation.

  • Parameter handling which makes it easy to get and set parameters in a standardized way and (de)serialize models.

Examples

https://raw.githubusercontent.com/swift-nav/albatross/master/examples/temperature_example/mean_temperature.png

Why Albatross?

First let’s start with a bigger question, “Why write anything from scratch when you can use external packages?”. Opinions may vary, but some reasonable answers are:

  • The external packages don’t quite do what you want.

  • You think you can do it better.

  • You don’t want any dependencies.

In on our situation it’s mostly the first; we want to build statistical models in a way that accommodates the research phase of development (rapid model iteration, evaluation, comparison, and tuning) but also runs fast in a production environment. So while just about everything in albatross could also be done with python packages such as pandas, scikit-learn, emcee and george, using them directly just wasn’t practical. Instead we started developing albatross, which draws heavily on paradigms we liked from those packages but with an emphasis on compile time safety and speed. In short you could say albatross is:

“A package containing some of the stats modeling tools from python that are missing in C++”

Install

albatross is a header only library so incorporating it in your C++ project should be as simple as adding ./albatross as an include directory.

Install as a submodule

If you’re using git you can run git submodule add https://github.com/swift-nav/albatross.git)

Then make sure you’ve run git submodule update --recursive --init to be sure all the third party libraries required by albatross are also up to date.

Tests and Examples

If you want to run the tests you can do so using cmake,

mkdir build;
cd build;
cmake ../
make run_albatross_unit_tests

Similarly you can make and run the examples,

make sinc_example
./examples/sinc_example -input ./examples/sinc_input.csv -output ./examples/sinc_predictions.csv

and plot the results (though this’ll require a numerical python environment),

python ../examples/plot_example_predictions.py ./examples/sinc_input.csv ./examples/sinc_predictions.csv

Credit

The fit, predict, get_params functionality was directly inspired by scikit-learn and the covariance function composition by george.

The ensemble sampler was inspired by emcee which itself was inspired by the paper Ensemble samplers with affine invariance.

Like this project? Want to get paid to help us apply it to our GNSS models? Join us at Swift Navigation !

https://bigmemes.funnyjunk.com/gifs/Albatross_408ca5_5434150.gif