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.2.0.tar.gz (176.9 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.2.0-cp313-cp313-win_amd64.whl (279.8 kB view details)

Uploaded CPython 3.13Windows x86-64

rustypca-0.2.0-cp313-cp313-manylinux_2_35_x86_64.whl (424.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.35+ x86-64

rustypca-0.2.0-cp313-cp313-macosx_11_0_arm64.whl (363.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rustypca-0.2.0-cp312-cp312-win_amd64.whl (279.8 kB view details)

Uploaded CPython 3.12Windows x86-64

rustypca-0.2.0-cp312-cp312-manylinux_2_35_x86_64.whl (424.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

rustypca-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (363.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rustypca-0.2.0-cp311-cp311-win_amd64.whl (279.5 kB view details)

Uploaded CPython 3.11Windows x86-64

rustypca-0.2.0-cp311-cp311-manylinux_2_35_x86_64.whl (425.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

rustypca-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (366.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rustypca-0.2.0-cp310-cp310-win_amd64.whl (279.7 kB view details)

Uploaded CPython 3.10Windows x86-64

rustypca-0.2.0-cp310-cp310-manylinux_2_35_x86_64.whl (425.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

rustypca-0.2.0-cp310-cp310-macosx_11_0_arm64.whl (367.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for rustypca-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fd162fb9ef9827840be138114be59f55e2a9f1430f0b22e3bb91ab77641d5b3a
MD5 1c4c4ff300a886d2b46c4182fdfd5cd3
BLAKE2b-256 f8b3df80a9bcc9c7fa14beb67a1871da9913da5a5523b5866fa8405745b0a06a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0.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.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rustypca-0.2.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 279.8 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.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 cd711e6a6e761c803f994c11170737f2f40df236a12b0fd1acd7e76d97e1fb51
MD5 c51a47062ea77ee0ae15f17be6613d37
BLAKE2b-256 3ac76ad4e1f9d0e8dfe123c0aefda709cf360fc02aecea8a02a43cc4c2640a6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp313-cp313-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for rustypca-0.2.0-cp313-cp313-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 d95553284a5708baea10ceba09ff4248454b936ab11365b71788a171d8012a1c
MD5 19b0c7181011a525cc7397a94937a975
BLAKE2b-256 9c3ec119e183ac91a064a6f634733e992719e6f8ffd35403bdc8dfe79c758fe5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypca-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ebf73b5959508013dafd10254a2d910f7b8f57ed9333b26ee7de49ffe48d4d83
MD5 602338a87fc2e17c1c45152d59d3a461
BLAKE2b-256 4f1157d2169df527f18cae8ceb855c8b96f2cccf1fcfe8013d74d2f88a31ac17

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rustypca-0.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 279.8 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.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 436c31ed6fdf2f4139b93b5402d0ba63e35c01bb335d809cdc6844794117ce4b
MD5 40b5db31ab15945579a64c4acc28db86
BLAKE2b-256 a1489e0fe397641152aa627ac271d201a78846ede2cf88d9a952b0c6c8b2d553

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for rustypca-0.2.0-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 8414397932a6f27b8c5a9b3c9371106cbe961f6c7378b515604681d1eaa41b97
MD5 8af2959b9d42d80fa822a18359f6d400
BLAKE2b-256 7673c999f19269cb59191d4d3b25bb455d2aaa0db19cf4f4bcc7c4d0f5c156c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypca-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5bede10768b933996a0e19d9714aae9005debebd28e2c840bc76e8dc268a7a95
MD5 073b0c2515cf4d0fee27c9318da87efc
BLAKE2b-256 fd9d4613cefde6d908e695678930ad5bb7cde5a44a2837cc7f275cf6ade69800

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: rustypca-0.2.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 279.5 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.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 6400cd3c44fff15800efb97defd11c2e6dc44192b15a9f171eadcbd904b2aaa7
MD5 5d99f546d7d19bb1bb3b072fbdb2c300
BLAKE2b-256 04de358b636a4eddcc474adad5f3f9a16352ff12b02152e22f1684a0d8fdfd7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for rustypca-0.2.0-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 a0cce6ba4137bc6f883966bc5a33e984ba82baed8aaa0055333b0ded0ad98cca
MD5 f48c06e2281e3b3df1fc3213b4d377c3
BLAKE2b-256 a70cd4363dd30271ff4f412cb06d8373a7d4b988fa48e00f563ac644e1e80d0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypca-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6718bb1c8715c663274458b9b20fe62a99c6e211264bd98d64969b06b5dfca93
MD5 49b13cadd607469a17eed3d800a9520f
BLAKE2b-256 23a84ff6ab79f99adb1f924e4d5a395f3b853ce7e808ebfbd2169a06c3119b0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: rustypca-0.2.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 279.7 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.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b0dbdb8034de3a0004098a4d0538352f9648c9ee3180e5b159518c1a49a84f7e
MD5 2ae81a49687b301474d2b6c4de98dffb
BLAKE2b-256 50af466ea11c519bfa6424673d8e7fb9e1114e4826b535146e906546f8b03106

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for rustypca-0.2.0-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 061599859804969ad74c8207a30a35ac3e6c8413cfa2178b8e2b324507515e8f
MD5 0a1a92a2ad8fe4eb6cef9f450f0704b1
BLAKE2b-256 35db540eee90dada29fef24cdfc4d189e4a3ed40cf1535222a849134675a50e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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.2.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustypca-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 73bd8179a0492a05e67e73d4a582a478c323304d12bc761d0768023ce6c639d0
MD5 c62d9f455142c228d0ce945424e95881
BLAKE2b-256 898d4534b658c4dfd594a48c8bebc8a1e73eb11bef5c309e641a83a41ca8cea8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustypca-0.2.0-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