Skip to main content

A JAX-based Dimension Reducer

Project description

DiRe-JAX logo

License Python 3.8+ PyPI DOI badge

PyPI Downloads CI Docs Docs Live

A new DImensionality REduction package written in JAX

We offer a new dimension reduction tool called DiRe - JAX that is benchmarked against the existing approaches: UMAP (original and Rapids.AI versions), and tSNE (Rapids.AI version)

Quick start

Do either

pip install dire-jax

if you need to install the main DiRe class only, or

pip install dire-jax[utils]

if you also need the benchmarking utilities.

Note: For GPU or TPU acceleration, JAX needs to be specifically installed with hardware support. See the JAX documentation for more details on enabling GPU/TPU support.

Then, do the imports

# your imports here ...

# ... DiRe JAX import ...
from dire_jax import DiRe

# ... test dataset 
from sklearn.datasets import make_blobs

and afterwards, for example, try this:

n_samples  = 100_000
n_features = 1_000
n_centers  = 12
features_blobs, labels_blobs = make_blobs(n_samples=n_samples, n_features=n_features, centers=n_centers, random_state=42)

reducer_blobs = DiRe(n_components=2,
                     n_neighbors=16,
                     init='pca',
                     max_iter_layout=32,
                     min_dist=1e-4,
                     spread=1.0,
                     cutoff=4.0,
                     n_sample_dirs=8,
                     sample_size=16,
                     neg_ratio=32,
                     verbose=False,)

embedding = reducer_blobs.fit_transform(features_blobs)
reducer_blobs.visualize(labels=labels_blobs, point_size=4)

The output should look similar to

12 blobs with 100k points in 1k dimensions embedded in dimension 2

Documentation

Please refer to the DiRe API documentation for more instructions.

Working paper

Our working paper is available on the arXiv. Paper

Also, check out the Jupyter notebook with benchmarking results. Open in Colab

Benchmarking and utilities

In order to run the Jupyter notebook in the ./tests folder, you need to install some extras:

pip install dire-jax[utils]

This installation will give you access to the utilities (metrics and benchmarking routines) that are specifically implemented to be used together with DiRe. However, some of them rely on external packages (especially for persistent homology computations) that may have longer runtimes.

Contributing

Please follow the contibuting guide. Thanks!

Acknowledgement

This work is supported by the Google Cloud Research Award number GCP19980904.

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

dire_jax-0.2.0.tar.gz (7.3 MB view details)

Uploaded Source

Built Distribution

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

dire_jax-0.2.0-py3-none-any.whl (7.3 MB view details)

Uploaded Python 3

File details

Details for the file dire_jax-0.2.0.tar.gz.

File metadata

  • Download URL: dire_jax-0.2.0.tar.gz
  • Upload date:
  • Size: 7.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dire_jax-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b6f7b3bcfa8f9026d2b8e4691da01b47a9e27f895b0651c092341d0aa13ea4c3
MD5 0b4d27816c4043e70bf674dda43b432c
BLAKE2b-256 0211441cc188480340b7606eb3fa8d0191baff0fd31e87a1feeea875ef647e1a

See more details on using hashes here.

File details

Details for the file dire_jax-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dire_jax-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dire_jax-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1cc1e3043b70d38a9aec08c416ad76cabd4136213138f4d372d0e0ec24a1f3f
MD5 9d0236acd20341d7b956c2537c69ac5f
BLAKE2b-256 28f36976e51eb091d58090d834b7f0101451e76cafedcd84149385cecc615c64

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