VBPCApy
Variational Bayesian PCA (Ilin & Raiko, 2010) with support for missing data, sparse masks, optional bias terms, and an orthogonal post-rotation to a PCA basis. The implementation follows the original MATLAB reference while adding Python-native APIs, fast C++ extensions, and runtime autotuning.
Documentation · API Reference · Tutorials
Statement of need
Missing values are common in scientific and industrial tabular datasets, but many analysis pipelines either impute first (masking uncertainty) or drop incomplete samples. VBPCApy models missingness directly and exposes posterior uncertainty outputs alongside reconstructions, enabling uncertainty-aware latent-factor analysis in a single reproducible Python API.
Installation
From PyPI (pre-built wheels for Python 3.11–3.14, Linux/macOS/Windows):
pip install vbpca-py
With plotting support:
pip install vbpca-py[plot]
See the installation guide for building from source and Eigen setup.
Quick start
import numpy as np
from vbpca_py import VBPCA
# 50 features, 200 samples
x = np.random.randn(50, 200)
mask = np.ones_like(x) # 1 = observed, 0 = missing
model = VBPCA(n_components=5, maxiters=100)
scores = model.fit_transform(x, mask=mask)
recon = model.reconstruction_
var = model.variance_
More examples: quickstart, dense PCA tutorial, missing data & model selection, sparse data.
Features
- Dense or sparse data with explicit missing-entry masks
- Optional bias estimation and rotation to PCA-aligned solution
- Posterior covariances for scores and loadings; held-out probe RMS
- C++ extensions with runtime autotune for threading and memory
- Missing-aware preprocessing: one-hot, standard/minmax scaling, log, power, winsorize, auto-routing (
AutoEncoder) - Preflight data diagnostics via
check_data()/DataReport - scikit-learn-compatible estimator (
fit/transform/inverse_transform,get_params/set_params, cloning) — scikit-learn is an optional dependency - Model selection via
select_n_componentsandcross_validate_components - Configurable convergence: subspace angle, RMS/cost plateau, ELBO, curvature, composite rules, patience, with per-criterion enable/disable and custom ordering
- Convergence diagnostics (
n_iter_,converged_,convergence_reason_,learning_curve_, best-probe state metadata) and calibratedpredictive_variance_(includes observation noise) recommend_config(n, p, priority)— regime-aware default hyperparameters from a surrogate trade study
See the concept guides and API reference for full details.
Development
git clone https://github.com/yoavram-lab/VBPCApy.git
cd VBPCApy
uv sync --extra dev --extra plot
just ci # lint + typecheck + test
just docs-serve # local docs preview
See CONTRIBUTING.md for guidelines.
Citation
If you use this package in your research, please cite:
@software{vbpca_py2026,
author = {Macdonald, Joshua and Naim, Shany and Ram, Yoav},
title = {{VBPCApy}: Variational Bayesian PCA with Missing Data Support},
year = {2026},
url = {https://github.com/yoavram-lab/VBPCApy},
version = {0.4.0},
}
@article{ilin2010practical,
title={Practical Approaches to Principal Component Analysis in the Presence of Missing Values},
author={Ilin, Alexander and Raiko, Tapani},
journal={Journal of Machine Learning Research},
volume={11},
pages={1957--2000},
year={2010}
}
See CITATION.cff for machine-readable metadata.
License
MIT — see LICENSE.
Release files for vbpca-py 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| vbpca_py-0.4.0.tar.gz | 233.2 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| vbpca_py-0.4.0-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
| vbpca_py-0.4.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| vbpca_py-0.4.0-cp313-cp313-macosx_11_0_arm64.whl | CPython 3.13 | CPython 3.13 | macOS 11.0+ ARM64 | Details |
| vbpca_py-0.4.0-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| vbpca_py-0.4.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 | Details |
| vbpca_py-0.4.0-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details |
| vbpca_py-0.4.0-cp311-cp311-win_amd64.whl | CPython 3.11 | CPython 3.11 | Windows x86-64 | Details |
| vbpca_py-0.4.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| vbpca_py-0.4.0-cp311-cp311-macosx_11_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 11.0+ ARM64 | Details |
Total release size: 39.9 MB
Release files / vbpca_py-0.4.0.tar.gz
| Download URL | vbpca_py-0.4.0.tar.gz |
|---|---|
| Size | 233.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
935c490caae609137e4de3f6b435b1dd024a4b28eadae04d290a64cee925fac4
|
|
BLAKE2b-256 checksum How to use checksums |
13995204384e3d18afab993dcc1f57584ba8ff8af8136148569420b8d4f1ce5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / vbpca_py-0.4.0-cp313-cp313-win_amd64.whl
| Download URL | vbpca_py-0.4.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 765.1 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8d68a0c80f1f39a09eb0465e229efc1d4b463a519de9846caccef54f0b1473c4
|
|
BLAKE2b-256 checksum How to use checksums |
01c895e4f1c37351a296051e90bb30de6ac1a00553052f7d8b448414c5e27b18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / vbpca_py-0.4.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | vbpca_py-0.4.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.7 MB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e9395caa01866defab603eabe8582f84521492d3d6683e9e78207f9601a3125a
|
|
BLAKE2b-256 checksum How to use checksums |
52adb7037c670a1c839610bda074b8894e9efa97cfdf4aaa8e234cda54d65dc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / vbpca_py-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | vbpca_py-0.4.0-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 784.1 kB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4818b2ef38000d54d28e5989ea3bceeb283cdcb0bf342731c767d3921c030c9a
|
|
BLAKE2b-256 checksum How to use checksums |
bc92dffbf6988e03c8869a92d5a495c1340eeda9eecb8d4bb396d1f45d7922fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / vbpca_py-0.4.0-cp312-cp312-win_amd64.whl
| Download URL | vbpca_py-0.4.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 764.7 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
21223f09611c0a1df98e46c29587983698a3ac9440b22bd93172b783e798f727
|
|
BLAKE2b-256 checksum How to use checksums |
783348dec28ffc1cc45ea4e52a9dcf96bc962e31153e579c9c608e2cd5a4b6b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / vbpca_py-0.4.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | vbpca_py-0.4.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.7 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
806c784ec54ceee9c827baa5228330b967111e12eb4bd388332e728e7a0d71ab
|
|
BLAKE2b-256 checksum How to use checksums |
6d9d858ac9f01456eedbedcc3dc4e3dca794d8630258ccf00b1f7b365a475695
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / vbpca_py-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | vbpca_py-0.4.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 783.8 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
51d15632e8062f26ff60b48c695cab09e5657c0447262f3bd9d2f3c08d0947f9
|
|
BLAKE2b-256 checksum How to use checksums |
ca3422a5cfc1b2d50a86734564aeae6d3365ba25dead1f234e3bdbac12b45715
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / vbpca_py-0.4.0-cp311-cp311-win_amd64.whl
| Download URL | vbpca_py-0.4.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 748.6 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1336140819c094e16201f37c7ee09d2753a2ee3c4e037cc4c8ca3d6ff2b755b9
|
|
BLAKE2b-256 checksum How to use checksums |
4e7faec0e0d8643d4d9e0ab9fefb72618150af6cd7536b4300470f2a364df59f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / vbpca_py-0.4.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | vbpca_py-0.4.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.6 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9a87da0c6d2019479b13929547bb5c9d9ce9320630e5ed7cab193e8fe5cdf52e
|
|
BLAKE2b-256 checksum How to use checksums |
bd78d8e9875f8c106c2fcd724613302aaff2527972a325bb05bc75995af36e41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / vbpca_py-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | vbpca_py-0.4.0-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 768.0 kB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
bd84456bd48cbc2c162733e1b90c86fbfd6285b4d73a667ab55e2087e2021ad3
|
|
BLAKE2b-256 checksum How to use checksums |
e176cca045bd4c19b8d238aee3c0ac7ac9704bd50a90e4cc93ec921de3f4f1d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log