PGCuts Documentation

PGCuts is a GPU-accelerated implementation of Probabilistic Graph Cuts (PGCuts) for graph clustering with a scikit-learn-compatible API.

For reasonable feature matrices, simply use as follows:

from pgcuts import HyCut

# Just like KMeans or SpectralClustering
labels = HyCut(n_clusters=10).fit_predict(X)

PGCuts replace the spectral eigendecomposition with a differentiable probabilistic upper bound that scales to large datasets, as introduced in:

PGCuts include:

  • PRCut – Probabilistic RatioCut \((\frac{1}{\bar{p}_\ell})\)

  • H-RCut – Hypergeometric RatioCut \(({}_{2}F_{1}(-m, 1; 2; \alpha_\ell))\)

  • H-NCut – Hypergeometric NCut with Holder-binned envelopes (default)

Key features:

  • Drop-in replacement for sklearn.cluster.SpectralClustering

  • GPU-accelerated \({}_{2}F_{1}\) kernels (Triton + CUDA)

  • Gradient mixing for collapse-free training

  • Works on pre-extracted embeddings (DINOv2, CLIP, etc.)

Indices and tables