Python+Rust implementation of the Probabilistic Principal Component Analysis model
Reason this release was yanked:
PPCATrainer calls inexistent methods
Project description
Probabilistic Principal Component Analysis model
This project implements a PPCA model implemented in Rust for Python using pyO3
and maturin
.
Installing
PyPI package comming soon:
pip install ppca_rs # hopefully!
Quick example
import numpy as np
from ppca_rs import Dataset, PPCATrainer, PPCA
samples: np.ndarray
# Create your dataset from a rank 2 np.ndarray, where each line is a sample.
# Use non-finite values (`inf`s and `nan`) to signal masked values
dataset = Dataset(samples)
# Train the model:
model: PPCAModel = PPCATrainer(dataset).train(state_size=10, n_iters=10)
# And now, let's have fun!
# Extrapolates the missing values with the most probable values:
model.extrapolate(dataset)
# Smooths (removes noise from) samples and fills in missing values:
model.filter_extrapolate(dataset)
Building from soure
Prerequisites
You will need Rust, which can be installed locally (i.e., without sudo
) and you will also need maturin
, which can be installed by
pip install maturin
pipenv
is also a good idea if you are going to mess around with it locally. At least, you need a venv
set, otherwise, maturin
will complain with you.
Installing it locally
Check the Makefile
for the available commands (or just type make
). To install it locally, do
make install # optional: i=python.version (e.g, `i=3.9`)
Messing around and testing
To mess around, inside a virtual environment (a Pipfile
is provided for the pipenv
lovers), do
maturin develop # use the flag --release to unlock superspeed!
This will install the package locally as is from source.
How do I use this stuff?
See the examples in the examples
folder. Also, all functions are type hinted and commented. If you are using pylance
or mypy
, it should be easy to navigate.
Is it faster than the pure Python implemetation you made?
You bet!
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
File details
Details for the file ppca_rs-0.1.0.tar.gz
.
File metadata
- Download URL: ppca_rs-0.1.0.tar.gz
- Upload date:
- Size: 20.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.14.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5a4e7909602cf25f5a499d4260809d4d54c8c7e751c4ec4c7d3023e8261c648 |
|
MD5 | 23829dc604ec23390348185b9ae6c882 |
|
BLAKE2b-256 | 08a13990ad7d8919ac777c1b75c63902d7949a2e9dfc381e95dc58dcbf2d592b |
File details
Details for the file ppca_rs-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: ppca_rs-0.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 400.8 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/0.14.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f4f46897c8d288c04697f215b64e0ea9441fef384151ee2f56e4308d33752fb |
|
MD5 | ad7281f504429f93d49b68e4db13a482 |
|
BLAKE2b-256 | 683fe2537df5d5eb155a54c6fda1d75465b173f44a6d75adb7ab77d4a7beb9ef |