rlabbe / Kalman-and-Bayesian-Filters-in-Python

Kalman Filter book using Jupyter Notebook. Focuses on building intuition and experience, not formal proofs. Includes Kalman filters,extended Kalman filters, unscented Kalman filters, particle filters, and more. All exercises include solutions.
Other
16.45k stars 4.16k forks source link

Implementing Kalman filter that predict spikes ? #25

Closed vsraptor closed 9 years ago

vsraptor commented 9 years ago

hi,

Is it suitable to use Kalman filter for predicting spikes ? F.e. let say I monitor CPU usage where the values go from 0 to 100 ... will the Kalman filter be "agile" enough to detect and predict when the usage go above say 80% ... with say better tha 60-70% hit rate.

Or you would use some other technique.

rlabbe commented 9 years ago

The KF cannot predict future events in that way. You provide the KF with a process model - a set of differential equations that define the time-varying behavior of the system. It uses that model to help produce better estimates. (That set of differential equations are discretized in put in the F matrix of the discrete KFs that the book considers.)

With that said, the KF is able to make estimates on unobservables. To go back to Newtonian physics, if we measure position over time the KF can derive the velocity and accelerations from these measurements. To kind of tie this to your question - suppose we are tracking humans running. If there is a velocity spike I can infer that there will be a spike in their temperature, heart rate, and so on, even though I am not measuring temperature and heart rate. Perhaps something similar is possible in your use case; I don't know. I'm going to guess that there is nothing that you can monitor that will predict CPU usage (after all, how could you predict that the user presses a convolve button in Photoshop), but I guess it really depends on what you are trying to do. But it is incumbent on you, the designer, to figure out what your observed and unobserved variables are, and to provide the KF with an accurate process model.

vsraptor commented 9 years ago

So I have to come up with the model which will generate the prediction of spikes as the "u" argument in prediction() step and the Kalman filter does the rest of the "smoothing/converging". From what I read so far it seems the Kalman filter is not "forward-predicting" this is the task of the Model. thanks for the answer