https://github.com/mloning/rocket-rs
Rust implementation of ROCKET time-series transform with Python bindings
https://github.com/mloning/rocket-rs
python rust time-series
Last synced: about 2 months ago
JSON representation
Rust implementation of ROCKET time-series transform with Python bindings
- Host: GitHub
- URL: https://github.com/mloning/rocket-rs
- Owner: mloning
- Created: 2024-03-21T20:48:03.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-25T13:30:18.000Z (over 1 year ago)
- Last Synced: 2025-07-20T12:36:25.425Z (12 months ago)
- Topics: python, rust, time-series
- Language: Python
- Homepage:
- Size: 94.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rust implementation of ROCKET time-series transform with Python bindings
This repo implements the [ROCKET] time-series transform in Rust with Python bindings. Originally, ROCKET is implemented in Python.
[ROCKET]: https://github.com/angus924/rocket
## Usage
Using the [arrow-head dataset] provided by [aeon]:
```python
from aeon.datasets import load_arrow_head
from rocket_rs import transform
x, _ = load_arrow_head(split="train")
z = transform(x)
```
[arrow-head dataset]: https://timeseriesclassification.com/description.php?Dataset=ArrowHead
[aeon]: https://github.com/aeon-toolkit/aeon
## Contributing
### Initial setup
- Install Python, e.g. using [miniforge](https://github.com/conda-forge/miniforge)
- Install [Rust](https://www.rust-lang.org/tools/install)
- Install [maturin](https://www.maturin.rs/)
- Create and activate Python virtual environment (e.g. `conda create -n rocket-rs python=3.11 && conda activate rocket-rs`)
- Run:
```bash
maturin develop --extras=dev
pre-commit install --install-hooks
python -m maturin_import_hook site install --args="--release"
```
### Development
- `maturin develop` to re-build and install the editable development version (`pip install --editable .`)
- `maturin build` to build the Rust package and Python wheel
- `pytest --benchmark-skip` to rebuild automatically using `maturin_import_hook` and run Python unit tests
- `pytest --benchmark-only` to run benchmarks using `maturin_import_hook`
### Todo
- [x] separate kernel parameter generation from computation
- [x] compare and test against Python implementation in [aeon]
- [x] refactor to pass random generator to functions
- [ ] use debugger
- [ ] benchmark & improve
### Notes
- For Python bindings for Rust, see https://github.com/PyO3/pyo3
- https://github.com/PyO3/maturin for packaging and publishing
- To use `poetry` with `maturin`, see https://github.com/PyO3/maturin/discussions/1246#discussioncomment-4047386
- For project layout using both Python and Rust, see https://www.maturin.rs/project_layout.html#mixed-rustpython-project, I preferred having separate folders for Rust and Python
- To generate GitHub Action, run `maturin generate-ci github`
- https://github.com/FL33TW00D/rustDTW
- https://github.com/PyO3/rust-numpy for integration between Python Numpy and Rust ndarray arrays
- https://www.aeon-toolkit.org/en/stable/examples/classification/classification.html
- https://github.com/projectsyn/reclass-rs and https://www.youtube.com/watch?v=N7GMHcX-WdA
- micro-benchmarking with https://github.com/bheisler/criterion.rs