Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scase-0.1.3.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scase-0.1.3-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file scase-0.1.3.tar.gz.

File metadata

  • Download URL: scase-0.1.3.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

Hashes for scase-0.1.3.tar.gz
Algorithm Hash digest
SHA256 487e532ab08314f30bd62789c27197453e80d0941093624e68e58e034aa1df64
MD5 2c5d3d9883377508d415251bcae6895d
BLAKE2b-256 5dd43041f483918c1a766b6c79ed441d213c0e3eac5deb2b2770dea35cc2d0f3

See more details on using hashes here.

File details

Details for the file scase-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: scase-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 40.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.6

File hashes

Hashes for scase-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4be0377e6c2043355fcfc45a43c9098e0a301e0391c6ed2d8bc52b6f4a1b0cf4
MD5 b140e314868b25af0cd6c9c33e03c616
BLAKE2b-256 43d5432d6b85a0676ad7f1431a3670d9bd2eb96c69edc353a87dcdb450e2b7cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page