Kalman Filter

class rackio_AI.preprocessing.KalmanFilter()

Class to filter data using kalman filter

Attributes

  • alpha: (float) (default=1.0)
  • beta: (float) (default=0.0): Uncertainty in measurement
  • f_value: (float)
set_init_value(self, value)

Set init value for the Kalman filter


Parameters

  • :param value: (float)

  • :return:

None


Snippet code

>>> import numpy as np
>>> from rackio_AI import RackioAI
>>> preprocessing = RackioAI.get('Preprocessing', _type="Preprocessing")
>>> kf = preprocessing.kalman_filter # Kalman filter definition
>>> variable_to_filter = np.ones((10,1)) + np.random.random((10,1))
>>> kf.set_init_value(variable_to_filter[0])
call(self, value)

Parameters

  • :param value: (float) value to filter :return:

See This example for a real example

>>> import numpy as np
>>> from rackio_AI import RackioAI
>>> preprocessing = RackioAI.get("Preprocessing", _type="Preprocessing")
>>> kf = preprocessing.kalman_filter # Kalman filter definition
>>> kf.alpha = 0.001
>>> kf.beta = 0.2
>>> variable_to_filter = np.ones((10,1)) + np.random.random((10,1))
>>> filtered_variable = np.array([kf(value) for value in variable_to_filter]) # Applying Kalman filter