I didn't have a good time series filter implementation in python, so I made it myself.
I implemented the following.
Specify the following matrices $ F, G, Q, H, R $ when creating an instance.
x_{n+1} = F x_n + G v_n, \hspace{1em} v_n \sim N(O,Q) \\
y_n = H x_n + w_n, \hspace{2em} w_n \sim N(O,R)
--Likelihood calculation --Filtering --Fixed section smoothing
When creating an instance, specify the state transition method ʻupdate, the log-likelihood calculation method
loglikelihood, and the state estimation method ʻestimate
.
x_{n+1} = F(x_n, v_n) \\
y_n = H(x_n) + w_n
--Likelihood calculation --Filtering --Fixed rug smoothing
See README for how to use ryskiwt/tsfilter: Time Series Filtering
--The state space model can be specified at the time of generation so that it can be used universally.
――Be careful about the speed as much as possible by allocating memory in advance and avoiding array copying.
――Instead, I eat a lot of memory
--Random sampling of particle filter is faster using Numba
――I compared it with Cython, but it didn't change so much, so I chose this one.
--The signal is output, but the state is not output, so improve it.
Recommended Posts