oxits
A high-performance time series classification and transformation library for Rust, validated against pyts.
Features
Preprocessing
- StandardScaler — zero-mean, unit-variance normalization
- MinMaxScaler — scale to arbitrary range
- MaxAbsScaler — scale by maximum absolute value
- RobustScaler — median/IQR-based scaling
- KBinsDiscretizer — binning with normal, uniform, and quantile strategies
- PowerTransform — Box-Cox and Yeo-Johnson transforms
- QuantileTransform — uniform or normal output distribution
- Imputer — fill NaN values (nearest, previous, next, linear)
Approximation
- PAA — Piecewise Aggregate Approximation
- SAX — Symbolic Aggregate Approximation
- DFT — Discrete Fourier Transform coefficients
- SFA — Symbolic Fourier Approximation (DFT → MCB discretization, ANOVA feature selection)
Metrics
- DTW — Dynamic Time Warping (classic, Sakoe-Chiba band, Itakura parallelogram, multiscale, fast)
- Lower bounds — LB_Kim, LB_Keogh, LB_Improved, LB_Yi
- BOSS metric — histogram intersection distance
Image Transforms
- GASF — Gramian Angular Summation Field
- GADF — Gramian Angular Difference Field
- MTF — Markov Transition Field
- RecurrencePlot — recurrence plot with time-delay embedding
Decomposition
- SSA — Singular Spectrum Analysis with automatic trend/seasonal/residual grouping
Transformation
- BOSS — Bag of SFA Symbols
- ROCKET — Random Convolutional Kernel Transform
- BagOfPatterns — sliding-window SAX bag of words with TF-IDF
- ShapeletTransform — shapelet-based feature extraction
- WEASEL — Word ExtrAction for time SEries cLassification
Classification
- KNN — k-nearest neighbors with pluggable distance metrics
- BOSSVS — BOSS in Vector Space (TF-IDF cosine similarity)
- SAXVSM — SAX-VSM classifier
- TimeSeriesForest — interval-based random forest
- TSBF — Time Series Bag of Features
- LearningShapelets — gradient-descent shapelet learning
Multivariate
- JointRecurrencePlot — joint recurrence plots for multivariate time series
- Multivariate wrapper — apply univariate transforms/classifiers per channel
Datasets
- UCR Archive — fetch datasets from the UCR Time Series Archive
- Synthetic generators — Cylinder-Bell-Funnel (CBF) dataset
- Built-in — GunPoint, Coffee synthetic datasets
Infrastructure
- Parallel computation — feature-gated Rayon parallelism across all modules
- Core traits —
Transformer,FittableTransformer,Classifier,DistanceMetric - SIMD autovectorization — AVX2 on x86-64 via
target-cpu=native
Performance
See PERFORMANCE.md for detailed benchmark tables against pyts across all algorithms.
Benchmarked on Intel i9-13900H (P25 of 51 runs, 5 warmup):
| Algorithm | Speedup | Algorithm | Speedup | |
|---|---|---|---|---|
| StandardScaler | 12.3x | GASF | 3.1x | |
| MinMaxScaler | 7.0x | MTF | 6.0x | |
| KBinsDiscretizer | 10.7x | RecurrencePlot | 3.7x | |
| SAX | 7.9x | SSA | 10.5x | |
| DFT | 7.4x | BOSS | 2.9x | |
| DTW fast | 34.4x | ROCKET | 10.4x | |
| KNN | 16.8x | ShapeletTransform | 131.2x | |
| BOSSVS | 3.3x | TimeSeriesForest | 4.8x | |
| Geometric mean | 5.0x | Median | 3.7x |
Installation
Add to your Cargo.toml:
[]
= "0.1"
Quick Start
Stateless Transform (StandardScaler)
use ;
use Transformer;
let config = new;
let x = vec!;
let scaled = transform;
Stateful Transform (SFA)
use ;
use FittableTransformer;
let config = SfaConfig ;
let x = vec!;
let fitted = fit;
let result = transform;
Classification (BOSSVS)
use ;
let config = new;
let x_train = vec!;
let y_train = vec!;
let fitted = fit;
let predictions = predict;
Distance Metrics (DTW)
use dtw_classic;
let a = vec!;
let b = vec!;
let distance = dtw_classic;
Image Transform (GASF)
use ;
use ;
let config = GafConfig ;
let x = vec!;
let images = transform;
// images[0] is a 5x5 Gramian Angular Summation Field
Cargo Features
| Feature | Default | Description |
|---|---|---|
parallel |
yes | Parallel computation via Rayon |
decomposition |
no | SSA with nalgebra SVD |
datasets |
no | UCR Archive fetching via ureq |
validation |
no | Golden data tests via serde |
# Default (parallel)
# All features
# No parallelism
Building
For best performance, ensure .cargo/config.toml targets your CPU:
[]
= ["-C", "target-cpu=native"]
Validation
All modules are validated against pyts via golden integration tests. Each test loads reference data generated by pyts and compares output at epsilon < 1e-6:
To regenerate golden data:
Dependencies
- realfft — FFT for DFT, SFA, and SSA periodograms
- rayon — parallel computation (optional)
- rand / rand_distr — random kernels for ROCKET
- nalgebra — SVD for SSA decomposition (optional)
- ureq — HTTP client for UCR Archive (optional)
License
MIT License — see LICENSE.