Skip to content

Commit

Permalink
fix posdef numerical error by workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
dinarior committed Feb 6, 2021
1 parent 101f569 commit 429f1c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DPMMSubClusters"
uuid = "2841fd70-8698-11e9-176d-6dfa142d2ee7"
authors = ["Or Dinari <[email protected]>"]
version = "0.1.9"
version = "0.1.10"

[deps]
Clustering = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5"
Expand Down
3 changes: 3 additions & 0 deletions src/priors/niw.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ function calc_posterior(prior:: niw_hyperparams, suff_statistics::niw_sufficient
m = (prior.m.*prior.κ + suff_statistics.points_sum) / κ
ψ = (prior.ν * prior.ψ + prior.κ*prior.m*prior.m' -κ*m*m'+ suff_statistics.S) / ν
ψ = Matrix(Hermitian(ψ))
while(isposdef(ψ) == false)
ψ += 0.1*I
end
return niw_hyperparams(κ,m,ν,ψ)
end

Expand Down

0 comments on commit 429f1c7

Please sign in to comment.