This project implements a PPCA model implemented in Rust for Python using pyO3
and maturin
.
This package is available in PyPI!
bash
pip install ppca-rs
And you can also use it natively in Rust:
bash
cargo add ppca
Glad you asked!
ppca-rs
?That's an easy one!
rayon
to paralellize computations evenly across as many CPUs as you have.```python import numpy as np from ppca_rs import Dataset, PPCATrainer, PPCA
samples: np.ndarray
inf
s and nan
) to signal masked valuesdataset = Dataset(samples)
model: PPCAModel = PPCATrainer(dataset).train(statesize=10, niters=10)
extrapolated: Dataset = model.extrapolate(dataset)
extrapolated: Dataset = model.filter_extrapolate(dataset)
eextrapolated_np = extrapolated.numpy()
```
pandas
or polars
. Never juggle those df
s in your code again.You will need Rust, which can be installed locally (i.e., without sudo
) and you will also need maturin
, which can be installed by
bash
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.
Check the Makefile
for the available commands (or just type make
). To install it locally, do
bash
make install # optional: i=python.version (e.g, `i=3.9`)
To mess around, inside a virtual environment (a Pipfile
is provided for the pipenv
lovers), do
bash
maturin develop # use the flag --release to unlock superspeed!
This will install the package locally as is from source.
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.
You bet!