GPU-optimised PyTorch implementation of HYDRA (HYbrid Dictionary-Rocket Architecture) for fast and accurate time-series classification.
- GPU-accelerated feature extraction for multivariate time series.
- SparseScaler: sparsity-aware feature scaling for both PyTorch and NumPy.
- Scikit-learn compatible API.
- Competitive convolutional kernels with configurable number of dilations to control number of features to extract.
uv add git+https://github.com/nimanzik/fast-hydra.gitimport torch
from fast_hydra import HydraMultivariate, SparseScaler
input_size = 1000 # Length of time series
n_channels = 6 # Number of channels in multivariate time series
batch_size = 32 # Number of samples in a batch
# Extract features from multivariate time series
hydra = HydraMultivariate(
input_size=input_size,
n_channels=n_channels,
n_groups=64,
n_kernels=8,
random_state=42,
)
X = torch.randn(batch_size, n_channels, input_size)
features = hydra(X) # Tensor of shape (batch_size, n_features)
# Scale sparse features
scaler = SparseScaler()
scaled_features = scaler.fit_transform(features)- Numpy >= 2.3.4
- scikit-learn >= 1.7.2
- PyTorch >= 2.9.0
Dempster, A., Schmidt, D. F., & Webb, G. I. (2023). Hydra: Competing convolutional kernels for fast and accurate time series classification. Data Mining and Knowledge Discovery, 37(5), 1779-1805.
This project is licensed under the MIT License. See the LICENSE file for details.