Skip to content

Commit

Permalink
fix log likelihood calculation for Unscented Kalman Filter implementa…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
JonnyCBB committed Mar 14, 2016
1 parent 0d8363d commit bef120a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/filter_types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ function filter{T}(m::AbstractGaussianSSM, y::Array{T}, x0::AbstractMvNormal,
x_filtered[i] = x_pred
else
x_filtered[i] = update(m, x_pred, sigma_points, y[:, i])
loglik += logpdf(observe(m, x_filtered[i+1], calcSigmaPoints(x_filtered[i+1], params), y[:, 1])[1],
y[:, 1])
end
loglik += logpdf(x_pred, mean(x_filtered[i+1]))
end
return FilteredState(y, x_filtered, loglik, false)
end
Expand All @@ -231,7 +234,7 @@ typealias EnKF EnsembleKalmanFilter
EnsembleKalmanFilter() = EnsembleKalmanFilter(100)


function predict(m::AbstractGaussianSSM, ensemble::Matrix, filter::EnKF=EnKF();
function predict(m::AbstractGaussianSSM, ensemble::Matrix, filter::EnKF=EnKF();
u::Vector=zeros(m.nu), t::Int=1)
ensemble_new = similar(ensemble)
CI = control_input(m, u, t)
Expand Down Expand Up @@ -290,4 +293,4 @@ function filter{T}(m::AbstractGaussianSSM, y::Array{T}, x0::AbstractMvNormal,
end
return FilteredState(y, x_filtered, loglik, false)
end
end
end

0 comments on commit bef120a

Please sign in to comment.