Skip to content

Commit

Permalink
logpdf(d, X) to logpdf.(d, X)(no longer supported)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmetivie committed Mar 29, 2022
1 parent ea433ee commit 2351f4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/fit_em.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function fit_mle(mix::MixtureModel, y::AbstractVector; display = :none, maxiter
# E-step
# evaluate likelihood for each type k
for k = 1:K
LL[:, k] = log(α[k]) .+ logpdf(dists[k], y)
LL[:, k] = log(α[k]) .+ logpdf.(dists[k], y)
end
robust && replace!(LL, -Inf => nextfloat(-Inf), Inf => log(prevfloat(Inf)))
# get posterior of each category
Expand All @@ -47,7 +47,7 @@ function fit_mle(mix::MixtureModel, y::AbstractVector; display = :none, maxiter
# E-step
# evaluate likelihood for each type k
for k = 1:K
LL[:, k] = log(α[k]) .+ logpdf(dists[k], y)
LL[:, k] = log(α[k]) .+ logpdf.(dists[k], y)
end
robust && replace!(LL, -Inf => nextfloat(-Inf), Inf => log(prevfloat(Inf)))
# get posterior of each category
Expand Down Expand Up @@ -102,7 +102,7 @@ function fit_mle(mix::MixtureModel, y::AbstractMatrix; display = :none, maxiter
# E-step
# evaluate likelihood for each type k
for k = 1:K
LL[:, k] = log(α[k]) .+ logpdf(dists[k], y)
LL[:, k] = log(α[k]) .+ logpdf.(dists[k], y)
end
robust && replace!(LL, -Inf => nextfloat(-Inf), Inf => log(prevfloat(Inf)))
# get posterior of each category
Expand All @@ -123,7 +123,7 @@ function fit_mle(mix::MixtureModel, y::AbstractMatrix; display = :none, maxiter
# E-step
# evaluate likelihood for each type k
for k = 1:K
LL[:, k] = log(α[k]) .+ logpdf(dists[k], y)
LL[:, k] = log(α[k]) .+ logpdf.(dists[k], y)
end
robust && replace!(LL, -Inf => nextfloat(-Inf), Inf => log(prevfloat(Inf)))
# get posterior of each category
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Distributions
using Test

@testset "ExpectationMaximization.jl" begin
N = 50000
N = 50_000
θ₁ = 10
θ₂ = 5
α = 0.2
Expand Down

0 comments on commit 2351f4d

Please sign in to comment.