Algorithms for simplex-structured matrix factorization and polyhedral facet extraction.
Project description
Polyfacet
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
- Getting started
- Algorithms and FPI extension point
- Bundled datasets and attribution
- Scenarios and persistence
- Evaluation workflows
- Examples
- Notebooks
- Troubleshooting
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polyfacet-1.0.0.tar.gz.
File metadata
- Download URL: polyfacet-1.0.0.tar.gz
- Upload date:
- Size: 8.6 MB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
775d181a04458315edb4054e2c3ea81ae8821d7195be09790efc597c77fe5cd1
|
|
| MD5 |
9ea4f6c07bdc1db216a3be1a07e6082d
|
|
| BLAKE2b-256 |
a450fc7baf93b83acb44d1850d510efbae6c67f0951afff0c99437ee87a3cd00
|
File details
Details for the file polyfacet-1.0.0-py3-none-any.whl.
File metadata
- Download URL: polyfacet-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.6 MB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fa66004346e0d42d5786e7974b640a2523f0b5c8ee03c6e71a8858acf151477
|
|
| MD5 |
ab77be5ba8eb35b583d28067948b02e8
|
|
| BLAKE2b-256 |
3d26a70f8c058e86d424c64dd3a1b117923250717f935ce6eeda0b9988f3538f
|