JaxRK is a library for working with (vectors of) RKHS elements and RKHS operators using JAX for automatic differentiation. This library includes implementations of kernel transfer operators and conditional density operators.
Elementary kernels can be applied directly to input space points jaxrk.kern.base.Kernel
.
RKHS elements
A more complex RKHS element would be
Vectors of RKHS elements are simply represented as jaxrk.rkhs.base.Vec
. The most commonly used concrete implementation is jaxrk.rhks.vec.FiniteVec
.
The simplest RKHS vector is one where each jaxrk.rhks.vec.FiniteVec(kernel_object, input_space_points)
. If the number of rows in input_space_points
equals
One commonly cited advantage of kernel models is that you only have to define a new kernel to apply the same upstream models like Gaussian Processes, Conditional Mean and conditional density operators, kernel based classifiers etc. to not only numbers but also more complicated data like graphs, sequences, etc.
Using RKHS vectors
The advantage is that all upstream models can automatically handle very complex data using only elementary kernels and a smart linear combination. For example, one can use all upstream models directly with distributions as input by simply representing each distribution by its mean embedding. Concretely, the training data would look like
To construct an RKHS vector containing more complex RKHS elements, reductions can be used, which are implemented in jaxrk.reduce.base.Reduce
. These take
Given
First you have to make sure to have jax and jaxlib installed. Please follow the JAX installation instructions depending on whether you want a CPU or GPU/TPU installation. After that you only need
$ pip install jaxrk
For some examples of what you can do with JaxRK, see examples/Quick_start.ipynb.
To help in developing JaxRK, clone the github repo and change to the cloned directory on the command line. Then
$ pip install -e ".[ci]"
$ pytest test/
will install the package into your python path. Changes to files in the directory are reflected in the python package when loaded.
If you want to send pull requests, use the tool black
for ensuring the correct style.
To browse the documentation, use
pdoc --docformat google jaxrk