Registry / ai-ml / simdkalman

simdkalman

JSON →
library1.0.4pypypi✓ verified 83d ago

simdkalman provides Kalman filters vectorized as Single Instruction, Multiple Data, enabling efficient processing of multiple independent time series simultaneously. It is designed for performance when dealing with large numbers of parallel Kalman filter estimations. The library is actively maintained and currently at version 1.0.4, with a stable release cadence focused on performance and bug fixes.

pip install simdkalman
INSTALL
IMPORT
SIG · SIMDKALMAN
S
simdkalman
ai-mlpythonv1.0.4
Install
3.5s avg
Import
259ms
Disk
89MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.249s · 89.4MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.5s · import 0.269s · 86MB
89MB installed
● package 89MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

KalmanFilter
from simdkalman import KalmanFilter
import simdkalman

This quickstart demonstrates how to create a `KalmanFilter` instance and use it to smooth a batch of time series data. It generates synthetic 1D random walk data for multiple series, then applies a simple Kalman filter model. Crucially, input observations are reshaped to the expected `(n_series, n_timesteps, n_features)` format.

import numpy as np import simdkalman # Generate some synthetic data for 3 series, 50 time steps each n_series = 3 n_timesteps = 50 rand = np.random.RandomState(0) true_states = np.cumsum(rand.normal(0, 0.1, size=(n_series, n_timesteps)), axis=1) observations = true_states + rand.normal(0, 1, size=(n_series, n_timesteps)) # Initialize a Kalman Filter # Simple 1-D random walk model: # state_transition = [[1]] (state at t is state at t-1) # process_noise = [[0.1]] (noise in state transition) # observation_model = [[1]] (observation is directly the state) # observation_noise = [[1.0]] (noise in observation) kf = simdkalman.KalmanFilter( state_transition = np.array([[1]]), # 1D state, previous state is current state process_noise = np.diag([0.1]), # Variance of 0.1 for state evolution observation_model = np.array([[1]]), # Observation is the state itself observation_noise = np.diag([1.0]) # Observation noise variance of 1.0 ) # Smooth the observations # `observations` needs to be 3D: (n_series, n_timesteps, n_features) # Here n_features is 1 for 1D data. smoothed_states = kf.smooth(observations[:, :, np.newaxis]).states.mean print(f"Smoothed states shape: {smoothed_states.shape}") # Expected: (n_series, n_timesteps, 1) # You can also predict new values predicted_states = kf.predict(observations[:, :, np.newaxis], n_test=10).states.mean print(f"Predicted states shape: {predicted_states.shape}")
Debug
Known issues
gotchaVersions prior to 1.0.2 contained a bug where shape checks for updates with varying or vectorized H-matrices were incorrect, potentially leading to wrong results without explicit errors for affected use cases.
fix
Update to simdkalman version 1.0.2 or newer to ensure correct handling of vectorized observation models. Review code that uses varying H-matrices.
affects: <1.0.2
gotchaVersions prior to 1.0.4 might consume significantly more memory, especially when processing very large datasets or many parallel time series, due to less optimized internal data structures.
fix
Upgrade to simdkalman 1.0.4 or higher to benefit from memory usage reductions. If using older versions and encountering OOM errors, consider processing data in smaller batches if feasible.
affects: <1.0.4
gotchasimdkalman is designed for vectorized (simultaneous) Kalman filter operations on multiple time series. While it can be used for a single series, it might be less performant or efficient than single-series-optimized Kalman filter implementations or simpler statistical methods for very small datasets.
fix
Ensure you are leveraging the library's vectorized capabilities by passing data for multiple series. For single series or very small datasets, consider if a different library or approach might be more suitable.
affects: all
Upgrade
Version history
1.0.4latest on PyPI · released Dec 16, 2023
Audit
Dependencies
numpyrequiredCore dependency for numerical operations and array manipulation.
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
simdkalman — pip install simdkalman · libregistry