A framework for statistical modelling in C++, with a focus on Gaussian processes.
- 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.
- A One dimensional example using a sinc function.
- An example spatial model for temperature estimation.
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
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++”
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
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