(no title)
chubs | 1 year ago
function transpose(a) { return a } // 1x1 matrix eg a single value.
function invert(a) { return 1/a }
const qExternalNoiseVariance = 0.1
const rMeasurementNoiseVariance = 0.1
const fStateTransition = 1
let pStateError = 1
let xCurrentState = rawDataArray[0]
for (const zMeasurement in rawDataArray) {
const xPredicted = fStateTransition * xCurrentState
const pPredicted = fStateTransition * pStateError * transpose(fStateTransition) + qExternalNoiseVariance
const kKalmanGain = pPredicted * invert(pPredicted + rMeasurementNoiseVariance)
pStateError = pPredicted - kKalmanGain * pPredicted
xCurrentState = xPredicted + kKalmanGain * (zMeasurement - xPredicted) // Output!
}
https://www.splinter.com.au/2023/12/14/the-kalman-filter-for...
nextos|1 year ago
It helps to take a more abstract view where you split the generative process and the inference algorithm. Some frameworks (Infer.NET, ForneyLab.jl) can generate an efficient inference algorithm from the generative model without any user input. See e.g. https://github.com/biaslab/ForneyLab.jl/blob/master/demo/kal...
ngriffiths|1 year ago
I'm not familiar with these techniques at all but seems like they have a ton of useful applications.