# I made a package to filter time series with python

## Introduction

I didn't have a good time series filter implementation in python, so I made it myself.

## Implemented

I implemented the following.

### Kalman filter

Specify the following matrices $F, G, Q, H, R$ when creating an instance.

#### State space representation

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)


#### What you can do

--Likelihood calculation --Filtering --Fixed section smoothing

### Particle filter

When creating an instance, specify the state transition method ʻupdate, the log-likelihood calculation method loglikelihood, and the state estimation method ʻestimate.

#### State space representation

x_{n+1} = F(x_n, v_n) \\
y_n = H(x_n) + w_n


#### What you can do

--Likelihood calculation --Filtering --Fixed rug smoothing

## Repository

See README for how to use ryskiwt/tsfilter: Time Series Filtering

## Ingenuity

--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.

## from now on

--The signal is output, but the state is not output, so improve it.