PySRF implements Similarity-Based Representation Factorization (SRF), a method for revealing low-dimensional, non-negative, interpretable embeddings from similarity matrices. Given a symmetric, non-negative similarity matrix S, it reveals a small set of sparse, non-negative dimensions W with S ≈ WWᵀ. It learns from observed entries without imputing missing values and selects the number of dimensions by cross-validation.
pip install "git+https://github.com/florianmahner/pysrf.git"A C compiler is needed to build the Cython extension; see the installation guide for details.
from pysrf import SRF
model = SRF(rank=10, random_state=42)
w = model.fit_transform(s)See florianmahner.github.io/pysrf for installation details, walkthroughs, examples, and the API reference.
To cite PySRF, use the Cite this repository button in the sidebar (generated from CITATION.cff), or read the preprint at arXiv:2605.26921.