A package for learning basis functions over arbitrary function sets. This allows even high-dimensional problems to be solved via a minimal number of basis functions. This allows for zero-shot transfer within these spaces, and also a mechanism for fully informative function representation via the coefficients of the basis functions. Hilbert spaces are nifty.
Project description
Function Encoder
A function encoder learns basis functions/vectors over arbitrary Hilbert spaces. This allows for zero-shot transfer within this learned by space by using a weighted combination of the basis functions to approximate any function in the space. The coefficients can be calculated quickly from a small amount of data, either using an inner product or the least squares method. The basis functions are learned from data as a neural network, which allows them to scale to high-dimensional function spaces. Furthermore, since the number of basis functions is fixed, this yields a fixed-size representation of the function which can be used for downstream tasks.
See the original paper for a mathematical introduction or the blog for an intuitive explanation of function encoders.
Installation
For the latest stable release:
pip install FunctionEncoder
For the latest version:
pip install git+https://github.com/tyler-ingebrand/FunctionEncoder.git
Examples
Each of the following examples can be found in the Examples/ directory. These examples illustrate the basis use of this repo and algorithm, but are by no means the extent of its applications or scalability.
Euclidean Vectors
This algorithm can be applied to any Hilbert space. To visualize what this algorithm looks like, we can apply it to Euclidean vectors. Watch as the basis vectors (black) converge to the Hilbert space being fit (blue square).
Quadratics
In the figure above, each panel shows a quadratic function (blue) and its function encoder approximation (orange). Small amounts of data are taken from each quadratic function, and used to compute a representation by taking the Monte Carlo approximation of the inner product between the function and basis functions. Then, the function is approximated as a weighted combination of basis functions. As you can see, a single set of learned basis functions is able to reproduce all nine of these quadratics accurately.
The basis functions look like this:
Distributions
As distributions are also Hilbert spaces, we can apply the exact same algorithm. The only difference is the definition of the inner product. The black dots below are example data points, and the red area indicates the approximated probability density function. Just like in the quadratic example, the same basis functions are able to approximate the pdfs of all of these distributions.
Related Papers
- "Zero-Shot Reinforcement Learning Via Function Encoders" (ICML 2024)
- "Zero-Shot Transfer of Neural ODEs" (Under Review)
Citation
If you use this repo for research, please cite
@article{Ingebrand2024,
author = {Tyler Ingebrand and
Amy Zhang and
Ufuk Topcu},
title = {Zero-Shot Reinforcement Learning via Function Encoders},
booktitle = {{ICML}},
year = {2024},
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file functionencoder-0.0.6.tar.gz
.
File metadata
- Download URL: functionencoder-0.0.6.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ca0321ab71c10f843b3653d624438d36ce631afc06ebb129461dbf9c56c31ae |
|
MD5 | 6c8a04e8ffeab84f374170e480d832f0 |
|
BLAKE2b-256 | 3f37c3fe4d683dac6ff90c2e0265477567d7690a93abf26d0aca332ffd718323 |
File details
Details for the file FunctionEncoder-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: FunctionEncoder-0.0.6-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3951944bcb5cb39f69b2100b7d6fc595fcc94ee85e142234da62027e93505bf |
|
MD5 | b749415cd6041789f3e9e775e3fca1f1 |
|
BLAKE2b-256 | d621307c74fa67286f7c2843162ac88c80ed5dc5a97fc02a2544f1eed9caf287 |