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.3.0.tar.gz (2.8 MB view details)

Uploaded Source

Built Distribution

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

pysgtsnepi-0.3.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysgtsnepi-0.3.0.tar.gz
  • Upload date:
  • Size: 2.8 MB
  • 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.3.0.tar.gz
Algorithm Hash digest
SHA256 fe7531cc36197f9f83d267b9bb5fda7c8da2e0502149130558804c803a5d0102
MD5 1153823977a6e5e958594ee076c8ee63
BLAKE2b-256 3d5c2dc05d52184fc4954de8ef206c1fb451dbff163699e05987a9492fb05905

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysgtsnepi-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 17.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 846ff0449709918e4a4a0c67b85968b107530a129f068d44c75c1a14cba0bce8
MD5 c1f19b26fc57b8664140592f067ac492
BLAKE2b-256 74976dbb412c5539823f7f7d648dcae4d17338493ea4f3e724e5b1d71330f884

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