Skip to main content

Pure Python implementation of SG-t-SNE-Π: Swift Neighbor Embedding of Sparse Stochastic Graphs

Project description

SG-t-SNE-Pi logo PySGtSNEpi

SG-t-SNE-Pi embedding demo

PyPI version Python 3.10–3.13 License: MIT CI Docs

Embed sparse graphs into 2D/3D — pure Python, pip-installable, sklearn-compatible.

PySGtSNEpi is a pure Python port of the SG-t-SNE-Pi algorithm, translated from the original C++ and Julia implementations. Unlike standard t-SNE, SG-t-SNE-Pi works on any sparse stochastic graph, not just kNN graphs derived from point clouds. No C/C++ compiler needed — pip install and go.

Features

  • 1D / 2D / 3D embedding of sparse stochastic graphs
  • Arbitrary sparse graph input — not limited to kNN graphs
  • Point cloud input with automatic kNN graph construction via PyNNDescent
  • Lambda rescaling to equalize effective node degrees
  • Scikit-learn compatible API (fit / transform / fit_transform)
  • Pure Python — runs on Windows, macOS (including Apple Silicon), and Linux
  • Numba JIT compiled hot loops for near-native speed
  • FFT-accelerated repulsive force computation

Quick Start

pip install pysgtsnepi

Scikit-learn API (point cloud)

from pysgtsnepi import SGtSNEpi

model = SGtSNEpi(d=2, lambda_=10)
Y = model.fit_transform(X)   # X is (n_samples, n_features)

Functional API (sparse graph)

from scipy.io import mmread
from pysgtsnepi import sgtsnepi

P = mmread("graph.mtx")       # sparse stochastic graph
Y = sgtsnepi(P, d=3, lambda_=10)

Roadmap

  • Lambda equalization
  • kNN graph construction (via PyNNDescent)
  • Core SG-t-SNE-Pi embedding (attractive + repulsive forces)
  • FFT-accelerated repulsive forces
  • Numba JIT for interpolation and gradient kernels
  • 1D / 3D embedding support
  • SGtSNEpi sklearn estimator class
  • sgtsnepi() functional API

Citation

If you use this package in your research, please cite:

@article{pitsianis2019joss,
  title     = {{SG-t-SNE-$\Pi$}: Swift Neighbor Embedding of Sparse Stochastic Graphs},
  author    = {Pitsianis, Nikos and Floros, Dimitris and Iliopoulos, Alexandros-Stavros and Sun, Xiaobai},
  journal   = {Journal of Open Source Software},
  volume    = {4},
  number    = {39},
  pages     = {1577},
  year      = {2019},
  doi       = {10.21105/joss.01577}
}

@inproceedings{pitsianis2019hpec,
  title     = {Spaceland Embedding of Sparse Stochastic Graphs},
  author    = {Pitsianis, Nikos and Iliopoulos, Alexandros-Stavros and Floros, Dimitris and Sun, Xiaobai},
  booktitle = {IEEE High Performance Extreme Computing Conference},
  year      = {2019},
  doi       = {10.1109/HPEC.2019.8916505}
}

Links

License

MIT — see LICENSE.

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

pysgtsnepi-0.2.0.tar.gz (862.0 kB view details)

Uploaded Source

Built Distribution

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

pysgtsnepi-0.2.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysgtsnepi-0.2.0.tar.gz
  • Upload date:
  • Size: 862.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pysgtsnepi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1af4afc6d084528e94d91552d2a3fe87298346cede93e3f2be80c2e16fc1f1e6
MD5 b2222f25c71e39af2e030f59d9b242f3
BLAKE2b-256 b1db4476bd09b499918a6c27be88fd73a49c88c6ddc4bd124f8fabc4b2a30013

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysgtsnepi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pysgtsnepi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 035e940af61d088c2fd91bf2e86086c068f2dec0d328db18551c0f3195a7cff3
MD5 9582b8a46e9c78c89ba93ba445ebe218
BLAKE2b-256 05821254c01f829f61f3d5f875530b4f71103f867284738a7534cc40ec922115

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