Skip to main content

Polyfacet

Polyfacet logo

Simplex-structured matrix factorization and polyhedral facet extraction in Python.

Polyfacet provides FPI and non-FPI algorithms through one Python API, with reproducible synthetic scenarios and parameter grids, bundled hyperspectral reference datasets, typed multi-scenario evaluation, metrics, visualizations, examples, and notebooks.

Install

Polyfacet requires Python 3.11 or newer:

# From an existing uv project, add the latest published Polyfacet release.
uv add polyfacet

If you are starting a new application, initialize its uv project first:

uv init my-polyfacet-project
cd my-polyfacet-project
uv add polyfacet

For development from a checkout, use uv:

git clone https://github.com/crogs-foundation/polyfacet.git
cd polyfacet
uv sync --group dev

Quick start

from polyfacet.algorithms import SOFPI
from polyfacet.data import Scenario

scenario = Scenario(rank=3, seed=7)
result = SOFPI().run(scenario.data.X, target_dim=scenario.rank, rank_X=scenario.data.r)

print(result.W.shape)  # (n_features, rank)
print(result.H.shape)  # (rank, n_samples)

Input matrices use X.shape == (n_features, n_samples): each column is one sample.

For repeatable research grids, polyfacet.data.Scenario and ScenarioMatrix support facet/interior point distributions, purity, SNR, deterministic trials, lossless save/load, and stored projections for true/estimated vertex figures.

polyfacet.evaluation.evaluate accepts algorithm factories, scenarios, and metric callables. It isolates failures and produces typed summaries plus reloadable JSON/NPZ estimates without requiring pandas.

Algorithms

Family Methods
Facet-based GFPI, EMFPI, MBFPI, SOFPI
Other factorization methods SNPA, HyperCSI, MinVolNMF, MVIE

Each method implements run(X, target_dim=..., rank_X=...) and returns factors W and H. Supply the known signal rank for noisy data instead of relying on its usually larger numerical rank. Polyfacet does not make comparative performance claims; use the included workflows to inspect the methods on data relevant to your work.

Researchers can compose the general FPI algorithm with a custom FacetExtractor from polyfacet.extractors. Runnable methods remain under polyfacet.algorithms; no generic separation API is exposed.

Data and examples

The wheel bundles Samson, Jasper Ridge, and Moffett Field. Samson and Jasper Ridge include reference factors; Moffett is a qualitative real-data example.

from polyfacet.datasets import load_moffett

scene = load_moffett(rank=3)
print(scene.name, scene.X.shape)

The repository includes an all-method Moffett notebook. It continues after an individual method fails and does not calculate ground-truth metrics because the bundled Moffett scene has no reference factors.

Documentation

License and citation

Polyfacet is distributed under the MIT License. For academic use, cite the software using CITATION.cff and cite the original publication for every algorithm used.

Release files for polyfacet 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polyfacet 1.0.0
File Size Uploaded
polyfacet-1.0.0.tar.gz 8.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for polyfacet 1.0.0
File Interpreter ABI Platform
polyfacet-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size:17.2 MB

Release files / polyfacet-1.0.0.tar.gz

Download URL polyfacet-1.0.0.tar.gz
Size 8.6 MB
Tags Source
SHA-256 checksum
How to use checksums
775d181a04458315edb4054e2c3ea81ae8821d7195be09790efc597c77fe5cd1
BLAKE2b-256 checksum
How to use checksums
a450fc7baf93b83acb44d1850d510efbae6c67f0951afff0c99437ee87a3cd00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / polyfacet-1.0.0-py3-none-any.whl

Download URL polyfacet-1.0.0-py3-none-any.whl
Size 8.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4fa66004346e0d42d5786e7974b640a2523f0b5c8ee03c6e71a8858acf151477
BLAKE2b-256 checksum
How to use checksums
3d26a70f8c058e86d424c64dd3a1b117923250717f935ce6eeda0b9988f3538f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page