Skip to main content

Probabilistic PCA with missing value support using Rust and PyO3

Project description

rustypca

A Python library for Probabilistic PCA that handles missing data without asking you to impute first. It uses the EM algorithm under the hood, with the number-crunching done in Rust.

Why?

Regular PCA doesn't cope well when your data has holes in it. Probabilistic PCA treats missing values as latent variables in a generative model — a more principled approach than patching NaNs and hoping for the best.

For the full story, see Tipping & Bishop (1999), "Probabilistic Principal Component Analysis", Journal of the Royal Statistical Society, 61(3), 611–622.

Features

  • Rust backend — keeps things snappy on larger datasets
  • Missing value support — the main reason this exists
  • Scikit-learn compatible — fits in wherever you'd use sklearn.decomposition.PCA

Installation

pip install rustypca

You'll need a Rust toolchain to build from source. Python >= 3.10.

Quick start

import numpy as np
from rustypca import PPCA

X = np.random.randn(100, 10)
X[np.random.rand(100, 10) < 0.1] = np.nan  # Introduce some missing values

model = PPCA(n_components=2)
X_transformed = model.fit_transform(X)
X_reconstructed = model.inverse_transform(X_transformed)

No preprocessing or imputation needed.

Testing

make test

Disclaimer

This project was built with the help of Claude.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rustypca-0.1.1.tar.gz (174.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rustypca-0.1.1-cp313-cp313-win_amd64.whl (278.9 kB view details)

Uploaded CPython 3.13Windows x86-64

rustypca-0.1.1-cp313-cp313-manylinux_2_35_x86_64.whl (423.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ x86-64

rustypca-0.1.1-cp313-cp313-macosx_11_0_arm64.whl (362.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rustypca-0.1.1-cp312-cp312-win_amd64.whl (278.9 kB view details)

Uploaded CPython 3.12Windows x86-64

rustypca-0.1.1-cp312-cp312-manylinux_2_35_x86_64.whl (424.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

rustypca-0.1.1-cp312-cp312-macosx_11_0_arm64.whl (362.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rustypca-0.1.1-cp311-cp311-win_amd64.whl (278.6 kB view details)

Uploaded CPython 3.11Windows x86-64

rustypca-0.1.1-cp311-cp311-manylinux_2_35_x86_64.whl (424.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

rustypca-0.1.1-cp311-cp311-macosx_11_0_arm64.whl (365.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rustypca-0.1.1-cp310-cp310-win_amd64.whl (278.8 kB view details)

Uploaded CPython 3.10Windows x86-64

rustypca-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl (424.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

rustypca-0.1.1-cp310-cp310-macosx_11_0_arm64.whl (366.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file rustypca-0.1.1.tar.gz.

File metadata

  • Download URL: rustypca-0.1.1.tar.gz
  • Upload date:
  • Size: 174.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for rustypca-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d84a1721c2b0a4c03bb25ad9d0569cad95a1a7b5a578ae10bf1acb68c1d45d01
MD5 4a800f4c464537b825febaa66c4b2f2a
BLAKE2b-256 bf7085bff1b2f949025076181c586adb3b2f5c65a5c319c1203c6bf895d75238

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1.tar.gz:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rustypca-0.1.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 278.9 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for rustypca-0.1.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 e1ed3ba0994f515cc2067c65d42329627b62273020a5d6e16b9adb6bc5de49b5
MD5 cc6da9dab66a25ec28210c332f6579a2
BLAKE2b-256 f56cb351b7b5bc60f8ebf3be62d4504dace73850d1ddc9c55c360a01cfa9aa0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp313-cp313-win_amd64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp313-cp313-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for rustypca-0.1.1-cp313-cp313-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 bcf38e5736279f2efb199dfedd756bbe4b0bcd124721f48f7a4dbd9454652390
MD5 bbc2a34ecd5137406fb3ebfbc910f9bb
BLAKE2b-256 f1710b6974fb9d47be83a07f4fd28060b7d2a038fd0a1b34a4d5be6e5e7d7007

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp313-cp313-manylinux_2_35_x86_64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypca-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f444d8a121932e93250aa7fea989e43dac31589c2984d5f1c40b1a4c37620f17
MD5 724c69270cd399628aed27af1ae916b0
BLAKE2b-256 2ad42e7cd0381a873ae092ef74ca6fb914843ad18f0a3211f69bb3728bbc83f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rustypca-0.1.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 278.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for rustypca-0.1.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9b4837b5e392b7b63e3eb375376a18f98b095cd48f82628d8b6ae5ad248c82b0
MD5 1edf32b3dc499442835dc551be0cc7cb
BLAKE2b-256 4f231e84b6f5667e316d53b05e65a2749111ae4c2cb529cd5e74d503574d9c2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp312-cp312-win_amd64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for rustypca-0.1.1-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 ec9d7d00af13cb8f00d53e655968b2dd5a9831c99224519fd6bd9f24fe8e5264
MD5 933a9aa6a17b9635557d6d3939fc1af4
BLAKE2b-256 811f162650a01ef521e89bc540957b8371c7f5c52907d3d031094c45cfc88ccb

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp312-cp312-manylinux_2_35_x86_64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypca-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9bb7cc2a6feac3a05cd1c380fdc2d13d85e0a2f1b7b1762ce12ba0db864b1093
MD5 467441258d174f57d8f1d8ef0ade949b
BLAKE2b-256 ee814a97817d63d15d4c032311926facdc8c1412744246721dd356d0af1567cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: rustypca-0.1.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 278.6 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for rustypca-0.1.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e6019a990727cd47eb8926a726b8c03658cbf9b427532b92878116bb8b3af43a
MD5 92a172f47435ace77b55d7e3d49bb1cc
BLAKE2b-256 a1ea81669de6e9b59b67624ade2412d0399fad5ab6ae580513ef46737bf74af9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp311-cp311-win_amd64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for rustypca-0.1.1-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 37c88bc27e75ae5cd88cc1eab9430aa74988c955700c8066f15dbbbdafe35cda
MD5 0436efd76e43bb0586e5bda6b4f9c73a
BLAKE2b-256 b5e7c2fb4475739f0233ee4317e50ab75432d0d53bb299612a5d5ccf02677124

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp311-cp311-manylinux_2_35_x86_64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypca-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5878f0d2aa7a7c63c0dfffb14415102c8bff8b72f9d5cbbdc27e68463a348596
MD5 5ab36cbb53326aa14faa8796cc35e41c
BLAKE2b-256 4bfeea1b96301413eb86cba0c57e2b56ee3afa81bda67fb1cfb1d92056e21b5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: rustypca-0.1.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 278.8 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for rustypca-0.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 0097af5e01c7564917bac151e64b655a6793bb7eefbe3a8d47f9e13f3e097175
MD5 a0d55a2c390c124e4d040df220ada406
BLAKE2b-256 72ff1621701f368e22e0110a82f0da424281eb6ca4a7a5d0c0d4e1e1b8c0e871

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp310-cp310-win_amd64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for rustypca-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 6d6ef49644dadc33b73ade4eba7b781fc22d373073d9a47cd566381e91d99237
MD5 42208b52cb66d0df3a6a3200ce9540f3
BLAKE2b-256 c218881d2605ee1cc67e38ae82fb1df2e655498d65b0475736d255c830ecf6d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp310-cp310-manylinux_2_35_x86_64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustypca-0.1.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypca-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 47a7e5b40538377a20c8bc228000fa31a1df160d5cb7875e2465793a3c9ac7b1
MD5 ead797bfe1461b9d5ae7b7e9d4e2166b
BLAKE2b-256 56f5d4df2bd2b7ceb00d23bc417b548132aed4a782300268dfa9bf49123f84fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.1.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on tingiskhan/rustypca

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page