KalmanFormer
Implementation of KalmanFormer.
The paper proposes learning the Kalman Gain directly from data using Transformers, bypassing the limitations of traditional Kalman Filters on non-linear systems.
Install
$ pip install kalmanformer
Usage
import torch
from kalmanformer import KalmanFormer
# kalmanformer
kalmanformer = KalmanFormer(
state_dim = 3,
obs_dim = 3,
dim = 64,
depth = 2,
heads = 2,
dim_head = 32,
mlp_dim = 64
)
# mock observations
observations = torch.randn(2, 10, 3)
# state transition matrix f and observation matrix h
F = torch.randn(3, 3)
H = torch.randn(3, 3)
# initial state
x_0 = torch.zeros(2, 3)
# tracking over sequence
post_states = kalmanformer(
observations,
F,
H,
x_0 = x_0
)
assert post_states.shape == (2, 10, 3)
Citations
@article{Shen2025KalmanFormer,
title = {KalmanFormer: using transformer to model the Kalman Gain in Kalman Filters},
author = {Siyuan Shen and Jichen Chen and Guanfeng Yu and Zhengjun Zhai and Pujie Han},
journal = {Frontiers in Neurorobotics},
year = {2025},
volume = {18},
doi = {10.3389/fnbot.2024.1460255}
}
Metadata
Release files for kalmanformer 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kalmanformer-0.0.12.tar.gz | 7.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kalmanformer-0.0.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / kalmanformer-0.0.12.tar.gz
| Download URL | kalmanformer-0.0.12.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27477f98e170dea3c33f7c5c39b46470fb927b6af1c9ba9a4d2785a90cf2f998
|
|
BLAKE2b-256 checksum How to use checksums |
481a79aba374eca4d8217f15efb1ac8369463ea9ff7224d16a6ac4784f00570d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.17
|
Release files / kalmanformer-0.0.12-py3-none-any.whl
| Download URL | kalmanformer-0.0.12-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8565a6b24ec2964c90e57cdbc5c9a4525ed09eb9dcd95644ddb57363ff0ba55e
|
|
BLAKE2b-256 checksum How to use checksums |
6f9892dbe53a4f06ba5142aa3fb5f8c0c4f765813d5d173e9dabb49feb729055
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.17
|