👋 Welcome to Ramsey!#
Ramsey is a library for probabilistic modelling using JAX , Flax and NumPyro. It offers high quality implementations of neural processes, Gaussian processes, Bayesian time series and state-space models, clustering processes, and everything else Bayesian.
Ramsey makes use of
Flax`s module system for models with trainable parameters (such as neural or Gaussian processes),
NumPyro for models where parameters are endowed with prior distributions (such as Gaussian processes, Bayesian neural networks, etc.)
and is hence aimed at being fully compatible with both of them.
You can, for instance, construct a simple neural process like this:
from jax import random as jr from ramsey import NP, MLP from ramsey.data import sample_from_sine_function def get_neural_process(): dim = 128 np = NP( decoder=MLP([dim] * 3 + ), latent_encoder=( MLP([dim] * 3), MLP([dim, dim * 2]) ) ) return np key = jr.PRNGKey(23) data = sample_from_sine_function(key) neural_process = get_neural_process() params = neural_process.init(key, x_context=data.x, y_context=data.y, x_target=data.x)
The neural process takes a decoder and a set of two latent encoders as arguments. All of these are typically MLPs, but Ramsey is flexible enough that you can change them, for instance, to CNNs or RNNs. Once the model is defined, you can initialize its parameters just like in Flax.
Just as the names of other probabilistic languages are inspired by researchers in the field (e.g., Stan, Edward, Turing), Ramsey takes its name from one of my favourite philosophers/mathematicians, Frank Ramsey.
To install from PyPI, call:
pip install ramsey
To install the latest GitHub <RELEASE>, just call the following on the command line:
pip install git+https://github.com/ramsey-devs/ramsey@<RELEASE>
See also the installation instructions for JAX, if you plan to use Ramsey on GPU/TPU.
Contributions in the form of pull requests are more than welcome. A good way to start is to check out issues labelled “good first issue”.
In order to contribute:
Clone Ramsey and install it and its dev dependencies via
pip install -e '.[dev]',
create a new branch locally
git checkout -b feature/my-new-featureor
git checkout -b issue/fixes-bug,
implement your contribution,
test it by calling
toxon the (Unix) command line,
submit a PR 🙂
Ramsey is licensed under the Apache 2.0 License.