Spectral Embedding Using Deep Neural Networks
Project description
ScaSE
ScaSE is The official PyTorch implementation of ScaSE from the paper "Scalable and Generalizable Spectral Embedding via deep neural networks.
One of many applications of ScaSE is UMAP initialization, as shown in the following figure:
Initializing UMAP with ScaSE results in a similar embedding to the one obtained by UMAP itself (initialized with Spectral Embedding), but with a much faster runtime for a large number of samples.
Installation
To install the package, simply use the following command:
pip install scase
Usage
The basic functionality is quite intuitive and easy to use, e.g.,
from src.scase import ScaSE
scase = ScaSE(n_components=10) # n_components is the number of dimensions in the low-dimensional representation
scase.fit(X) # X is the dataset and it should be a torch.Tensor
X_reduced = scase.transfrom(X) # Get the low-dimensional representation of the dataset
Y_reduced = scase.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, ScaSE can be used for UMAP initialization, Fiedler vector and value approximation, and Diffusion Maps approximation. The following is examples of how to use ScaSE for each of these applications:
UMAP initialization
from src.scase import ScaSE
from umap import UMAP
scase = ScaSE(n_components=2)
se = scase.fit_transform(X)
umap = UMAP(n_components=2, init=se)
X_reduced = umap.fit_transform(X)
Fiedler vector and value approximation
from src.scase import ScaSE
scase = ScaSE(n_components=1)
fiedlerVector = scase.fit_transform(X)
fiedlerValue = scase..get_eigenvalues()
Diffusion Maps approximation
from src.scase import ScaSE
scase = ScaSE(n_components=10)
diffusionMaps = scase.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
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scase-0.1.5.tar.gz.
File metadata
- Download URL: scase-0.1.5.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9903c3d6d717e7e24381170c1e64776751c1344e683fffcfb270dc26d2dda93a
|
|
| MD5 |
16371ce90fe6448dfed255e784677809
|
|
| BLAKE2b-256 |
9f63d7111c132795d6919a5383186d78fbbca9b0f36a1aa1cb5ba8353686eda1
|
File details
Details for the file scase-0.1.5-py3-none-any.whl.
File metadata
- Download URL: scase-0.1.5-py3-none-any.whl
- Upload date:
- Size: 40.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c062010a61beb270ddc9abb8ec32b6482210bf67c9424297e3868fcf48fba29
|
|
| MD5 |
a0cd4cc32c9f215649953a6b3267bd7e
|
|
| BLAKE2b-256 |
755f973c1bcef1ad74385c4334a170b63e551919a37c02dc855f6ec0a9a2f3e3
|