From 2351f4d72919e09f9426c6f9f58c3caede1c829b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20M=C3=A9tivier?= <46794064+dmetivie@users.noreply.github.com> Date: Tue, 29 Mar 2022 14:35:39 +0200 Subject: [PATCH] logpdf(d, X) to logpdf.(d, X)(no longer supported) --- src/fit_em.jl | 8 ++++---- test/runtests.jl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/fit_em.jl b/src/fit_em.jl index 028ff6f..effdc63 100644 --- a/src/fit_em.jl +++ b/src/fit_em.jl @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index d477b35..676e654 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,7 +3,7 @@ using Distributions using Test @testset "ExpectationMaximization.jl" begin - N = 50000 + N = 50_000 θ₁ = 10 θ₂ = 5 α = 0.2