Skip to content

shaham-lab/GrEASE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GrEASE

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.

Installation

To install the package, simply use the following command:

pip install grease-embeddings

Usage

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:

Fiedler vector and value approximation

from grease import GrEASE

grease = GrEASE(n_components=1)
fiedlerVector = grease.fit_transform(X)
fiedlerValue = grease.get_eigenvalues()

Diffusion Maps approximation

from grease import GrEASE

grease = GrEASE(n_components=10)
diffusionMaps = grease.fit_transform(X, t=5)  # t is the diffusion time

Running examples

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages