A Practical Method for Constructing Equivariant Multilayer Perceptrons for Arbitrary Matrix Groups
Project description
A Practical Method for Constructing Equivariant Multilayer Perceptrons for Arbitrary Matrix Groups
| Paper|
EMLP is a jax library for the automated construction of equivariant layers in deep learning. You can read the documentation here.
WARNING: Our library (and paper) have not yet been released, and may have sharp edges, bugs, and may be subject to breaking changes. Use at your own caution. But if you notice things behaving unexpectedly or get frustrated, send me an email so I can make the library better.
Our type system is centered on it making it easy to combine representations using ρᵤ⊗ρᵥ, ρᵤ⊕ρᵥ, ρ*. For any given matrix group and representation formed in our type system, you can get the equivariant basis with rep.equivariant_basis()
or a matrix which projects to that subspace with rep.equivariant_projector()
. For example:
from emlp.reps import V
from emlp.groups import *
W=V(O13())
repin = (W+2*W**2)*(W.T+1*W).T + W.T
repout = 3*W**0 + W + W*W.T
Q = (repin>>repout).equivariant_basis()
is code that will run and produce the basis for linear maps from repin to repout that are equivariant to the Lorentz group O(1,3).
You can even mix and match representations from different groups. For example with the cyclic group ℤ₃, the permutation group 𝕊₄, and the orthogonal group O(3)
rep = 2*V(Z(3))*V(S(4))+V(O(3))**2
Q = (rep>>rep).equivariant_basis()
You can visualize these equivariant bases with vis(repin,repout)
, such as with the two examples above
Checkout our documentation to see how to use our system and some worked examples.
Installation instructions
To install as a package, run pip install emlp
.
To run the scripts you will instead need to clone the repo and install it locally which you can do with
git clone https://github.com/mfinzi/equivariant-MLP.git
cd equivariant-MLP
pip install -e .
Experimental Results from Paper
Assuming you have installed the repo locally, you can run the experiments we described in the paper.
To train the regression models on one of the Inertia
, O5Synthetic
, or ParticleInteraction
datasets found in emlp.datasets.py
you can run the script experiments/train_regression.py
with command line arguments specifying the dataset, network, and symmetry group. For example to train EMLP
with SO(3)
equivariance on the Inertia
dataset, you can run
python experiments/train_regression.py --dataset Inertia --network EMLP --group "SO(3)"
or to train the MLP baseline you can run
python experiments/train_regression.py --dataset Inertia --network MLP
Other command line arguments such as --aug=True
for data augmentation or --ch=512
for number of hidden units and others are available, and you can browse the options and their defaults with python experiments/train_regression.py -h
. If no group is specified, EMLP will automatically choose the one matched to the dataset, but you can also go crazy with any of the other groups implemented in groups.py
provided the dimensions match the data (e.g. for the 3D inertia dataset you could do --group=
"Z(3)"
or "DkeR3(3)"
but not "Sp(2)"
or "SU(5)"
).
For the dynamical systems modeling experiments you can use the scripts
experiments/neuralode.py
to train (equivariant) Neural ODEs and experiments/hnn.py
to train (equivariant) Hamiltonian Neural Networks.
For the dynamical system task, the Neural ODE and HNN models have special names. EMLPode
and MLPode
for the Neural ODEs in neuralode.py
and EMLPH
and MLPH
for the HNNs in hnn.py
. For example,
python experiments/neuralode.py --network EMLPode --group="O2eR3()"
or
python experiments/hnn.py --network EMLPH --group="DkeR3(6)"
If you find our work helpful, please cite it with
@article{finzi2021emlp,
title={A Practical Method for Constructing Equivariant Multilayer Perceptrons for Arbitrary Matrix Groups},
author={Finzi, Marc and Welling, Max and Wilson, Andrew Gordon},
journal={Arxiv},
year={2021}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file emlp-0.8.1-py3-none-any.whl
.
File metadata
- Download URL: emlp-0.8.1-py3-none-any.whl
- Upload date:
- Size: 39.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 208024139e91743c3859d0eb314e1a631cd84a1f402c06259ed031bed24d19f2 |
|
MD5 | 08739a6253db726394459746c3034a73 |
|
BLAKE2b-256 | 85932de50d374e6132be0dd64110aec4605c727f7a00595a1e3e02e029f11193 |