Skip to main content

VBPCApy

License: MIT Python 3.11+ Code style: ruff DOI Docs

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, genomics dosage data, and 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_components and cross_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 calibrated predictive_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.3},
}
@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.

Metadata

Release files for vbpca-py 0.4.3

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

Source distribution (sdist)

Source distribution for vbpca-py 0.4.3
File Size Uploaded
vbpca_py-0.4.3.tar.gz 264.1 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for vbpca-py 0.4.3
File
vbpca_py-0.4.3-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
vbpca_py-0.4.3-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.3-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
vbpca_py-0.4.3-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
vbpca_py-0.4.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
vbpca_py-0.4.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
vbpca_py-0.4.3-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
vbpca_py-0.4.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
vbpca_py-0.4.3-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 40.9 MB

Release files / vbpca_py-0.4.3.tar.gz

Download URL vbpca_py-0.4.3.tar.gz
Size 264.1 kB
Tags Source
SHA-256 checksum
How to use checksums
af2bd195ce58f3271bf2c49d8cb932e9976cefe543b3bce5649ef154b822aada
BLAKE2b-256 checksum
How to use checksums
31368488cfcf2c9204a9379856bc0fe7d7d5d1c93494e1c1442e02f0ef3788ac
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 28, 2026.

Transparency log

Release files / vbpca_py-0.4.3-cp313-cp313-win_amd64.whl

Download URL vbpca_py-0.4.3-cp313-cp313-win_amd64.whl
Size 786.8 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
93acddf573d92d7fddd1761b79cc97745a187483eecad6d09cc2c40db59bfb2d
BLAKE2b-256 checksum
How to use checksums
1b46e55749df378e7da77280b6aa22a1e9cf9de18aa57292923ff00b45a63d43
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 28, 2026.

Transparency log

Release files / vbpca_py-0.4.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL vbpca_py-0.4.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 12.0 MB
Tags CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
648e0d304f08cdc91d033ad45040797b50958533326697e7ebfef719bd9934b9
BLAKE2b-256 checksum
How to use checksums
bc870fecb2945df649e4429170d3045162380df11b910ff79bac2ec5a0f1783a
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 28, 2026.

Transparency log

Release files / vbpca_py-0.4.3-cp313-cp313-macosx_11_0_arm64.whl

Download URL vbpca_py-0.4.3-cp313-cp313-macosx_11_0_arm64.whl
Size 808.1 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b7c24e8b0e969bf55934e79551e662b6c124d40371f73b336a408b0b9cca1849
BLAKE2b-256 checksum
How to use checksums
9ed24ddcc66deece1431cfb0b10cb093f3cfc1e077ee80aec0666a9a5ef60f0e
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 28, 2026.

Transparency log

Release files / vbpca_py-0.4.3-cp312-cp312-win_amd64.whl

Download URL vbpca_py-0.4.3-cp312-cp312-win_amd64.whl
Size 786.5 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
5ad46292cb2c195b77009805302e03c52ff541bda5ca72df5d86f9624b177e99
BLAKE2b-256 checksum
How to use checksums
b9673c297b695faad0e7992997d3384e32c3ad83f301403024d4b07b3e636436
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 28, 2026.

Transparency log

Release files / vbpca_py-0.4.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL vbpca_py-0.4.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 12.0 MB
Tags CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
3cf16af91a0581811d2d528ddfc205c7d5a87bbe4e6b4311d10a1239c2484695
BLAKE2b-256 checksum
How to use checksums
50764f9efa82fb64f76e820956f0c0cae63aae82f7393d0271ad6132355f4c21
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 28, 2026.

Transparency log

Release files / vbpca_py-0.4.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL vbpca_py-0.4.3-cp312-cp312-macosx_11_0_arm64.whl
Size 807.7 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
487aea7174c58018df04abccefeaf850966f6606a92b554edc79c7079f6ec729
BLAKE2b-256 checksum
How to use checksums
2e8c382c2d48572f60cf36f032f458f8442e7b5b646f9cfaf11d0ccfe229e749
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 28, 2026.

Transparency log

Release files / vbpca_py-0.4.3-cp311-cp311-win_amd64.whl

Download URL vbpca_py-0.4.3-cp311-cp311-win_amd64.whl
Size 770.6 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
1f7acce5e6b884aee9e932dc9090c7a52512a6c573b8450880d5696bc453d8ee
BLAKE2b-256 checksum
How to use checksums
65f62dad444d0b612c54e24b56af370943365738fd88fb391a313e50c21d039f
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 28, 2026.

Transparency log

Release files / vbpca_py-0.4.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL vbpca_py-0.4.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 11.9 MB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8991ef815589c0db489aad6e0de6394930616fafbf064660b02d8977ba892729
BLAKE2b-256 checksum
How to use checksums
053717df6f55a868511a466b0a72f45586f3fbdcbe42bd4937a6449f2cef3dcc
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 28, 2026.

Transparency log

Release files / vbpca_py-0.4.3-cp311-cp311-macosx_11_0_arm64.whl

Download URL vbpca_py-0.4.3-cp311-cp311-macosx_11_0_arm64.whl
Size 791.5 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4bda3986b162a38e8ce8d6619ec0a32d7950460a95f0f3bc46d3de47f9de07f0
BLAKE2b-256 checksum
How to use checksums
bb1f209080c0ff1e4c2cf97bf5a9c6ba7b01abe37828b13b60b2bae23a48c89d
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 28, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.6

13 release files

This release

0.4.3 This release

10 release files

0.4.2

10 release files

0.4.0

10 release files

0.3.0

10 release files

0.2.0

10 release files

0.1.1

10 release files

0.1.0

10 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