This is the official PyTorch implementation of GrEASE: Generalizable and Efficient Approximate Spectral Embedding.
See our GitHub repository for more information.
The main application of GrEASE is NUMAP, a generalizable version of UMAP. The code for NUMAP can be found here.
To install the package, simply use the following command:
pip install grease-embeddings
The basic functionality is quite intuitive and easy to use, e.g.,
from grease import GrEASE
grease = GrEASE(n_components=10) # n_components is the number of dimensions in the low-dimensional representation
grease.fit(X) # X is the dataset and it should be a torch.Tensor
X_reduced = grease.transfrom(X) # Get the low-dimensional representation of the dataset
Y_reduced = grease.transform(Y) # Get the low-dimensional representation of a test dataset
You can read the code docs for more information and functionalities.
Out of many applications, GrEASE can be used for generalizable Fiedler vector and value approximation, and Diffusion Maps approximation. The following is examples of how to use GrEASE for these applications:
from grease import GrEASE
grease = GrEASE(n_components=1)
fiedlerVector = grease.fit_transform(X)
fiedlerValue = grease.get_eigenvalues()
from grease import GrEASE
grease = GrEASE(n_components=10)
diffusionMaps = grease.fit_transform(X, t=5) # t is the diffusion time
In order to run the model on the moon dataset, you can either run the file, or using the command-line command:
python -m examples.reduce_moon
This will run the model on the moon dataset and plot the results.
The same can be done for the circles dataset:
python -m examples.reduce_circles