I try to use Kalman filtering for my one dimensional data. So, assume that I have the following dataset:
Variable
250.1
248.5
262.3
265.3
270.2
I do know that there is a noise in my data and hence, I want to clean this data by using Kalman filtering. Which way can produce the most efficient result for me?
I run the following code:
from pykalman import KalmanFilter
import numpy as np
kf = KalmanFilter(transition_matrices = [[1, 1], [0, 1]],
observation_matrices = [[0.1, 0.5], [-0.3, 0.0]])
measurements = np.asarray([(250.1),(248.5),(262.3),(265.3), (270.2)])
kf = kf.em(measurements, n_iter=5)
(filtered_state_means, filtered_state_covariances)=kf.filter(measurements)
(smoothed_state_means, smoothed_state_covariances)=kf.smooth(measurements)
As you can see, I try to use pykalman, however I cannot install this module. I try to use easy_install pykalman direction, and the error is invalid syntax. Another problem is, I have a huge data set, so I have more than one hundred thousand rows in my variable column. So, I cannot write all observations one by one.